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

Reject paths which contain elements which aren't even registered to the schema.

Piotrek Koszuliński 9 лет назад
Родитель
Сommit
9191b822d9
1 измененных файлов с 8 добавлено и 1 удалено
  1. 8 1
      packages/ckeditor5-engine/src/model/schema.js

+ 8 - 1
packages/ckeditor5-engine/src/model/schema.js

@@ -577,7 +577,14 @@ function matchPaths( schema, checkPath, allowedPath ) {
 	let index = 0;
 
 	while ( index < length ) {
-		const extChain = schema._extensionChains.get( checkPathReversed[ index ] );
+		const checkName = checkPathReversed[ index ];
+
+		// Fail when checking a path which contains element which aren't even registered to the schema.
+		if ( !schema.hasItem( checkName ) ) {
+			return false;
+		}
+
+		const extChain = schema._extensionChains.get( checkName );
 
 		if ( extChain.includes( allowedPathReversed[ index ] ) ) {
 			index++;