jenkins-bot has submitted this change and it was merged. Change subject: Bring in VisualEditor support from VE extension ......................................................................
Bring in VisualEditor support from VE extension Enables editing of hiero instances, but doesn't add to the toolbar by default. Depends on hiero code being removed from VE extension. Change-Id: If55af2adf3b2e10b5e1aeb15d9661f7a19e072d8 --- M i18n/en.json M i18n/qqq.json A modules/VisualEditor/AUTHORS.txt A modules/VisualEditor/LICENSE.txt A modules/VisualEditor/hiero.svg A modules/VisualEditor/ve.ce.MWHieroNode.css A modules/VisualEditor/ve.ce.MWHieroNode.js A modules/VisualEditor/ve.dm.MWHieroNode.js A modules/VisualEditor/ve.ui.MWHieroIcons.css A modules/VisualEditor/ve.ui.MWHieroInspector.js A modules/VisualEditor/ve.ui.MWHieroInspectorTool.js M wikihiero.php 12 files changed, 209 insertions(+), 8 deletions(-) Approvals: Krinkle: Looks good to me, approved Esanders: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/i18n/en.json b/i18n/en.json index fad25f5..d7596ce 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -47,5 +47,6 @@ "wikihiero-category-X": "X: Loaves and cakes", "wikihiero-category-Y": "Y: Writings, games, music", "wikihiero-category-Z": "Z: Strokes, geometrical figures, etc.", - "wikihiero-category-Aa": "Aa: Unclassified" + "wikihiero-category-Aa": "Aa: Unclassified", + "wikihiero-visualeditor-mwhieroinspector-title": "Hieroglyphs" } \ No newline at end of file diff --git a/i18n/qqq.json b/i18n/qqq.json index f2d54d9..f777827 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -21,5 +21,6 @@ "wikihiero-th-result": "{{Identical|Result}}", "wikihiero-eol": "Help text that says that \"!\" inserts an end of a line of Egyptian text.", "wikihiero-superposition": "{{Identical|Subdivision}}", - "wikihiero-comment": "{{Identical|Comment}}" + "wikihiero-comment": "{{Identical|Comment}}", + "wikihiero-visualeditor-mwhieroinspector-title": "Used as title for the hieroglyphs inspector." } diff --git a/modules/VisualEditor/AUTHORS.txt b/modules/VisualEditor/AUTHORS.txt new file mode 100644 index 0000000..78db76a --- /dev/null +++ b/modules/VisualEditor/AUTHORS.txt @@ -0,0 +1,6 @@ +Ed Sanders <esand...@wikimedia.org> +James Forrester <jforres...@wikimedia.org> +Moriel Schottlender <mschottlen...@wikimedia.org> +Roan Kattouw <r...@wikimedia.org> +Timo Tijhof <t...@wikimedia.org> +Trevor Parscal <tre...@wikimedia.org> diff --git a/modules/VisualEditor/LICENSE.txt b/modules/VisualEditor/LICENSE.txt new file mode 100644 index 0000000..f320ff5 --- /dev/null +++ b/modules/VisualEditor/LICENSE.txt @@ -0,0 +1,25 @@ +Copyright (c) 2011-2014 VisualEditor Team and others under the terms +of The MIT License (MIT), as follows: + +This software consists of voluntary contributions made by many +individuals (AUTHORS.txt) For exact contribution history, see the +revision history and logs, available at https://gerrit.wikimedia.org + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/modules/VisualEditor/hiero.svg b/modules/VisualEditor/hiero.svg new file mode 100644 index 0000000..6150795 --- /dev/null +++ b/modules/VisualEditor/hiero.svg @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + width="24px" height="24px" viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve"> +<g id="hiero" opacity="0.75"> + <path id="ankh" d="m 9.0045786,8.4037839 c 0.408197,1.3287357 1.4031084,2.8056531 2.2058904,3.7584441 L 6.969,11.969103 c 0.1279068,0.414647 0.1155421,0.82887 0,1.243515 L 11.210469,13.028527 10.924165,19 c 0.569216,-0.151198 1.0357,-0.09337 1.484575,0 l -0.261619,-5.971473 3.821884,0.184091 c -0.103706,-0.414645 -0.138812,-0.828868 0,-1.243515 l -3.821884,0.193125 C 12.857348,11.130195 13.853548,9.7831196 14.211705,8.2738643 14.935527,5.2236985 13.022035,5.0015265 11.603171,5 10.184306,4.9984831 8.1310072,5.5601434 9.0045786,8.4037839 z M 11.584645,6 c 1.520843,-0.010056 3.080433,1.9804496 0.11698,5.577337 C 8.581706,8.0207315 10.063806,6.0100704 11.584645,6 z"/> +</g> +</svg> diff --git a/modules/VisualEditor/ve.ce.MWHieroNode.css b/modules/VisualEditor/ve.ce.MWHieroNode.css new file mode 100644 index 0000000..b352721 --- /dev/null +++ b/modules/VisualEditor/ve.ce.MWHieroNode.css @@ -0,0 +1,3 @@ +.ve-ce-mwHieroNode { + display: inline-block; +} diff --git a/modules/VisualEditor/ve.ce.MWHieroNode.js b/modules/VisualEditor/ve.ce.MWHieroNode.js new file mode 100644 index 0000000..4e86c11 --- /dev/null +++ b/modules/VisualEditor/ve.ce.MWHieroNode.js @@ -0,0 +1,35 @@ +/*global ve, OO */ + +/** + * ContentEditable MediaWiki hieroglyphics node. + * + * @class + * @extends ve.ce.MWBlockExtensionNode + * + * @constructor + * @param {ve.dm.MWHieroNode} model Model to observe + * @param {Object} [config] Configuration options + */ +ve.ce.MWHieroNode = function VeCeMWHieroNode( model, config ) { + // Parent constructor + ve.ce.MWBlockExtensionNode.call( this, model, config ); + + // DOM changes + this.$element.addClass( 've-ce-mwHieroNode' ); +}; + +/* Inheritance */ + +OO.inheritClass( ve.ce.MWHieroNode, ve.ce.MWBlockExtensionNode ); + +/* Static Properties */ + +ve.ce.MWHieroNode.static.name = 'mwHiero'; + +ve.ce.MWHieroNode.static.tagName = 'div'; + +ve.ce.MWHieroNode.static.primaryCommandName = 'hiero'; + +/* Registration */ + +ve.ce.nodeFactory.register( ve.ce.MWHieroNode ); diff --git a/modules/VisualEditor/ve.dm.MWHieroNode.js b/modules/VisualEditor/ve.dm.MWHieroNode.js new file mode 100644 index 0000000..220ebbc --- /dev/null +++ b/modules/VisualEditor/ve.dm.MWHieroNode.js @@ -0,0 +1,31 @@ +/*global ve, OO */ + +/** + * DataModel MediaWiki hieroglyphics node. + * + * @class + * @extends ve.dm.MWBlockExtensionNode + * + * @constructor + * @param {Object} [element] Reference to element in linear model + */ +ve.dm.MWHieroNode = function VeDmMWHieroNode() { + // Parent constructor + ve.dm.MWBlockExtensionNode.apply( this, arguments ); +}; + +/* Inheritance */ + +OO.inheritClass( ve.dm.MWHieroNode, ve.dm.MWBlockExtensionNode ); + +/* Static members */ + +ve.dm.MWHieroNode.static.name = 'mwHiero'; + +ve.dm.MWHieroNode.static.tagName = 'table'; + +ve.dm.MWHieroNode.static.extensionName = 'hiero'; + +/* Registration */ + +ve.dm.modelRegistry.register( ve.dm.MWHieroNode ); diff --git a/modules/VisualEditor/ve.ui.MWHieroIcons.css b/modules/VisualEditor/ve.ui.MWHieroIcons.css new file mode 100644 index 0000000..5899a8d --- /dev/null +++ b/modules/VisualEditor/ve.ui.MWHieroIcons.css @@ -0,0 +1,4 @@ +.oo-ui-icon-hiero { + /* @embed */ + background-image: url(hiero.svg); +} diff --git a/modules/VisualEditor/ve.ui.MWHieroInspector.js b/modules/VisualEditor/ve.ui.MWHieroInspector.js new file mode 100644 index 0000000..7569f6f --- /dev/null +++ b/modules/VisualEditor/ve.ui.MWHieroInspector.js @@ -0,0 +1,36 @@ +/*global ve, OO */ + +/** + * MediaWiki hieroglyphics inspector. + * + * @class + * @extends ve.ui.MWLiveExtensionInspector + * + * @constructor + * @param {Object} [config] Configuration options + */ +ve.ui.MWHieroInspector = function VeUiMWHieroInspector( config ) { + // Parent constructor + ve.ui.MWLiveExtensionInspector.call( this, config ); +}; + +/* Inheritance */ + +OO.inheritClass( ve.ui.MWHieroInspector, ve.ui.MWLiveExtensionInspector ); + +/* Static properties */ + +ve.ui.MWHieroInspector.static.name = 'hiero'; + +ve.ui.MWHieroInspector.static.icon = 'hiero'; + +ve.ui.MWHieroInspector.static.title = + OO.ui.deferMsg( 'wikihiero-visualeditor-mwhieroinspector-title' ); + +ve.ui.MWHieroInspector.static.nodeModel = ve.dm.MWHieroNode; + +ve.ui.MWHieroInspector.static.dir = 'ltr'; + +/* Registration */ + +ve.ui.windowFactory.register( ve.ui.MWHieroInspector ); diff --git a/modules/VisualEditor/ve.ui.MWHieroInspectorTool.js b/modules/VisualEditor/ve.ui.MWHieroInspectorTool.js new file mode 100644 index 0000000..d5da5e8 --- /dev/null +++ b/modules/VisualEditor/ve.ui.MWHieroInspectorTool.js @@ -0,0 +1,28 @@ +/*global ve, OO */ + +/** + * MediaWiki UserInterface hieroglyphics tool. + * + * @class + * @extends ve.ui.InspectorTool + * @constructor + * @param {OO.ui.ToolGroup} toolGroup + * @param {Object} [config] Configuration options + */ +ve.ui.MWHieroInspectorTool = function VeUiMWHieroInspectorTool( toolGroup, config ) { + ve.ui.InspectorTool.call( this, toolGroup, config ); +}; +OO.inheritClass( ve.ui.MWHieroInspectorTool, ve.ui.InspectorTool ); +ve.ui.MWHieroInspectorTool.static.name = 'hiero'; +ve.ui.MWHieroInspectorTool.static.group = 'object'; +ve.ui.MWHieroInspectorTool.static.icon = 'hiero'; +ve.ui.MWHieroInspectorTool.static.title = + OO.ui.deferMsg( 'wikihiero-visualeditor-mwhieroinspector-title' ); +ve.ui.MWHieroInspectorTool.static.modelClasses = [ ve.dm.MWHieroNode ]; +ve.ui.MWHieroInspectorTool.static.commandName = 'hiero'; +ve.ui.MWHieroInspectorTool.static.autoAddToGroup = false; + +ve.ui.toolFactory.register( ve.ui.MWHieroInspectorTool ); +ve.ui.commandRegistry.register( + new ve.ui.Command( 'hiero', 'window', 'open', 'hiero' ) +); diff --git a/wikihiero.php b/wikihiero.php index 22c2f11..91046a3 100644 --- a/wikihiero.php +++ b/wikihiero.php @@ -51,24 +51,47 @@ $wgSpecialPages['Hieroglyphs'] = 'SpecialHieroglyphs'; $wgSpecialPageGroups['Hieroglyphs'] = 'wiki'; +$moduleTemplate = array( + 'localBasePath' => __DIR__ . '/modules', + 'remoteExtPath' => 'wikihiero/modules', +); + $wgResourceModules['ext.wikihiero'] = array( 'styles' => 'ext.wikihiero.css', - 'localBasePath' => "$dir/modules", - 'remoteExtPath' => 'wikihiero/modules', -); +) + $moduleTemplate; $wgResourceModules['ext.wikihiero.Special'] = array( 'scripts' => 'ext.wikihiero.Special.js', 'styles' => 'ext.wikihiero.Special.css', - 'localBasePath' => dirname( __FILE__ ) . '/modules', - 'remoteExtPath' => 'wikihiero/modules', 'dependencies' => array( 'jquery.spinner' ), 'messages' => array( 'wikihiero-input', 'wikihiero-result', 'wikihiero-load-error', ), -); +) + $moduleTemplate; + +$wgResourceModules['ext.wikihiero.visualEditor'] = array( + 'scripts' => array( + 'VisualEditor/ve.dm.MWHieroNode.js', + 'VisualEditor/ve.ce.MWHieroNode.js', + 'VisualEditor/ve.ui.MWHieroInspector.js', + 'VisualEditor/ve.ui.MWHieroInspectorTool.js', + ), + 'styles' => array( + 'VisualEditor/ve.ce.MWHieroNode.css', + 'VisualEditor/ve.ui.MWHieroIcons.css', + ), + 'dependencies' => array( + 'ext.visualEditor.mwcore', + ), + 'messages' => array( + 'wikihiero-visualeditor-mwhieroinspector-title', + ), + 'targets' => array( 'desktop', 'mobile' ), +) + $moduleTemplate; + +$wgVisualEditorPluginModules[] = 'ext.wikihiero.visualEditor'; /** * Because <hiero> tag is used rarely, we don't need to load its body on every hook call, -- To view, visit https://gerrit.wikimedia.org/r/138911 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If55af2adf3b2e10b5e1aeb15d9661f7a19e072d8 Gerrit-PatchSet: 7 Gerrit-Project: mediawiki/extensions/wikihiero Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: Catrope <roan.katt...@gmail.com> Gerrit-Reviewer: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: Siebrand <siebr...@kitano.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits