Explorar el Código

Changed: `.ck` class should not be added to elements inside editor editable.

Szymon Cofalik hace 7 años
padre
commit
aa72457acc

+ 6 - 6
packages/ckeditor5-link/src/linkediting.js

@@ -19,7 +19,7 @@ import bindTwoStepCaretToAttribute from '@ckeditor/ckeditor5-engine/src/utils/bi
 import findLinkRange from './findlinkrange';
 import '../theme/link.css';
 
-const HIGHLIGHT_CLASSES = [ 'ck', 'ck-link_selected' ];
+const HIGHLIGHT_CLASS = 'ck-link_selected';
 
 /**
  * The link engine feature.
@@ -70,11 +70,11 @@ export default class LinkEditing extends Plugin {
 	 * Adds a visual highlight style to a link in which the selection is anchored.
 	 * Together with two-step caret movement, they indicate that the user is typing inside the link.
 	 *
-	 * Highlight is turned on by adding `.ck .ck-link_selected` classes to the link in the view:
+	 * Highlight is turned on by adding `.ck-link_selected` class to the link in the view:
 	 *
-	 * * the classes are removed before conversion has started, as callbacks added with `'highest'` priority
+	 * * the class is removed before conversion has started, as callbacks added with `'highest'` priority
 	 * to {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher} events,
-	 * * the classes are added in the view post fixer, after other changes in the model tree were converted to the view.
+	 * * the class is added in the view post fixer, after other changes in the model tree were converted to the view.
 	 *
 	 * This way, adding and removing highlight does not interfere with conversion.
 	 *
@@ -97,7 +97,7 @@ export default class LinkEditing extends Plugin {
 				// broken by a UIElement.
 				for ( const item of viewRange.getItems() ) {
 					if ( item.is( 'a' ) ) {
-						writer.addClass( HIGHLIGHT_CLASSES, item );
+						writer.addClass( HIGHLIGHT_CLASS, item );
 						highlightedLinks.add( item );
 					}
 				}
@@ -115,7 +115,7 @@ export default class LinkEditing extends Plugin {
 			function removeHighlight() {
 				view.change( writer => {
 					for ( const item of highlightedLinks.values() ) {
-						writer.removeClass( HIGHLIGHT_CLASSES, item );
+						writer.removeClass( HIGHLIGHT_CLASS, item );
 						highlightedLinks.delete( item );
 					}
 				} );

+ 12 - 12
packages/ckeditor5-link/tests/linkediting.js

@@ -157,7 +157,7 @@ describe( 'LinkEditing', () => {
 
 			expect( model.document.selection.hasAttribute( 'linkHref' ) ).to.be.true;
 			expect( getViewData( view ) ).to.equal(
-				'<p>foo <a class="ck ck-link_selected" href="url">b{}ar</a> baz</p>'
+				'<p>foo <a class="ck-link_selected" href="url">b{}ar</a> baz</p>'
 			);
 		} );
 
@@ -174,7 +174,7 @@ describe( 'LinkEditing', () => {
 
 			expect( model.document.selection.hasAttribute( 'linkHref' ) ).to.be.true;
 			expect( getViewData( view ) ).to.equal(
-				'<p>foo <a class="ck ck-link_selected" href="url">{}bar</a> baz</p>'
+				'<p>foo <a class="ck-link_selected" href="url">{}bar</a> baz</p>'
 			);
 		} );
 
@@ -185,7 +185,7 @@ describe( 'LinkEditing', () => {
 
 			expect( model.document.selection.hasAttribute( 'linkHref' ) ).to.be.true;
 			expect( getViewData( view ) ).to.equal(
-				'<p>foo <a class="ck ck-link_selected" href="url">bar{}</a> baz</p>'
+				'<p>foo <a class="ck-link_selected" href="url">bar{}</a> baz</p>'
 			);
 		} );
 
@@ -210,7 +210,7 @@ describe( 'LinkEditing', () => {
 			);
 
 			expect( getViewData( view ) ).to.equal(
-				'<p>foo <a class="ck ck-link_selected" href="url">li{}nk</a> baz</p>'
+				'<p>foo <a class="ck-link_selected" href="url">li{}nk</a> baz</p>'
 			);
 
 			model.change( writer => writer.setSelection( model.document.getRoot().getChild( 0 ), 0 ) );
@@ -226,13 +226,13 @@ describe( 'LinkEditing', () => {
 			);
 
 			expect( getViewData( view ) ).to.equal(
-				'<p>foo <a class="ck ck-link_selected" href="url">li{}nk</a> baz</p>'
+				'<p>foo <a class="ck-link_selected" href="url">li{}nk</a> baz</p>'
 			);
 
 			model.change( writer => writer.setSelection( model.document.getRoot().getChild( 0 ), 5 ) );
 
 			expect( getViewData( view ) ).to.equal(
-				'<p>foo <a class="ck ck-link_selected" href="url">l{}ink</a> baz</p>'
+				'<p>foo <a class="ck-link_selected" href="url">l{}ink</a> baz</p>'
 			);
 		} );
 
@@ -247,7 +247,7 @@ describe( 'LinkEditing', () => {
 				} );
 
 				expect( getViewData( view ) ).to.equal(
-					'<p>foo <a class="ck ck-link_selected" href="url">liFOO{}nk</a> baz</p>'
+					'<p>foo <a class="ck-link_selected" href="url">liFOO{}nk</a> baz</p>'
 				);
 			} );
 
@@ -264,7 +264,7 @@ describe( 'LinkEditing', () => {
 				} );
 
 				expect( getViewData( view ) ).to.equal(
-					'<p><a class="ck ck-link_selected" href="url">i{}nk</a> baz</p>'
+					'<p><a class="ck-link_selected" href="url">i{}nk</a> baz</p>'
 				);
 			} );
 
@@ -281,7 +281,7 @@ describe( 'LinkEditing', () => {
 				} );
 
 				expect( getViewData( view ) ).to.equal(
-					'<p>foo <a href="url">l</a><a class="ck ck-link_selected" href="new-url">i{}n</a><a href="url">k</a> baz</p>'
+					'<p>foo <a href="url">l</a><a class="ck-link_selected" href="new-url">i{}n</a><a href="url">k</a> baz</p>'
 				);
 			} );
 
@@ -298,7 +298,7 @@ describe( 'LinkEditing', () => {
 				} );
 
 				expect( getViewData( view ) ).to.equal(
-					'<p>foo <a class="ck ck-link_selected" href="url">l{in}k</a> baz</p>'
+					'<p>foo <a class="ck-link_selected" href="url">l{in}k</a> baz</p>'
 				);
 			} );
 
@@ -317,13 +317,13 @@ describe( 'LinkEditing', () => {
 				} );
 
 				expect( getViewData( view ) ).to.equal(
-					'<p><span>foo </span><a class="ck ck-link_selected" href="url"><span>l</span>i{}nk</a> baz</p>'
+					'<p><span>foo </span><a class="ck-link_selected" href="url"><span>l</span>i{}nk</a> baz</p>'
 				);
 
 				model.change( writer => writer.removeMarker( 'fooMarker' ) );
 
 				expect( getViewData( view ) ).to.equal(
-					'<p>foo <a class="ck ck-link_selected" href="url">li{}nk</a> baz</p>'
+					'<p>foo <a class="ck-link_selected" href="url">li{}nk</a> baz</p>'
 				);
 			} );
 		} );

+ 2 - 2
packages/ckeditor5-link/tests/linkui.js

@@ -276,7 +276,7 @@ describe( 'LinkUI', () => {
 				const spy = testUtils.sinon.stub( balloon, 'updatePosition' ).returns( {} );
 
 				expect( getViewData( view ) ).to.equal(
-					'<p><a class="ck ck-link_selected" href="url">f{}oo</a></p>'
+					'<p><a class="ck-link_selected" href="url">f{}oo</a></p>'
 				);
 
 				const root = viewDocument.getRoot();
@@ -345,7 +345,7 @@ describe( 'LinkUI', () => {
 				const spyUpdate = testUtils.sinon.stub( balloon, 'updatePosition' ).returns( {} );
 				const spyHide = testUtils.sinon.spy( linkUIFeature, '_hideUI' );
 
-				expect( getViewData( view ) ).to.equal( '<p><a class="ck ck-link_selected" href="url">f{}oo</a></p>' );
+				expect( getViewData( view ) ).to.equal( '<p><a class="ck-link_selected" href="url">f{}oo</a></p>' );
 
 				const root = viewDocument.getRoot();
 				const text = root.getChild( 0 ).getChild( 0 ).getChild( 0 );

+ 1 - 1
packages/ckeditor5-link/theme/linkactions.css

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md.
  */
 
-.ck.ck-link-actions {
+.ck .ck-link-actions {
 	& .ck-link-actions__preview {
 		display: inline-block;
 

+ 1 - 1
packages/ckeditor5-link/theme/linkform.css

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md.
  */
 
-.ck.ck-link-form {
+.ck .ck-link-form {
 	& .ck-labeled-input {
 		display: inline-block;
 	}