http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97827
Revision: 97827
Author: tparscal
Date: 2011-09-22 17:21:37 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
Added transaction methods to all models (still empty, many will just delegate)
Modified Paths:
--------------
trunk/parsers/wikidom/lib/synth/models/es.BlockModel.js
trunk/parsers/wikidom/lib/synth/models/es.ContentModel.js
trunk/parsers/wikidom/lib/synth/models/es.DocumentModel.js
trunk/parsers/wikidom/lib/synth/models/es.HeadingBlockModel.js
trunk/parsers/wikidom/lib/synth/models/es.ListBlockItemModel.js
trunk/parsers/wikidom/lib/synth/models/es.ListBlockModel.js
trunk/parsers/wikidom/lib/synth/models/es.ParagraphBlockModel.js
trunk/parsers/wikidom/lib/synth/models/es.TableBlockCellModel.js
trunk/parsers/wikidom/lib/synth/models/es.TableBlockModel.js
trunk/parsers/wikidom/lib/synth/models/es.TableBlockRowModel.js
Modified: trunk/parsers/wikidom/lib/synth/models/es.BlockModel.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/models/es.BlockModel.js 2011-09-22
17:19:23 UTC (rev 97826)
+++ trunk/parsers/wikidom/lib/synth/models/es.BlockModel.js 2011-09-22
17:21:37 UTC (rev 97827)
@@ -164,25 +164,37 @@
};
es.BlockModel.prototype.commit = function( transaction ) {
- // commit transaction
+ // TODO
};
es.BlockModel.prototype.rollback = function( transaction ) {
- // rollback transaction
+ // TODO
};
es.BlockModel.prototype.prepareInsertContent = function( offset, content ) {
- // generate transaction
+ // TODO
};
es.BlockModel.prototype.prepareRemoveContent = function( range ) {
- // generate transaction
+ // TODO
};
es.BlockModel.prototype.prepareAnnotateContent = function( range, annotation )
{
- // generate transaction
+ // TODO
};
+es.BlockModel.prototype.insertContent = function( offset, content ) {
+ // TODO
+};
+
+es.BlockModel.prototype.removeContent = function( range ) {
+ // TODO
+};
+
+es.BlockModel.prototype.annotateContent = function( range, annotation ) {
+ // TODO
+};
+
/**
* Gets a plain object representation of block, for serialization.
*
Modified: trunk/parsers/wikidom/lib/synth/models/es.ContentModel.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/models/es.ContentModel.js 2011-09-22
17:19:23 UTC (rev 97826)
+++ trunk/parsers/wikidom/lib/synth/models/es.ContentModel.js 2011-09-22
17:21:37 UTC (rev 97827)
@@ -134,7 +134,6 @@
this.attributes[name] = value;
};
-
/**
* Gets plain text version of the content within a specific range.
*
@@ -258,26 +257,6 @@
return new es.Range( start, end );
};
-es.ContentModel.prototype.commit = function( transaction ) {
- // commit transaction
-};
-
-es.ContentModel.prototype.rollback = function( transaction ) {
- // rollback transaction
-};
-
-es.ContentModel.prototype.prepareInsertContent = function( offset, content ) {
- // generate transaction
-};
-
-es.ContentModel.prototype.prepareRemoveContent = function( range ) {
- // generate transaction
-};
-
-es.ContentModel.prototype.prepareAnnotateContent = function( range, annotation
) {
- // generate transaction
-};
-
/**
* Get a plain content object.
*
@@ -422,6 +401,26 @@
return -1;
};
+es.ContentModel.prototype.commit = function( transaction ) {
+ // TODO
+};
+
+es.ContentModel.prototype.rollback = function( transaction ) {
+ // TODO
+};
+
+es.ContentModel.prototype.prepareInsertContent = function( offset, content ) {
+ // TODO
+};
+
+es.ContentModel.prototype.prepareRemoveContent = function( range ) {
+ // TODO
+};
+
+es.ContentModel.prototype.prepareAnnotateContent = function( range, annotation
) {
+ // TODO
+};
+
/**
* Inserts content data at a specific position.
*
@@ -433,7 +432,7 @@
* @emits "insert" with offset and content data properties
* @emits "change" with type:"insert" data property
*/
-es.ContentModel.prototype.insert = function( offset, content, autoAnnotate ) {
+es.ContentModel.prototype.insertContent = function( offset, content,
autoAnnotate ) {
if ( autoAnnotate ) {
// TODO: Prefer to not take annotations from a neighbor that's
a space character
var neighbor = this.data[Math.max( offset - 1, 0 )];
@@ -464,7 +463,7 @@
* @emits "remove" with range data property
* @emits "change" with type:"remove" data property
*/
-es.ContentModel.prototype.remove = function( range ) {
+es.ContentModel.prototype.removeContent = function( range ) {
range.normalize();
this.data.splice( range.start, range.getLength() );
this.emit( 'remove', {
@@ -502,7 +501,7 @@
* @emits "annotate" with method, annotation and range data properties
* @emits "change" with type:"annotate" data property
*/
-es.ContentModel.prototype.annotate = function( method, annotation, range ) {
+es.ContentModel.prototype.annotateContent = function( method, annotation,
range ) {
// Support calling without a range argument, using the full content
range as default
if ( !range ) {
range = new es.Range( 0, this.data.length );
@@ -591,4 +590,6 @@
this.emit( 'update', { 'type': 'annotate' } );
};
+/* Inheritance */
+
es.extend( es.ContentModel, es.EventEmitter );
Modified: trunk/parsers/wikidom/lib/synth/models/es.DocumentModel.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/models/es.DocumentModel.js 2011-09-22
17:19:23 UTC (rev 97826)
+++ trunk/parsers/wikidom/lib/synth/models/es.DocumentModel.js 2011-09-22
17:21:37 UTC (rev 97827)
@@ -38,25 +38,37 @@
/* Methods */
es.DocumentModel.prototype.commit = function( transaction ) {
- // commit transaction
+ // TODO
};
es.DocumentModel.prototype.rollback = function( transaction ) {
- // rollback transaction
+ // TODO
};
es.DocumentModel.prototype.prepareInsertContent = function( offset, content ) {
- // generate transaction
+ // TODO
};
es.DocumentModel.prototype.prepareRemoveContent = function( range ) {
- // generate transaction
+ // TODO
};
es.DocumentModel.prototype.prepareAnnotateContent = function( range,
annotation ) {
- // generate transaction
+ // TODO
};
+es.DocumentModel.prototype.insertContent = function( offset, content ) {
+ // TODO
+};
+
+es.DocumentModel.prototype.removeContent = function( range ) {
+ // TODO
+};
+
+es.DocumentModel.prototype.annotateContent = function( range, annotation ) {
+ // TODO
+};
+
es.DocumentModel.prototype.getPlainObject = function() {
var obj = {};
if ( this.items.length ) {
Modified: trunk/parsers/wikidom/lib/synth/models/es.HeadingBlockModel.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/models/es.HeadingBlockModel.js
2011-09-22 17:19:23 UTC (rev 97826)
+++ trunk/parsers/wikidom/lib/synth/models/es.HeadingBlockModel.js
2011-09-22 17:21:37 UTC (rev 97827)
@@ -56,6 +56,38 @@
return { 'type': 'heading', 'content': this.content.getPlainObject(),
'level': this.level };
};
+es.HeadingBlockModel.prototype.commit = function( transaction ) {
+ // TODO
+};
+
+es.HeadingBlockModel.prototype.rollback = function( transaction ) {
+ // TODO
+};
+
+es.HeadingBlockModel.prototype.prepareInsertContent = function( offset,
content ) {
+ // TODO
+};
+
+es.HeadingBlockModel.prototype.prepareRemoveContent = function( range ) {
+ // TODO
+};
+
+es.HeadingBlockModel.prototype.prepareAnnotateContent = function( range,
annotation ) {
+ // TODO
+};
+
+es.HeadingBlockModel.prototype.insertContent = function( offset, content ) {
+ // TODO
+};
+
+es.HeadingBlockModel.prototype.removeContent = function( range ) {
+ // TODO
+};
+
+es.HeadingBlockModel.prototype.annotateContent = function( range, annotation )
{
+ // TODO
+};
+
// Register constructor
es.BlockModel.constructors['heading'] = es.HeadingBlockModel;
Modified: trunk/parsers/wikidom/lib/synth/models/es.ListBlockItemModel.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/models/es.ListBlockItemModel.js
2011-09-22 17:19:23 UTC (rev 97826)
+++ trunk/parsers/wikidom/lib/synth/models/es.ListBlockItemModel.js
2011-09-22 17:21:37 UTC (rev 97827)
@@ -55,6 +55,38 @@
return { 'content': this.content.getPlainObject(), 'styles':
this.styles.slice( 0 ) };
};
+es.ListBlockItemModel.prototype.commit = function( transaction ) {
+ // TODO
+};
+
+es.ListBlockItemModel.prototype.rollback = function( transaction ) {
+ // TODO
+};
+
+es.ListBlockItemModel.prototype.prepareInsertContent = function( offset,
content ) {
+ // TODO
+};
+
+es.ListBlockItemModel.prototype.prepareRemoveContent = function( range ) {
+ // TODO
+};
+
+es.ListBlockItemModel.prototype.prepareAnnotateContent = function( range,
annotation ) {
+ // TODO
+};
+
+es.ListBlockItemModel.prototype.insertContent = function( offset, content ) {
+ // TODO
+};
+
+es.ListBlockItemModel.prototype.removeContent = function( range ) {
+ // TODO
+};
+
+es.ListBlockItemModel.prototype.annotateContent = function( range, annotation
) {
+ // TODO
+};
+
/* Inheritance */
es.extend( es.ListBlockItemModel, es.ModelListItem );
\ No newline at end of file
Modified: trunk/parsers/wikidom/lib/synth/models/es.ListBlockModel.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/models/es.ListBlockModel.js 2011-09-22
17:19:23 UTC (rev 97826)
+++ trunk/parsers/wikidom/lib/synth/models/es.ListBlockModel.js 2011-09-22
17:21:37 UTC (rev 97827)
@@ -110,6 +110,38 @@
return obj;
};
+es.ListBlockModel.prototype.commit = function( transaction ) {
+ // TODO
+};
+
+es.ListBlockModel.prototype.rollback = function( transaction ) {
+ // TODO
+};
+
+es.ListBlockModel.prototype.prepareInsertContent = function( offset, content )
{
+ // TODO
+};
+
+es.ListBlockModel.prototype.prepareRemoveContent = function( range ) {
+ // TODO
+};
+
+es.ListBlockModel.prototype.prepareAnnotateContent = function( range,
annotation ) {
+ // TODO
+};
+
+es.ListBlockModel.prototype.insertContent = function( offset, content ) {
+ // TODO
+};
+
+es.ListBlockModel.prototype.removeContent = function( range ) {
+ // TODO
+};
+
+es.ListBlockModel.prototype.annotateContent = function( range, annotation ) {
+ // TODO
+};
+
// Register constructor
es.BlockModel.constructors['list'] = es.ListBlockModel.newFromPlainObject
Modified: trunk/parsers/wikidom/lib/synth/models/es.ParagraphBlockModel.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/models/es.ParagraphBlockModel.js
2011-09-22 17:19:23 UTC (rev 97826)
+++ trunk/parsers/wikidom/lib/synth/models/es.ParagraphBlockModel.js
2011-09-22 17:21:37 UTC (rev 97827)
@@ -70,6 +70,38 @@
return { 'type': 'paragraph', 'content': this.content.getPlainObject()
};
};
+es.ParagraphBlockModel.prototype.commit = function( transaction ) {
+ // TODO
+};
+
+es.ParagraphBlockModel.prototype.rollback = function( transaction ) {
+ // TODO
+};
+
+es.ParagraphBlockModel.prototype.prepareInsertContent = function( offset,
content ) {
+ // TODO
+};
+
+es.ParagraphBlockModel.prototype.prepareRemoveContent = function( range ) {
+ // TODO
+};
+
+es.ParagraphBlockModel.prototype.prepareAnnotateContent = function( range,
annotation ) {
+ // TODO
+};
+
+es.ParagraphBlockModel.prototype.insertContent = function( offset, content ) {
+ // TODO
+};
+
+es.ParagraphBlockModel.prototype.removeContent = function( range ) {
+ // TODO
+};
+
+es.ParagraphBlockModel.prototype.annotateContent = function( range, annotation
) {
+ // TODO
+};
+
// Register constructor
es.BlockModel.constructors['paragraph'] =
es.ParagraphBlockModel.newFromPlainObject;
Modified: trunk/parsers/wikidom/lib/synth/models/es.TableBlockCellModel.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/models/es.TableBlockCellModel.js
2011-09-22 17:19:23 UTC (rev 97826)
+++ trunk/parsers/wikidom/lib/synth/models/es.TableBlockCellModel.js
2011-09-22 17:21:37 UTC (rev 97827)
@@ -68,6 +68,38 @@
*/
};
+es.TableBlockCellModel.prototype.commit = function( transaction ) {
+ // TODO
+};
+
+es.TableBlockCellModel.prototype.rollback = function( transaction ) {
+ // TODO
+};
+
+es.TableBlockCellModel.prototype.prepareInsertContent = function( offset,
content ) {
+ // TODO
+};
+
+es.TableBlockCellModel.prototype.prepareRemoveContent = function( range ) {
+ // TODO
+};
+
+es.TableBlockCellModel.prototype.prepareAnnotateContent = function( range,
annotation ) {
+ // TODO
+};
+
+es.TableBlockCellModel.prototype.insertContent = function( offset, content ) {
+ // TODO
+};
+
+es.TableBlockCellModel.prototype.removeContent = function( range ) {
+ // TODO
+};
+
+es.TableBlockCellModel.prototype.annotateContent = function( range, annotation
) {
+ // TODO
+};
+
/* Inheritance */
es.extend( es.TableBlockCellModel, es.ModelListItem );
\ No newline at end of file
Modified: trunk/parsers/wikidom/lib/synth/models/es.TableBlockModel.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/models/es.TableBlockModel.js
2011-09-22 17:19:23 UTC (rev 97826)
+++ trunk/parsers/wikidom/lib/synth/models/es.TableBlockModel.js
2011-09-22 17:21:37 UTC (rev 97827)
@@ -81,6 +81,38 @@
*/
};
+es.TableBlockModel.prototype.commit = function( transaction ) {
+ // TODO
+};
+
+es.TableBlockModel.prototype.rollback = function( transaction ) {
+ // TODO
+};
+
+es.TableBlockModel.prototype.prepareInsertContent = function( offset, content
) {
+ // TODO
+};
+
+es.TableBlockModel.prototype.prepareRemoveContent = function( range ) {
+ // TODO
+};
+
+es.TableBlockModel.prototype.prepareAnnotateContent = function( range,
annotation ) {
+ // TODO
+};
+
+es.TableBlockModel.prototype.insertContent = function( offset, content ) {
+ // TODO
+};
+
+es.TableBlockModel.prototype.removeContent = function( range ) {
+ // TODO
+};
+
+es.TableBlockModel.prototype.annotateContent = function( range, annotation ) {
+ // TODO
+};
+
// Register constructor
es.BlockModel.constructors['table'] = es.TableBlockModel.newFromPlainObject;
Modified: trunk/parsers/wikidom/lib/synth/models/es.TableBlockRowModel.js
===================================================================
--- trunk/parsers/wikidom/lib/synth/models/es.TableBlockRowModel.js
2011-09-22 17:19:23 UTC (rev 97826)
+++ trunk/parsers/wikidom/lib/synth/models/es.TableBlockRowModel.js
2011-09-22 17:21:37 UTC (rev 97827)
@@ -80,6 +80,38 @@
*/
};
+es.TableBlockRowModel.prototype.commit = function( transaction ) {
+ // TODO
+};
+
+es.TableBlockRowModel.prototype.rollback = function( transaction ) {
+ // TODO
+};
+
+es.TableBlockRowModel.prototype.prepareInsertContent = function( offset,
content ) {
+ // TODO
+};
+
+es.TableBlockRowModel.prototype.prepareRemoveContent = function( range ) {
+ // TODO
+};
+
+es.TableBlockRowModel.prototype.prepareAnnotateContent = function( range,
annotation ) {
+ // TODO
+};
+
+es.TableBlockRowModel.prototype.insertContent = function( offset, content ) {
+ // TODO
+};
+
+es.TableBlockRowModel.prototype.removeContent = function( range ) {
+ // TODO
+};
+
+es.TableBlockRowModel.prototype.annotateContent = function( range, annotation
) {
+ // TODO
+};
+
/* Inheritance */
es.extend( es.TableBlockRowModel, es.ModelListItem );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs