This repository was archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
+1,235
−12
Merged
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
58d139d
Introduced linking engine.
oskarwrobel ea4ead7
WIP: Introduced link command and link feature.
oskarwrobel 353a2ff
Introduced basic manual test.
oskarwrobel 7cdd8ab
Added binding for active feature. Improved docs.
oskarwrobel 0f93f14
Improved link command.
oskarwrobel 49d61b6
Minor test changes.
oskarwrobel fae57da
Created mockup of the LinkBalloonPanel.
oleq cdd90ab
Created basic themes for LinkBalloonPanel.
oleq d9373c0
Extended Link manual test to include the UI.
oleq eb414b4
Enabled LinkBalloonPanel in Link feature. Code refactoring.
oleq 6f14c14
Merge remote-tracking branch 'origin/t/1' into t/2
oleq 926f4dc
Use domConverter to obtain native DOM range.
oleq 1b2db40
Added panel elements like button, URL input and label along with the
oleq fd070c7
Created balloonPanel#url attribute. Basic focus handling when editing…
oleq eda9c2b
Added Cancel button to LinkBalloonPanel component.
oleq 20cbffc
Massive code refactoring, decoupling and polishing.
oleq 82b170b
Minor refactoring.
oleq 43c1fe6
Added tmp extended version of ck-z helper to linkballoonpanel stylesh…
oleq eb9223f
Decoupled styles for various components.
oleq 98862a5
Merge branch 't/1' into t/2
oskarwrobel 6821253
Improved data flow between the feature and the UI.
oleq fc5d6c5
Minor refactoring and docs in Link Feature.
oleq cd97be6
Added docs for _createBalloonPanel method in Link Feature.
oleq 2cc453c
Very base ui and command integration.
oskarwrobel b52f48d
Refactored the way of creating panel.
oskarwrobel f8f9051
Prevent showing panel when editor is not focused.
oskarwrobel cd2a43c
Moved panel creation to Link Feature init(). Fixed some focus issues.
oleq 762ae4d
Merge branch 't/1' into t/2
oskarwrobel f9fccc2
Merge branch 'master' into t/2
oskarwrobel a93540a
Moved Balloon Panel component to ckeditor5-ui-default and ckeditor5-t…
oskarwrobel 932197b
Introduced toolbar unlink button.
oskarwrobel fc66303
Show panel on Ctrl+l keystroke.
oskarwrobel ad1d48f
Added missing docs and test for LinkBalloonPanel component.
oskarwrobel 74770f1
Added missing bender tag.
oskarwrobel c240af5
Added test + minor refactor of Link feature.
oskarwrobel fb131cd
Moved bender tag at the top of file.
oskarwrobel 7780ed3
Changed the way of getting editable element.
oskarwrobel 25f3806
Removed Balloon Panel test case from link manual test.
oskarwrobel 1b0fb4e
Added use cases to manual test.
oskarwrobel d3bb9b5
Removed unused editor init.
oskarwrobel dabe64c
Minor docs refactoring.
oskarwrobel 2cf3f4d
Introduced LinkElement class.
oskarwrobel 6b78bd9
Refactored the way of test which use editable element.
oskarwrobel a983c1d
Fixed typo in tests.
oskarwrobel a7ca040
Added unlink button to link balloon panel.
oskarwrobel f5c07b3
Refactoring after changes in `ckeditor5-ui-default`.
oskarwrobel 10a09de
Changed initialization of LabeledInput component.
oskarwrobel 52fe998
Added keystroke to button title.
oskarwrobel 4840986
Changed CSS class name of LinkForm component region.
oskarwrobel b940d80
Refactored code style and docs.
oskarwrobel 4b2e4d2
Refactored docs.
oskarwrobel e49efba
Minor code refactoring and documentation fixes.
oleq 6749e9a
Minor code refactoring and documentation fixes.
oleq 8fdf0f3
Used the new LabeledInput API in the LinkBalloonPanel.
oleq 1091d43
Enhanced visually the link balloon panel with more space.
oleq File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Added missing docs and test for LinkBalloonPanel component.
commit ad1d48f082548c6e7b41a3ba8c49cc1e0b068aac
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,22 @@ import BoxView from '../../ui/box/boxview.js'; | |
/** | ||
* The link balloon panel controller class. | ||
* | ||
* const model = new Model( { | ||
* maxWidth: 300, | ||
* url: 'http://ckeditor.com' | ||
* } ); | ||
* | ||
* // An instance of LinkBalloonPanel. | ||
* new LinkBalloonPanel( model, new LinkBalloonPanelView() ); | ||
* | ||
* See {@link link.ui.LinkBalloonPanelView}. | ||
* | ||
* @memberOf link.ui | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder whether There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But it's defined inside |
||
* @extends ui.Controller | ||
* @extends ui.balloonPanel.BalloonPanel | ||
*/ | ||
export default class LinkBalloonPanel extends BalloonPanel { | ||
/** | ||
* Creates an instance of {@link ui.dropdown.Dropdown} class. | ||
* Creates an instance of {@link link.ui.LinkBalloonPanel} class. | ||
* | ||
* @param {ui.balloonPanel.BalloonPanelModel} model Model of this balloon panel. | ||
* @param {ui.View} view View of this balloon panel. | ||
|
@@ -33,23 +43,37 @@ export default class LinkBalloonPanel extends BalloonPanel { | |
this.add( 'content', this._createForm() ); | ||
} | ||
|
||
/** | ||
* Initialize {@link ui.form.Form Form} component with input and buttons. | ||
* | ||
* @private | ||
* @returns {ui.form.Form} Form component. | ||
*/ | ||
_createForm() { | ||
const formModel = new Model(); | ||
|
||
formModel.delegate( 'execute' ).to( this.model ); | ||
|
||
/** | ||
* TODO | ||
* Instance of {@link ui.form.Form Form} component. | ||
* | ||
* @member {} todo | ||
* @member {ui.form.Form} link.ui.LinkBalloonPanel#form | ||
*/ | ||
this.form = new Form( formModel, new FormView( this.locale ) ); | ||
|
||
// Add Input and buttons as a form content. | ||
this.form.add( 'content', this._createLabeledInput() ); | ||
this.form.add( 'content', this._createButtons() ); | ||
|
||
return this.form; | ||
} | ||
|
||
/** | ||
* Initialize {@link ui.input.LabeledInput LabeledInput} for providing `href` value. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/Initialize/Initializes (+ couple of eccurences below) |
||
* | ||
* @private | ||
* @returns {ui.input.LabeledInput} Labeled input component. | ||
*/ | ||
_createLabeledInput() { | ||
const t = this.view.t; | ||
const model = new Model( { | ||
|
@@ -59,40 +83,53 @@ export default class LinkBalloonPanel extends BalloonPanel { | |
model.bind( 'value' ).to( this.model, 'url' ); | ||
|
||
/** | ||
* TODO | ||
* Input component for providing `href` value. | ||
* | ||
* @member {} todo | ||
* @member {ui.input.LabeledInput} link.ui.LinkBalloonPanel#urlInput | ||
*/ | ||
this.urlInput = new LabeledInput( model, new LabeledInputView( this.locale ) ); | ||
|
||
return this.urlInput; | ||
} | ||
|
||
/** | ||
* Create {@link ui.box.Box Box} instance with `Cancel` and `Save` buttons. | ||
* | ||
* @private | ||
* @returns {ui.box.Box} Box component. | ||
*/ | ||
_createButtons() { | ||
const box = new Box( new Model( { | ||
alignRight: true | ||
} ), new BoxView( this.locale ) ); | ||
|
||
/** | ||
* TODO | ||
* Button component for submitting form. | ||
* | ||
* @member {} todo | ||
* @member {ui.button.Button} link.ui.LinkBalloonPanel#saveButton | ||
*/ | ||
this.saveButton = this._createSaveButton(); | ||
|
||
/** | ||
* TODO | ||
* Button component for canceling form. | ||
* | ||
* @member {} todo | ||
* @member {ui.button.Button} link.ui.LinkBalloonPanel#cancelButton | ||
*/ | ||
this.cancelButton = this._createCancelButton(); | ||
|
||
// Add `Cancel` and `Save` buttons as a box content. | ||
box.add( 'content', this.cancelButton ); | ||
box.add( 'content', this.saveButton ); | ||
|
||
return box; | ||
} | ||
|
||
/** | ||
* Initialize {@link ui.button.Button Button} for submitting form. | ||
* | ||
* @private | ||
* @returns {ui.button.Button} Save button component. | ||
*/ | ||
_createSaveButton() { | ||
const t = this.view.t; | ||
const saveModel = new Model( { | ||
|
@@ -110,6 +147,12 @@ export default class LinkBalloonPanel extends BalloonPanel { | |
return button; | ||
} | ||
|
||
/** | ||
* Initialize {@link ui.button.Button Button} for canceling form. | ||
* | ||
* @private | ||
* @returns {ui.button.Button} Cancel button component. | ||
*/ | ||
_createCancelButton() { | ||
const t = this.view.t; | ||
const cancelModel = new Model( { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/** | ||
* @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/* bender-tags: ui, link */ | ||
|
||
import LinkBalloonPanel from '/ckeditor5/link/ui/linkballoonpanel.js'; | ||
import LinkBalloonPanelView from '/ckeditor5/link/ui/linkballoonpanelview.js'; | ||
import BalloonPanel from '/ckeditor5/ui/balloonpanel/balloonpanel.js'; | ||
import Model from '/ckeditor5/ui/model.js'; | ||
|
||
import Form from '/ckeditor5/ui/form/form.js'; | ||
import LabeledInput from '/ckeditor5/ui/labeledinput/labeledinput.js'; | ||
import Button from '/ckeditor5/ui/button/button.js'; | ||
|
||
import LocaleMock from '/tests/utils/_utils/locale-mock.js'; | ||
|
||
describe( 'LinkBalloonPanel', () => { | ||
let model, linkBalloonPanel, view; | ||
|
||
beforeEach( () => { | ||
model = new Model( { | ||
maxWidth: 200, | ||
url: 'http://ckeditor.com' | ||
} ); | ||
|
||
view = new LinkBalloonPanelView( new LocaleMock() ); | ||
linkBalloonPanel = new LinkBalloonPanel( model, view ); | ||
} ); | ||
|
||
describe( 'constructor', () => { | ||
it( 'should extends BalloonPanel class', () => { | ||
expect( linkBalloonPanel ).to.be.instanceOf( BalloonPanel ); | ||
} ); | ||
|
||
describe( 'child components', () => { | ||
describe( 'form', () => { | ||
it( 'should creates Form instance', () => { | ||
expect( linkBalloonPanel.form ).to.instanceof( Form ); | ||
} ); | ||
|
||
it( 'should appends to "content" collection', () => { | ||
expect( linkBalloonPanel.collections.get( 'content' ).get( 0 ) ).to.deep.equal( linkBalloonPanel.form ); | ||
} ); | ||
|
||
it( 'should delegates form.model#execute to the model', () => { | ||
const executeSpy = sinon.spy(); | ||
|
||
model.on( 'execute', executeSpy ); | ||
|
||
linkBalloonPanel.form.model.fire( 'execute' ); | ||
|
||
expect( executeSpy.calledOnce ).to.true; | ||
} ); | ||
} ); | ||
|
||
describe( 'urlInput', () => { | ||
it( 'should creates LabeledInput instance', () => { | ||
expect( linkBalloonPanel.urlInput ).to.instanceof( LabeledInput ); | ||
} ); | ||
|
||
it( 'should appends to Form "content" collection', () => { | ||
expect( linkBalloonPanel.form.collections.get( 'content' ).get( 0 ) ).to.deep.equal( linkBalloonPanel.urlInput ); | ||
} ); | ||
|
||
it( 'should binds model#url to urlInput.model#value', () => { | ||
expect( linkBalloonPanel.urlInput.model.value ).to.equal( model.url ).to.equal( 'http://ckeditor.com' ); | ||
|
||
model.url = 'http://cksource.com'; | ||
|
||
expect( linkBalloonPanel.urlInput.model.value ).to.equal( 'http://cksource.com' ); | ||
} ); | ||
} ); | ||
|
||
describe( 'saveButton', () => { | ||
it( 'should creates Button instance', () => { | ||
expect( linkBalloonPanel.saveButton ).to.instanceof( Button ); | ||
} ); | ||
|
||
it( 'should trigger model#execute event after clicking', ( done ) => { | ||
const executeSpy = sinon.spy(); | ||
|
||
model.on( 'execute', executeSpy ); | ||
|
||
linkBalloonPanel.init().then( () => { | ||
linkBalloonPanel.saveButton.view.element.click(); | ||
|
||
expect( executeSpy.calledOnce ).to.true; | ||
done(); | ||
} ); | ||
} ); | ||
|
||
it( 'should be a submit', () => { | ||
expect( linkBalloonPanel.saveButton.model.type ).to.equal( 'submit' ); | ||
} ); | ||
} ); | ||
|
||
describe( 'cancelButton', () => { | ||
it( 'should creates Button instance', () => { | ||
expect( linkBalloonPanel.cancelButton ).to.instanceof( Button ); | ||
} ); | ||
|
||
it( 'should hide LinkBalloonPanel on cancelButton.model#execute event', () => { | ||
const hideSpy = sinon.spy( linkBalloonPanel.view, 'hide' ); | ||
|
||
linkBalloonPanel.cancelButton.model.fire( 'execute' ); | ||
|
||
expect( hideSpy.calledOnce ).to.true; | ||
} ); | ||
} ); | ||
} ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/* bender-tags: ui, link */ | ||
|
||
import LinkBalloonPanelView from '/ckeditor5/link/ui/linkballoonpanelview.js'; | ||
import BalloonPanelView from '/ckeditor5/ui/balloonpanel/balloonpanelview.js'; | ||
|
||
describe( 'LinkBalloonPanelView', () => { | ||
let view; | ||
|
||
beforeEach( () => { | ||
view = new LinkBalloonPanelView(); | ||
} ); | ||
|
||
describe( 'constructor', () => { | ||
it( 'should extends BalloonPanelView class', () => { | ||
expect( view ).to.be.instanceof( BalloonPanelView ); | ||
} ); | ||
|
||
it( 'should extend BalloonPanel element by additional class', () => { | ||
expect( view.element.classList.contains( 'ck-link-balloon-panel' ) ).to.be.true; | ||
} ); | ||
} ); | ||
} ); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An extra tab.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is hard to notice it in webstorm :)

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An extra space in fact... indeed it's poorly visible in Webstorm. Use Sublime :P