Parcourir la source

"Schema#checkAttributeInSelection()" should use current text node or a generic "$text".

Kamil Piechaczek il y a 7 ans
Parent
commit
b0b3132d95
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      packages/ckeditor5-engine/src/model/schema.js

+ 2 - 2
packages/ckeditor5-engine/src/model/schema.js

@@ -491,8 +491,8 @@ export default class Schema {
 			const firstPosition = selection.getFirstPosition();
 			const context = [
 				...firstPosition.getAncestors(),
-				firstPosition.root.getNodeByPath( firstPosition.path )
-			].filter( Boolean );
+				firstPosition.root.getNodeByPath( firstPosition.path ) || '$text'
+			];
 
 			// Check whether schema allows for a text with the attribute in the selection.
 			return this.checkAttribute( context, attribute );