Text filter to only show first content page if current route is not that entity route

Created on 12 May 2023, over 1 year ago
Updated 26 August 2024, 3 months ago

Problem/Motivation

It would be really useful if there was a text filter that would just output the first page of content if the current route is not the route belonging to that entity.

Proposed resolution

Provide a text filter that removes all text after the page break if the current route is not the entity's route.

Remaining tasks

Build the thing.

User interface changes

New text filter.

API changes

n/a

Data model changes

n/a

✨ Feature request
Status

Closed: works as designed

Version

1.1

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @DamienMcKenna
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    WIP, I'm stuck because of #3360216.

  • Status changed to Needs review over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    This works, though it takes a bit of finagling to make it work correctly due to #3360216.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    In order to make #3 work I had to manually modify the config file for the text format like this:

      filter_html:
        id: filter_html
        provider: filter
        status: true
        weight: -48
        settings:
          allowed_html: '<br> <p class="text-align-left text-align-center text-align-right text-align-justify"> <h2 class="text-align-left text-align-center text-align-right text-align-justify"> <h3 class="text-align-left text-align-center text-align-right text-align-justify"> <h4 class="text-align-left text-align-center text-align-right text-align-justify"> <h5 class="text-align-left text-align-center text-align-right text-align-justify"> <h6 class="text-align-left text-align-center text-align-right text-align-justify"> <strong> <em> <s> <sub> <sup> <blockquote> <a href data-entity-type data-entity-uuid data-entity-substitution> <ul> <ol reversed start> <li> <hr> <drupal-media data-entity-type data-entity-uuid alt data-caption data-align> <div class="page-break" style="page-break-after"> <span style="display">'
          filter_html_help: false
          filter_html_nofollow: false
    

    The new bits are the DIV and SPAN items at the end.

    It's worth noting that the plugin in #3 looks for <div class="page-break" rather than the full string provided by the Pagebreak plugin.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Now with the config file I forgot to add before. I also renamed the plugin to be more specific.

  • Status changed to Needs work 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Moving to the CKEditor 5 Plugin Pack module.

    The patch needs to be rerolled.

  • Status changed to Needs review 5 months ago
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Rerolled.

  • Status changed to Needs work 4 months ago
  • πŸ‡΅πŸ‡±Poland dolszewski

    Hello @damienmckenna
    In Drupal 10.3 I can't submit a Text Format form. I have an error:

    Error message
    'node' is not a supported key.
    'file' is not a supported key.
    'media' is not a supported key.
    'taxonomy_term' is not a supported key.
    'user' is not a supported key.
    

    Possible it is a similar case as in the shortcode module: https://www.drupal.org/project/shortcode/issues/3457731 πŸ› Unable to save text format config form in 10.3 Fixed

  • Status changed to Needs review 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Please open a new issue for the problem you're running into, it's a different problem to what this issue is focused on. Thank you.

  • Status changed to Needs work 4 months ago
  • πŸ‡΅πŸ‡±Poland dolszewski

    @damienmckenna
    I had that error when I applied your patch, so it is related to this issue.
    On Drupal 10.2 I can save text format but on 10.3 it doesn't work.

  • Status changed to Needs review 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    I worked out a fix for this - the config schema needed to use a "sequence", not a "mapping".

  • Status changed to Closed: works as designed 3 months ago
  • We've decided not to include this change in the module as it seems to be quite use-case specific.
    We'll be happy to reconsider in the future in case there would be more people requesting this feature.

Production build 0.71.5 2024