Property changes on: trunk/extensions/Math/modules/MathJax/config/TeX-AMS-texvc_HTML.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 1 | + native |
Property changes on: trunk/extensions/SideBarMenu/test/MenuParserTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
2 | 2 | + native |
Property changes on: trunk/extensions/SideBarMenu/test/MenuItemTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
3 | 3 | + native |
Property changes on: trunk/extensions/SideBarMenu/LICENSE |
___________________________________________________________________ |
Added: svn:eol-style |
4 | 4 | + native |
Property changes on: trunk/extensions/SideBarMenu/SideBarMenu.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
5 | 5 | + native |
Property changes on: trunk/extensions/SideBarMenu/SideBarMenu.php |
___________________________________________________________________ |
Added: svn:eol-style |
6 | 6 | + native |
Property changes on: trunk/extensions/SideBarMenu/.gitignore |
___________________________________________________________________ |
Added: svn:eol-style |
7 | 7 | + native |
Property changes on: trunk/extensions/SideBarMenu/SideBarMenu.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
8 | 8 | + native |
Property changes on: trunk/extensions/SideBarMenu/includes/MenuParser.php |
___________________________________________________________________ |
Added: svn:eol-style |
9 | 9 | + native |
Property changes on: trunk/extensions/SideBarMenu/includes/MenuItem.php |
___________________________________________________________________ |
Added: svn:eol-style |
10 | 10 | + native |
Property changes on: trunk/extensions/SideBarMenu/css/ext.sidebarmenu.css |
___________________________________________________________________ |
Modified: svn:eol-style |
11 | 11 | - native *.eot = svn:mime-type=application/vnd.ms-fontobject *.gif = svn:mime-type=image/gif *.ico = svn:mime-type=image/vnd.microsoft.icon *.inc = svn:eol-style=native *.info = svn:eol-style=native *.install=svn:eol-style=native *.java = svn:eol-style=native *.jpeg = svn:mime-type=image/jpeg *.jpg = svn:mime-type=image/jpeg *.js = svn:eol-style=native *.jsp = svn:eol-style=native *.module = svn:eol-style=native *.php5 = svn:eol-style=native *.php = svn:eol-style=native *.pl = svn:eol-style=native *.pm = svn:eol-style=native *.png = svn:mime-type=image/png *.py = svn:eol-style=native *.sh = svn:eol-style=native *.sql = svn:eol-style=native *.svg = svn:mime-type=image/svg+xml *.tpl = svn:eol-style=native *.ttf = svn:mime-type=application/x-font-ttf *.txt = svn:eol-style=native *.woff = svn:mime-type=application/x-woff *.xcf = svn:mime-type=image/x-xcf Makefile = svn:eol-style=native SConscript = svn:eol-style=native SConstruct = svn:eol-style=native USERINFO = svn:eol-style=native |
12 | 12 | + native |
Property changes on: trunk/extensions/SideBarMenu/js/ext.sidebarmenu.js |
___________________________________________________________________ |
Added: svn:eol-style |
13 | 13 | + native |
Property changes on: trunk/extensions/SideBarMenu/README |
___________________________________________________________________ |
Added: svn:eol-style |
14 | 14 | + native |
Property changes on: trunk/extensions/VisualEditor/tests/ve/ve.dm.DocumentSynchronizer.test.js |
___________________________________________________________________ |
Added: svn:eol-style |
15 | 15 | + native |
Property changes on: trunk/extensions/VisualEditor/modules/ve/dm/ve.dm.DocumentSynchronizer.js |
___________________________________________________________________ |
Added: svn:eol-style |
16 | 16 | + native |
Index: trunk/extensions/VisualEditor/modules/ve/ce/ve.ce.Node.js |
— | — | @@ -1,107 +1,107 @@ |
2 | | -/**
|
3 | | - * Creates an ve.ce.Node object.
|
4 | | - *
|
5 | | - * @class
|
6 | | - * @abstract
|
7 | | - * @constructor
|
8 | | - * @extends {ve.Node}
|
9 | | - * @param {ve.dm.Node} model Model to observe
|
10 | | - * @param {jQuery} [$element=$( '<div></div>' )] Element to use as a container
|
11 | | - */
|
12 | | -ve.ce.Node = function( model, $element ) {
|
13 | | - // Inheritance
|
14 | | - ve.Node.call( this );
|
15 | | -
|
16 | | - // Properties
|
17 | | - this.model = model;
|
18 | | - this.parent = null;
|
19 | | - this.$ = $element || $( '<div/>' );
|
20 | | -};
|
21 | | -
|
22 | | -/* Methods */
|
23 | | -
|
24 | | -/**
|
25 | | - * Gets the length of the element in the model.
|
26 | | - *
|
27 | | - * @method
|
28 | | - * @see {ve.Node.prototype.getElementLength}
|
29 | | - * @returns {Integer} Length of content
|
30 | | - */
|
31 | | -ve.ce.Node.prototype.getElementLength = function() {
|
32 | | - return this.model.getElementLength();
|
33 | | -};
|
34 | | -
|
35 | | -/**
|
36 | | - * Gets the length of the content in the model.
|
37 | | - *
|
38 | | - * @method
|
39 | | - * @see {ve.Node.prototype.getContentLength}
|
40 | | - * @returns {Integer} Length of content
|
41 | | - */
|
42 | | -ve.ce.Node.prototype.getContentLength = function() {
|
43 | | - return this.model.getContentLength();
|
44 | | -};
|
45 | | -
|
46 | | -/**
|
47 | | - * Attaches node as a child to another node.
|
48 | | - *
|
49 | | - * @method
|
50 | | - * @param {ve.ce.Node} parent Node to attach to
|
51 | | - * @emits attach (parent)
|
52 | | - */
|
53 | | -ve.ce.Node.prototype.attach = function( parent ) {
|
54 | | - this.parent = parent;
|
55 | | - this.emit( 'attach', parent );
|
56 | | -};
|
57 | | -
|
58 | | -/**
|
59 | | - * Detaches node from it's parent.
|
60 | | - *
|
61 | | - * @method
|
62 | | - * @emits detach (parent)
|
63 | | - */
|
64 | | -ve.ce.Node.prototype.detach = function() {
|
65 | | - var parent = this.parent;
|
66 | | - this.parent = null;
|
67 | | - this.emit( 'detach', parent );
|
68 | | -};
|
69 | | -
|
70 | | -/**
|
71 | | - * Gets a reference to this node's parent.
|
72 | | - *
|
73 | | - * @method
|
74 | | - * @returns {ve.ce.Node} Reference to this node's parent
|
75 | | - */
|
76 | | -ve.ce.Node.prototype.getParent = function() {
|
77 | | - return this.parent;
|
78 | | -};
|
79 | | -
|
80 | | -/**
|
81 | | - * Gets a reference to the model this node observes.
|
82 | | - *
|
83 | | - * @method
|
84 | | - * @returns {ve.dm.Node} Reference to the model this node observes
|
85 | | - */
|
86 | | -ve.ce.Node.prototype.getModel = function() {
|
87 | | - return this.model;
|
88 | | -};
|
89 | | -
|
90 | | -ve.ce.Node.getSplitableNode = function( node ) {
|
91 | | - var splitableNode = null;
|
92 | | -
|
93 | | - ve.Node.traverseUpstream( node, function( node ) {
|
94 | | - var elementType = node.model.getElementType();
|
95 | | - if (
|
96 | | - splitableNode !== null &&
|
97 | | - ve.ce.DocumentNode.splitRules[ elementType ].children === true
|
98 | | - ) {
|
99 | | - return false;
|
100 | | - }
|
101 | | - splitableNode = ve.ce.DocumentNode.splitRules[ elementType ].self ? node : null;
|
102 | | - } );
|
103 | | - return splitableNode;
|
104 | | -};
|
105 | | -
|
106 | | -/* Inheritance */
|
107 | | -
|
108 | | -ve.extendClass( ve.ce.Node, ve.Node );
|
| 2 | +/** |
| 3 | + * Creates an ve.ce.Node object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @abstract |
| 7 | + * @constructor |
| 8 | + * @extends {ve.Node} |
| 9 | + * @param {ve.dm.Node} model Model to observe |
| 10 | + * @param {jQuery} [$element=$( '<div></div>' )] Element to use as a container |
| 11 | + */ |
| 12 | +ve.ce.Node = function( model, $element ) { |
| 13 | + // Inheritance |
| 14 | + ve.Node.call( this ); |
| 15 | + |
| 16 | + // Properties |
| 17 | + this.model = model; |
| 18 | + this.parent = null; |
| 19 | + this.$ = $element || $( '<div/>' ); |
| 20 | +}; |
| 21 | + |
| 22 | +/* Methods */ |
| 23 | + |
| 24 | +/** |
| 25 | + * Gets the length of the element in the model. |
| 26 | + * |
| 27 | + * @method |
| 28 | + * @see {ve.Node.prototype.getElementLength} |
| 29 | + * @returns {Integer} Length of content |
| 30 | + */ |
| 31 | +ve.ce.Node.prototype.getElementLength = function() { |
| 32 | + return this.model.getElementLength(); |
| 33 | +}; |
| 34 | + |
| 35 | +/** |
| 36 | + * Gets the length of the content in the model. |
| 37 | + * |
| 38 | + * @method |
| 39 | + * @see {ve.Node.prototype.getContentLength} |
| 40 | + * @returns {Integer} Length of content |
| 41 | + */ |
| 42 | +ve.ce.Node.prototype.getContentLength = function() { |
| 43 | + return this.model.getContentLength(); |
| 44 | +}; |
| 45 | + |
| 46 | +/** |
| 47 | + * Attaches node as a child to another node. |
| 48 | + * |
| 49 | + * @method |
| 50 | + * @param {ve.ce.Node} parent Node to attach to |
| 51 | + * @emits attach (parent) |
| 52 | + */ |
| 53 | +ve.ce.Node.prototype.attach = function( parent ) { |
| 54 | + this.parent = parent; |
| 55 | + this.emit( 'attach', parent ); |
| 56 | +}; |
| 57 | + |
| 58 | +/** |
| 59 | + * Detaches node from it's parent. |
| 60 | + * |
| 61 | + * @method |
| 62 | + * @emits detach (parent) |
| 63 | + */ |
| 64 | +ve.ce.Node.prototype.detach = function() { |
| 65 | + var parent = this.parent; |
| 66 | + this.parent = null; |
| 67 | + this.emit( 'detach', parent ); |
| 68 | +}; |
| 69 | + |
| 70 | +/** |
| 71 | + * Gets a reference to this node's parent. |
| 72 | + * |
| 73 | + * @method |
| 74 | + * @returns {ve.ce.Node} Reference to this node's parent |
| 75 | + */ |
| 76 | +ve.ce.Node.prototype.getParent = function() { |
| 77 | + return this.parent; |
| 78 | +}; |
| 79 | + |
| 80 | +/** |
| 81 | + * Gets a reference to the model this node observes. |
| 82 | + * |
| 83 | + * @method |
| 84 | + * @returns {ve.dm.Node} Reference to the model this node observes |
| 85 | + */ |
| 86 | +ve.ce.Node.prototype.getModel = function() { |
| 87 | + return this.model; |
| 88 | +}; |
| 89 | + |
| 90 | +ve.ce.Node.getSplitableNode = function( node ) { |
| 91 | + var splitableNode = null; |
| 92 | + |
| 93 | + ve.Node.traverseUpstream( node, function( node ) { |
| 94 | + var elementType = node.model.getElementType(); |
| 95 | + if ( |
| 96 | + splitableNode !== null && |
| 97 | + ve.ce.DocumentNode.splitRules[ elementType ].children === true |
| 98 | + ) { |
| 99 | + return false; |
| 100 | + } |
| 101 | + splitableNode = ve.ce.DocumentNode.splitRules[ elementType ].self ? node : null; |
| 102 | + } ); |
| 103 | + return splitableNode; |
| 104 | +}; |
| 105 | + |
| 106 | +/* Inheritance */ |
| 107 | + |
| 108 | +ve.extendClass( ve.ce.Node, ve.Node ); |
Property changes on: trunk/extensions/VisualEditor/modules/ve/ce/ve.ce.Node.js |
___________________________________________________________________ |
Added: svn:eol-style |
109 | 109 | + native |
Index: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.HeadingNode.js |
— | — | @@ -1,53 +1,53 @@ |
2 | | -/**
|
3 | | - * Creates an ve.ce.HeadingNode object.
|
4 | | - *
|
5 | | - * @class
|
6 | | - * @constructor
|
7 | | - * @extends {ve.ce.LeafNode}
|
8 | | - * @param {ve.dm.HeadingNode} model Heading model to view
|
9 | | - */
|
10 | | -ve.ce.HeadingNode = function( model ) {
|
11 | | - // Inheritance
|
12 | | - ve.ce.LeafNode.call( this, model );
|
13 | | -
|
14 | | - // Properties
|
15 | | - this.currentLevelHash = null;
|
16 | | -
|
17 | | - // DOM Changes
|
18 | | - this.$.addClass( 'es-headingView' );
|
19 | | -
|
20 | | - // Events
|
21 | | - var _this = this;
|
22 | | - this.model.on( 'update', function() {
|
23 | | - _this.setClasses();
|
24 | | - } );
|
25 | | -
|
26 | | - // Initialization
|
27 | | - this.setClasses();
|
28 | | -};
|
29 | | -
|
30 | | -/* Methods */
|
31 | | -
|
32 | | -ve.ce.HeadingNode.prototype.setClasses = function() {
|
33 | | - var level = this.model.getElementAttribute( 'level' );
|
34 | | - if ( level !== this.currentLevelHash ) {
|
35 | | - this.currentLevelHash = level;
|
36 | | - var classes = this.$.attr( 'class' );
|
37 | | - this.$
|
38 | | - // Remove any existing level classes
|
39 | | - .attr( 'class', classes.replace( / ?es-headingView-level[0-9]+/, '' ) )
|
40 | | - // Add a new level class
|
41 | | - .addClass( 'es-headingView-level' + level );
|
42 | | - }
|
43 | | -};
|
44 | | -
|
45 | | -/* Registration */
|
46 | | -
|
47 | | -ve.ce.DocumentNode.splitRules.heading = {
|
48 | | - 'self': true,
|
49 | | - 'children': null
|
50 | | -};
|
51 | | -
|
52 | | -/* Inheritance */
|
53 | | -
|
54 | | -ve.extendClass( ve.ce.HeadingNode, ve.ce.LeafNode );
|
| 2 | +/** |
| 3 | + * Creates an ve.ce.HeadingNode object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + * @extends {ve.ce.LeafNode} |
| 8 | + * @param {ve.dm.HeadingNode} model Heading model to view |
| 9 | + */ |
| 10 | +ve.ce.HeadingNode = function( model ) { |
| 11 | + // Inheritance |
| 12 | + ve.ce.LeafNode.call( this, model ); |
| 13 | + |
| 14 | + // Properties |
| 15 | + this.currentLevelHash = null; |
| 16 | + |
| 17 | + // DOM Changes |
| 18 | + this.$.addClass( 'es-headingView' ); |
| 19 | + |
| 20 | + // Events |
| 21 | + var _this = this; |
| 22 | + this.model.on( 'update', function() { |
| 23 | + _this.setClasses(); |
| 24 | + } ); |
| 25 | + |
| 26 | + // Initialization |
| 27 | + this.setClasses(); |
| 28 | +}; |
| 29 | + |
| 30 | +/* Methods */ |
| 31 | + |
| 32 | +ve.ce.HeadingNode.prototype.setClasses = function() { |
| 33 | + var level = this.model.getElementAttribute( 'level' ); |
| 34 | + if ( level !== this.currentLevelHash ) { |
| 35 | + this.currentLevelHash = level; |
| 36 | + var classes = this.$.attr( 'class' ); |
| 37 | + this.$ |
| 38 | + // Remove any existing level classes |
| 39 | + .attr( 'class', classes.replace( / ?es-headingView-level[0-9]+/, '' ) ) |
| 40 | + // Add a new level class |
| 41 | + .addClass( 'es-headingView-level' + level ); |
| 42 | + } |
| 43 | +}; |
| 44 | + |
| 45 | +/* Registration */ |
| 46 | + |
| 47 | +ve.ce.DocumentNode.splitRules.heading = { |
| 48 | + 'self': true, |
| 49 | + 'children': null |
| 50 | +}; |
| 51 | + |
| 52 | +/* Inheritance */ |
| 53 | + |
| 54 | +ve.extendClass( ve.ce.HeadingNode, ve.ce.LeafNode ); |
Property changes on: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.HeadingNode.js |
___________________________________________________________________ |
Added: svn:eol-style |
55 | 55 | + native |
Index: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.TableRowNode.js |
— | — | @@ -1,28 +1,28 @@ |
2 | | -/**
|
3 | | - * Creates an ve.ce.TableRowNode object.
|
4 | | - *
|
5 | | - * @class
|
6 | | - * @constructor
|
7 | | - * @extends {ve.ce.BranchNode}
|
8 | | - * @param {ve.dm.TableRowNode} model Table row model to view
|
9 | | - */
|
10 | | -ve.ce.TableRowNode = function( model ) {
|
11 | | - // Inheritance
|
12 | | - ve.ce.BranchNode.call( this, model, $( '<tr>' ), true );
|
13 | | -
|
14 | | - // DOM Changes
|
15 | | - this.$
|
16 | | - .attr( 'style', model.getElementAttribute( 'html/style' ) )
|
17 | | - .addClass( 'es-tableRowView' );
|
18 | | -};
|
19 | | -
|
20 | | -/* Registration */
|
21 | | -
|
22 | | -ve.ce.DocumentNode.splitRules.tableRow = {
|
23 | | - 'self': false,
|
24 | | - 'children': false
|
25 | | -};
|
26 | | -
|
27 | | -/* Inheritance */
|
28 | | -
|
29 | | -ve.extendClass( ve.ce.TableRowNode, ve.ce.BranchNode );
|
| 2 | +/** |
| 3 | + * Creates an ve.ce.TableRowNode object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + * @extends {ve.ce.BranchNode} |
| 8 | + * @param {ve.dm.TableRowNode} model Table row model to view |
| 9 | + */ |
| 10 | +ve.ce.TableRowNode = function( model ) { |
| 11 | + // Inheritance |
| 12 | + ve.ce.BranchNode.call( this, model, $( '<tr>' ), true ); |
| 13 | + |
| 14 | + // DOM Changes |
| 15 | + this.$ |
| 16 | + .attr( 'style', model.getElementAttribute( 'html/style' ) ) |
| 17 | + .addClass( 'es-tableRowView' ); |
| 18 | +}; |
| 19 | + |
| 20 | +/* Registration */ |
| 21 | + |
| 22 | +ve.ce.DocumentNode.splitRules.tableRow = { |
| 23 | + 'self': false, |
| 24 | + 'children': false |
| 25 | +}; |
| 26 | + |
| 27 | +/* Inheritance */ |
| 28 | + |
| 29 | +ve.extendClass( ve.ce.TableRowNode, ve.ce.BranchNode ); |
Property changes on: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.TableRowNode.js |
___________________________________________________________________ |
Added: svn:eol-style |
30 | 30 | + native |
Index: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.PreNode.js |
— | — | @@ -1,26 +1,26 @@ |
2 | | -/**
|
3 | | - * Creates an ve.ce.PreNode object.
|
4 | | - *
|
5 | | - * @class
|
6 | | - * @constructor
|
7 | | - * @extends {ve.ce.LeafNode}
|
8 | | - * @param {ve.dm.PreNode} model Pre model to view
|
9 | | - */
|
10 | | -ve.ce.PreNode = function( model ) {
|
11 | | - // Inheritance
|
12 | | - ve.ce.LeafNode.call( this, model, undefined, { 'pre': true } );
|
13 | | -
|
14 | | - // DOM Changes
|
15 | | - this.$.addClass( 'es-preView' );
|
16 | | -};
|
17 | | -
|
18 | | -/* Registration */
|
19 | | -
|
20 | | -ve.ce.DocumentNode.splitRules.pre = {
|
21 | | - 'self': true,
|
22 | | - 'children': null
|
23 | | -};
|
24 | | -
|
25 | | -/* Inheritance */
|
26 | | -
|
27 | | -ve.extendClass( ve.ce.PreNode, ve.ce.LeafNode );
|
| 2 | +/** |
| 3 | + * Creates an ve.ce.PreNode object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + * @extends {ve.ce.LeafNode} |
| 8 | + * @param {ve.dm.PreNode} model Pre model to view |
| 9 | + */ |
| 10 | +ve.ce.PreNode = function( model ) { |
| 11 | + // Inheritance |
| 12 | + ve.ce.LeafNode.call( this, model, undefined, { 'pre': true } ); |
| 13 | + |
| 14 | + // DOM Changes |
| 15 | + this.$.addClass( 'es-preView' ); |
| 16 | +}; |
| 17 | + |
| 18 | +/* Registration */ |
| 19 | + |
| 20 | +ve.ce.DocumentNode.splitRules.pre = { |
| 21 | + 'self': true, |
| 22 | + 'children': null |
| 23 | +}; |
| 24 | + |
| 25 | +/* Inheritance */ |
| 26 | + |
| 27 | +ve.extendClass( ve.ce.PreNode, ve.ce.LeafNode ); |
Property changes on: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.PreNode.js |
___________________________________________________________________ |
Added: svn:eol-style |
28 | 28 | + native |
Index: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.TableCellNode.js |
— | — | @@ -1,28 +1,28 @@ |
2 | | -/**
|
3 | | - * Creates an ve.ce.TableCellNode object.
|
4 | | - *
|
5 | | - * @class
|
6 | | - * @constructor
|
7 | | - * @extends {ve.ce.BranchNode}
|
8 | | - * @param {ve.dm.TableCellNode} model Table cell model to view
|
9 | | - */
|
10 | | -ve.ce.TableCellNode = function( model ) {
|
11 | | - // Inheritance
|
12 | | - ve.ce.BranchNode.call( this, model, $( '<td>' ) );
|
13 | | -
|
14 | | - // DOM Changes
|
15 | | - this.$
|
16 | | - .attr( 'style', model.getElementAttribute( 'html/style' ) )
|
17 | | - .addClass( 'es-tableCellView' );
|
18 | | -};
|
19 | | -
|
20 | | -/* Registration */
|
21 | | -
|
22 | | -ve.ce.DocumentNode.splitRules.tableCell = {
|
23 | | - 'self': false,
|
24 | | - 'children': true
|
25 | | -};
|
26 | | -
|
27 | | -/* Inheritance */
|
28 | | -
|
29 | | -ve.extendClass( ve.ce.TableCellNode, ve.ce.BranchNode );
|
| 2 | +/** |
| 3 | + * Creates an ve.ce.TableCellNode object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + * @extends {ve.ce.BranchNode} |
| 8 | + * @param {ve.dm.TableCellNode} model Table cell model to view |
| 9 | + */ |
| 10 | +ve.ce.TableCellNode = function( model ) { |
| 11 | + // Inheritance |
| 12 | + ve.ce.BranchNode.call( this, model, $( '<td>' ) ); |
| 13 | + |
| 14 | + // DOM Changes |
| 15 | + this.$ |
| 16 | + .attr( 'style', model.getElementAttribute( 'html/style' ) ) |
| 17 | + .addClass( 'es-tableCellView' ); |
| 18 | +}; |
| 19 | + |
| 20 | +/* Registration */ |
| 21 | + |
| 22 | +ve.ce.DocumentNode.splitRules.tableCell = { |
| 23 | + 'self': false, |
| 24 | + 'children': true |
| 25 | +}; |
| 26 | + |
| 27 | +/* Inheritance */ |
| 28 | + |
| 29 | +ve.extendClass( ve.ce.TableCellNode, ve.ce.BranchNode ); |
Property changes on: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.TableCellNode.js |
___________________________________________________________________ |
Added: svn:eol-style |
30 | 30 | + native |
Index: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.TableNode.js |
— | — | @@ -1,28 +1,28 @@ |
2 | | -/**
|
3 | | - * Creates an ve.ce.TableNode object.
|
4 | | - *
|
5 | | - * @class
|
6 | | - * @constructor
|
7 | | - * @extends {ve.ce.BranchNode}
|
8 | | - * @param {ve.dm.TableNode} model Table model to view
|
9 | | - */
|
10 | | -ve.ce.TableNode = function( model ) {
|
11 | | - // Inheritance
|
12 | | - ve.ce.BranchNode.call( this, model, $( '<table>' ) );
|
13 | | -
|
14 | | - // DOM Changes
|
15 | | - this.$
|
16 | | - .attr( 'style', model.getElementAttribute( 'html/style' ) )
|
17 | | - .addClass( 'es-tableView' );
|
18 | | -};
|
19 | | -
|
20 | | -/* Registration */
|
21 | | -
|
22 | | -ve.ce.DocumentNode.splitRules.table = {
|
23 | | - 'self': false,
|
24 | | - 'children': false
|
25 | | -};
|
26 | | -
|
27 | | -/* Inheritance */
|
28 | | -
|
29 | | -ve.extendClass( ve.ce.TableNode, ve.ce.BranchNode );
|
| 2 | +/** |
| 3 | + * Creates an ve.ce.TableNode object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + * @extends {ve.ce.BranchNode} |
| 8 | + * @param {ve.dm.TableNode} model Table model to view |
| 9 | + */ |
| 10 | +ve.ce.TableNode = function( model ) { |
| 11 | + // Inheritance |
| 12 | + ve.ce.BranchNode.call( this, model, $( '<table>' ) ); |
| 13 | + |
| 14 | + // DOM Changes |
| 15 | + this.$ |
| 16 | + .attr( 'style', model.getElementAttribute( 'html/style' ) ) |
| 17 | + .addClass( 'es-tableView' ); |
| 18 | +}; |
| 19 | + |
| 20 | +/* Registration */ |
| 21 | + |
| 22 | +ve.ce.DocumentNode.splitRules.table = { |
| 23 | + 'self': false, |
| 24 | + 'children': false |
| 25 | +}; |
| 26 | + |
| 27 | +/* Inheritance */ |
| 28 | + |
| 29 | +ve.extendClass( ve.ce.TableNode, ve.ce.BranchNode ); |
Property changes on: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.TableNode.js |
___________________________________________________________________ |
Added: svn:eol-style |
30 | 30 | + native |
Index: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.ListItemNode.js |
— | — | @@ -1,62 +1,62 @@ |
2 | | -/**
|
3 | | - * Creates an ve.ce.ListItemNode object.
|
4 | | - *
|
5 | | - * @class
|
6 | | - * @constructor
|
7 | | - * @extends {ve.ce.LeafNode}
|
8 | | - * @param {ve.dm.ListItemNode} model List item model to view
|
9 | | - */
|
10 | | -ve.ce.ListItemNode = function( model ) {
|
11 | | - // Inheritance
|
12 | | - ve.ce.BranchNode.call( this, model );
|
13 | | -
|
14 | | - // Properties
|
15 | | - this.$icon = $( '<div class="es-listItemView-icon"></div>' ).prependTo( this.$ );
|
16 | | - this.currentStylesHash = null;
|
17 | | -
|
18 | | - // DOM Changes
|
19 | | - this.$.addClass( 'es-listItemView' );
|
20 | | -
|
21 | | - // Events
|
22 | | - var _this = this;
|
23 | | - this.model.on( 'update', function() {
|
24 | | - _this.setClasses();
|
25 | | - } );
|
26 | | -
|
27 | | - // Initialization
|
28 | | - this.setClasses();
|
29 | | -};
|
30 | | -
|
31 | | -/* Methods */
|
32 | | -
|
33 | | -ve.ce.ListItemNode.prototype.setClasses = function() {
|
34 | | - var styles = this.model.getElementAttribute( 'styles' ),
|
35 | | - stylesHash = styles.join( '|' );
|
36 | | - if ( this.currentStylesHash !== stylesHash ) {
|
37 | | - this.currentStylesHash = stylesHash;
|
38 | | - var classes = this.$.attr( 'class' );
|
39 | | - this.$
|
40 | | - // Remove any existing level classes
|
41 | | - .attr(
|
42 | | - 'class',
|
43 | | - classes
|
44 | | - .replace( / ?es-listItemView-level[0-9]+/, '' )
|
45 | | - .replace( / ?es-listItemView-(bullet|number|term|definition)/, '' )
|
46 | | - )
|
47 | | - // Set the list style class from the style on top of the stack
|
48 | | - .addClass( 'es-listItemView-' + styles[styles.length - 1] )
|
49 | | - // Set the list level class from the length of the stack
|
50 | | - .addClass( 'es-listItemView-level' + ( styles.length - 1 ) );
|
51 | | - }
|
52 | | -};
|
53 | | -
|
54 | | -/* Registration */
|
55 | | -
|
56 | | -ve.ce.DocumentNode.splitRules.listItem = {
|
57 | | - 'self': true,
|
58 | | - 'children': false
|
59 | | -};
|
60 | | -
|
61 | | -/* Inheritance */
|
62 | | -
|
63 | | -ve.extendClass( ve.ce.ListItemNode, ve.ce.BranchNode );
|
| 2 | +/** |
| 3 | + * Creates an ve.ce.ListItemNode object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + * @extends {ve.ce.LeafNode} |
| 8 | + * @param {ve.dm.ListItemNode} model List item model to view |
| 9 | + */ |
| 10 | +ve.ce.ListItemNode = function( model ) { |
| 11 | + // Inheritance |
| 12 | + ve.ce.BranchNode.call( this, model ); |
| 13 | + |
| 14 | + // Properties |
| 15 | + this.$icon = $( '<div class="es-listItemView-icon"></div>' ).prependTo( this.$ ); |
| 16 | + this.currentStylesHash = null; |
| 17 | + |
| 18 | + // DOM Changes |
| 19 | + this.$.addClass( 'es-listItemView' ); |
| 20 | + |
| 21 | + // Events |
| 22 | + var _this = this; |
| 23 | + this.model.on( 'update', function() { |
| 24 | + _this.setClasses(); |
| 25 | + } ); |
| 26 | + |
| 27 | + // Initialization |
| 28 | + this.setClasses(); |
| 29 | +}; |
| 30 | + |
| 31 | +/* Methods */ |
| 32 | + |
| 33 | +ve.ce.ListItemNode.prototype.setClasses = function() { |
| 34 | + var styles = this.model.getElementAttribute( 'styles' ), |
| 35 | + stylesHash = styles.join( '|' ); |
| 36 | + if ( this.currentStylesHash !== stylesHash ) { |
| 37 | + this.currentStylesHash = stylesHash; |
| 38 | + var classes = this.$.attr( 'class' ); |
| 39 | + this.$ |
| 40 | + // Remove any existing level classes |
| 41 | + .attr( |
| 42 | + 'class', |
| 43 | + classes |
| 44 | + .replace( / ?es-listItemView-level[0-9]+/, '' ) |
| 45 | + .replace( / ?es-listItemView-(bullet|number|term|definition)/, '' ) |
| 46 | + ) |
| 47 | + // Set the list style class from the style on top of the stack |
| 48 | + .addClass( 'es-listItemView-' + styles[styles.length - 1] ) |
| 49 | + // Set the list level class from the length of the stack |
| 50 | + .addClass( 'es-listItemView-level' + ( styles.length - 1 ) ); |
| 51 | + } |
| 52 | +}; |
| 53 | + |
| 54 | +/* Registration */ |
| 55 | + |
| 56 | +ve.ce.DocumentNode.splitRules.listItem = { |
| 57 | + 'self': true, |
| 58 | + 'children': false |
| 59 | +}; |
| 60 | + |
| 61 | +/* Inheritance */ |
| 62 | + |
| 63 | +ve.extendClass( ve.ce.ListItemNode, ve.ce.BranchNode ); |
Property changes on: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.ListItemNode.js |
___________________________________________________________________ |
Added: svn:eol-style |
64 | 64 | + native |
Index: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.ListNode.js |
— | — | @@ -1,62 +1,62 @@ |
2 | | -/**
|
3 | | - * Creates an ve.ce.ListNode object.
|
4 | | - *
|
5 | | - * @class
|
6 | | - * @constructor
|
7 | | - * @extends {ve.ce.BranchNode}
|
8 | | - * @param {ve.dm.ListNode} model List model to view
|
9 | | - */
|
10 | | -ve.ce.ListNode = function( model ) {
|
11 | | - // Inheritance
|
12 | | - ve.ce.BranchNode.call( this, model );
|
13 | | -
|
14 | | - // DOM Changes
|
15 | | - this.$.addClass( 'es-listView' );
|
16 | | -
|
17 | | - // Events
|
18 | | - var _this = this;
|
19 | | - this.model.on( 'update', function() {
|
20 | | - _this.enumerate();
|
21 | | - } );
|
22 | | -
|
23 | | - // Initialization
|
24 | | - this.enumerate();
|
25 | | -};
|
26 | | -
|
27 | | -/* Methods */
|
28 | | -
|
29 | | -/**
|
30 | | - * Set the number labels of all ordered list items.
|
31 | | - *
|
32 | | - * @method
|
33 | | - */
|
34 | | -ve.ce.ListNode.prototype.enumerate = function() {
|
35 | | - var styles,
|
36 | | - levels = [];
|
37 | | - for ( var i = 0; i < this.children.length; i++ ) {
|
38 | | - styles = this.children[i].model.getElementAttribute( 'styles' );
|
39 | | - levels = levels.slice( 0, styles.length );
|
40 | | - if ( styles[styles.length - 1] === 'number' ) {
|
41 | | - if ( !levels[styles.length - 1] ) {
|
42 | | - levels[styles.length - 1] = 0;
|
43 | | - }
|
44 | | - this.children[i].$icon.text( ++levels[styles.length - 1] + '.' );
|
45 | | - } else {
|
46 | | - this.children[i].$icon.text( '' );
|
47 | | - if ( levels[styles.length - 1] ) {
|
48 | | - levels[styles.length - 1] = 0;
|
49 | | - }
|
50 | | - }
|
51 | | - }
|
52 | | -};
|
53 | | -
|
54 | | -/* Registration */
|
55 | | -
|
56 | | -ve.ce.DocumentNode.splitRules.list = {
|
57 | | - 'self': false,
|
58 | | - 'children': true
|
59 | | -};
|
60 | | -
|
61 | | -/* Inheritance */
|
62 | | -
|
63 | | -ve.extendClass( ve.ce.ListNode, ve.ce.BranchNode );
|
| 2 | +/** |
| 3 | + * Creates an ve.ce.ListNode object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @constructor |
| 7 | + * @extends {ve.ce.BranchNode} |
| 8 | + * @param {ve.dm.ListNode} model List model to view |
| 9 | + */ |
| 10 | +ve.ce.ListNode = function( model ) { |
| 11 | + // Inheritance |
| 12 | + ve.ce.BranchNode.call( this, model ); |
| 13 | + |
| 14 | + // DOM Changes |
| 15 | + this.$.addClass( 'es-listView' ); |
| 16 | + |
| 17 | + // Events |
| 18 | + var _this = this; |
| 19 | + this.model.on( 'update', function() { |
| 20 | + _this.enumerate(); |
| 21 | + } ); |
| 22 | + |
| 23 | + // Initialization |
| 24 | + this.enumerate(); |
| 25 | +}; |
| 26 | + |
| 27 | +/* Methods */ |
| 28 | + |
| 29 | +/** |
| 30 | + * Set the number labels of all ordered list items. |
| 31 | + * |
| 32 | + * @method |
| 33 | + */ |
| 34 | +ve.ce.ListNode.prototype.enumerate = function() { |
| 35 | + var styles, |
| 36 | + levels = []; |
| 37 | + for ( var i = 0; i < this.children.length; i++ ) { |
| 38 | + styles = this.children[i].model.getElementAttribute( 'styles' ); |
| 39 | + levels = levels.slice( 0, styles.length ); |
| 40 | + if ( styles[styles.length - 1] === 'number' ) { |
| 41 | + if ( !levels[styles.length - 1] ) { |
| 42 | + levels[styles.length - 1] = 0; |
| 43 | + } |
| 44 | + this.children[i].$icon.text( ++levels[styles.length - 1] + '.' ); |
| 45 | + } else { |
| 46 | + this.children[i].$icon.text( '' ); |
| 47 | + if ( levels[styles.length - 1] ) { |
| 48 | + levels[styles.length - 1] = 0; |
| 49 | + } |
| 50 | + } |
| 51 | + } |
| 52 | +}; |
| 53 | + |
| 54 | +/* Registration */ |
| 55 | + |
| 56 | +ve.ce.DocumentNode.splitRules.list = { |
| 57 | + 'self': false, |
| 58 | + 'children': true |
| 59 | +}; |
| 60 | + |
| 61 | +/* Inheritance */ |
| 62 | + |
| 63 | +ve.extendClass( ve.ce.ListNode, ve.ce.BranchNode ); |
Property changes on: trunk/extensions/VisualEditor/modules/ve/ce/nodes/ve.ce.ListNode.js |
___________________________________________________________________ |
Added: svn:eol-style |
64 | 64 | + native |
Index: trunk/extensions/VisualEditor/modules/ve/ce/ve.ce.BranchNode.js |
— | — | @@ -1,272 +1,272 @@ |
2 | | -/**
|
3 | | - * Creates an ve.ce.BranchNode object.
|
4 | | - *
|
5 | | - * @class
|
6 | | - * @abstract
|
7 | | - * @constructor
|
8 | | - * @extends {ve.BranchNode}
|
9 | | - * @extends {ve.ce.Node}
|
10 | | - * @param model {ve.ModelNode} Model to observe
|
11 | | - * @param {jQuery} [$element] Element to use as a container
|
12 | | - */
|
13 | | -ve.ce.BranchNode = function( model, $element, horizontal ) {
|
14 | | - // Inheritance
|
15 | | - ve.BranchNode.call( this );
|
16 | | - ve.ce.Node.call( this, model, $element );
|
17 | | -
|
18 | | - // Properties
|
19 | | - this.horizontal = horizontal || false;
|
20 | | -
|
21 | | - if ( model ) {
|
22 | | - // Append existing model children
|
23 | | - var childModels = model.getChildren();
|
24 | | - for ( var i = 0; i < childModels.length; i++ ) {
|
25 | | - this.onAfterPush( childModels[i] );
|
26 | | - }
|
27 | | -
|
28 | | - // Observe and mimic changes on model
|
29 | | - this.model.addListenerMethods( this, {
|
30 | | - 'afterPush': 'onAfterPush',
|
31 | | - 'afterUnshift': 'onAfterUnshift',
|
32 | | - 'afterPop': 'onAfterPop',
|
33 | | - 'afterShift': 'onAfterShift',
|
34 | | - 'afterSplice': 'onAfterSplice',
|
35 | | - 'afterSort': 'onAfterSort',
|
36 | | - 'afterReverse': 'onAfterReverse'
|
37 | | - } );
|
38 | | - }
|
39 | | -};
|
40 | | -
|
41 | | -/* Methods */
|
42 | | -
|
43 | | -ve.ce.BranchNode.prototype.onAfterPush = function( childModel ) {
|
44 | | - var childView = childModel.createView();
|
45 | | - this.emit( 'beforePush', childView );
|
46 | | - childView.attach( this );
|
47 | | - childView.on( 'update', this.emitUpdate );
|
48 | | - // Update children
|
49 | | - this.children.push( childView );
|
50 | | - // Update DOM
|
51 | | - this.$.append( childView.$ );
|
52 | | - // TODO: adding and deleting classes has to be implemented for unshift, shift, splice, sort
|
53 | | - // and reverse as well
|
54 | | - if ( this.children.length === 1 ) {
|
55 | | - childView.$.addClass('es-viewBranchNode-firstChild');
|
56 | | - }
|
57 | | - this.emit( 'afterPush', childView );
|
58 | | - this.emit( 'update' );
|
59 | | -};
|
60 | | -
|
61 | | -ve.ce.BranchNode.prototype.onAfterUnshift = function( childModel ) {
|
62 | | - var childView = childModel.createView();
|
63 | | - this.emit( 'beforeUnshift', childView );
|
64 | | - childView.attach( this );
|
65 | | - childView.on( 'update', this.emitUpdate );
|
66 | | - // Update children
|
67 | | - this.children.unshift( childView );
|
68 | | - // Update DOM
|
69 | | - this.$.prepend( childView.$ );
|
70 | | - this.emit( 'afterUnshift', childView );
|
71 | | - this.emit( 'update' );
|
72 | | -};
|
73 | | -
|
74 | | -ve.ce.BranchNode.prototype.onAfterPop = function() {
|
75 | | - this.emit( 'beforePop' );
|
76 | | - // Update children
|
77 | | - var childView = this.children.pop();
|
78 | | - childView.detach();
|
79 | | - childView.removeEventListener( 'update', this.emitUpdate );
|
80 | | - // Update DOM
|
81 | | - childView.$.detach();
|
82 | | - this.emit( 'afterPop' );
|
83 | | - this.emit( 'update' );
|
84 | | -};
|
85 | | -
|
86 | | -ve.ce.BranchNode.prototype.onAfterShift = function() {
|
87 | | - this.emit( 'beforeShift' );
|
88 | | - // Update children
|
89 | | - var childView = this.children.shift();
|
90 | | - childView.detach();
|
91 | | - childView.removeEventListener( 'update', this.emitUpdate );
|
92 | | - // Update DOM
|
93 | | - childView.$.detach();
|
94 | | - this.emit( 'afterShift' );
|
95 | | - this.emit( 'update' );
|
96 | | -};
|
97 | | -
|
98 | | -ve.ce.BranchNode.prototype.onAfterSplice = function( index, howmany ) {
|
99 | | - var i,
|
100 | | - length,
|
101 | | - args = Array.prototype.slice.call( arguments, 0 );
|
102 | | - // Convert models to views and attach them to this node
|
103 | | - if ( args.length >= 3 ) {
|
104 | | - for ( i = 2, length = args.length; i < length; i++ ) {
|
105 | | - args[i] = args[i].createView();
|
106 | | - }
|
107 | | - }
|
108 | | - this.emit.apply( this, ['beforeSplice'].concat( args ) );
|
109 | | - var removals = this.children.splice.apply( this.children, args );
|
110 | | - for ( i = 0, length = removals.length; i < length; i++ ) {
|
111 | | - removals[i].detach();
|
112 | | - removals[i].removeListener( 'update', this.emitUpdate );
|
113 | | - // Update DOM
|
114 | | - removals[i].$.detach();
|
115 | | - }
|
116 | | - if ( args.length >= 3 ) {
|
117 | | - var $target;
|
118 | | - if ( index ) {
|
119 | | - // Get the element before the insertion point
|
120 | | - $anchor = this.$.children().eq( index - 1 );
|
121 | | - }
|
122 | | - for ( i = args.length - 1; i >= 2; i-- ) {
|
123 | | - args[i].attach( this );
|
124 | | - args[i].on( 'update', this.emitUpdate );
|
125 | | - if ( index ) {
|
126 | | - $anchor.after( args[i].$ );
|
127 | | - } else {
|
128 | | - this.$.prepend( args[i].$ );
|
129 | | - }
|
130 | | - }
|
131 | | - }
|
132 | | - this.emit.apply( this, ['afterSplice'].concat( args ) );
|
133 | | - if ( args.length >= 3 ) {
|
134 | | - for ( i = 2, length = args.length; i < length; i++ ) {
|
135 | | - args[i].renderContent();
|
136 | | - }
|
137 | | - }
|
138 | | - this.emit( 'update' );
|
139 | | -};
|
140 | | -
|
141 | | -ve.ce.BranchNode.prototype.onAfterSort = function() {
|
142 | | - this.emit( 'beforeSort' );
|
143 | | - var childModels = this.model.getChildren();
|
144 | | - for ( var i = 0; i < childModels.length; i++ ) {
|
145 | | - for ( var j = 0; j < this.children.length; j++ ) {
|
146 | | - if ( this.children[j].getModel() === childModels[i] ) {
|
147 | | - var childView = this.children[j];
|
148 | | - // Update children
|
149 | | - this.children.splice( j, 1 );
|
150 | | - this.children.push( childView );
|
151 | | - // Update DOM
|
152 | | - this.$.append( childView.$ );
|
153 | | - }
|
154 | | - }
|
155 | | - }
|
156 | | - this.emit( 'afterSort' );
|
157 | | - this.emit( 'update' );
|
158 | | - this.renderContent();
|
159 | | -};
|
160 | | -
|
161 | | -ve.ce.BranchNode.prototype.onAfterReverse = function() {
|
162 | | - this.emit( 'beforeReverse' );
|
163 | | - // Update children
|
164 | | - this.reverse();
|
165 | | - // Update DOM
|
166 | | - this.$.children().each( function() {
|
167 | | - $(this).prependTo( $(this).parent() );
|
168 | | - } );
|
169 | | - this.emit( 'afterReverse' );
|
170 | | - this.emit( 'update' );
|
171 | | - this.renderContent();
|
172 | | -};
|
173 | | -
|
174 | | -/**
|
175 | | - * Render content.
|
176 | | - *
|
177 | | - * @method
|
178 | | - */
|
179 | | -ve.ce.BranchNode.prototype.renderContent = function() {
|
180 | | - for ( var i = 0; i < this.children.length; i++ ) {
|
181 | | - this.children[i].renderContent();
|
182 | | - }
|
183 | | -};
|
184 | | -
|
185 | | -/**
|
186 | | - * Draw selection around a given range.
|
187 | | - *
|
188 | | - * @method
|
189 | | - * @param {ve.Range} range Range of content to draw selection around
|
190 | | - */
|
191 | | -ve.ce.BranchNode.prototype.drawSelection = function( range ) {
|
192 | | - var selectedNodes = this.selectNodes( range, true );
|
193 | | - for ( var i = 0; i < this.children.length; i++ ) {
|
194 | | - if ( selectedNodes.length && this.children[i] === selectedNodes[0].node ) {
|
195 | | - for ( var j = 0; j < selectedNodes.length; j++ ) {
|
196 | | - selectedNodes[j].node.drawSelection( selectedNodes[j].range );
|
197 | | - }
|
198 | | - i += selectedNodes.length - 1;
|
199 | | - } else {
|
200 | | - this.children[i].clearSelection();
|
201 | | - }
|
202 | | - }
|
203 | | -};
|
204 | | -
|
205 | | -/**
|
206 | | - * Clear selection.
|
207 | | - *
|
208 | | - * @method
|
209 | | - */
|
210 | | -ve.ce.BranchNode.prototype.clearSelection = function() {
|
211 | | - for ( var i = 0; i < this.children.length; i++ ) {
|
212 | | - this.children[i].clearSelection();
|
213 | | - }
|
214 | | -};
|
215 | | -
|
216 | | -/**
|
217 | | - * Gets the nearest offset of a rendered position.
|
218 | | - *
|
219 | | - * @method
|
220 | | - * @param {ve.Position} position Position to get offset for
|
221 | | - * @returns {Integer} Offset of position
|
222 | | - */
|
223 | | -ve.ce.BranchNode.prototype.getOffsetFromRenderedPosition = function( position ) {
|
224 | | - if ( this.children.length === 0 ) {
|
225 | | - return 0;
|
226 | | - }
|
227 | | - var node = this.children[0];
|
228 | | - for ( var i = 1; i < this.children.length; i++ ) {
|
229 | | - if ( this.horizontal && this.children[i].$.offset().left > position.left ) {
|
230 | | - break;
|
231 | | - } else if ( !this.horizontal && this.children[i].$.offset().top > position.top ) {
|
232 | | - break;
|
233 | | - }
|
234 | | - node = this.children[i];
|
235 | | - }
|
236 | | - return node.getParent().getOffsetFromNode( node, true ) +
|
237 | | - node.getOffsetFromRenderedPosition( position ) + 1;
|
238 | | -};
|
239 | | -
|
240 | | -/**
|
241 | | - * Gets rendered position of offset within content.
|
242 | | - *
|
243 | | - * @method
|
244 | | - * @param {Integer} offset Offset to get position for
|
245 | | - * @returns {ve.Position} Position of offset
|
246 | | - */
|
247 | | -ve.ce.BranchNode.prototype.getRenderedPositionFromOffset = function( offset, leftBias ) {
|
248 | | - var node = this.getNodeFromOffset( offset, true );
|
249 | | - if ( node !== null ) {
|
250 | | - return node.getRenderedPositionFromOffset(
|
251 | | - offset - this.getOffsetFromNode( node, true ) - 1,
|
252 | | - leftBias
|
253 | | - );
|
254 | | - }
|
255 | | - return null;
|
256 | | -};
|
257 | | -
|
258 | | -ve.ce.BranchNode.prototype.getRenderedLineRangeFromOffset = function( offset ) {
|
259 | | - var node = this.getNodeFromOffset( offset, true );
|
260 | | - if ( node !== null ) {
|
261 | | - var nodeOffset = this.getOffsetFromNode( node, true );
|
262 | | - return ve.Range.newFromTranslatedRange(
|
263 | | - node.getRenderedLineRangeFromOffset( offset - nodeOffset - 1 ),
|
264 | | - nodeOffset + 1
|
265 | | - );
|
266 | | - }
|
267 | | - return null;
|
268 | | -};
|
269 | | -
|
270 | | -/* Inheritance */
|
271 | | -
|
272 | | -ve.extendClass( ve.ce.BranchNode, ve.BranchNode );
|
273 | | -ve.extendClass( ve.ce.BranchNode, ve.ce.Node );
|
| 2 | +/** |
| 3 | + * Creates an ve.ce.BranchNode object. |
| 4 | + * |
| 5 | + * @class |
| 6 | + * @abstract |
| 7 | + * @constructor |
| 8 | + * @extends {ve.BranchNode} |
| 9 | + * @extends {ve.ce.Node} |
| 10 | + * @param model {ve.ModelNode} Model to observe |
| 11 | + * @param {jQuery} [$element] Element to use as a container |
| 12 | + */ |
| 13 | +ve.ce.BranchNode = function( model, $element, horizontal ) { |
| 14 | + // Inheritance |
| 15 | + ve.BranchNode.call( this ); |
| 16 | + ve.ce.Node.call( this, model, $element ); |
| 17 | + |
| 18 | + // Properties |
| 19 | + this.horizontal = horizontal || false; |
| 20 | + |
| 21 | + if ( model ) { |
| 22 | + // Append existing model children |
| 23 | + var childModels = model.getChildren(); |
| 24 | + for ( var i = 0; i < childModels.length; i++ ) { |
| 25 | + this.onAfterPush( childModels[i] ); |
| 26 | + } |
| 27 | + |
| 28 | + // Observe and mimic changes on model |
| 29 | + this.model.addListenerMethods( this, { |
| 30 | + 'afterPush': 'onAfterPush', |
| 31 | + 'afterUnshift': 'onAfterUnshift', |
| 32 | + 'afterPop': 'onAfterPop', |
| 33 | + 'afterShift': 'onAfterShift', |
| 34 | + 'afterSplice': 'onAfterSplice', |
| 35 | + 'afterSort': 'onAfterSort', |
| 36 | + 'afterReverse': 'onAfterReverse' |
| 37 | + } ); |
| 38 | + } |
| 39 | +}; |
| 40 | + |
| 41 | +/* Methods */ |
| 42 | + |
| 43 | +ve.ce.BranchNode.prototype.onAfterPush = function( childModel ) { |
| 44 | + var childView = childModel.createView(); |
| 45 | + this.emit( 'beforePush', childView ); |
| 46 | + childView.attach( this ); |
| 47 | + childView.on( 'update', this.emitUpdate ); |
| 48 | + // Update children |
| 49 | + this.children.push( childView ); |
| 50 | + // Update DOM |
| 51 | + this.$.append( childView.$ ); |
| 52 | + // TODO: adding and deleting classes has to be implemented for unshift, shift, splice, sort |
| 53 | + // and reverse as well |
| 54 | + if ( this.children.length === 1 ) { |
| 55 | + childView.$.addClass('es-viewBranchNode-firstChild'); |
| 56 | + } |
| 57 | + this.emit( 'afterPush', childView ); |
| 58 | + this.emit( 'update' ); |
| 59 | +}; |
| 60 | + |
| 61 | +ve.ce.BranchNode.prototype.onAfterUnshift = function( childModel ) { |
| 62 | + var childView = childModel.createView(); |
| 63 | + this.emit( 'beforeUnshift', childView ); |
| 64 | + childView.attach( this ); |
| 65 | + childView.on( 'update', this.emitUpdate ); |
| 66 | + // Update children |
| 67 | + this.children.unshift( childView ); |
| 68 | + // Update DOM |
| 69 | + this.$.prepend( childView.$ ); |
| 70 | + this.emit( 'afterUnshift', childView ); |
| 71 | + this.emit( 'update' ); |
| 72 | +}; |
| 73 | + |
| 74 | +ve.ce.BranchNode.prototype.onAfterPop = function() { |
| 75 | + this.emit( 'beforePop' ); |
| 76 | + // Update children |
| 77 | + var childView = this.children.pop(); |
| 78 | + childView.detach(); |
| 79 | + childView.removeEventListener( 'update', this.emitUpdate ); |
| 80 | + // Update DOM |
| 81 | + childView.$.detach(); |
| 82 | + this.emit( 'afterPop' ); |
| 83 | + this.emit( 'update' ); |
| 84 | +}; |
| 85 | + |
| 86 | +ve.ce.BranchNode.prototype.onAfterShift = function() { |
| 87 | + this.emit( 'beforeShift' ); |
| 88 | + // Update children |
| 89 | + var childView = this.children.shift(); |
| 90 | + childView.detach(); |
| 91 | + childView.removeEventListener( 'update', this.emitUpdate ); |
| 92 | + // Update DOM |
| 93 | + childView.$.detach(); |
| 94 | + this.emit( 'afterShift' ); |
| 95 | + this.emit( 'update' ); |
| 96 | +}; |
| 97 | + |
| 98 | +ve.ce.BranchNode.prototype.onAfterSplice = function( index, howmany ) { |
| 99 | + var i, |
| 100 | + length, |
| 101 | + args = Array.prototype.slice.call( arguments, 0 ); |
| 102 | + // Convert models to views and attach them to this node |
| 103 | + if ( args.length >= 3 ) { |
| 104 | + for ( i = 2, length = args.length; i < length; i++ ) { |
| 105 | + args[i] = args[i].createView(); |
| 106 | + } |
| 107 | + } |
| 108 | + this.emit.apply( this, ['beforeSplice'].concat( args ) ); |
| 109 | + var removals = this.children.splice.apply( this.children, args ); |
| 110 | + for ( i = 0, length = removals.length; i < length; i++ ) { |
| 111 | + removals[i].detach(); |
| 112 | + removals[i].removeListener( 'update', this.emitUpdate ); |
| 113 | + // Update DOM |
| 114 | + removals[i].$.detach(); |
| 115 | + } |
| 116 | + if ( args.length >= 3 ) { |
| 117 | + var $target; |
| 118 | + if ( index ) { |
| 119 | + // Get the element before the insertion point |
| 120 | + $anchor = this.$.children().eq( index - 1 ); |
| 121 | + } |
| 122 | + for ( i = args.length - 1; i >= 2; i-- ) { |
| 123 | + args[i].attach( this ); |
| 124 | + args[i].on( 'update', this.emitUpdate ); |
| 125 | + if ( index ) { |
| 126 | + $anchor.after( args[i].$ ); |
| 127 | + } else { |
| 128 | + this.$.prepend( args[i].$ ); |
| 129 | + } |
| 130 | + } |
| 131 | + } |
| 132 | + this.emit.apply( this, ['afterSplice'].concat( args ) ); |
| 133 | + if ( args.length >= 3 ) { |
| 134 | + for ( i = 2, length = args.length; i < length; i++ ) { |
| 135 | + args[i].renderContent(); |
| 136 | + } |
| 137 | + } |
| 138 | + this.emit( 'update' ); |
| 139 | +}; |
| 140 | + |
| 141 | +ve.ce.BranchNode.prototype.onAfterSort = function() { |
| 142 | + this.emit( 'beforeSort' ); |
| 143 | + var childModels = this.model.getChildren(); |
| 144 | + for ( var i = 0; i < childModels.length; i++ ) { |
| 145 | + for ( var j = 0; j < this.children.length; j++ ) { |
| 146 | + if ( this.children[j].getModel() === childModels[i] ) { |
| 147 | + var childView = this.children[j]; |
| 148 | + // Update children |
| 149 | + this.children.splice( j, 1 ); |
| 150 | + this.children.push( childView ); |
| 151 | + // Update DOM |
| 152 | + this.$.append( childView.$ ); |
| 153 | + } |
| 154 | + } |
| 155 | + } |
| 156 | + this.emit( 'afterSort' ); |
| 157 | + this.emit( 'update' ); |
| 158 | + this.renderContent(); |
| 159 | +}; |
| 160 | + |
| 161 | +ve.ce.BranchNode.prototype.onAfterReverse = function() { |
| 162 | + this.emit( 'beforeReverse' ); |
| 163 | + // Update children |
| 164 | + this.reverse(); |
| 165 | + // Update DOM |
| 166 | + this.$.children().each( function() { |
| 167 | + $(this).prependTo( $(this).parent() ); |
| 168 | + } ); |
| 169 | + this.emit( 'afterReverse' ); |
| 170 | + this.emit( 'update' ); |
| 171 | + this.renderContent(); |
| 172 | +}; |
| 173 | + |
| 174 | +/** |
| 175 | + * Render content. |
| 176 | + * |
| 177 | + * @method |
| 178 | + */ |
| 179 | +ve.ce.BranchNode.prototype.renderContent = function() { |
| 180 | + for ( var i = 0; i < this.children.length; i++ ) { |
| 181 | + this.children[i].renderContent(); |
| 182 | + } |
| 183 | +}; |
| 184 | + |
| 185 | +/** |
| 186 | + * Draw selection around a given range. |
| 187 | + * |
| 188 | + * @method |
| 189 | + * @param {ve.Range} range Range of content to draw selection around |
| 190 | + */ |
| 191 | +ve.ce.BranchNode.prototype.drawSelection = function( range ) { |
| 192 | + var selectedNodes = this.selectNodes( range, true ); |
| 193 | + for ( var i = 0; i < this.children.length; i++ ) { |
| 194 | + if ( selectedNodes.length && this.children[i] === selectedNodes[0].node ) { |
| 195 | + for ( var j = 0; j < selectedNodes.length; j++ ) { |
| 196 | + selectedNodes[j].node.drawSelection( selectedNodes[j].range ); |
| 197 | + } |
| 198 | + i += selectedNodes.length - 1; |
| 199 | + } else { |
| 200 | + this.children[i].clearSelection(); |
| 201 | + } |
| 202 | + } |
| 203 | +}; |
| 204 | + |
| 205 | +/** |
| 206 | + * Clear selection. |
| 207 | + * |
| 208 | + * @method |
| 209 | + */ |
| 210 | +ve.ce.BranchNode.prototype.clearSelection = function() { |
| 211 | + for ( var i = 0; i < this.children.length; i++ ) { |
| 212 | + this.children[i].clearSelection(); |
| 213 | + } |
| 214 | +}; |
| 215 | + |
| 216 | +/** |
| 217 | + * Gets the nearest offset of a rendered position. |
| 218 | + * |
| 219 | + * @method |
| 220 | + * @param {ve.Position} position Position to get offset for |
| 221 | + * @returns {Integer} Offset of position |
| 222 | + */ |
| 223 | +ve.ce.BranchNode.prototype.getOffsetFromRenderedPosition = function( position ) { |
| 224 | + if ( this.children.length === 0 ) { |
| 225 | + return 0; |
| 226 | + } |
| 227 | + var node = this.children[0]; |
| 228 | + for ( var i = 1; i < this.children.length; i++ ) { |
| 229 | + if ( this.horizontal && this.children[i].$.offset().left > position.left ) { |
| 230 | + break; |
| 231 | + } else if ( !this.horizontal && this.children[i].$.offset().top > position.top ) { |
| 232 | + break; |
| 233 | + } |
| 234 | + node = this.children[i]; |
| 235 | + } |
| 236 | + return node.getParent().getOffsetFromNode( node, true ) + |
| 237 | + node.getOffsetFromRenderedPosition( position ) + 1; |
| 238 | +}; |
| 239 | + |
| 240 | +/** |
| 241 | + * Gets rendered position of offset within content. |
| 242 | + * |
| 243 | + * @method |
| 244 | + * @param {Integer} offset Offset to get position for |
| 245 | + * @returns {ve.Position} Position of offset |
| 246 | + */ |
| 247 | +ve.ce.BranchNode.prototype.getRenderedPositionFromOffset = function( offset, leftBias ) { |
| 248 | + var node = this.getNodeFromOffset( offset, true ); |
| 249 | + if ( node !== null ) { |
| 250 | + return node.getRenderedPositionFromOffset( |
| 251 | + offset - this.getOffsetFromNode( node, true ) - 1, |
| 252 | + leftBias |
| 253 | + ); |
| 254 | + } |
| 255 | + return null; |
| 256 | +}; |
| 257 | + |
| 258 | +ve.ce.BranchNode.prototype.getRenderedLineRangeFromOffset = function( offset ) { |
| 259 | + var node = this.getNodeFromOffset( offset, true ); |
| 260 | + if ( node !== null ) { |
| 261 | + var nodeOffset = this.getOffsetFromNode( node, true ); |
| 262 | + return ve.Range.newFromTranslatedRange( |
| 263 | + node.getRenderedLineRangeFromOffset( offset - nodeOffset - 1 ), |
| 264 | + nodeOffset + 1 |
| 265 | + ); |
| 266 | + } |
| 267 | + return null; |
| 268 | +}; |
| 269 | + |
| 270 | +/* Inheritance */ |
| 271 | + |
| 272 | +ve.extendClass( ve.ce.BranchNode, ve.BranchNode ); |
| 273 | +ve.extendClass( ve.ce.BranchNode, ve.ce.Node ); |
Property changes on: trunk/extensions/VisualEditor/modules/ve/ce/ve.ce.BranchNode.js |
___________________________________________________________________ |
Added: svn:eol-style |
274 | 274 | + native |
Property changes on: trunk/extensions/MobileFrontend/javascripts/beta_opensearch.min.js |
___________________________________________________________________ |
Added: svn:eol-style |
275 | 275 | + native |
Property changes on: trunk/extensions/MobileFrontend/javascripts/application.min.js |
___________________________________________________________________ |
Added: svn:eol-style |
276 | 276 | + native |
Property changes on: trunk/extensions/MobileFrontend/javascripts/banner.min.js |
___________________________________________________________________ |
Added: svn:eol-style |
277 | 277 | + native |
Property changes on: trunk/extensions/MobileFrontend/javascripts/opensearch.min.js |
___________________________________________________________________ |
Added: svn:eol-style |
278 | 278 | + native |
Property changes on: trunk/extensions/MobileFrontend/javascripts/beta_application.min.js |
___________________________________________________________________ |
Added: svn:eol-style |
279 | 279 | + native |
Property changes on: trunk/extensions/MobileFrontend/Makefile |
___________________________________________________________________ |
Added: svn:eol-style |
280 | 280 | + native |