Problem/Motivation
The current version of this module doesn't appear to support entity reference revisions (paragraph) fields. As a result, only the first paragraph renders its code snippet.
Paragraphs might not be the only use case affected by this bug.
Steps to reproduce
- Install this module and the paragraphs module.
- Create a text format that only uses the filter provided by this module and does not use the wysiwyg editor.
- Create a new paragraph that contains a formatted text field that includes your new text format.
- Create a node bundle that has a entity reference revisions field, allow references to the paragraph type that you created.
- Create a node of the new bundle you created.
- In your paragraphs field, add multiple paragraphs and add a code snippet to each paragraph (ie.
<ace syntax="html">Test snippet 1/2/3</ace>) - Save and view the page
- Observe only your first paragraph renders content and is styled as a code snippet.
- Optional: Open your dev tools > console and inspect the
drupalSettings.ace_filter.instancesarray and observe there is only one instance.
Proposed resolution
In the AceFilter filter's process method, write the Drupal settings content to a static variable, so that prior instantiation's content persist each time the method is called per page load.
Additionally, ensure that the element ids are truly unique by generating a uuid instead of using an array key which would be repeated on subsequent instantiations of the method.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | ace_editor-only_first_instance-3236361-2.patch | 1.74 KB | jesconstantine |
Issue fork ace_editor-3236361
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3236361-only-first-instance
changes, plain diff MR !1
Comments
Comment #3
jesconstantineUploading a patch with the changes contained in the merge request so that folks can test its inclusion via composer.
Comment #4
jesconstantineComment #5
hngrytrl commentedComment #7
interdruper commentedCommitted to dev, thanks.