Skip to content

Commit

Permalink
Update version
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Pulges committed Aug 18, 2015
1 parent 24aa752 commit 4c97ec8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/wysihtml/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Wysihtml
module Rails
VERSION = "0.5.0.beta12"
VERSION = "0.5.0.beta13"
end
end
19 changes: 15 additions & 4 deletions vendor/assets/javascripts/wysihtml-toolbar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license wysihtml v0.5.0-beta12
* @license wysihtml v0.5.0-beta13
* https://github.com/Voog/wysihtml
*
* Author: Christopher Blum (https://github.com/tiff)
Expand All @@ -10,7 +10,7 @@
*
*/
var wysihtml5 = {
version: "0.5.0-beta12",
version: "0.5.0-beta13",

// namespaces
commands: {},
Expand Down Expand Up @@ -405,20 +405,24 @@ var wysihtml5 = {
return all;
};



var normalizeFix = function() {
var f = Node.prototype.normalize;
var nf = function() {
var texts = getTextNodes(this),
s = this.ownerDocument.defaultView.getSelection(),
anode = s.anchorNode,
aoffset = s.anchorOffset,
aelement = anode && anode.nodeType === 1 && anode.childNodes.length > 0 ? anode.childNodes[aoffset] : undefined,
fnode = s.focusNode,
foffset = s.focusOffset,
felement = fnode && fnode.nodeType === 1 && foffset > 0 ? fnode.childNodes[foffset -1] : undefined,
r = this.ownerDocument.createRange(),
prevTxt = texts.shift(),
curText = prevTxt ? texts.shift() : null;

if ((anode === fnode && foffset < aoffset) || (anode !== fnode && (anode.compareDocumentPosition(fnode) & Node.DOCUMENT_POSITION_PRECEDING))) {
if ((anode === fnode && foffset < aoffset) || (anode !== fnode && (anode.compareDocumentPosition(fnode) & Node.DOCUMENT_POSITION_PRECEDING) && !(anode.compareDocumentPosition(fnode) & Node.DOCUMENT_POSITION_CONTAINS))) {
fnode = [anode, anode = fnode][0];
foffset = [aoffset, aoffset = foffset][0];
}
Expand All @@ -442,13 +446,20 @@ var wysihtml5 = {
}
}

if (felement) {
foffset = Array.prototype.indexOf.call(felement.parentNode.childNodes, felement) + 1;
}

if (aelement) {
aoffset = Array.prototype.indexOf.call(aelement.parentNode.childNodes, aelement);
}

if (anode && anode.parentNode && fnode && fnode.parentNode) {
r.setStart(anode, aoffset);
r.setEnd(fnode, foffset);
s.removeAllRanges();
s.addRange(r);
}

};
Node.prototype.normalize = nf;
};
Expand Down
19 changes: 15 additions & 4 deletions vendor/assets/javascripts/wysihtml.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license wysihtml v0.5.0-beta12
* @license wysihtml v0.5.0-beta13
* https://github.com/Voog/wysihtml
*
* Author: Christopher Blum (https://github.com/tiff)
Expand All @@ -10,7 +10,7 @@
*
*/
var wysihtml5 = {
version: "0.5.0-beta12",
version: "0.5.0-beta13",

// namespaces
commands: {},
Expand Down Expand Up @@ -405,20 +405,24 @@ var wysihtml5 = {
return all;
};



var normalizeFix = function() {
var f = Node.prototype.normalize;
var nf = function() {
var texts = getTextNodes(this),
s = this.ownerDocument.defaultView.getSelection(),
anode = s.anchorNode,
aoffset = s.anchorOffset,
aelement = anode && anode.nodeType === 1 && anode.childNodes.length > 0 ? anode.childNodes[aoffset] : undefined,
fnode = s.focusNode,
foffset = s.focusOffset,
felement = fnode && fnode.nodeType === 1 && foffset > 0 ? fnode.childNodes[foffset -1] : undefined,
r = this.ownerDocument.createRange(),
prevTxt = texts.shift(),
curText = prevTxt ? texts.shift() : null;

if ((anode === fnode && foffset < aoffset) || (anode !== fnode && (anode.compareDocumentPosition(fnode) & Node.DOCUMENT_POSITION_PRECEDING))) {
if ((anode === fnode && foffset < aoffset) || (anode !== fnode && (anode.compareDocumentPosition(fnode) & Node.DOCUMENT_POSITION_PRECEDING) && !(anode.compareDocumentPosition(fnode) & Node.DOCUMENT_POSITION_CONTAINS))) {
fnode = [anode, anode = fnode][0];
foffset = [aoffset, aoffset = foffset][0];
}
Expand All @@ -442,13 +446,20 @@ var wysihtml5 = {
}
}

if (felement) {
foffset = Array.prototype.indexOf.call(felement.parentNode.childNodes, felement) + 1;
}

if (aelement) {
aoffset = Array.prototype.indexOf.call(aelement.parentNode.childNodes, aelement);
}

if (anode && anode.parentNode && fnode && fnode.parentNode) {
r.setStart(anode, aoffset);
r.setEnd(fnode, foffset);
s.removeAllRanges();
s.addRange(r);
}

};
Node.prototype.normalize = nf;
};
Expand Down

0 comments on commit 4c97ec8

Please sign in to comment.