-
Notifications
You must be signed in to change notification settings - Fork 220
DOC-3189: Add new options for preserving MathML elements and attributes in the Math plugin #3681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kemister85
merged 6 commits into
feature/7.8.0/DOC-3131
from
feature/7.8.0/DOC-3131_TINY-11756
Apr 8, 2025
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
60d87d9
DOC-3189: Add new options for preserving MathML elements and attribut…
kemister85 25bda8e
Update modules/ROOT/pages/7.8.0-release-notes.adoc
kemister85 46e713f
Update modules/ROOT/pages/7.8.0-release-notes.adoc
kemister85 ddef5ff
Update modules/ROOT/pages/7.8.0-release-notes.adoc
kemister85 b5b9e01
Update modules/ROOT/pages/7.8.0-release-notes.adoc
kemister85 15d5bef
Merge branch 'feature/7.8.0/DOC-3131' into feature/7.8.0/DOC-3131_TIN…
kemister85 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
57 changes: 57 additions & 0 deletions
57
modules/ROOT/partials/configuration/extended_mathml_attributes.adoc
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| [[extended-mathml-attributes]] | ||
| == `+extended_mathml_attributes+` | ||
|
|
||
| This option allows a specific list of additional MathML attributes to be preserved in the editor content, even if they are not included in the default DOMPurify allowlist. This setting only affects attributes used within MathML markup and has no effect on general HTML content. | ||
|
|
||
| *Type:* `+Array+` of `+Strings+` | ||
|
|
||
| *Default value:* `+[]+` (empty array) | ||
|
|
||
| === Example: using `+extended_mathml_attributes+` | ||
|
|
||
| [source,js] | ||
| ---- | ||
| tinymce.init({ | ||
| selector: 'textarea', | ||
| extended_mathml_attributes: [ 'linebreak', 'encoding' ] | ||
| }); | ||
| ---- | ||
|
|
||
| .Example of MathML with preserved attributes | ||
| [source,html] | ||
| ---- | ||
| <p> | ||
| <math xmlns="http://www.w3.org/1998/Math/MathML"> | ||
| <mrow linebreak="newline" encoding="utf8"> | ||
| <mi>x</mi> | ||
| <mo>=</mo> | ||
| <mfrac> | ||
| <mrow> | ||
| <mo>−</mo> | ||
| <mi>b</mi> | ||
| <mo>±</mo> | ||
| <msqrt> | ||
| <mrow> | ||
| <msup> | ||
| <mi>b</mi> | ||
| <mn>2</mn> | ||
| </msup> | ||
| <mo>−</mo> | ||
| <mn>4</mn> | ||
| <mo>⁢</mo> | ||
| <mi>a</mi> | ||
| <mo>⁢</mo> | ||
| <mi>c</mi> | ||
| </mrow> | ||
| </msqrt> | ||
| </mrow> | ||
| <mrow> | ||
| <mn>2</mn> | ||
| <mo>⁢</mo> | ||
| <mi>a</mi> | ||
| </mrow> | ||
| </mfrac> | ||
| </mrow> | ||
| </math> | ||
| </p> | ||
| ---- |
46 changes: 46 additions & 0 deletions
46
modules/ROOT/partials/configuration/extended_mathml_elements.adoc
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| [[extended-mathml-elements]] | ||
| == `+extended_mathml_elements+` | ||
|
|
||
| This option allows a specific list of additional MathML elements to be preserved in the editor content, even if they are not included in the default DOMPurify allowlist. This setting only affects elements used within MathML markup and has no effect on general HTML content. | ||
|
|
||
| *Type:* `+Array+` of `+Strings+` | ||
|
|
||
| *Default value:* `+[]+` (empty array) | ||
|
|
||
| === Example: using `+extended_mathml_elements+` | ||
|
|
||
| [source,js] | ||
| ---- | ||
| tinymce.init({ | ||
| selector: 'textarea', | ||
| extended_mathml_elements: [ 'mn', 'mspace' ] | ||
| }); | ||
| ---- | ||
|
|
||
| .Example of MathML with preserved elements | ||
| [source,html] | ||
| ---- | ||
| <p> | ||
| <math xmlns="http://www.w3.org/1998/Math/MathML"> | ||
| <mrow> | ||
| <mi>a</mi> | ||
| <mo>=</mo> | ||
| <mfrac> | ||
| <mrow> | ||
| <mn>1</mn> | ||
| <mo>+</mo> | ||
| <mn>√2</mn> | ||
| </mrow> | ||
| <mn>3</mn> | ||
| </mfrac> | ||
| <mspace width="1em"></mspace> | ||
| <mo>∪</mo> | ||
| <mspace width="1em"></mspace> | ||
| <msup> | ||
| <mn>5</mn> | ||
| <mn>2</mn> | ||
| </msup> | ||
| </mrow> | ||
| </math> | ||
| </p> | ||
| ---- |
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.
Uh oh!
There was an error while loading. Please reload this page.