wysihtml-rails 0.5.0.beta2 → 0.5.0.beta3

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: 267eee793c065a025baf524f402e873eef5cae91
4
- data.tar.gz: eb78cce4979a2cb6bcb168c101896d5e6601eaa1
3
+ metadata.gz: 80fb7a97bd3a8949601d855eb648fe70e04fb780
4
+ data.tar.gz: 7e3e5d9f5c94a4baf89d7f4194712475f34750db
5
5
  SHA512:
6
- metadata.gz: f9913fd89e5135d18bfcc84c6e01e24d2caf0958c423eac23aa1b862c4eaf4327ef4c7a1c476d5be0ae35780062deb5bcb9ecad2e8945c139079298c6b0842ea
7
- data.tar.gz: d9ac39c4a3a64b6dd779e943472439239afd73789de27acb936d029063a515c90aa01a7aee252c05c1f181082b645e03bb9d406982b53c7047dc32380c84eb10
6
+ metadata.gz: cf951f10fe24d21b4d61cd2fa1fc28c8c4e0090ab4fb72a13552e52c085ffc43a0b59a5b3a388226420702af3a97de074ee7ba1e51ad324ec0b6a062ff2480fc
7
+ data.tar.gz: 53662b435dd43a8a704fdc209f7ddd4aa8fbca1025768387e26aef6ef9b7d2e51bdeef1e506024f5fbb909f4145d8a58623771c2c08a706371280025d12f5a20
@@ -1,5 +1,5 @@
1
1
  module Wysihtml
2
2
  module Rails
3
- VERSION = "0.5.0.beta2"
3
+ VERSION = "0.5.0.beta3"
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  // TODO: in future try to replace most inline compability checks with polyfills for code readability
2
2
 
3
3
  // IE8 SUPPORT BLOCK
4
- // You can compile wuthout all this if IE8 is not needed
4
+ // You can compile without all this if IE8 is not needed
5
5
 
6
6
  // String trim for ie8
7
7
  if (!String.prototype.trim) {
@@ -321,9 +321,10 @@ if ("document" in self) {
321
321
 
322
322
  }(self));
323
323
 
