2013-05-14 23:45:42 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor UserInterface Surface class.
|
|
|
|
*
|
|
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A surface is a top-level object which contains both a surface model and a surface view.
|
|
|
|
*
|
|
|
|
* @class
|
2013-10-09 20:09:59 +00:00
|
|
|
* @extends OO.ui.Element
|
2013-05-14 23:45:42 +00:00
|
|
|
*
|
|
|
|
* @constructor
|
2013-09-05 01:01:22 +00:00
|
|
|
* @param {HTMLDocument|Array|ve.dm.LinearData|ve.dm.Document} dataOrDoc Document data to edit
|
2013-09-25 10:21:09 +00:00
|
|
|
* @param {Object} [config] Configuration options
|
2013-05-14 23:45:42 +00:00
|
|
|
*/
|
2013-07-01 20:02:10 +00:00
|
|
|
ve.ui.Surface = function VeUiSurface( dataOrDoc, config ) {
|
2013-12-04 17:37:50 +00:00
|
|
|
var documentModel;
|
|
|
|
|
2013-05-14 23:45:42 +00:00
|
|
|
// Parent constructor
|
2013-10-09 20:09:59 +00:00
|
|
|
OO.ui.Element.call( this, config );
|
2013-05-14 23:45:42 +00:00
|
|
|
|
2013-06-20 00:28:51 +00:00
|
|
|
// Mixin constructor
|
2013-10-15 11:58:04 +00:00
|
|
|
OO.EventEmitter.call( this, config );
|
2013-06-20 00:28:51 +00:00
|
|
|
|
2013-05-14 23:45:42 +00:00
|
|
|
// Properties
|
2013-11-01 19:45:59 +00:00
|
|
|
this.$globalOverlay = this.$( '<div>' );
|
|
|
|
this.$localOverlay = this.$( '<div>' );
|
|
|
|
this.$localOverlayBlockers = this.$( '<div>' );
|
|
|
|
this.$localOverlayControls = this.$( '<div>' );
|
|
|
|
this.$localOverlayMenus = this.$( '<div>' );
|
2013-12-04 17:37:50 +00:00
|
|
|
if ( dataOrDoc instanceof ve.dm.Document ) {
|
|
|
|
// ve.dm.Document
|
|
|
|
documentModel = dataOrDoc;
|
|
|
|
} else if ( dataOrDoc instanceof ve.dm.LinearData || ve.isArray( dataOrDoc ) ) {
|
|
|
|
// LinearData or raw linear data
|
|
|
|
documentModel = new ve.dm.Document( dataOrDoc );
|
|
|
|
} else {
|
|
|
|
// HTMLDocument
|
|
|
|
documentModel = ve.dm.converter.getModelFromDom( dataOrDoc );
|
|
|
|
}
|
|
|
|
this.model = new ve.dm.Surface( documentModel );
|
2013-11-01 19:45:59 +00:00
|
|
|
this.view = new ve.ce.Surface( this.model, this, { '$': this.$ } );
|
|
|
|
this.context = new ve.ui.Context( this, { '$': this.$ } );
|
2013-11-05 00:29:50 +00:00
|
|
|
this.dialogs = new ve.ui.WindowSet( this, ve.ui.dialogFactory, { '$': this.$ } );
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
this.commands = {};
|
2013-10-23 23:27:12 +00:00
|
|
|
this.triggers = {};
|
2013-09-30 13:26:33 +00:00
|
|
|
this.pasteRules = {};
|
2013-05-14 23:45:42 +00:00
|
|
|
this.enabled = true;
|
|
|
|
|
|
|
|
// Initialization
|
2013-11-01 19:45:59 +00:00
|
|
|
this.$element
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
.addClass( 've-ui-surface' )
|
2013-11-01 19:45:59 +00:00
|
|
|
.append( this.view.$element );
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
this.$localOverlay
|
|
|
|
.addClass( 've-ui-surface-overlay ve-ui-surface-overlay-local' )
|
2013-06-27 18:24:26 +00:00
|
|
|
.append( this.$localOverlayBlockers )
|
|
|
|
.append( this.$localOverlayControls )
|
|
|
|
.append( this.$localOverlayMenus );
|
|
|
|
this.$localOverlayMenus
|
2013-11-01 19:45:59 +00:00
|
|
|
.append( this.context.$element );
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
this.$globalOverlay
|
|
|
|
.addClass( 've-ui-surface-overlay ve-ui-surface-overlay-global' )
|
2013-11-01 19:45:59 +00:00
|
|
|
.append( this.dialogs.$element );
|
2013-05-14 23:45:42 +00:00
|
|
|
|
|
|
|
// Make instance globally accessible for debugging
|
|
|
|
ve.instances.push( this );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2013-10-09 20:09:59 +00:00
|
|
|
OO.inheritClass( ve.ui.Surface, OO.ui.Element );
|
2013-05-14 23:45:42 +00:00
|
|
|
|
2013-10-15 11:58:04 +00:00
|
|
|
OO.mixinClass( ve.ui.Surface, OO.EventEmitter );
|
2013-06-20 00:28:51 +00:00
|
|
|
|
|
|
|
/* Events */
|
|
|
|
|
2013-07-31 20:15:33 +00:00
|
|
|
/**
|
|
|
|
* When the surface changes its position (only if it happens
|
|
|
|
* after initialize has already been called).
|
|
|
|
*
|
|
|
|
* @event position
|
|
|
|
*/
|
|
|
|
|
2013-10-23 23:27:12 +00:00
|
|
|
/**
|
|
|
|
* When a command is added to the surface.
|
|
|
|
*
|
|
|
|
* @event addCommand
|
|
|
|
* @param {string} name Symbolic name of command and trigger
|
|
|
|
* @param {ve.ui.Command} command Command that's been registered
|
|
|
|
* @param {ve.ui.Trigger} trigger Trigger to associate with command
|
|
|
|
*/
|
|
|
|
|
2013-05-14 23:45:42 +00:00
|
|
|
/* Methods */
|
|
|
|
|
2013-10-23 23:27:12 +00:00
|
|
|
/**
|
|
|
|
* Initialize surface.
|
|
|
|
*
|
|
|
|
* This must be called after the surface has been attached to the DOM.
|
|
|
|
*/
|
2013-05-14 23:45:42 +00:00
|
|
|
ve.ui.Surface.prototype.initialize = function () {
|
2013-11-01 19:45:59 +00:00
|
|
|
this.view.$element.after( this.$localOverlay );
|
|
|
|
this.$( 'body' ).append( this.$globalOverlay );
|
2013-06-27 17:25:28 +00:00
|
|
|
|
2013-05-14 23:45:42 +00:00
|
|
|
this.view.initialize();
|
|
|
|
// By re-asserting the current selection and forcing a poll we force selection to be something
|
|
|
|
// reasonable - otherwise in Firefox, the initial selection is (0,0), causing bug 42277
|
|
|
|
this.model.getFragment().select();
|
2013-09-07 01:03:10 +00:00
|
|
|
this.view.surfaceObserver.pollOnce();
|
2013-05-14 23:45:42 +00:00
|
|
|
this.model.startHistoryTracking();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if editing is enabled.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @returns {boolean} Editing is enabled
|
|
|
|
*/
|
|
|
|
ve.ui.Surface.prototype.isEnabled = function () {
|
|
|
|
return this.enabled;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the surface model.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @returns {ve.dm.Surface} Surface model
|
|
|
|
*/
|
|
|
|
ve.ui.Surface.prototype.getModel = function () {
|
|
|
|
return this.model;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the surface view.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @returns {ve.ce.Surface} Surface view
|
|
|
|
*/
|
|
|
|
ve.ui.Surface.prototype.getView = function () {
|
|
|
|
return this.view;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the context menu.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @returns {ve.ui.Context} Context user interface
|
|
|
|
*/
|
|
|
|
ve.ui.Surface.prototype.getContext = function () {
|
|
|
|
return this.context;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
* Get dialogs window set.
|
2013-05-14 23:45:42 +00:00
|
|
|
*
|
|
|
|
* @method
|
2013-10-09 20:09:59 +00:00
|
|
|
* @returns {OO.ui.WindowSet} Dialogs window set
|
2013-05-14 23:45:42 +00:00
|
|
|
*/
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
ve.ui.Surface.prototype.getDialogs = function () {
|
|
|
|
return this.dialogs;
|
2013-05-14 23:45:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2013-10-23 23:27:12 +00:00
|
|
|
* Get list of commands keyed by trigger string.
|
2013-05-14 23:45:42 +00:00
|
|
|
*
|
|
|
|
* @method
|
2013-10-23 23:27:12 +00:00
|
|
|
* @returns {Object.<string,ve.ui.Command>} Commands
|
2013-05-14 23:45:42 +00:00
|
|
|
*/
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
ve.ui.Surface.prototype.getCommands = function () {
|
|
|
|
return this.commands;
|
2013-05-14 23:45:42 +00:00
|
|
|
};
|
|
|
|
|
2013-10-23 23:27:12 +00:00
|
|
|
/**
|
|
|
|
* Get list of triggers keyed by symbolic name.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @returns {Object.<string,ve.ui.Trigger>} Triggers
|
|
|
|
*/
|
|
|
|
ve.ui.Surface.prototype.getTriggers = function () {
|
|
|
|
return this.triggers;
|
|
|
|
};
|
|
|
|
|
2013-05-14 23:45:42 +00:00
|
|
|
/**
|
|
|
|
* Destroy the surface, releasing all memory and removing all DOM elements.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @returns {ve.ui.Context} Context user interface
|
|
|
|
*/
|
|
|
|
ve.ui.Surface.prototype.destroy = function () {
|
|
|
|
ve.instances.splice( ve.instances.indexOf( this ), 1 );
|
2013-10-06 12:59:42 +00:00
|
|
|
this.view.destroy();
|
2013-11-01 19:45:59 +00:00
|
|
|
this.$element.remove();
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
this.$globalOverlay.remove();
|
|
|
|
this.$localOverlay.remove();
|
2013-05-14 23:45:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Disable editing.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
ve.ui.Surface.prototype.disable = function () {
|
|
|
|
this.view.disable();
|
|
|
|
this.model.disable();
|
|
|
|
this.enabled = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enable editing.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
ve.ui.Surface.prototype.enable = function () {
|
|
|
|
this.enabled = true;
|
|
|
|
this.view.enable();
|
|
|
|
this.model.enable();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute an action or command.
|
|
|
|
*
|
|
|
|
* @method
|
|
|
|
* @param {ve.ui.Trigger|string} action Trigger or symbolic name of action
|
|
|
|
* @param {string} [method] Action method name
|
|
|
|
* @param {Mixed...} [args] Additional arguments for action
|
|
|
|
* @returns {boolean} Action or command was executed
|
|
|
|
*/
|
|
|
|
ve.ui.Surface.prototype.execute = function ( action, method ) {
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
var trigger, obj, ret;
|
|
|
|
|
2013-05-14 23:45:42 +00:00
|
|
|
if ( !this.enabled ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( action instanceof ve.ui.Trigger ) {
|
2013-10-23 23:27:12 +00:00
|
|
|
// Lookup command by trigger
|
2013-05-14 23:45:42 +00:00
|
|
|
trigger = action.toString();
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
if ( trigger in this.commands ) {
|
2013-10-23 23:27:12 +00:00
|
|
|
// Have command call execute with action arguments
|
|
|
|
return this.commands[trigger].execute( this );
|
2013-05-14 23:45:42 +00:00
|
|
|
}
|
|
|
|
} else if ( typeof action === 'string' && typeof method === 'string' ) {
|
|
|
|
// Validate method
|
|
|
|
if ( ve.ui.actionFactory.doesActionSupportMethod( action, method ) ) {
|
|
|
|
// Create an action object and execute the method on it
|
|
|
|
obj = ve.ui.actionFactory.create( action, this );
|
|
|
|
ret = obj[method].apply( obj, Array.prototype.slice.call( arguments, 2 ) );
|
|
|
|
return ret === undefined || !!ret;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add all commands from initialization options.
|
|
|
|
*
|
2013-10-23 23:27:12 +00:00
|
|
|
* Commands and triggers must be registered under the same name prior to adding them to the surface.
|
|
|
|
*
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
* @method
|
2013-10-23 23:27:12 +00:00
|
|
|
* @param {string[]} names List of symbolic names of commands in the command registry
|
|
|
|
* @throws {Error} If command has not been registered
|
|
|
|
* @throws {Error} If trigger has not been registered
|
|
|
|
* @throws {Error} If trigger is not complete
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
*/
|
2013-10-23 23:27:12 +00:00
|
|
|
ve.ui.Surface.prototype.addCommands = function ( names ) {
|
|
|
|
var i, len, key, command, trigger;
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
|
2013-10-23 23:27:12 +00:00
|
|
|
for ( i = 0, len = names.length; i < len; i++ ) {
|
|
|
|
command = ve.ui.commandRegistry.lookup( names[i] );
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
if ( !command ) {
|
2013-10-23 23:27:12 +00:00
|
|
|
throw new Error( 'No command registered by that name: ' + names[i] );
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
}
|
2013-10-23 23:27:12 +00:00
|
|
|
// Normalize trigger key
|
|
|
|
trigger = ve.ui.triggerRegistry.lookup( names[i] );
|
|
|
|
if ( !trigger ) {
|
|
|
|
throw new Error( 'No trigger registered by that name: ' + names[i] );
|
|
|
|
}
|
|
|
|
key = trigger.toString();
|
|
|
|
// Validate trigger
|
|
|
|
if ( key.length === 0 ) {
|
|
|
|
throw new Error( 'Incomplete trigger: ' + trigger );
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
}
|
2013-10-23 23:27:12 +00:00
|
|
|
this.commands[key] = command;
|
|
|
|
this.triggers[names[i]] = trigger;
|
|
|
|
this.emit( 'addCommand', names[i], command, trigger );
|
The Great ve.ui.Surface refactor of 2013
Prologue:
Farewell ve.Editor my good chap… Oh, hey there HTML frames - I didn't
see you there! In a world where iframes are outlaws, and symbols like
document and window are global, there were more than a few assumptions
about which document or window was being used. But fear not - for this
commit (probably) tracks them all down, leaving a trail of
iframe-compatible awesomeness in its wake. With the great ve.ui.Surface
now able to be used inside of iframes, let the reference editing
commence. But there, lurking in the darkness is a DM issue so fierce it
may take Roan and/or Ed up to 3 whole hours to sort it out.
Note to Roan and/or Ed:
Editing references seems to work fine, but when saving the page there
are "no changes" which is a reasonable indication to the contrary.
Objectives:
* Make it possible to have multiple surfaces be instantiated, get along
nicely, and be embedded inside of iframes if needed.
* Make reference content editable within a dialog
Approach:
* Move what's left of ve.Editor to ve.ui.Surface and essentially
obliterate all use of it
* Make even more stuff inherit from ve.Element (long live this.$$)
* Use the correct document or window anywhere it was being assumed to be
the top level one
* Resolve stacking order issues by removing the excessive use of z-index
and introducing global and local overlay elements for each editor
* Add a surface to the reference dialog, load up the reference contents
and save them back on apply
* Actually destroy what we create in ce and ui surfaces
* Add recursive frame offset calculation method to ve.Element
* Moved ve.ce.Surface's getSelectionRect method to the prototype
Bonus:
* Move ve.ce.DocumentNode.css contents to ve.ce.Node.css (not sure why it
was separate in the first place, but I'm likely the one to blame)
* Fix blatant lies in documentation
* Whitespace cleanup here and there
* Get rid of ve.ui.Window overlays - not used or needed
Change-Id: Iede83e7d24f7cb249b6ba3dc45d770445b862e08
2013-05-20 22:45:50 +00:00
|
|
|
}
|
|
|
|
};
|
2013-07-22 20:55:32 +00:00
|
|
|
|
2013-09-30 13:26:33 +00:00
|
|
|
/**
|
|
|
|
* Get sanitization rules for rich paste
|
|
|
|
*
|
|
|
|
* @returns {Object} Paste rules
|
|
|
|
*/
|
|
|
|
ve.ui.Surface.prototype.getPasteRules = function () {
|
|
|
|
return this.pasteRules;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set sanitization rules for rich paste
|
|
|
|
*
|
2013-12-09 19:46:53 +00:00
|
|
|
* @see ve.dm.ElementLinearData#sanitize
|
2013-09-30 13:26:33 +00:00
|
|
|
* @param {Object} pasteRules Paste rules
|
|
|
|
*/
|
|
|
|
ve.ui.Surface.prototype.setPasteRules = function ( pasteRules ) {
|
|
|
|
this.pasteRules = pasteRules;
|
|
|
|
};
|
|
|
|
|
2013-07-22 20:55:32 +00:00
|
|
|
/**
|
|
|
|
* Surface 'dir' property (GUI/User-Level Direction)
|
|
|
|
* @returns {string} 'ltr' or 'rtl'
|
|
|
|
*/
|
|
|
|
ve.ui.Surface.prototype.getDir = function () {
|
2013-11-01 19:45:59 +00:00
|
|
|
return this.$element.css( 'direction' );
|
2013-07-22 20:55:32 +00:00
|
|
|
};
|