瀏覽代碼

Update packages/ckeditor5-media-embed/src/mediaembedcommand.js

Co-authored-by: Maciej <jodator@jodator.net>
Paweł Kwaśnik 5 年之前
父節點
當前提交
6714e0224d
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      packages/ckeditor5-media-embed/src/mediaembedcommand.js

+ 2 - 2
packages/ckeditor5-media-embed/src/mediaembedcommand.js

@@ -35,7 +35,8 @@ export default class MediaEmbedCommand extends Command {
 
 		let parent = insertPosition.parent;
 
-		if ( parent.isEmpty && model.schema.isBlock( parent ) ) {
+		// The model.insertContent() will remove empty parent (unless it is a $root or a limit).
+		if ( parent.isEmpty && !model.schema.isLimit( parent ) ) {
 			parent = parent.parent;
 		}
 
@@ -68,4 +69,3 @@ export default class MediaEmbedCommand extends Command {
 		}
 	}
 }
-