-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15349 from ckeditor/ck/14933
Fix (html-support): The editor should not crash when there is a `<template>` element in the content. Closes #14933.
- Loading branch information
Showing
6 changed files
with
166 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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 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 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
8 changes: 8 additions & 0 deletions
8
packages/ckeditor5-html-support/tests/manual/ghs-template-element.html
This file contains 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,8 @@ | ||
<div id="editor"> | ||
<h2>The <code><template></code> element</h2> | ||
<p>As block:</p> | ||
<template id="test1"> aa <h2> Hi </h2> bb </template> | ||
<p>In paragraph: <template id="test2"> aa <b> Hi </b> bb </template> </p> | ||
<div>In container: <template id="test3"> aa <h3> Hi </h3> bb </template> </div> | ||
<p>Other custom element: <foo-bar class="abc"> aa <i> Hi </i> bb </foo-bar> </p> | ||
</div> |
58 changes: 58 additions & 0 deletions
58
packages/ckeditor5-html-support/tests/manual/ghs-template-element.js
This file contains 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,58 @@ | ||
/** | ||
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
*/ | ||
|
||
/* globals console:false, window, document */ | ||
|
||
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor'; | ||
import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset'; | ||
import Code from '@ckeditor/ckeditor5-basic-styles/src/code'; | ||
import CodeBlock from '@ckeditor/ckeditor5-code-block/src/codeblock'; | ||
import HorizontalLine from '@ckeditor/ckeditor5-horizontal-line/src/horizontalline'; | ||
import HtmlEmbed from '@ckeditor/ckeditor5-html-embed/src/htmlembed'; | ||
import LinkImage from '@ckeditor/ckeditor5-link/src/linkimage'; | ||
import Strikethrough from '@ckeditor/ckeditor5-basic-styles/src/strikethrough'; | ||
import SourceEditing from '@ckeditor/ckeditor5-source-editing/src/sourceediting'; | ||
import Underline from '@ckeditor/ckeditor5-basic-styles/src/underline'; | ||
import ImageUpload from '@ckeditor/ckeditor5-image/src/imageupload'; | ||
import RemoveFormat from '@ckeditor/ckeditor5-remove-format/src/removeformat'; | ||
|
||
import GeneralHtmlSupport from '../../src/generalhtmlsupport'; | ||
|
||
ClassicEditor | ||
.create( document.querySelector( '#editor' ), { | ||
plugins: [ | ||
ArticlePluginSet, Underline, Strikethrough, Code, CodeBlock, LinkImage, | ||
HtmlEmbed, HorizontalLine, ImageUpload, RemoveFormat, SourceEditing, GeneralHtmlSupport | ||
], | ||
toolbar: [ | ||
'sourceEditing', | ||
'|', | ||
'heading', | ||
'|', | ||
'bulletedList', 'numberedList', | ||
'|', | ||
'blockQuote', 'uploadImage', 'insertTable', 'mediaEmbed', 'codeBlock', | ||
'|', | ||
'htmlEmbed', | ||
'|', | ||
'undo', 'redo' | ||
], | ||
htmlSupport: { | ||
allow: [ | ||
{ | ||
name: /./, | ||
styles: true, | ||
attributes: true, | ||
classes: true | ||
} | ||
] | ||
} | ||
} ) | ||
.then( editor => { | ||
window.editor = editor; | ||
} ) | ||
.catch( err => { | ||
console.error( err.stack ); | ||
} ); |
1 change: 1 addition & 0 deletions
1
packages/ckeditor5-html-support/tests/manual/ghs-template-element.md
This file contains 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 @@ | ||
## GHS `<template>` element support |