8
0
Просмотр исходного кода

Fix: It will be possible to paste basic styles. See https://github.com/ckeditor/ckeditor5/issues/477.

Piotrek Koszuliński 8 лет назад
Родитель
Сommit
8ad5a222b7

+ 2 - 0
packages/ckeditor5-basic-styles/src/boldengine.js

@@ -33,6 +33,8 @@ export default class BoldEngine extends Plugin {
 
 		// Allow bold attribute on all inline nodes.
 		editor.document.schema.allow( { name: '$inline', attributes: [ BOLD ], inside: '$block' } );
+		// Temporary workaround. See https://github.com/ckeditor/ckeditor5/issues/477.
+		editor.document.schema.allow( { name: '$inline', attributes: [ BOLD ], inside: '$clipboardHolder' } );
 
 		// Build converter from model to view for data and editing pipelines.
 		buildModelConverter().for( data.modelToView, editing.modelToView )

+ 2 - 0
packages/ckeditor5-basic-styles/src/italicengine.js

@@ -33,6 +33,8 @@ export default class ItalicEngine extends Plugin {
 
 		// Allow italic attribute on all inline nodes.
 		editor.document.schema.allow( { name: '$inline', attributes: [ ITALIC ], inside: '$block' } );
+		// Temporary workaround. See https://github.com/ckeditor/ckeditor5/issues/477.
+		editor.document.schema.allow( { name: '$inline', attributes: [ ITALIC ], inside: '$clipboardHolder' } );
 
 		// Build converter from model to view for data and editing pipelines.
 		buildModelConverter().for( data.modelToView, editing.modelToView )

+ 1 - 0
packages/ckeditor5-basic-styles/tests/boldengine.js

@@ -33,6 +33,7 @@ describe( 'BoldEngine', () => {
 	it( 'should set proper schema rules', () => {
 		expect( doc.schema.check( { name: '$inline', attributes: [ 'bold' ], inside: '$root' } ) ).to.be.false;
 		expect( doc.schema.check( { name: '$inline', attributes: [ 'bold' ], inside: '$block' } ) ).to.be.true;
+		expect( doc.schema.check( { name: '$inline', attributes: [ 'bold' ], inside: '$clipboardHolder' } ) ).to.be.true;
 	} );
 
 	describe( 'command', () => {

+ 1 - 0
packages/ckeditor5-basic-styles/tests/italicengine.js

@@ -37,6 +37,7 @@ describe( 'ItalicEngine', () => {
 	it( 'should set proper schema rules', () => {
 		expect( doc.schema.check( { name: '$inline', attributes: [ 'italic' ], inside: '$root' } ) ).to.be.false;
 		expect( doc.schema.check( { name: '$inline', attributes: [ 'italic' ], inside: '$block' } ) ).to.be.true;
+		expect( doc.schema.check( { name: '$inline', attributes: [ 'italic' ], inside: '$clipboardHolder' } ) ).to.be.true;
 	} );
 
 	describe( 'command', () => {