mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
Typo fixes and missing 'var' in newFromRemoval()
Change-Id: Ibb984d862670b5386ff76fc55ef3322f695b6ae1
This commit is contained in:
parent
db793009be
commit
c0e19915ef
|
@ -46,13 +46,13 @@ ve.dm.Transaction.newFromInsertion = function( doc, offset, insertion ) {
|
||||||
* 1. Remove content only
|
* 1. Remove content only
|
||||||
* - Occurs when the range starts and ends on elements of different type, depth or ancestry
|
* - Occurs when the range starts and ends on elements of different type, depth or ancestry
|
||||||
* 2. Remove entire elements and their content
|
* 2. Remove entire elements and their content
|
||||||
* - Occurs when the range spans accross an entire element
|
* - Occurs when the range spans across an entire element
|
||||||
* 3. Merge two elements by removing the end of one and the beginning of another
|
* 3. Merge two elements by removing the end of one and the beginning of another
|
||||||
* - Occurs when the range starts and ends on elements of similar type, depth and ancestry
|
* - Occurs when the range starts and ends on elements of similar type, depth and ancestry
|
||||||
*
|
*
|
||||||
* This function uses the following logic to decide what to actually remove:
|
* This function uses the following logic to decide what to actually remove:
|
||||||
* 1. Elements are only removed if range being removed covers the entire element
|
* 1. Elements are only removed if range being removed covers the entire element
|
||||||
* 2. Elements can only be merged if {ve.dm.Node.canBeMergedWith} returns true
|
* 2. Elements can only be merged if ve.dm.Node.canBeMergedWith() returns true
|
||||||
* 3. Merges take place at the highest common ancestor
|
* 3. Merges take place at the highest common ancestor
|
||||||
*
|
*
|
||||||
* @method
|
* @method
|
||||||
|
@ -76,14 +76,14 @@ ve.dm.Transaction.newFromRemoval = function( doc, range ) {
|
||||||
nodeRange;
|
nodeRange;
|
||||||
if ( selection.length === 0 ) {
|
if ( selection.length === 0 ) {
|
||||||
// Empty selection? Something is wrong!
|
// Empty selection? Something is wrong!
|
||||||
throw 'Invalid range, can not remove from ' + range.start + ' to ' + range.end;
|
throw 'Invalid range, cannot remove from ' + range.start + ' to ' + range.end;
|
||||||
}
|
}
|
||||||
// Decide whether to merge or strip
|
// Decide whether to merge or strip
|
||||||
if ( selection[0].node.canBeMergedWith( selection[selection.length - 1].node ) ) {
|
if ( selection[0].node.canBeMergedWith( selection[selection.length - 1].node ) ) {
|
||||||
// If only one node was selected, ignore anything past this node
|
// If only one node was selected, ignore anything past this node
|
||||||
if ( selection.length === 1 ) {
|
if ( selection.length === 1 ) {
|
||||||
// Include the parent's wrapping (if any - there should always be, but let's be safe)
|
// Include the parent's wrapping (if any - there should always be, but let's be safe)
|
||||||
wrapping = selection[0].node.getParent().isWrapped() ? 1 : 0;
|
var wrapping = selection[0].node.getParent().isWrapped() ? 1 : 0;
|
||||||
// Only reduces the range to cover the selected node if it's shorter
|
// Only reduces the range to cover the selected node if it's shorter
|
||||||
range.start = Math.max( range.start, selection[0].nodeRange.start - wrapping );
|
range.start = Math.max( range.start, selection[0].nodeRange.start - wrapping );
|
||||||
// Only reduces the range to cover the selected node if it's shorter
|
// Only reduces the range to cover the selected node if it's shorter
|
||||||
|
|
Loading…
Reference in a new issue