scribe-editor
Advanced tools
Comparing version 1.2.9 to 1.2.10
@@ -0,1 +1,5 @@ | ||
# 1.2.10 | ||
Bugfixes for selections that are 'reversed' (i.e. selected from right to left) from [Deains](https://github.com/deains). Thanks | ||
# 1.2.9 | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "scribe-editor", | ||
"version": "1.2.9", | ||
"version": "1.2.10", | ||
"main": "src/scribe.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -31,4 +31,15 @@ define([ | ||
this.range = document.createRange(); | ||
var reverseRange = document.createRange(); | ||
this.range.setStart(this.selection.anchorNode, this.selection.anchorOffset); | ||
this.range.setEnd(this.selection.focusNode, this.selection.focusOffset); | ||
reverseRange.setStart(this.selection.focusNode, this.selection.focusOffset); | ||
// Check if anchorNode is before focusNode, use reverseRange if not | ||
if (this.range.compareBoundaryPoints(Range.START_TO_START, reverseRange) <= 0) { | ||
this.range.setEnd(this.selection.focusNode, this.selection.focusOffset); | ||
} | ||
else { | ||
this.range = reverseRange; | ||
this.range.setEnd(this.selection.anchorNode, this.selection.anchorOffset); | ||
} | ||
} | ||
@@ -35,0 +46,0 @@ } |
@@ -269,10 +269,10 @@ define([ | ||
*/ | ||
Scribe.prototype.registerHTMLFormatter = function (phase, fn) { | ||
Scribe.prototype.registerHTMLFormatter = function (phase, formatter) { | ||
this._htmlFormatterFactory.formatters[phase] | ||
= this._htmlFormatterFactory.formatters[phase].push(fn); | ||
= this._htmlFormatterFactory.formatters[phase].push(formatter); | ||
}; | ||
Scribe.prototype.registerPlainTextFormatter = function (fn) { | ||
Scribe.prototype.registerPlainTextFormatter = function (formatter) { | ||
this._plainTextFormatterFactory.formatters | ||
= this._plainTextFormatterFactory.formatters.push(fn); | ||
= this._plainTextFormatterFactory.formatters.push(formatter); | ||
}; | ||
@@ -279,0 +279,0 @@ |
184391
3857