8
0
فهرست منبع

Added manual test for filtering attributes.

Oskar Wróbel 8 سال پیش
والد
کامیت
145dec8a40

+ 23 - 0
packages/ckeditor5-engine/tests/manual/tickets/1088/1.html

@@ -0,0 +1,23 @@
+<div style="padding: 20px;">
+	<div id="editor">
+		<h2>Heading 1 (disallowed: link)</h2>
+		<p>This is a paragraph</p>
+		<h3>Heading 2 (disallowed: italic)</h3>
+		<p></p>
+		<blockquote>
+			<p>This is a paragraph in a blockQuote</p>
+			<p></p>
+		</blockquote>
+		<h4>Heading 3 (disallowed: italic, link)</h4>
+	</div>
+
+	<div>
+		<p><a href="https://ckeditor.com"><i>Paragraph with link and italic</i></a></p>
+
+		<ul>
+			<li><a href="https://ckeditor.com"><b>List item with link and bold</b></a></li>
+		</ul>
+
+		<div><b>Just a text with bold</b></div>
+	</div>
+</div>

+ 29 - 0
packages/ckeditor5-engine/tests/manual/tickets/1088/1.js

@@ -0,0 +1,29 @@
+/**
+ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
+ * For licensing, see LICENSE.md.
+ */
+
+/* globals console, window, document */
+
+import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
+import ArticlePreset from '@ckeditor/ckeditor5-presets/src/article';
+
+ClassicEditor
+	.create( document.querySelector( '#editor' ), {
+		plugins: [ ArticlePreset ],
+		toolbar: [ 'headings', 'undo', 'redo' ]
+	} )
+	.then( editor => {
+		window.editor = editor;
+
+		const schema = editor.document.schema;
+
+		schema.disallow( { name: '$text', attributes: [ 'linkHref' ], inside: 'heading1' } );
+		schema.disallow( { name: '$text', attributes: [ 'italic' ], inside: 'heading2' } );
+		schema.disallow( { name: '$text', attributes: [ 'italic', 'linkHref' ], inside: 'heading3' } );
+		schema.disallow( { name: '$text', attributes: [ 'bold' ], inside: 'paragraph' } );
+		schema.disallow( { name: '$text', attributes: [ 'bold', 'linkHref' ], inside: 'blockQuote listItem' } );
+	} )
+	.catch( err => {
+		console.error( err.stack );
+	} );

+ 20 - 0
packages/ckeditor5-engine/tests/manual/tickets/1088/1.md

@@ -0,0 +1,20 @@
+## Stripping disallowed attributes by `(insert|delete)Content` [#1088](https://github.com/ckeditor/ckeditor5-engine/issues/1088)
+
+### Simple scenario.
+
+1. Copy a paragraph with italic and link.
+2. Paste it to the Heading 1. Inserted text should have only an italic style.
+3. Paste it to the Heading 2. Inserted text should have only a link.
+4. Paste it to the Heading 3. Inserted text should be fully stripped.
+
+### Nested nodes.
+
+1. Copy a list item with bold and link.
+2. Paste it into the empty block (just under the Heading 2). Inserted list item should have a bold style a link.
+2. Paste it into the empty block in BlockQuote. Inserted list item should be fully stripped.
+
+### Auto paragraphing.
+
+1. Copy a text with bold.
+2. Select all content in the editor.
+3. Paste copied text. Inserted content should be a paragraph and should be stripped from bold.