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

Use SchemaContex.startsWith() to check clipboard context.

Maciej Gołaszewski 6 лет назад
Родитель
Сommit
fb52dd7e37

+ 2 - 6
packages/ckeditor5-restricted-editing/src/restrictededitingmodeediting.js

@@ -426,18 +426,14 @@ function ensureNewMarkerIsFlat( editor ) {
 
 function onlyAllowAttributesFromList( allowedAttributes ) {
 	return ( context, attributeName ) => {
-		if ( isClipboardContext( context ) ) {
+		if ( context.startsWith( '$clipboardHolder' ) ) {
 			return allowedAttributes.includes( attributeName );
 		}
 	};
 }
 
 function allowTextOnlyInClipboardHolder( context, childDefinition ) {
-	if ( isClipboardContext( context ) ) {
+	if ( context.startsWith( '$clipboardHolder' ) ) {
 		return childDefinition.name === '$text';
 	}
 }
-
-function isClipboardContext( context ) {
-	return Array.from( context.getNames() ).includes( '$clipboardHolder' );
-}