Sfoglia il codice sorgente

Hot fix for https://github.com/ckeditor/ckeditor5-engine/issues/454.

Szymon Kupś 9 anni fa
parent
commit
697a81103b

+ 1 - 2
packages/ckeditor5-engine/src/model/selection.js

@@ -498,9 +498,8 @@ export default class Selection {
 
 			// ...look for a first character node in that range and take attributes from it.
 			for ( let item of range ) {
-				if ( item.type == 'TEXT' ) {
+				if ( item.type == 'TEXT' && attrs === null ) {
 					attrs = item.item.getAttributes();
-					break;
 				}
 			}
 		} else {

+ 2 - 2
packages/ckeditor5-engine/src/view/writer.js

@@ -799,7 +799,7 @@ function wrapAttributeElement( wrapper, toWrap ) {
 	}
 
 	// Check if attributes can be merged.
-	for ( let key of wrapper.getAttributeKeys() ) {
+	for ( let key of [ ...wrapper.getAttributeKeys() ] ) {
 		// Classes and styles should be checked separately.
 		if ( key === 'class' || key === 'style' ) {
 			continue;
@@ -860,7 +860,7 @@ function unwrapAttributeElement( wrapper, toUnwrap ) {
 	}
 
 	// Check if AttributeElement has all wrapper attributes.
-	for ( let key of wrapper.getAttributeKeys() ) {
+	for ( let key of [ ...wrapper.getAttributeKeys() ] ) {
 		// Classes and styles should be checked separately.
 		if ( key === 'class' || key === 'style' ) {
 			continue;