wysihtml-rails 0.5.0.beta12 → 0.5.0.beta13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64171b06f3c46b4089c9c548bb95a507de396ea4
4
- data.tar.gz: 7559f9afd8744d42fc5d180e8df237055b35dd5d
3
+ metadata.gz: a79f93a11f62b9a5968cc94d9c2c7f8351cb9b7e
4
+ data.tar.gz: 49601e86e3255bcc8bbc4b15f79f2d828110da70
5
5
  SHA512:
6
- metadata.gz: 0c6f3f07ac3e718c699fd894e94812c6cc06da6f099c750bf4355d85f2c4e1b1c2484f035ffe663e11c7ddfb3c09fe0cbf78c60846dc34718f369535c7cc2de8
7
- data.tar.gz: efecb729c9262b867e0dcc0b7aaa6b85f1470f0d51e145e03aa571d641df54f19f4b523d12fc6b4a5dfd644d2e585721476fc8ef3575778d0c412382bfbdb751
6
+ metadata.gz: b86153a882e2772ac3082297ab25a72e863d8a528573c49e2e5676137575afc7d033aa019ec0453b8dafda8f0b9e112a4ee3aa4d7f5e58994c780f40de6565e8
7
+ data.tar.gz: b73e798b9da47ad9080e49c9adf227839dd453f57e80149d4f2ec1b7f8afcf24640d7d83b293eb0cc4ab534aff941dbe46700d3e62bc4d4cfcb23f3582f4d859
@@ -1,5 +1,5 @@
1
1
  module Wysihtml
2
2
  module Rails
3
- VERSION = "0.5.0.beta12"
3
+ VERSION = "0.5.0.beta13"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license wysihtml v0.5.0-beta12
2
+ * @license wysihtml v0.5.0-beta13
3
3
  * https://github.com/Voog/wysihtml
4
4
  *
