Repository navigation
4.x: parse shortcode attributes without creating DOM nodes; match names with digits (#11) - #14
Merged
Merged
Conversation
Backport from main. getCurrentEditorSelectionAsParsedShortcodeData() read a selected shortcode's attributes by building it as an element with jQuery, in the live CMS document. They are now parsed in an inert document (document.implementation.createHTMLDocument) under a fixed tag name; values, entities and lower-cased names come out as before. placeholdersToShortcodes() uses the same inert document. dist rebuilt. 4.x has no browser tests of its own: main's selection and dialog specs were run against this checkout on a Silverstripe 5 host (must-fail first on a114686, then green). Pair-programmed with my buddy Claude
Backport from main. Names are matched as ShortcodeParser does, \w+ ending at whitespace or ']', so [year2] is no longer taken for [year] and saved back as [year 2], [button-large] no longer matches button, a registered name with a digit gets its placeholder, and a shortcode without attributes has no trailing space in its placeholder title. dist rebuilt. Verified with main's names spec on a Silverstripe 5 host (must-fail first, then green). Pair-programmed with my buddy Claude
Pair-programmed with my buddy Claude
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Release 4.0.18. Backport of the two JS fixes in #13.
placeholdersToShortcodes()uses the same inert document.The 4.x branch has no tests or CI of its own. main's selection, names, dialog and editor-placeholder specs were run locally against this checkout on a Silverstripe 5 host: 3 failing on a114686 (the selection handler spec and both names specs), 10/10 green after. Not tested: Silverstripe 4 / TinyMCE 4, and simpler 0.x (the host had simpler 1.0.4).
Pair-programmed with my buddy Claude