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

Internal: Removed hardcoded bold attribute dependency.

Marek Lewandowski 6 лет назад
Родитель
Сommit
9ccfc84444

+ 1 - 1
packages/ckeditor5-remove-format/src/removeformat.js

@@ -4,7 +4,7 @@
  */
 
 /**
- * @module highlight/highlight
+ * @module removeformat/removeformat
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';

+ 7 - 5
packages/ckeditor5-remove-format/src/removeformatcommand.js

@@ -84,11 +84,13 @@ export default class RemoveFormatCommand extends Command {
 			const document = model.document;
 			const selection = document.selection;
 
-			const ranges = model.schema.getValidRanges( selection.getRanges(), 'bold' );
-
-			for ( const curRange of ranges ) {
-				for ( const attributeName of removedAttributes ) {
-					writer.removeAttribute( attributeName, curRange );
+			for ( const curRange of selection.getRanges() ) {
+				for ( const item of curRange.getItems() ) {
+					for ( const attributeName of removedAttributes ) {
+						if ( item.hasAttribute( attributeName ) ) {
+							writer.removeAttribute( attributeName, item );
+						}
+					}
 				}
 			}