' )
.prop( 'class' , 've-ui-context-icon' )
.appendTo( this.$ );
// Toolbar
this.$toolbar = $( '
' )
.prop( 'class', 've-ui-context-toolbar');
// Toolbar view
this.toolbarView = new ve.ui.Toolbar(
this.$toolbar,
this.surfaceView,
[{ 'name': 'textStyle', 'items' : [ 'bold', 'italic', 'link', 'clear' ] }]
);
// Context Menu
this.menuView = new ve.ui.Menu( [
// Example menu items
{ 'name': 'tools', '$': this.$toolbar }
],
null,
this.$
);
// Events
this.$icon.on( {
'mousedown': ve.bind( this.onMouseDown, this ),
'mouseup': ve.bind( this.onMouseUp, this )
} );
this.surfaceView.getDocument().getDocumentNode().$.on( {
'focus': ve.bind( this.onDocumentFocus, this ),
'blur': ve.bind( this.onDocumentBlur, this )
} );
// Setup Inspectors.
this.setupInspectorSpace();
};
/* Methods */
ve.ui.Context.prototype.setupInspectorSpace = function () {
var $styleLink;
// Inspector container
this.$inspectors = $( '
' )
.prop( 'class', 've-ui-context-inspectors' )
.appendTo( this.$ );
// Overlay in main document scope for positioning elements over iframe.
this.$iframeOverlay = $( '
' )
.prop( 'class', 've-iframe-overlay' )
.appendTo( this.$inspectors );
// Create and append an iframe to contain inspectors.
// NOTE: Inspectors are required to be inside the iframe to prevent loss of content selection.
this.$inspectorFrame = $( '