mediawiki-extensions-Visual.../modules/ve/ui/dialogs/ve.ui.MetaDialog.js
Trevor Parscal 148b6bf8a8 Media dialog support
*/index.php
* Added links to new files

VisualEditor.php
* Added links to new files
* Removed keys of non-existent messages

ve.ui.ContentDialog.js, ve.ui.MetaDialog.js
* Removed redundant comments

ve.ui.MediaDialog.js
* New dialog, just for media

icons.ai, picture.png, picture.svg, ve.ui.Icons-*.css
* Added picture icon

ve.ui.MediaButtonTool.js
* New button, just for media (shows up in the context toolbar)

ve.ui.DialogButtonTool.js
* New base class for dialog buttons

ve.ui.Context.js
* Added basic support for showing dialog buttons, in addition to
  annotation buttons, in the context toolbar - to test, select only an
  image node

ve.ui.Dialog.js
* Prevent clicks on the click-block from changing focus
* Moved initialize to below the event handlers and updated its
  documentation

ve.ui.DialogFactory.js
* Added a way to get the names of dialogs that can be used to edit a
  node

ve.ui.Inspector.js
* Removed close handler which set focus, this is done already in window

ve.ui.InspectorFactory.js
* Fixed comment so it's not telling lies anymore

ve.ui.Window.js
* Removed auto-focus on frame, it's changing the focus in the parent
  document which blows-away the focus in CE, and it really isn't needed
  as it turns out

VisualEditor.18n.php
* Added media dialog title message
* Added media tool tooltip message

Bug: 37870
Change-Id: I9150c46b3e292910fed899fa60d6da433049ca45
2013-04-05 11:52:57 -07:00

88 lines
2.3 KiB
JavaScript

/*!
* VisualEditor user interface MetaDialog class.
*
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* Document dialog.
*
* @class
* @abstract
* @extends ve.ui.Dialog
*
* @constructor
* @param {ve.Surface} surface
*/
ve.ui.MetaDialog = function VeUiMetaDialog( surface ) {
// Parent constructor
ve.ui.Dialog.call( this, surface );
};
/* Inheritance */
ve.inheritClass( ve.ui.MetaDialog, ve.ui.Dialog );
/* Static Properties */
ve.ui.MetaDialog.static.titleMessage = 'visualeditor-dialog-meta-title';
ve.ui.MetaDialog.static.icon = 'settings';
/* Methods */
/**
* Handle frame ready events.
*
* @method
*/
ve.ui.MetaDialog.prototype.initialize = function () {
// Call parent method
ve.ui.Dialog.prototype.initialize.call( this );
// Properties
this.outlinePanel = new ve.ui.PanelLayout( { '$$': this.$$ } );
this.editorPanel = new ve.ui.StackPanelLayout( { '$$': this.$$ } );
this.editorPanels = {
'categories': new ve.ui.EditorPanelLayout( {
'$$': this.$$, 'icon': 'categories', 'label': 'Categories'
} ),
'languages': new ve.ui.EditorPanelLayout( {
'$$': this.$$, 'icon': 'language', 'label': 'Languages'
} )
};
this.layout = new ve.ui.GridLayout(
[this.outlinePanel, this.editorPanel],
{ '$$': this.$$, 'widths': [1, 2] }
);
this.editorPanel.addItems( ve.getObjectValues( this.editorPanels ) );
// HACK
this.outlineWidget = new ve.ui.OutlineWidget( { '$$': this.$$ } );
this.outlineWidget.addItems( [
new ve.ui.OutlineItemWidget(
'categories', { '$$': this.$$, 'icon': 'categories', 'label': 'Categories' }
),
new ve.ui.OutlineItemWidget(
'languages', { '$$': this.$$, 'icon': 'language', 'label': 'Languages' }
)
] );
this.outlineWidget
.on( 'select', ve.bind( function ( item ) {
this.editorPanel.showItem( this.editorPanels[item.getData()] );
}, this ) )
.selectItem( this.outlineWidget.getClosestSelectableItem( 0 ) );
// Initialization
this.outlinePanel.$.addClass( 've-ui-metaDialog-outlinePanel' );
this.editorPanel.$.addClass( 've-ui-metaDialog-editorPanel' );
this.$body.append( this.layout.$ );
this.outlinePanel.$.append( this.outlineWidget.$ );
this.layout.update();
};
/* Registration */
ve.ui.dialogFactory.register( 'meta', ve.ui.MetaDialog );