Ver Fonte

Changed docs.

Oskar Wróbel há 8 anos atrás
pai
commit
12ee0664ea

+ 7 - 7
packages/ckeditor5-engine/src/controller/deletecontent.js

@@ -226,23 +226,23 @@ function getNodeSchemaName( node ) {
 	return node.is( 'text' ) ? '$text' : node.name;
 }
 
-// Adds deltas with `removeAttributes` operation for disallowed by schema attributes on given nodes and its children.
+// Creates AttributeDeltas that removes attributes that are disallowed by schema on given node and its children.
 //
-// @param {module:engine/model/node~Node|Array<module:engine/model/node~Node>} nodes
-// @param {module:engine/model/schema~SchemaPath} schemaPath
-// @param {module:engine/model/batch~Batch} batch
-function removeDisallowedAttributes( nodes, schemaPath, batch ) {
+// @param {Array<module:engine/model/node~Node>} nodes Nodes that will be filtered.
+// @param {module:engine/model/schema~SchemaPath} inside Path inside which schema will be checked.
+// @param {module:engine/model/batch~Batch} batch Batch to which the deltas will be added.
+function removeDisallowedAttributes( nodes, inside, batch ) {
 	const schema = batch.document.schema;
 
 	for ( const node of nodes ) {
 		const name = getNodeSchemaName( node );
 
 		// When node with attributes is not allowed in current position.
-		if ( !schema.check( { name, inside: schemaPath, attributes: Array.from( node.getAttributeKeys() ) } ) ) {
+		if ( !schema.check( { name, inside, attributes: Array.from( node.getAttributeKeys() ) } ) ) {
 			// Let's remove attributes one by one.
 			// This should be improved to check all combination of attributes.
 			for ( const attribute of node.getAttributeKeys() ) {
-				if ( !schema.check( { name, attributes: attribute, inside: schemaPath } ) ) {
+				if ( !schema.check( { name, inside, attributes: attribute } ) ) {
 					batch.removeAttribute( node, attribute );
 				}
 			}

+ 9 - 9
packages/ckeditor5-engine/src/controller/insertcontent.js

@@ -455,23 +455,23 @@ function getNodeSchemaName( node ) {
 }
 
 // Removes disallowed by schema attributes from given nodes. When batch parameter is provided then
-// attributes will be removed by adding deltas with `removeAttributes` operation to this batch
-// otherwise attributes will be removed directly from provided nodes.
+// attributes will be removed by creating AttributeDeltas otherwise attributes will be removed
+// directly from provided nodes.
 //
-// @param {Array<module:engine/model/node~Node>} nodes
-// @param {module:engine/model/schema~SchemaPath} schemaPath
-// @param {module:engine/model/schema~Schema} schema
-// @param {module:engine/model/batch~Batch} [batch]
-function removeDisallowedAttributes( nodes, schemaPath, schema, batch ) {
+// @param {Array<module:engine/model/node~Node>} nodes Nodes that will be filtered.
+// @param {module:engine/model/schema~SchemaPath} inside Path inside which schema will be checked.
+// @param {module:engine/model/schema~Schema} schema Schema instance uses for element validation.
+// @param {module:engine/model/batch~Batch} [batch] Batch to which the deltas will be added.
+function removeDisallowedAttributes( nodes, inside, schema, batch ) {
 	for ( const node of nodes ) {
 		const name = getNodeSchemaName( node );
 
 		// When node with attributes is not allowed in current position.
-		if ( !schema.check( { name, inside: schemaPath, attributes: Array.from( node.getAttributeKeys() ) } ) ) {
+		if ( !schema.check( { name, inside, attributes: Array.from( node.getAttributeKeys() ) } ) ) {
 			// Let's remove attributes one by one.
 			// This should be improved to check all combination of attributes.
 			for ( const attribute of node.getAttributeKeys() ) {
-				if ( !schema.check( { name, inside: schemaPath, attributes: attribute } ) ) {
+				if ( !schema.check( { name, inside, attributes: attribute } ) ) {
 					if ( batch ) {
 						batch.removeAttribute( node, attribute );
 					} else {