Jforrester has uploaded a new change for review.
https://gerrit.wikimedia.org/r/72732
Change subject: Add support for <blockquote> elements
......................................................................
Add support for <blockquote> elements
Bug: 51009
Change-Id: I7ba1635e4f856a021e1a7a2d26a8714230c9364a
---
M VisualEditor.i18n.php
M VisualEditor.php
M modules/ve-mw/ui/tools/dropdowns/ve.ui.MWFormatDropdownTool.js
A modules/ve/ce/nodes/ve.ce.BlockquoteNode.js
A modules/ve/dm/nodes/ve.dm.BlockquoteNode.js
M modules/ve/ui/styles/ve.ui.Tool.css
M modules/ve/ui/tools/dropdowns/ve.ui.FormatDropdownTool.js
7 files changed, 98 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/32/72732/1
diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index f206557..67ecaad 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -84,6 +84,7 @@
'visualeditor-editsummary' => 'Describe what you changed',
'visualeditor-feedback-link' => 'Project:VisualEditor/Feedback',
'visualeditor-feedback-tool' => 'Leave feedback',
+ 'visualeditor-formatdropdown-format-blockquote' => 'Blockquote',
'visualeditor-formatdropdown-format-heading1' => 'Heading 1',
'visualeditor-formatdropdown-format-heading2' => 'Heading 2',
'visualeditor-formatdropdown-format-heading3' => 'Heading 3',
@@ -326,6 +327,7 @@
'visualeditor-editsummary' => 'Label for the edit summary box',
'visualeditor-feedback-link' => 'Link to a page where users can leave
feedback that is automatically posted using this tool. This should be a
sub-page of {{msg-mw|visualeditor-descriptionpagelink}}',
'visualeditor-feedback-tool' => 'Text of tool in the toolbar that lets
users provide feedback',
+ 'visualeditor-formatdropdown-format-blockquote' => 'Item in the
formatting dropdown for blockquoted text.',
'visualeditor-formatdropdown-format-heading1' => 'Item in the generic
formatting dropdown for a level 1 heading.
{{Identical|Heading}}',
'visualeditor-formatdropdown-format-heading2' => 'Item in the generic
formatting dropdown for a level 2 heading.
diff --git a/VisualEditor.php b/VisualEditor.php
index 61086f5..7aad5fa 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -332,6 +332,7 @@
've/dm/nodes/ve.dm.ListNode.js',
've/dm/nodes/ve.dm.ParagraphNode.js',
've/dm/nodes/ve.dm.PreformattedNode.js',
+ 've/dm/nodes/ve.dm.BlockquoteNode.js',
've/dm/nodes/ve.dm.TableCaptionNode.js',
've/dm/nodes/ve.dm.TableCellNode.js',
've/dm/nodes/ve.dm.TableNode.js',
@@ -403,6 +404,7 @@
've/ce/nodes/ve.ce.ListNode.js',
've/ce/nodes/ve.ce.ParagraphNode.js',
've/ce/nodes/ve.ce.PreformattedNode.js',
+ 've/ce/nodes/ve.ce.BlockquoteNode.js',
've/ce/nodes/ve.ce.TableCaptionNode.js',
've/ce/nodes/ve.ce.TableCellNode.js',
've/ce/nodes/ve.ce.TableNode.js',
@@ -634,6 +636,7 @@
'visualeditor-editsummary',
'visualeditor-feedback-link',
'visualeditor-feedback-tool',
+ 'visualeditor-formatdropdown-format-blockquote',
'visualeditor-formatdropdown-format-mw-heading1',
'visualeditor-formatdropdown-format-mw-heading2',
'visualeditor-formatdropdown-format-mw-heading3',
diff --git a/modules/ve-mw/ui/tools/dropdowns/ve.ui.MWFormatDropdownTool.js
b/modules/ve-mw/ui/tools/dropdowns/ve.ui.MWFormatDropdownTool.js
index 504212e..fb45520 100644
--- a/modules/ve-mw/ui/tools/dropdowns/ve.ui.MWFormatDropdownTool.js
+++ b/modules/ve-mw/ui/tools/dropdowns/ve.ui.MWFormatDropdownTool.js
@@ -42,8 +42,8 @@
ve.ui.MWFormatDropdownTool.static.items[6].label =
'visualeditor-formatdropdown-format-mw-heading6';
ve.ui.MWFormatDropdownTool.static.items[7].data.type = 'mwPreformatted';
-// Move the H1 (item 1 in the list) to the end (7) so as to make it less
prominent and tempting to users
-ve.ui.MWFormatDropdownTool.static.items.splice( 7, 0,
ve.ui.MWFormatDropdownTool.static.items.splice( 1, 1 )[0] );
+// Move the H1 (item 1 in the list) to the end (8) so as to make it less
prominent and tempting to users
+ve.ui.MWFormatDropdownTool.static.items.splice( 8, 0,
ve.ui.MWFormatDropdownTool.static.items.splice( 1, 1 )[0] );
/* Registration */
diff --git a/modules/ve/ce/nodes/ve.ce.BlockquoteNode.js
b/modules/ve/ce/nodes/ve.ce.BlockquoteNode.js
new file mode 100644
index 0000000..98059f8
--- /dev/null
+++ b/modules/ve/ce/nodes/ve.ce.BlockquoteNode.js
@@ -0,0 +1,36 @@
+/*!
+ * VisualEditor ContentEditable BlockquoteNode class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * ContentEditable blockquote node.
+ *
+ * @class
+ * @extends ve.ce.BranchNode
+ * @constructor
+ * @param {ve.dm.BlockquoteNode} model Model to observe
+ * @param {Object} [config] Config options
+ */
+ve.ce.BlockquoteNode = function VeCeBlockquoteNode( model, config ) {
+ // Parent constructor
+ ve.ce.ContentBranchNode.call( this, model, config );
+};
+
+/* Inheritance */
+
+ve.inheritClass( ve.ce.BlockquoteNode, ve.ce.ContentBranchNode );
+
+/* Static Properties */
+
+ve.ce.BlockquoteNode.static.name = 'blockquote';
+
+ve.ce.BlockquoteNode.static.tagName = 'blockquote';
+
+ve.ce.BlockquoteNode.static.canBeSplit = true;
+
+/* Registration */
+
+ve.ce.nodeFactory.register( ve.ce.BlockquoteNode );
diff --git a/modules/ve/dm/nodes/ve.dm.BlockquoteNode.js
b/modules/ve/dm/nodes/ve.dm.BlockquoteNode.js
new file mode 100644
index 0000000..93ca78c
--- /dev/null
+++ b/modules/ve/dm/nodes/ve.dm.BlockquoteNode.js
@@ -0,0 +1,44 @@
+/*!
+ * VisualEditor DataModel BlockquoteNode class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * DataModel blockquote node.
+ *
+ * @class
+ * @extends ve.dm.BranchNode
+ * @constructor
+ * @param {ve.dm.LeafNode[]} [children] Child nodes to attach
+ * @param {Object} [element] Reference to element in linear model
+ */
+ve.dm.BlockquoteNode = function VeDmBlockquoteNode( children, element ) {
+ // Parent constructor
+ ve.dm.BranchNode.call( this, children, element );
+};
+
+/* Inheritance */
+
+ve.inheritClass( ve.dm.BlockquoteNode, ve.dm.BranchNode );
+
+/* Static Properties */
+
+ve.dm.BlockquoteNode.static.name = 'blockquote';
+
+ve.dm.BlockquoteNode.static.canContainContent = true;
+
+ve.dm.BlockquoteNode.static.matchTagNames = [ 'blockquote' ];
+
+ve.dm.BlockquoteNode.static.toDataElement = function () {
+ return { 'type': 'blockquote' };
+};
+
+ve.dm.BlockquoteNode.static.toDomElements = function ( dataElement, doc ) {
+ return [ doc.createElement( 'blockquote' ) ];
+};
+
+/* Registration */
+
+ve.dm.modelRegistry.register( ve.dm.BlockquoteNode );
diff --git a/modules/ve/ui/styles/ve.ui.Tool.css
b/modules/ve/ui/styles/ve.ui.Tool.css
index d42cf1f..85dc56f 100644
--- a/modules/ve/ui/styles/ve.ui.Tool.css
+++ b/modules/ve/ui/styles/ve.ui.Tool.css
@@ -163,6 +163,10 @@
font-weight: bold;
}
+.ve-ui-dropdownTool-format .ve-ui-optionWidget[rel="blockquote"]
.ve-ui-labeledElement-label {
+ margin-left: 2em;
+}
+
.ve-ui-dropdownTool-format .ve-ui-optionWidget[rel="preformatted"]
.ve-ui-labeledElement-label {
font-family: monospace, "Courier New";
}
diff --git a/modules/ve/ui/tools/dropdowns/ve.ui.FormatDropdownTool.js
b/modules/ve/ui/tools/dropdowns/ve.ui.FormatDropdownTool.js
index ea57ae4..7dca88c 100644
--- a/modules/ve/ui/tools/dropdowns/ve.ui.FormatDropdownTool.js
+++ b/modules/ve/ui/tools/dropdowns/ve.ui.FormatDropdownTool.js
@@ -109,6 +109,13 @@
'data': {
'type' : 'preformatted'
}
+ },
+ {
+ 'label': 'visualeditor-formatdropdown-format-blockquote',
+ 'rel': 'blockquote',
+ 'data': {
+ 'type' : 'blockquote'
+ }
}
];
--
To view, visit https://gerrit.wikimedia.org/r/72732
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ba1635e4f856a021e1a7a2d26a8714230c9364a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits