Update ckeditor asset plugin to fix issues #964
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


This pull request updates the
AssetTagBuilderCKEditor 5 plugin to improve how customr:asset:imagetags are handled in both the editor's data model and its HTML output. The main focus is on normalizing the tag structure to ensure consistent handling of self-closing and paired tags, as well as updating the way these tags are rendered in the editor.Asset Tag Normalization and Conversion Improvements:
Added a
_defineDataNormalizationmethod to ensure that all<r:asset:image>tags are normalized to paired tags when loading into the editor, and converted back to self-closing tags (with whitespace cleanup) when exporting data. This helps avoid inconsistencies between self-closing and paired tag formats. (F0951dbcL87, app/assets/builds/trusty_cms/ckeditor5.jsL103144-R103179)Updated the upcast converter to use
writer.createContainerElement('r:asset:image', attrs)instead ofcreateEmptyElement, ensuring the tag is always treated as a container in the model. [1] [2]Remove special characters from the menu bar
Add CSS to show a placeholder for asset tags on the front end of the editor.
Plugin Initialization:
Registered the new normalization logic in the plugin's
initmethod, so it's always applied when the plugin is loaded. [1] [2]These changes make the handling of custom asset tags more robust and consistent, reducing the risk of malformed HTML or unexpected editor behavior. Reducing the risk of overwriting content in the editor view, which overwrites the content on saving.