mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Merge "Implement ve.ui.MWTemplateDialog"
This commit is contained in:
commit
d97114ad10
|
@ -29,6 +29,7 @@ $messages['en'] = array(
|
|||
'visualeditor-dialog-content-title' => 'Content settings',
|
||||
'visualeditor-dialog-media-title' => 'Media settings',
|
||||
'visualeditor-dialog-reference-title' => 'Reference',
|
||||
'visualeditor-dialog-template-title' => 'Template',
|
||||
'visualeditor-dialog-action-apply' => 'Apply changes',
|
||||
'visualeditor-dialog-action-cancel' => 'Cancel',
|
||||
'visualeditor-dialog-action-close' => 'Close',
|
||||
|
@ -65,6 +66,7 @@ $messages['en'] = array(
|
|||
'visualeditor-annotationbutton-italic-tooltip' => 'Italic',
|
||||
'visualeditor-annotationbutton-link-tooltip' => 'Link',
|
||||
'visualeditor-dialogbutton-reference-tooltip' => 'Reference',
|
||||
'visualeditor-dialogbutton-template-tooltip' => 'Template',
|
||||
'visualeditor-dialogbutton-media-tooltip' => 'Media',
|
||||
'visualeditor-indentationbutton-indent-tooltip' => 'Increase indentation',
|
||||
'visualeditor-indentationbutton-outdent-tooltip' => 'Decrease indentation',
|
||||
|
|
|
@ -542,7 +542,9 @@ $wgResourceModules += array(
|
|||
've/ce/nodes/ve.ce.MWReferenceNode.js',
|
||||
|
||||
've/ui/tools/buttons/ve.ui.MWReferenceButtonTool.js',
|
||||
've/ui/tools/buttons/ve.ui.MWTemplateButtonTool.js',
|
||||
've/ui/dialogs/ve.ui.MWReferenceDialog.js',
|
||||
've/ui/dialogs/ve.ui.MWTemplateDialog.js',
|
||||
),
|
||||
'dependencies' => array(
|
||||
'ext.visualEditor.core',
|
||||
|
@ -550,6 +552,8 @@ $wgResourceModules += array(
|
|||
'messages' => array(
|
||||
'visualeditor-dialog-reference-title',
|
||||
'visualeditor-dialogbutton-reference-tooltip',
|
||||
'visualeditor-dialog-template-title',
|
||||
'visualeditor-dialogbutton-template-tooltip',
|
||||
),
|
||||
),
|
||||
'ext.visualEditor.icons-raster' => $wgVisualEditorResourceTemplate + array(
|
||||
|
|
|
@ -309,7 +309,9 @@ $html = file_get_contents( $page );
|
|||
<script src="../../modules/ve/ce/nodes/ve.ce.MWReferenceListNode.js"></script>
|
||||
<script src="../../modules/ve/ce/nodes/ve.ce.MWReferenceNode.js"></script>
|
||||
<script src="../../modules/ve/ui/tools/buttons/ve.ui.MWReferenceButtonTool.js"></script>
|
||||
<script src="../../modules/ve/ui/tools/buttons/ve.ui.MWTemplateButtonTool.js"></script>
|
||||
<script src="../../modules/ve/ui/dialogs/ve.ui.MWReferenceDialog.js"></script>
|
||||
<script src="../../modules/ve/ui/dialogs/ve.ui.MWTemplateDialog.js"></script>
|
||||
|
||||
<!-- demo -->
|
||||
<script>
|
||||
|
|
|
@ -146,7 +146,7 @@
|
|||
}
|
||||
|
||||
.ve-ce-MWtemplateInlineNode {
|
||||
display: inline;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* ve.ce.BranchNode */
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
require( '../../../VisualEditor.i18n.php' );
|
||||
echo 've.init.platform.addMessages( ' . json_encode( $messages['en'] ) . ');' . "\n";
|
||||
?>
|
||||
ve.init.platform.setModulesUrl( '../../' );
|
||||
ve.init.platform.setModulesUrl( '../..' );
|
||||
</script>
|
||||
<!-- ext.visualEditor.core -->
|
||||
<script src="../../ve/ve.Registry.js"></script>
|
||||
|
@ -263,7 +263,9 @@
|
|||
<script src="../../ve/ce/nodes/ve.ce.MWReferenceListNode.js"></script>
|
||||
<script src="../../ve/ce/nodes/ve.ce.MWReferenceNode.js"></script>
|
||||
<script src="../../ve/ui/tools/buttons/ve.ui.MWReferenceButtonTool.js"></script>
|
||||
<script src="../../ve/ui/tools/buttons/ve.ui.MWTemplateButtonTool.js"></script>
|
||||
<script src="../../ve/ui/dialogs/ve.ui.MWReferenceDialog.js"></script>
|
||||
<script src="../../ve/ui/dialogs/ve.ui.MWTemplateDialog.js"></script>
|
||||
|
||||
<!-- Load plugins for test framework -->
|
||||
<script src="ve.qunit.js"></script>
|
||||
|
|
71
modules/ve/ui/dialogs/ve.ui.MWTemplateDialog.js
Normal file
71
modules/ve/ui/dialogs/ve.ui.MWTemplateDialog.js
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*!
|
||||
* VisualEditor user interface MWTemplateDialog class.
|
||||
*
|
||||
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
||||
* @license The MIT License (MIT); see LICENSE.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* Document dialog.
|
||||
*
|
||||
* @class
|
||||
* @extends ve.ui.Dialog
|
||||
*
|
||||
* @constructor
|
||||
* @param {ve.ui.Surface} surface
|
||||
*/
|
||||
ve.ui.MWTemplateDialog = function VeUiMWTemplateDialog( surface ) {
|
||||
// Parent constructor
|
||||
ve.ui.Dialog.call( this, surface );
|
||||
};
|
||||
|
||||
/* Inheritance */
|
||||
|
||||
ve.inheritClass( ve.ui.MWTemplateDialog, ve.ui.Dialog );
|
||||
|
||||
/* Static Properties */
|
||||
|
||||
ve.ui.MWTemplateDialog.static.titleMessage = 'visualeditor-dialog-template-title';
|
||||
|
||||
ve.ui.MWTemplateDialog.static.icon = 'template';
|
||||
|
||||
ve.ui.MWTemplateDialog.static.modelClasses = [ ve.dm.MWTemplateNode ];
|
||||
|
||||
/* Methods */
|
||||
|
||||
/**
|
||||
* Handle frame ready events.
|
||||
*
|
||||
* @method
|
||||
*/
|
||||
ve.ui.MWTemplateDialog.prototype.initialize = function () {
|
||||
// Call parent method
|
||||
ve.ui.Dialog.prototype.initialize.call( this );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle frame ready events.
|
||||
*
|
||||
* @method
|
||||
*/
|
||||
ve.ui.MWTemplateDialog.prototype.onOpen = function () {
|
||||
// Parent method
|
||||
ve.ui.Dialog.prototype.onOpen.call( this );
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle frame ready events.
|
||||
*
|
||||
* @method
|
||||
* @param {string} action Action that caused the window to be closed
|
||||
*/
|
||||
ve.ui.MWTemplateDialog.prototype.onClose = function () {
|
||||
// Parent method
|
||||
ve.ui.Dialog.prototype.onOpen.call( this );
|
||||
};
|
||||
|
||||
/* Registration */
|
||||
|
||||
ve.ui.dialogFactory.register( 'mwTemplate', ve.ui.MWTemplateDialog );
|
||||
|
||||
ve.ui.viewRegistry.register( 'mwTemplate', ve.ui.MWTemplateDialog );
|
38
modules/ve/ui/tools/buttons/ve.ui.MWTemplateButtonTool.js
Normal file
38
modules/ve/ui/tools/buttons/ve.ui.MWTemplateButtonTool.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*!
|
||||
* VisualEditor UserInterface MWTemplateButtonTool class.
|
||||
*
|
||||
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
||||
* @license The MIT License (MIT); see LICENSE.txt
|
||||
*/
|
||||
|
||||
/**
|
||||
* Template button tool.
|
||||
*
|
||||
* @class
|
||||
* @extends ve.ui.DialogButtonTool
|
||||
* @constructor
|
||||
* @param {ve.ui.Toolbar} toolbar
|
||||
* @param {Object} [config] Config options
|
||||
*/
|
||||
ve.ui.MWTemplateButtonTool = function VeUiMwTemplateButtonTool( toolbar, config ) {
|
||||
// Parent constructor
|
||||
ve.ui.DialogButtonTool.call( this, toolbar, config );
|
||||
};
|
||||
|
||||
/* Inheritance */
|
||||
|
||||
ve.inheritClass( ve.ui.MWTemplateButtonTool, ve.ui.DialogButtonTool );
|
||||
|
||||
/* Static Properties */
|
||||
|
||||
ve.ui.MWTemplateButtonTool.static.name = 'mwTemplate';
|
||||
|
||||
ve.ui.MWTemplateButtonTool.static.icon = 'template';
|
||||
|
||||
ve.ui.MWTemplateButtonTool.static.titleMessage = 'visualeditor-dialogbutton-template-tooltip';
|
||||
|
||||
ve.ui.MWTemplateButtonTool.static.dialog = 'mwTemplate';
|
||||
|
||||
/* Registration */
|
||||
|
||||
ve.ui.toolFactory.register( 'mwTemplate', ve.ui.MWTemplateButtonTool );
|
Loading…
Reference in a new issue