Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Other: Increased the specificity of CSS rules. Introduced the .ck cla…
Browse files Browse the repository at this point in the history
…ss for editor UI components (see: ckeditor/ckeditor5#494).
  • Loading branch information
oleq committed Mar 23, 2018
1 parent 0a6154d commit e66f921
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 11 deletions.
5 changes: 4 additions & 1 deletion src/linkediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ export default class LinkEditing extends Plugin {
const doc = model.document;
const highlightDescriptor = {
id: 'linkBoundaries',
class: 'ck-link_selected',
class: [
'ck',
'ck-link_selected'
],
priority: 1
};

Expand Down
2 changes: 2 additions & 0 deletions src/ui/linkactionsview.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export default class LinkActionsView extends View {

attributes: {
class: [
'ck',
'ck-link-actions',
],

Expand Down Expand Up @@ -202,6 +203,7 @@ export default class LinkActionsView extends View {
button.extendTemplate( {
attributes: {
class: [
'ck',
'ck-link-actions__preview'
],
href: bind.to( 'href' ),
Expand Down
1 change: 1 addition & 0 deletions src/ui/linkformview.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default class LinkFormView extends View {

attributes: {
class: [
'ck',
'ck-link-form',
],

Expand Down
12 changes: 6 additions & 6 deletions tests/linkediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe( 'LinkEditing', () => {
);

expect( getViewData( view ) ).to.equal(
'<p>foo <span class="ck-link_selected"><a href="url">b{}ar</a></span> baz</p>'
'<p>foo <span class="ck ck-link_selected"><a href="url">b{}ar</a></span> baz</p>'
);
} );

Expand All @@ -188,7 +188,7 @@ describe( 'LinkEditing', () => {
expect( marker.getEnd().path ).to.deep.equal( [ 0, 7 ] );

expect( getViewData( view ) ).to.equal(
'<p>foo <span class="ck-link_selected"><a href="url">{}bar</a></span> baz</p>'
'<p>foo <span class="ck ck-link_selected"><a href="url">{}bar</a></span> baz</p>'
);
} );

Expand All @@ -204,7 +204,7 @@ describe( 'LinkEditing', () => {
expect( marker.getEnd().path ).to.deep.equal( [ 0, 7 ] );

expect( getViewData( view ) ).to.equal(
'<p>foo <span class="ck-link_selected"><a href="url">bar{}</a></span> baz</p>'
'<p>foo <span class="ck ck-link_selected"><a href="url">bar{}</a></span> baz</p>'
);
} );

Expand Down Expand Up @@ -233,7 +233,7 @@ describe( 'LinkEditing', () => {
);

expect( getViewData( view ) ).to.equal(
'<p>foo <span class="ck-link_selected"><a href="url">li{}nk</a></span> baz</p>'
'<p>foo <span class="ck ck-link_selected"><a href="url">li{}nk</a></span> baz</p>'
);

expect( model.markers.has( 'linkBoundaries' ) ).to.be.true;
Expand All @@ -251,15 +251,15 @@ describe( 'LinkEditing', () => {
);

expect( getViewData( view ) ).to.equal(
'<p>foo <span class="ck-link_selected"><a href="url">li{}nk</a></span> baz</p>'
'<p>foo <span class="ck ck-link_selected"><a href="url">li{}nk</a></span> baz</p>'
);

expect( model.markers.has( 'linkBoundaries' ) ).to.be.true;
model.change( writer => writer.setSelection( model.document.getRoot().getChild( 0 ), 5 ) );

expect( model.markers.has( 'linkBoundaries' ) ).to.be.true;
expect( getViewData( view ) ).to.equal(
'<p>foo <span class="ck-link_selected"><a href="url">l{}ink</a></span> baz</p>'
'<p>foo <span class="ck ck-link_selected"><a href="url">l{}ink</a></span> baz</p>'
);
} );
} );
Expand Down
4 changes: 2 additions & 2 deletions tests/linkui.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ describe( 'LinkUI', () => {
const spy = testUtils.sinon.stub( balloon, 'updatePosition' ).returns( {} );

expect( getViewData( view ) ).to.equal(
'<p><span class="ck-link_selected"><a href="url">f{}oo</a></span></p>'
'<p><span class="ck ck-link_selected"><a href="url">f{}oo</a></span></p>'
);

const root = viewDocument.getRoot();
Expand Down Expand Up @@ -319,7 +319,7 @@ describe( 'LinkUI', () => {
const spyUpdate = testUtils.sinon.stub( balloon, 'updatePosition' ).returns( {} );
const spyHide = testUtils.sinon.spy( linkUIFeature, '_hideUI' );

expect( getViewData( view ) ).to.equal( '<p><span class="ck-link_selected"><a href="url">f{}oo</a></span></p>' );
expect( getViewData( view ) ).to.equal( '<p><span class="ck ck-link_selected"><a href="url">f{}oo</a></span></p>' );

const root = viewDocument.getRoot();
const text = root.getChild( 0 ).getChild( 0 ).getChild( 0 ).getChild( 0 );
Expand Down
1 change: 1 addition & 0 deletions tests/ui/linkactionsview.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe( 'LinkActionsView', () => {

describe( 'constructor()', () => {
it( 'should create element from template', () => {
expect( view.element.classList.contains( 'ck' ) ).to.true;
expect( view.element.classList.contains( 'ck-link-actions' ) ).to.true;
expect( view.element.getAttribute( 'tabindex' ) ).to.equal( '-1' );
} );
Expand Down
1 change: 1 addition & 0 deletions tests/ui/linkformview.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe( 'LinkFormView', () => {

describe( 'constructor()', () => {
it( 'should create element from template', () => {
expect( view.element.classList.contains( 'ck' ) ).to.true;
expect( view.element.classList.contains( 'ck-link-form' ) ).to.true;
expect( view.element.getAttribute( 'tabindex' ) ).to.equal( '-1' );
} );
Expand Down
2 changes: 1 addition & 1 deletion theme/linkactions.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md.
*/

.ck-link-actions {
.ck.ck-link-actions {
& .ck-link-actions__preview {
display: inline-block;

Expand Down
2 changes: 1 addition & 1 deletion theme/linkform.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md.
*/

.ck-link-form {
.ck.ck-link-form {
& .ck-labeled-input {
display: inline-block;
}
Expand Down

0 comments on commit e66f921

Please sign in to comment.