5
5
  * Author: Christopher Blum (https://github.com/tiff)
@@ -10,7 +10,7 @@
10
10
  *
11
11
  */
12
12
  var wysihtml5 = {
13
- version: "0.5.0-beta12",
13
+ version: "0.5.0-beta13",
14
14
 
15
15
  // namespaces
16
16
  commands: {},
@@ -405,6 +405,8 @@ var wysihtml5 = {
405
405
  return all;
406
406
  };
407
407
 
408
+
409
+
408
410
  var normalizeFix = function() {
409
411
  var f = Node.prototype.normalize;
410
412
  var nf = function() {
@@ -412,13 +414,15 @@ var wysihtml5 = {
412
414
  s = this.ownerDocument.defaultView.getSelection(),
413
415
  anode = s.anchorNode,
414
416
  aoffset = s.anchorOffset,
417
+ aelement = anode && anode.nodeType === 1 && anode.childNodes.length > 0 ? anode.childNodes[aoffset] : undefined,
415
418
  fnode = s.focusNode,
416
419
  foffset = s.focusOffset,
420
+ felement = fnode && fnode.nodeType === 1 && foffset > 0 ? fnode.childNodes[foffset -1] : undefined,
417
421
  r = this.ownerDocument.createRange(),
418
422
  prevTxt = texts.shift(),
419
423
  curText = prevTxt ? texts.shift() : null;
420
424
 
421
- if ((anode === fnode && foffset < aoffset) || (anode !== fnode && (anode.compareDocumentPosition(fnode) & Node.DOCUMENT_POSITION_PRECEDING))) {
425
+ if ((anode === fnode && foffset < aoffset) || (anode !== fnode && (anode.compareDocumentPosition(fnode) & Node.DOCUMENT_POSITION_PRECEDING) && !(anode.compareDocumentPosition(fnode) & Node.DOCUMENT_POSITION_CONTAINS))) {
422
426
  fnode = [anode, anode = fnode][0];
423
427
  foffset = [aoffset, aoffset = foffset][0];
424
428
  }
@@ -442,13 +446,20 @@ var wysihtml5 = {
442
446
  }
443
447
  }
444
448
 
449
+ if (felement) {
450
+ foffset = Array.prototype.indexOf.call(felement.parentNode.childNodes, felement) + 1;
451
+ }
452
+
453
+ if (aelement) {
454
+ aoffset = Array.prototype.indexOf.call(aelement.parentNode.childNodes, aelement);
455
+ }
456
+
445
457
  if (anode && anode.parentNode && fnode && fnode.parentNode) {
446
458
  r.setStart(anode, aoffset);
447
459
  r.setEnd(fnode, foffset);
448
460
  s.removeAllRanges();
449
461
  s.addRange(r);
450
462
  }
451
-
452
463
  };
453
464
  Node.prototype.normalize = nf;
454
465
  };
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license wysihtml v0.5.0-beta12
2
+ * @license wysihtml v0.5.0-beta13
3
3
  * https://github.com/Voog/wysihtml
4
4
  *
5
5
  * Author: Christopher Blum (https://github.com/tiff)
@@ -10,7 +10,7 @@
10
10
  *
11
11
  */
12
12
  var wysihtml5 = {
13
- version: "0.5.0-beta12",
13
+ version: "0.5.0-beta13",
14
14
 
15
15
  // namespaces
16
16
  commands: {},
@@ -405,6 +405,8 @@ var wysihtml5 = {
405
405
  return all;
406
406
  };
407
407
 
408
+
409
+
408
410
  var normalizeFix = function() {
409
411
  var f = Node.prototype.normalize;
410
412
  var nf = function() {
@@ -412,13 +414,15 @@ var wysihtml5 = {
412
414
  s = this.ownerDocument.defaultView.getSelection(),
413
415
  anode = s.anchorNode,
414
416
  aoffset = s.anchorOffset,
417
+ aelement = anode && anode.nodeType === 1 && anode.childNodes.length > 0 ? anode.childNodes[aoffset] : undefined,
415
418
  fnode = s.focusNode,
416
419
  foffset = s.focusOffset,
420
+ felement = fnode && fnode.nodeType === 1 && foffset > 0 ? fnode.childNodes[foffset -1] : undefined,
417
421
  r = this.ownerDocument.createRange(),
418
422
  prevTxt = texts.shift(),
419
423
  curText = prevTxt ? texts.shift() : null;
420
424
 
421
- if ((anode === fnode && foffset < aoffset) || (anode !== fnode && (anode.compareDocumentPosition(fnode) & Node.DOCUMENT_POSITION_PRECEDING))) {
425
+ if ((anode === fnode && foffset < aoffset) || (anode !== fnode && (anode.compareDocumentPosition(fnode) & Node.DOCUMENT_POSITION_PRECEDING) && !(anode.compareDocumentPosition(fnode) & Node.DOCUMENT_POSITION_CONTAINS))) {
422
426
  fnode = [anode, anode = fnode][0];
423
427
  foffset = [aoffset, aoffset = foffset][0];
424
428
  }
@@ -442,13 +446,20 @@ var wysihtml5 = {
442
446
  }
443
447
  }
444
448
 
449
+ if (felement) {
450
+ foffset = Array.prototype.indexOf.call(felement.parentNode.childNodes, felement) + 1;
451
+ }
452
+
453
+ if (aelement) {
454
+ aoffset = Array.prototype.indexOf.call(aelement.parentNode.childNodes, aelement);
455
+ }
456
+
445
457
  if (anode && anode.parentNode && fnode && fnode.parentNode) {
446
458
  r.setStart(anode, aoffset);
447
459
  r.setEnd(fnode, foffset);
448
460
  s.removeAllRanges();
449
461
  s.addRange(r);
450
462
  }
451
-
452
463
  };
453
464
  Node.prototype.normalize = nf;
454
465
  };
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wysihtml-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0.beta12
4
+ version: 0.5.0.beta13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanel Jakobsoo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-03 00:00:00.000000000 Z
11
+ date: 2015-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties