r100609 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100608‎ | r100609 | r100610 >
Date:16:13, 24 October 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Wrapped some comments that exceeded the 100 character wrapping boundary
Modified paths:
  • /trunk/parsers/wikidom/lib/hype/models/es.DocumentModel.js (modified) (history)

Diff [purge]

Index: trunk/parsers/wikidom/lib/hype/models/es.DocumentModel.js
@@ -586,9 +586,11 @@
587587 * <p>a</p><p>b</p>| - End of the document
588588 * Content locations
589589 * <p>|a</p><p>b</p> - Inside an element (like in a paragraph or listItem)
590 - * <p>a|</p><p>b</p> - May also be inside an element but right before/after an open/close
 590+ * <p>a|</p><p>b</p> - May also be inside an element but right before/after an
 591+ * open/close
591592 *
592 - * if ( Incoming data contains structural elements ) { // We're assuming the incoming data is balanced, is that OK?
 593+ * if ( Incoming data contains structural elements ) {
 594+ // We're assuming the incoming data is balanced, is that OK?
593595 * if ( Insertion point is a structural location ) {
594596 * if ( Incoming data is not a complete structural element ) {
595597 * Incoming data must be balanced
@@ -618,9 +620,10 @@
619621 //debugger;
620622
621623 /**
622 - * Return true if can merge the remaining contents of the elements after a selection is deleted across them.
623 - * For instance, if a selection is painted across two paragraphs, and then the text is deleted, the two paragraphs can become one paragraph.
624 - * However, if the selection crosses into a table, those cannot be merged.
 624+ * Return true if can merge the remaining contents of the elements after a selection is deleted
 625+ * across them. For instance, if a selection is painted across two paragraphs, and then the text
 626+ * is deleted, the two paragraphs can become one paragraph. However, if the selection crosses
 627+ * into a table, those cannot be merged.
625628 * @param {Number} integer offset
626629 * @param {Number} integer offset
627630 * @return {Boolean}
@@ -628,9 +631,10 @@
629632 function canMerge( range ) {
630633 var node1 = doc.getNodeFromOffset( range.start );
631634 var node2 = doc.getNodeFromOffset( range.end - 1 );
632 - // This is the simple rule we are following for now -- same type & same parent = can merge. So you can merge adjacent paragraphs, or listitems.
633 - // And you can't merge a paragraph into a table row.
634 - // There may be other rules we will want in here later, for instance, special casing merging a listitem into a paragraph.
 635+ // This is the simple rule we are following for now -- same type & same parent = can merge.
 636+ // So you can merge adjacent paragraphs, or listitems. And you can't merge a paragraph into
 637+ // a table row. There may be other rules we will want in here later, for instance, special
 638+ // casing merging a listitem into a paragraph.
635639
636640 // wait, some nodes don't have types? Is this the top document node?
637641 return (
@@ -675,7 +679,8 @@
676680 // we add one because retain(3,3) really means retain 1 char at pos 3
677681 tx.pushRetain( op.end - op.start + 1 );
678682 } else if ( op.type === 'remove' ) {
679 - // we add one because to remove(3,5) we need to slice(3,6), the ending is last subscript removed + 1.
 683+ // we add one because to remove(3,5) we need to slice(3,6), the ending is last
 684+ // subscript removed + 1.
680685 tx.pushRemove( this.data.slice( op.start, op.end + 1 ) );
681686 } else {
682687 console.log( "this is impossible" );
@@ -694,7 +699,8 @@
695700 }
696701
697702
698 - // choose a deletion strategy; merging nodes together, or stripping content from existing structure.
 703+ // choose a deletion strategy; merging nodes together, or stripping content from existing
 704+ // structure.
699705 if ( canMerge( range ) ) {
700706 mergeDelete( range, tx );
701707 } else {

Status & tagging log