mediawiki-extensions-Visual.../modules/ve/ui/dialogs/ve.ui.MediaDialog.js
Trevor Parscal 55b5f30edb ve.ui.Context: Add embedding feature
Objectives:

* Make the context menu display in the top right corner of the currently
  focused inspectable node (if there is one)
* Prevent clicking on anything to do with the toolbar or popup from doing
  anything at all, ever

Bonus:

* While we are using the clever feature in jQuery's on method which allows
  passing boolean false to cancel the event - may as well do that in
  ve.ui.Dialog as well

Changes:

ve.ui.FocusableNode
* Add ability to specify the focusable element so that dimensions can be
  derived from it

ve.ce.Surface
* Add quotes to object keys

ve.ui.MediaDialog
* Change association from being MW specific to handling images in general

ve.ui.Context
* Add embedded styles for context
* Add embedded mode, which is triggered when the context is a single
  focusable node, and the node is large enough to fit the context
  reasonably

ve.ui.Dialog
* Inline mousedown handler

ve.ui.Toolbar, ve.ui.PopupWidget
* Cancel stray mousedown events

Change-Id: I4b25d33f64b4bcb8a3ecfd7e9728f54a2d4886f3
2013-05-16 11:23:59 -07:00

42 lines
871 B
JavaScript

/*!
* VisualEditor user interface MediaDialog 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.ui.Surface} surface
*/
ve.ui.MediaDialog = function VeUiMediaDialog( surface ) {
// Parent constructor
ve.ui.Dialog.call( this, surface );
};
/* Inheritance */
ve.inheritClass( ve.ui.MediaDialog, ve.ui.Dialog );
/* Static Properties */
ve.ui.MediaDialog.static.titleMessage = 'visualeditor-dialog-media-title';
ve.ui.MediaDialog.static.icon = 'picture';
ve.ui.MediaDialog.static.modelClasses = [ ve.dm.ImageNode ];
/* Methods */
/* Registration */
ve.ui.dialogFactory.register( 'media', ve.ui.MediaDialog );
ve.ui.viewRegistry.register( 'media', ve.ui.MediaDialog );