r102346 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102345‎ | r102346 | r102347 >
Date:23:46, 7 November 2011
Author:inez
Status:deferred
Tags:
Comment:
Basic support for "pre" elements (space at the beginning of the new paragraph in wikitext)
Modified paths:
  • /trunk/extensions/VisualEditor/demo/es.js (modified) (history)
  • /trunk/extensions/VisualEditor/demo/index.html (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/es.Surface.css (modified) (history)
  • /trunk/extensions/VisualEditor/modules/es/models/es.PreModel.js (added) (history)
  • /trunk/extensions/VisualEditor/modules/es/views/es.PreView.js (added) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/demo/es.js
@@ -3,6 +3,10 @@
44 'type': 'document',
55 'children': [
66 {
 7+ 'type': 'pre',
 8+ 'content': { 'text': 'A lot of text goes here... and at some point it wraps.. A lot of text goes here... and at some point it wraps.. A lot of text goes here... and at some point it wraps.. A lot of text goes here... and at some point it wraps.. A lot of text goes here... and at some point it wraps..' }
 9+ },
 10+ {
711 'type': 'heading',
812 'attributes': { 'level': 1 },
913 'content': {
Index: trunk/extensions/VisualEditor/demo/index.html
@@ -81,6 +81,7 @@
8282 <script src="../modules/es/models/es.SurfaceModel.js"></script>
8383 <script src="../modules/es/models/es.DocumentModel.js"></script>
8484 <script src="../modules/es/models/es.ParagraphModel.js"></script>
 85+ <script src="../modules/es/models/es.PreModel.js"></script>
8586 <script src="../modules/es/models/es.ListModel.js"></script>
8687 <script src="../modules/es/models/es.ListItemModel.js"></script>
8788 <script src="../modules/es/models/es.TableModel.js"></script>
@@ -93,6 +94,7 @@
9495 <script src="../modules/es/views/es.ContentView.js"></script>
9596 <script src="../modules/es/views/es.DocumentView.js"></script>
9697 <script src="../modules/es/views/es.ParagraphView.js"></script>
 98+ <script src="../modules/es/views/es.PreView.js"></script>
9799 <script src="../modules/es/views/es.ListView.js"></script>
98100 <script src="../modules/es/views/es.ListItemView.js"></script>
99101 <script src="../modules/es/views/es.TableView.js"></script>
Index: trunk/extensions/VisualEditor/modules/es/models/es.PreModel.js
@@ -0,0 +1,38 @@
 2+/**
 3+ * Creates an es.PreModel object.
 4+ *
 5+ * @class
 6+ * @constructor
 7+ * @extends {es.DocumentModelLeafNode}
 8+ * @param {Object} element Document data element of this node
 9+ * @param {Integer} length Length of document data element
 10+ */
 11+es.PreModel = function( element, length ) {
 12+ // Inheritance
 13+ es.DocumentModelLeafNode.call( this, 'pre', element, length );
 14+};
 15+
 16+/* Methods */
 17+
 18+/**
 19+ * Creates a pre view for this model.
 20+ *
 21+ * @method
 22+ * @returns {es.PreView}
 23+ */
 24+es.PreModel.prototype.createView = function() {
 25+ return new es.PreView( this );
 26+};
 27+
 28+/* Registration */
 29+
 30+es.DocumentModel.nodeModels.pre = es.PreModel;
 31+
 32+es.DocumentModel.nodeRules.pre = {
 33+ 'parents': null,
 34+ 'children': []
 35+};
 36+
 37+/* Inheritance */
 38+
 39+es.extendClass( es.PreModel, es.DocumentModelLeafNode );
Index: trunk/extensions/VisualEditor/modules/es/es.Surface.css
@@ -41,6 +41,7 @@
4242 .es-headingView,
4343 .es-tableView,
4444 .es-listView,
 45+.es-preView,
4546 .es-paragraphView {
4647 margin: 1em;
4748 margin-top: 0;
@@ -57,6 +58,14 @@
5859 margin: 0;
5960 }
6061
 62+.es-preView {
 63+ padding: 1em;
 64+ border: 1px dashed #2F6FAB;
 65+}
 66+.es-preView > * {
 67+ font-family: monospace,"Courier New";
 68+}
 69+
6170 .es-headingView-level1,
6271 .es-headingView-level2 {
6372 border-bottom: 1px solid #AAA;
Index: trunk/extensions/VisualEditor/modules/es/views/es.PreView.js
@@ -0,0 +1,19 @@
 2+/**
 3+ * Creates an es.PreView object.
 4+ *
 5+ * @class
 6+ * @constructor
 7+ * @extends {es.DocumentViewLeafNode}
 8+ * @param {es.PreModel} model Pre model to view
 9+ */
 10+es.PreView = function( model ) {
 11+ // Inheritance
 12+ es.DocumentViewLeafNode.call( this, model );
 13+
 14+ // DOM Changes
 15+ this.$.addClass( 'es-preView' );
 16+};
 17+
 18+/* Inheritance */
 19+
 20+es.extendClass( es.PreView, es.DocumentViewLeafNode );

Status & tagging log