324
- } else {
324
+ } else if ("DOMTokenList" in window) {
325
325
  // There is full or partial native classList support, so just check if we need
326
326
  // to normalize the add/remove and toggle APIs.
327
+ // DOMTokenList is expected to exist (removes conflicts with multiple polyfills present on site)
327
328
 
328
329
  (function() {
329
330
  "use strict";
@@ -376,7 +377,7 @@ if ("document" in self) {
376
377
  }
377
378
 
378
379
  ;/**
379
- * @license wysihtml5x v0.5.0-beta2
380
+ * @license wysihtml5x v0.5.0-beta3
380
381
  * https://github.com/Edicy/wysihtml5
381
382
  *
382
383
  * Author: Christopher Blum (https://github.com/tiff)
@@ -387,7 +388,7 @@ if ("document" in self) {
387
388
  *
388
389
  */
389
390
  var wysihtml5 = {
390
- version: "0.5.0-beta2",
391
+ version: "0.5.0-beta3",
391
392
 
392
393
  // namespaces
393
394
  commands: {},
@@ -9001,22 +9002,20 @@ wysihtml5.quirks.ensureProperClearing = (function() {
9001
9002
  cells: null,
9002
9003
  select: selectCells
9003
9004
  },
9004
- selection_class = "wysiwyg-tmp-selected-cell",
9005
- moveHandler = null,
9006
- upHandler = null;
9005
+ selection_class = "wysiwyg-tmp-selected-cell";
9007
9006
 
9008
9007
  function init () {
9009
-
9010
- dom.observe(editable, "mousedown", function(event) {
9011
- var target = wysihtml5.dom.getParentElement(event.target, { query: "td, th" });
9012
- if (target) {
9013
- handleSelectionMousedown(target);
9014
- }
9015
- });
9016
-
9008
+ editable.addEventListener("mousedown", handleMouseDown);
9017
9009
  return select;
9018
9010
  }
9019
9011
 
9012
+ var handleMouseDown = function(event) {
9013
+ var target = wysihtml5.dom.getParentElement(event.target, { query: "td, th" });
9014
+ if (target) {
9015
+ handleSelectionMousedown(target);
9016
+ }
9017
+ };
9018
+
9020
9019
  function handleSelectionMousedown (target) {
9021
9020
  select.start = target;
9022
9021
  select.end = target;
@@ -9026,8 +9025,8 @@ wysihtml5.quirks.ensureProperClearing = (function() {
9026
9025
  if (select.table) {
9027
9026
  removeCellSelections();
9028
9027
  dom.addClass(target, selection_class);
9029
- moveHandler = dom.observe(editable, "mousemove", handleMouseMove);
9030
- upHandler = dom.observe(editable, "mouseup", handleMouseUp);
9028
+ editable.addEventListener("mousemove", handleMouseMove);
9029
+ editable.addEventListener("mouseup", handleMouseUp);
9031
9030
  editor.fire("tableselectstart").fire("tableselectstart:composer");
9032
9031
  }
9033
9032
  }
@@ -9052,7 +9051,7 @@ wysihtml5.quirks.ensureProperClearing = (function() {
9052
9051
 
9053
9052
  function handleMouseMove (event) {
9054
9053
  var curTable = null,
9055
- cell = dom.getParentElement(event.target, { nodeName: "td, th" }),
9054
+ cell = dom.getParentElement(event.target, { query: "td, th" }),
9056
9055
  oldEnd;
9057
9056
 
9058
9057
  if (cell && select.table && select.start) {
@@ -9074,25 +9073,27 @@ wysihtml5.quirks.ensureProperClearing = (function() {
9074
9073
  }
9075
9074
 
9076
9075
  function handleMouseUp (event) {
9077
- moveHandler.stop();
9078
- upHandler.stop();
9076
+ editable.removeEventListener("mousemove", handleMouseMove);
9077
+ editable.removeEventListener("mouseup", handleMouseUp);
9079
9078
  editor.fire("tableselect").fire("tableselect:composer");
9080
9079
  setTimeout(function() {
9081
9080
  bindSideclick();
9082
9081
  },0);
9083
9082
  }
9084
9083
 
9084
+ var sideClickHandler = function(event) {
9085
+ editable.ownerDocument.removeEventListener("click", sideClickHandler);
9086
+ if (dom.getParentElement(event.target, { query: "table" }) != select.table) {
9087
+ removeCellSelections();
9088
+ select.table = null;
9089
+ select.start = null;
9090
+ select.end = null;
9091
+ editor.fire("tableunselect").fire("tableunselect:composer");
9092
+ }
9093
+ };
9094
+
9085
9095
  function bindSideclick () {
9086
- var sideClickHandler = dom.observe(editable.ownerDocument, "click", function(event) {
9087
- sideClickHandler.stop();
9088
- if (dom.getParentElement(event.target, { query: "table" }) != select.table) {
9089
- removeCellSelections();
9090
- select.table = null;
9091
- select.start = null;
9092
- select.end = null;
9093
- editor.fire("tableunselect").fire("tableunselect:composer");
9094
- }
9095
- });
9096
+ editable.ownerDocument.addEventListener("click", sideClickHandler);
9096
9097
  }
9097
9098
 
9098
9099
  function selectCells (start, end) {
@@ -12965,7 +12966,14 @@ wysihtml5.views.View = Base.extend(
12965
12966
  },
12966
12967
 
12967
12968
  cleanUp: function() {
12968
- this.parent.parse(this.element);
12969
+ var bookmark;
12970
+ if (this.selection) {
12971
+ bookmark = rangy.saveSelection(this.doc.defaultView || this.doc.parentWindow);
12972
+ }
12973
+ this.parent.parse(this.element);
12974
+ if (bookmark) {
12975
+ rangy.restoreSelection(bookmark);
12976
+ }
12969
12977
  },
12970
12978
 
12971
12979
  show: function() {
@@ -1,7 +1,7 @@
1
1
  // TODO: in future try to replace most inline compability checks with polyfills for code readability
2
2
 
3
3
  // IE8 SUPPORT BLOCK
4
- // You can compile wuthout all this if IE8 is not needed
4
+ // You can compile without all this if IE8 is not needed
5
5
 
6
6
  // String trim for ie8
7
7
  if (!String.prototype.trim) {
@@ -321,9 +321,10 @@ if ("document" in self) {
321
321
 
322
322
  }(self));
323
323
 
324
- } else {
324
+ } else if ("DOMTokenList" in window) {
325
325
  // There is full or partial native classList support, so just check if we need
326
326
  // to normalize the add/remove and toggle APIs.
327
+ // DOMTokenList is expected to exist (removes conflicts with multiple polyfills present on site)
327
328
 
328
329
  (function() {
329
330
  "use strict";
@@ -376,7 +377,7 @@ if ("document" in self) {
376
377
  }
377
378
 
378
379
  ;/**
379
- * @license wysihtml5x v0.5.0-beta2
380
+ * @license wysihtml5x v0.5.0-beta3
380
381
  * https://github.com/Edicy/wysihtml5
381
382
  *
382
383
  * Author: Christopher Blum (https://github.com/tiff)
@@ -387,7 +388,7 @@ if ("document" in self) {
387
388
  *
388
389
  */
389
390
  var wysihtml5 = {
390
- version: "0.5.0-beta2",
391
+ version: "0.5.0-beta3",
391
392
 
392
393
  // namespaces
393
394
  commands: {},
@@ -9001,22 +9002,20 @@ wysihtml5.quirks.ensureProperClearing = (function() {
9001
9002
  cells: null,
9002
9003
  select: selectCells
9003
9004
  },
9004
- selection_class = "wysiwyg-tmp-selected-cell",
9005
- moveHandler = null,
9006
- upHandler = null;
9005
+ selection_class = "wysiwyg-tmp-selected-cell";
9007
9006
 
9008
9007
  function init () {
9009
-
9010
- dom.observe(editable, "mousedown", function(event) {
9011
- var target = wysihtml5.dom.getParentElement(event.target, { query: "td, th" });
9012
- if (target) {
9013
- handleSelectionMousedown(target);
9014
- }
9015
- });
9016
-
9008
+ editable.addEventListener("mousedown", handleMouseDown);
9017
9009
  return select;
9018
9010
  }
9019
9011
 
9012
+ var handleMouseDown = function(event) {
9013
+ var target = wysihtml5.dom.getParentElement(event.target, { query: "td, th" });
9014
+ if (target) {
9015
+ handleSelectionMousedown(target);
9016
+ }
9017
+ };
9018
+
9020
9019
  function handleSelectionMousedown (target) {
9021
9020
  select.start = target;
9022
9021
  select.end = target;
@@ -9026,8 +9025,8 @@ wysihtml5.quirks.ensureProperClearing = (function() {
9026
9025
  if (select.table) {
9027
9026
  removeCellSelections();
9028
9027
  dom.addClass(target, selection_class);
9029
- moveHandler = dom.observe(editable, "mousemove", handleMouseMove);
9030
- upHandler = dom.observe(editable, "mouseup", handleMouseUp);
9028
+ editable.addEventListener("mousemove", handleMouseMove);
9029
+ editable.addEventListener("mouseup", handleMouseUp);
9031
9030
  editor.fire("tableselectstart").fire("tableselectstart:composer");
9032
9031
  }
9033
9032
  }
@@ -9052,7 +9051,7 @@ wysihtml5.quirks.ensureProperClearing = (function() {
9052
9051
 
9053
9052
  function handleMouseMove (event) {
9054
9053
  var curTable = null,
9055
- cell = dom.getParentElement(event.target, { nodeName: "td, th" }),
9054
+ cell = dom.getParentElement(event.target, { query: "td, th" }),
9056
9055
  oldEnd;
9057
9056
 
9058
9057
  if (cell && select.table && select.start) {
@@ -9074,25 +9073,27 @@ wysihtml5.quirks.ensureProperClearing = (function() {
9074
9073
  }
9075
9074
 
9076
9075
  function handleMouseUp (event) {
9077
- moveHandler.stop();
9078
- upHandler.stop();
9076
+ editable.removeEventListener("mousemove", handleMouseMove);
9077
+ editable.removeEventListener("mouseup", handleMouseUp);
9079
9078
  editor.fire("tableselect").fire("tableselect:composer");
9080
9079
  setTimeout(function() {
9081
9080
  bindSideclick();
9082
9081
  },0);
9083
9082
  }
9084
9083
 
9084
+ var sideClickHandler = function(event) {
9085
+ editable.ownerDocument.removeEventListener("click", sideClickHandler);
9086
+ if (dom.getParentElement(event.target, { query: "table" }) != select.table) {
9087
+ removeCellSelections();
9088
+ select.table = null;
9089
+ select.start = null;
9090
+ select.end = null;
9091
+ editor.fire("tableunselect").fire("tableunselect:composer");
9092
+ }
9093
+ };
9094
+
9085
9095
  function bindSideclick () {
9086
- var sideClickHandler = dom.observe(editable.ownerDocument, "click", function(event) {
9087
- sideClickHandler.stop();
9088
- if (dom.getParentElement(event.target, { query: "table" }) != select.table) {
9089
- removeCellSelections();
9090
- select.table = null;
9091
- select.start = null;
9092
- select.end = null;
9093
- editor.fire("tableunselect").fire("tableunselect:composer");
9094
- }
9095
- });
9096
+ editable.ownerDocument.addEventListener("click", sideClickHandler);
9096
9097
  }
9097
9098
 
9098
9099
  function selectCells (start, end) {
@@ -12965,7 +12966,14 @@ wysihtml5.views.View = Base.extend(
12965
12966
  },
12966
12967
 
12967
12968
  cleanUp: function() {
12968
- this.parent.parse(this.element);
12969
+ var bookmark;
12970
+ if (this.selection) {
12971
+ bookmark = rangy.saveSelection(this.doc.defaultView || this.doc.parentWindow);
12972
+ }
12973
+ this.parent.parse(this.element);
12974
+ if (bookmark) {
12975
+ rangy.restoreSelection(bookmark);
12976
+ }
12969
12977
  },
12970
12978
 
12971
12979
  show: function() {
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.beta2
4
+ version: 0.5.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanel Jakobsoo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-11 00:00:00.000000000 Z
11
+ date: 2014-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties