瀏覽代碼

Docs: some comments of explanation in treeModel.AttributeOperation#_execute.

Szymon Cofalik 10 年之前
父節點
當前提交
b9f9d432dc
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      packages/ckeditor5-engine/src/treemodel/operation/attributeoperation.js

+ 4 - 0
packages/ckeditor5-engine/src/treemodel/operation/attributeoperation.js

@@ -100,6 +100,8 @@ export default class AttributeOperation extends Operation {
 		if ( oldAttr !== null ) {
 			for ( let node of this.range.getAllNodes( true ) ) {
 				if ( node instanceof TextFragment ) {
+					// Because instance of TextFragment is kind-of a proxy, not a real, original item,
+					// we have to assign `node` a real item that is added to the node list.
 					node = node.first._nodeListText;
 				}
 
@@ -127,6 +129,8 @@ export default class AttributeOperation extends Operation {
 		if ( newAttr !== null ) {
 			for ( let node of this.range.getAllNodes( true ) ) {
 				if ( node instanceof TextFragment ) {
+					// Because instance of TextFragment is kind-of a proxy, not a real, original item,
+					// we have to assign `node` a real item that is added to the node list.
 					node = node.first._nodeListText;
 				}