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

t/152: Implemented FloatingToolbarView and Template.revert() #156

Merged
merged 29 commits into from
Mar 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
624aa58
(Temp) Improved Template#apply() so it preserves original data. Imple…
oleq Jan 27, 2017
30e9455
View#destroy() should not remove view's #element from DOM.
oleq Jan 27, 2017
98a0331
Code refactoring and docs improvements in Template class.
oleq Jan 27, 2017
c68588f
(TMP) Working draft of FloatingToolbarView.
oleq Jan 27, 2017
aa37943
Docs: Fixes in Template class.
oleq Jan 27, 2017
5b297ad
Improved CC of Template class.
oleq Jan 27, 2017
df62ec5
Template#apply() will extend only style and class attributes.
oleq Feb 2, 2017
703089a
Core–refactoring, massive docs improvements.
oleq Feb 2, 2017
1d5fd3e
[Tests, Docs, Code refac] for FloatingToolbarView.
oleq Feb 2, 2017
5f7f0a2
Made EditableUIView revert its template if #editableElement was passe…
oleq Feb 2, 2017
23a029e
Implemented expandToolbarConfig() and enableToolbarKeyboardFocus() to…
oleq Feb 3, 2017
f38789a
Added styles for FloatingToolbarView.
oleq Feb 3, 2017
8d2b005
Added styles for FloatingToolbarView. Code refac in *ToolbarView styles.
oleq Feb 3, 2017
b1e6a3c
Merge branch 'master' into t/152
oleq Feb 3, 2017
efb8b58
Renamed expandToolbarConfig->getItemsFromConfig.
oleq Feb 15, 2017
d7050ee
Merge branch 'master' into t/152
oleq Feb 15, 2017
eca5642
Created FloatingPanelView class. Moved panels to panel/ directory.
oleq Feb 15, 2017
9256a9a
Added #content collection to FloatingPanelView.
oleq Feb 15, 2017
1311a72
Removed FloatingToolbarView from the codebase. Added FloatingPanelVie…
oleq Feb 15, 2017
191a983
Merge branch 'master' into t/152
oleq Mar 1, 2017
0047487
Moved enableToolbarKeyboardFocus ToolbarView utils to a separate module.
oleq Mar 1, 2017
7b67c79
Merge remote-tracking branch 'origin/master' into t/152
oleq Mar 7, 2017
d40c01b
Renamed EditableUIView#isRendered to EditableUIView#externalElement.
oleq Mar 7, 2017
f3d5395
Docs: Fixed broken links.
oleq Mar 7, 2017
2349d63
Docs: Removed link to protected method from public API.
oleq Mar 7, 2017
c7ba822
Docs: Fixes in Template.
oleq Mar 7, 2017
35347df
Removed unnecessary node presence checks from Template#apply and Temp…
oleq Mar 7, 2017
51830e9
Renamed Template#_revertNode() into #_revertTemplateFromNode().
oleq Mar 7, 2017
e42cf46
Renamed module:ui/template~RenderConfig into module:ui/template~Rende…
oleq Mar 7, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dropdown/dropdownview.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ export default class DropdownView extends View {
this.focusTracker = new FocusTracker();

/**
* Instance of the {@link module:core/keystrokehandler~KeystrokeHandler}.
* Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
*
* @readonly
* @member {module:core/keystrokehandler~KeystrokeHandler}
* @member {module:utils/keystrokehandler~KeystrokeHandler}
*/
this.keystrokes = new KeystrokeHandler();

Expand Down
16 changes: 13 additions & 3 deletions src/editableui/editableuiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ export default class EditableUIView extends View {
*/
this.set( 'isFocused', false );

/**
* An external {@link #editableElement} passed into the constructor, which also means
* the view will not render its {@link #template}.
*
* @member {HTMLElement} #externalElement
*/
this.externalElement = editableElement;

/**
* The element which is the main editable element (usually the one with `contentEditable="true"`).
*
Expand All @@ -74,8 +82,8 @@ export default class EditableUIView extends View {
* @returns {Promise}
*/
init() {
if ( this.editableElement ) {
this.template.apply( this.editableElement );
if ( this.externalElement ) {
this.template.apply( this.externalElement );
} else {
this.editableElement = this.element;
}
Expand All @@ -87,7 +95,9 @@ export default class EditableUIView extends View {
* @inheritDoc
*/
destroy() {
this.editableElement.contentEditable = false;
if ( this.externalElement ) {
this.template.revert( this.externalElement );
}

return super.destroy();
}
Expand Down
22 changes: 11 additions & 11 deletions src/focuscycler.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class FocusCycler {
* @param {Object} options Configuration options.
* @param {module:utils/collection~Collection|Object} options.focusables
* @param {module:utils/focustracker~FocusTracker} options.focusTracker
* @param {module:core/keystrokehandler~KeystrokeHandler} [options.keystrokeHandler]
* @param {module:utils/keystrokehandler~KeystrokeHandler} [options.keystrokeHandler]
* @param {Object} [options.actions]
*/
constructor( options ) {
Expand All @@ -67,17 +67,17 @@ export default class FocusCycler {

/**
* A focus tracker instance that cycler uses to determine focus
* state in {@link #viewCollection}.
* state in {@link #focusables}.
*
* @readonly
* @member {module:utils/focustracker~FocusTracker} #focusTracker
*/

/**
* Instance of the {@link module:core/keystrokehandler~KeystrokeHandler}.
* Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
*
* @readonly
* @member {module:core/keystrokehandler~KeystrokeHandler} #keystrokeHandler
* @member {module:utils/keystrokehandler~KeystrokeHandler} #keystrokeHandler
*/

/**
Expand Down Expand Up @@ -117,7 +117,7 @@ export default class FocusCycler {
}

/**
* Returns the first focusable view in {@link #viewCollection}.
* Returns the first focusable view in {@link #focusables}.
* `null` if there's none.
*
* @readonly
Expand All @@ -128,7 +128,7 @@ export default class FocusCycler {
}

/**
* Returns the last focusable view in {@link #viewCollection}.
* Returns the last focusable view in {@link #focusables}.
* `null` if there's none.
*
* @readonly
Expand All @@ -139,7 +139,7 @@ export default class FocusCycler {
}

/**
* Returns the next focusable view in {@link #viewCollection} based on {@link #current}.
* Returns the next focusable view in {@link #focusables} based on {@link #current}.
* `null` if there's none.
*
* @readonly
Expand All @@ -150,7 +150,7 @@ export default class FocusCycler {
}

/**
* Returns the previous focusable view in {@link #viewCollection} based on {@link #current}.
* Returns the previous focusable view in {@link #focusables} based on {@link #current}.
* `null` if there's none.
*
* @readonly
Expand All @@ -161,7 +161,7 @@ export default class FocusCycler {
}

/**
* An index of the view in the {@link #viewCollection} which is focused according
* An index of the view in the {@link #focusables} which is focused according
* to {@link #focusTracker}. `null` when there's no such view.
*
* @readonly
Expand All @@ -170,7 +170,7 @@ export default class FocusCycler {
get current() {
let index = null;

// There's no focused view in the viewCollection.
// There's no focused view in the focusables.
if ( this.focusTracker.focusedElement === null ) {
return null;
}
Expand Down Expand Up @@ -229,7 +229,7 @@ export default class FocusCycler {
}

/**
* Returns the next/previous focusable view in {@link #viewCollection} with respect
* Returns the next/previous focusable view in {@link #focusables} with respect
* to {@link #current}.
*
* @protected
Expand Down
4 changes: 2 additions & 2 deletions src/list/listview.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ export default class ListView extends View {
this.focusTracker = new FocusTracker();

/**
* Instance of the {@link module:core/keystrokehandler~KeystrokeHandler}.
* Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
*
* @readonly
* @member {module:core/keystrokehandler~KeystrokeHandler}
* @member {module:utils/keystrokehandler~KeystrokeHandler}
*/
this.keystrokes = new KeystrokeHandler();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
*/

/**
* @module ui/balloonpanel/balloonpanelview
* @module ui/panel/balloon/balloonpanelview
*/

/* globals document */

import View from '../view';
import Template from '../template';
import View from '../../view';
import Template from '../../template';
import { getOptimalPosition } from '@ckeditor/ckeditor5-utils/src/dom/position';
import toUnit from '@ckeditor/ckeditor5-utils/src/dom/tounit';

Expand Down Expand Up @@ -54,7 +54,8 @@ export default class BalloonPanelView extends View {
* controls the minor aspects of the balloon's visual appearance like placement
* of the "arrow". To support a new position, an additional CSS must be created.
*
* Default position names correspond with {@link #defaultPositions}.
* Default position names correspond with
* {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions}.
*
* @observable
* @default 'se'
Expand Down Expand Up @@ -136,7 +137,7 @@ export default class BalloonPanelView extends View {
*
* @param {module:utils/dom/position~Options} options Positioning options compatible with
* {@link module:utils/dom/position~getOptimalPosition}. Default `positions` array is
* {@link module:ui/balloonpanel/balloonpanelview~BalloonPanelView.defaultPositions}.
* {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions}.
*/
attachTo( options ) {
this.show();
Expand Down Expand Up @@ -174,7 +175,7 @@ export default class BalloonPanelView extends View {
* >|-----|<---------------- horizontal offset
*
* @default 30
* @member {Number} module:ui/balloonpanel/balloonpanelview~BalloonPanelView.arrowHorizontalOffset
* @member {Number} module:ui/panel/balloon/balloonpanelview~BalloonPanelView.arrowHorizontalOffset
*/
BalloonPanelView.arrowHorizontalOffset = 30;

Expand All @@ -193,13 +194,13 @@ BalloonPanelView.arrowHorizontalOffset = 30;
* ^
*
* @default 15
* @member {Number} module:ui/balloonpanel/balloonpanelview~BalloonPanelView.arrowVerticalOffset
* @member {Number} module:ui/panel/balloon/balloonpanelview~BalloonPanelView.arrowVerticalOffset
*/
BalloonPanelView.arrowVerticalOffset = 15;

/**
* A default set of positioning functions used by the balloon panel view
* when attaching using {@link #attachTo} method.
* when attaching using {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView#attachTo} method.
*
* The available positioning functions are as follows:
*
Expand Down Expand Up @@ -238,14 +239,14 @@ BalloonPanelView.arrowVerticalOffset = 15;
* V
* [ Target ]
*
* See {@link #attachTo}.
* See {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView#attachTo}.
*
* Positioning functions must be compatible with {@link module:utils/dom/position~Position}.
*
* The name that position function returns will be reflected in balloon panel's class that
* controls the placement of the "arrow". See {@link #position} to learn more.
*
* @member {Object} module:ui/balloonpanel/balloonpanelview~BalloonPanelView.defaultPositions
* @member {Object} module:ui/panel/balloon/balloonpanelview~BalloonPanelView.defaultPositions
*/
BalloonPanelView.defaultPositions = {
se: ( targetRect ) => ( {
Expand Down
Loading