r110887 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110886‎ | r110887 | r110888 >
Date:22:22, 7 February 2012
Author:inez
Status:deferred
Tags:
Comment:
Make paragraphs in content editable use real <p> tags
Modified paths:
  • /trunk/extensions/VisualEditor/demos/ce/index.php (modified) (history)
  • /trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.es.ParagraphNode.js (added) (history)
  • /trunk/extensions/VisualEditor/modules/ve/ce/ve.es.LeafNode.js (added) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/demos/ce/index.php
@@ -117,13 +117,13 @@
118118 <script src="../../modules/ve/es/ve.es.js"></script>
119119 <script src="../../modules/ve/es/ve.es.Node.js"></script>
120120 <script src="../../modules/ve/es/ve.es.BranchNode.js"></script>
121 - <script src="../../modules/ve/es/ve.es.LeafNode.js"></script>
 121+ <script src="../../modules/ve/ce/ve.es.LeafNode.js"></script>
122122 <script src="../../modules/ve/ce/ve.es.Content.js"></script>
123123 <script src="../../modules/ve/ce/ve.es.Surface.js"></script>
124124
125125 <script src="../../modules/ve/ce/nodes/ve.es.DocumentNode.js"></script>
126126 <script src="../../modules/ve/es/nodes/ve.es.HeadingNode.js"></script>
127 - <script src="../../modules/ve/es/nodes/ve.es.ParagraphNode.js"></script>
 127+ <script src="../../modules/ve/ce/nodes/ve.es.ParagraphNode.js"></script>
128128 <script src="../../modules/ve/es/nodes/ve.es.PreNode.js"></script>
129129 <script src="../../modules/ve/es/nodes/ve.es.ListItemNode.js"></script>
130130 <script src="../../modules/ve/es/nodes/ve.es.ListNode.js"></script>
Index: trunk/extensions/VisualEditor/modules/ve/ce/ve.es.LeafNode.js
@@ -0,0 +1,41 @@
 2+/**
 3+ * Creates an ve.es.LeafNode object.
 4+ *
 5+ * @class
 6+ * @abstract
 7+ * @constructor
 8+ * @extends {ve.LeafNode}
 9+ * @extends {ve.es.Node}
 10+ * @param model {ve.ModelNode} Model to observe
 11+ * @param {jQuery} [$element] Element to use as a container
 12+ */
 13+ve.es.LeafNode = function( model, $element ) {
 14+ // Inheritance
 15+ ve.LeafNode.call( this );
 16+ ve.es.Node.call( this, model, $element );
 17+
 18+ this.$.data('view', this);
 19+ this.$.addClass('ce-leafNode');
 20+
 21+ // Properties
 22+ this.contentView = new ve.es.Content( this.$, model );
 23+
 24+ // Events
 25+ this.contentView.on( 'update', this.emitUpdate );
 26+};
 27+
 28+/* Methods */
 29+
 30+/**
 31+ * Render content.
 32+ *
 33+ * @method
 34+ */
 35+ve.es.LeafNode.prototype.renderContent = function() {
 36+ this.contentView.render();
 37+};
 38+
 39+/* Inheritance */
 40+
 41+ve.extendClass( ve.es.LeafNode, ve.LeafNode );
 42+ve.extendClass( ve.es.LeafNode, ve.es.Node );
Index: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.es.ParagraphNode.js
@@ -0,0 +1,26 @@
 2+/**
 3+ * Creates an ve.es.ParagraphNode object.
 4+ *
 5+ * @class
 6+ * @constructor
 7+ * @extends {ve.es.LeafNode}
 8+ * @param {ve.dm.ParagraphNode} model Paragraph model to view
 9+ */
 10+ve.es.ParagraphNode = function( model ) {
 11+ // Inheritance
 12+ ve.es.LeafNode.call( this, model, $( '<p></p>' ) );
 13+
 14+ // DOM Changes
 15+ this.$.addClass( 'es-paragraphView' );
 16+};
 17+
 18+/* Registration */
 19+
 20+ve.es.DocumentNode.splitRules.paragraph = {
 21+ 'self': true,
 22+ 'children': null
 23+};
 24+
 25+/* Inheritance */
 26+
 27+ve.extendClass( ve.es.ParagraphNode, ve.es.LeafNode );

Status & tagging log