Răsfoiți Sursa

Other: Add workaround to allow highlighters in clipboard holder.

Maciej Gołaszewski 8 ani în urmă
părinte
comite
ba82ab9d07

+ 2 - 0
packages/ckeditor5-highlight/src/highlightediting.js

@@ -47,6 +47,8 @@ export default class HighlightEditing extends Plugin {
 
 
 		// Allow highlight attribute on all elements
 		// Allow highlight attribute on all elements
 		editor.document.schema.allow( { name: '$inline', attributes: 'highlight', inside: '$block' } );
 		editor.document.schema.allow( { name: '$inline', attributes: 'highlight', inside: '$block' } );
+		// Temporary workaround. See https://github.com/ckeditor/ckeditor5/issues/477.
+		editor.document.schema.allow( { name: '$inline', attributes: 'highlight', inside: '$clipboardHolder' } );
 
 
 		// Convert highlight attribute to a mark element with associated class.
 		// Convert highlight attribute to a mark element with associated class.
 		buildModelConverter()
 		buildModelConverter()

+ 5 - 0
packages/ckeditor5-highlight/tests/highlightediting.js

@@ -30,6 +30,11 @@ describe( 'HighlightEditing', () => {
 		editor.destroy();
 		editor.destroy();
 	} );
 	} );
 
 
+	it( 'should set proper schema rules', () => {
+		expect( doc.schema.check( { name: '$inline', attributes: 'highlight', inside: '$block' } ) ).to.be.true;
+		expect( doc.schema.check( { name: '$inline', attributes: 'highlight', inside: '$clipboardHolder' } ) ).to.be.true;
+	} );
+
 	it( 'adds highlight commands', () => {
 	it( 'adds highlight commands', () => {
 		expect( editor.commands.get( 'highlight' ) ).to.be.instanceOf( HighlightCommand );
 		expect( editor.commands.get( 'highlight' ) ).to.be.instanceOf( HighlightCommand );
 	} );
 	} );