wysihtml5x-rails 0.4.14 → 0.4.15

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: a62302cf2161ea8009dc686b2aac7ed5d21497d4
4
- data.tar.gz: dce9c57421e7dc5f036aa5b2e44f08e6ad7baeae
3
+ metadata.gz: ba024a9b86e38263a64b95fde68d97da99bb70af
4
+ data.tar.gz: 51a1b1328c88a9b8d764166cdcad14f676f498b5
5
5
  SHA512:
6
- metadata.gz: 88049254529377d2d42acac2aca88e318a482b59356d5c1d54e0a5a82cd2743a488bcce445750cf62e3b68fa52ef7975c077e770060abcea5aa4fafa4f9cc577
7
- data.tar.gz: 9c59577f4e2543ca81daa02696c33bba1d8b3d97679a4b340114cdfd7d5cb3d336f0f4dcbbde7d6e81acd3c615ca933063e5b0edb6d630336d57293222b1a6dd
6
+ metadata.gz: 90a924710a8ebbbd0181886aaf43c42dd4799197d6ebd73c3e870be8c54a3fb515adfa1f9e5c0b1f08a71f85bcf14e43d9a0c91307ac6cb905b9ca8473d449bd
7
+ data.tar.gz: 0a8bd1c1d27715c7241ca089ab9b30d3624ec343ebbbdf9f231f4df5ff474f6aac4966df5c06145d67552cbdc4e5b71cf1e91953a972c8c1cfc368edb9636f73
@@ -1,5 +1,5 @@
1
1
  module Wysihtml5x
2
2
  module Rails
3
- VERSION = "0.4.14"
3
+ VERSION = "0.4.15"
4
4
  end
5
5
  end
@@ -25,7 +25,7 @@ if(!Array.isArray) {
25
25
  return Object.prototype.toString.call(arg) === '[object Array]';
26
26
  };
27
27
  };/**
28
- * @license wysihtml5x v0.4.14
28
+ * @license wysihtml5x v0.4.15
29
29
  * https://github.com/Edicy/wysihtml5
30
30
  *
31
31
  * Author: Christopher Blum (https://github.com/tiff)
@@ -36,7 +36,7 @@ if(!Array.isArray) {
36
36
  *
37
37
  */
38
38
  var wysihtml5 = {
39
- version: "0.4.14",
39
+ version: "0.4.15",
40
40
 
41
41
  // namespaces
42
42
  commands: {},
@@ -8325,15 +8325,15 @@ wysihtml5.dom.getPastedHtml = function(event) {
8325
8325
  wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) {
8326
8326
  var selBookmark = composer.selection.getBookmark(),
8327
8327
  doc = composer.element.ownerDocument,
8328
- cleanerDiv = coc.createElement('DIV');
8328
+ cleanerDiv = doc.createElement('DIV');
8329
8329
 
8330
+ doc.body.appendChild(cleanerDiv);
8331
+
8330
8332
  cleanerDiv.style.width = "1px";
8331
8333
  cleanerDiv.style.height = "1px";
8332
- cleanerDiv.style.visibility = "hidden";
8333
8334
  cleanerDiv.style.overflow = "hidden";
8334
8335
 
8335
8336
  cleanerDiv.setAttribute('contenteditable', 'true');
8336
- doc.body.appendChild(cleanerDiv);
8337
8337
  cleanerDiv.focus();
8338
8338
 
8339
8339
  setTimeout(function () {
@@ -9491,6 +9491,10 @@ wysihtml5.quirks.ensureProperClearing = (function() {
9491
9491
  return this.getSelection().isCollapsed;
9492
9492
  },
9493
9493
 
9494
+ getHtml: function() {
9495
+ return this.getSelection().toHtml();
9496
+ },
9497
+
9494
9498
  isEndToEndInNode: function(nodeNames) {
9495
9499
  var range = this.getRange(),
9496
9500
  parentElement = range.commonAncestorContainer,
@@ -12863,11 +12867,22 @@ wysihtml5.views.View = Base.extend(
12863
12867
  });
12864
12868
 
12865
12869
  dom.observe(element, pasteEvents, function(event) {
12866
- //setTimeout(function() {
12867
- that.parent.fire(event.type, event).fire(event.type + ":composer", event);
12868
- //}, 0);
12870
+ that.parent.fire(event.type, event).fire(event.type + ":composer", event);
12869
12871
  });
12870
12872
 
12873
+
12874
+ if (this.config.copyedFromMarking) {
12875
+ // If supported the copied source is based directly on selection
12876
+ // Very useful for webkit based browsers where copy will otherwise contain a lot of code and styles based on whatever and not actually in selection.
12877
+ dom.observe(element, "copy", function(event) {
12878
+ if (event.clipboardData) {
12879
+ event.clipboardData.setData("text/html", that.config.copyedFromMarking + that.selection.getHtml());
12880
+ event.preventDefault();
12881
+ }
12882
+ that.parent.fire(event.type, event).fire(event.type + ":composer", event);
12883
+ });
12884
+ }
12885
+
12871
12886
  // --------- neword event ---------
12872
12887
  dom.observe(element, "keyup", function(event) {
12873
12888
  var keyCode = event.keyCode;
@@ -13248,7 +13263,12 @@ wysihtml5.views.View = Base.extend(
13248
13263
  contentEditableMode: false,
13249
13264
  // Classname of container that editor should not touch and pass through
13250
13265
  // Pass false to disable
13251
- uneditableContainerClassname: "wysihtml5-uneditable-container"
13266
+ uneditableContainerClassname: "wysihtml5-uneditable-container",
13267
+ // Browsers that support copied source handling will get a marking of the origin of the copied source (for determinig code cleanup rules on paste)
13268
+ // Also copied source is based directly on selection -
13269
+ // (very useful for webkit based browsers where copy will otherwise contain a lot of code and styles based on whatever and not actually in selection).
13270
+ // If falsy value is passed source override is also disabled
13271
+ copyedFromMarking: '<meta name="copied-from" content="wysihtml5">'
13252
13272
  };
13253
13273
 
13254
13274
  wysihtml5.Editor = wysihtml5.lang.Dispatcher.extend(
@@ -25,7 +25,7 @@ if(!Array.isArray) {
25
25
  return Object.prototype.toString.call(arg) === '[object Array]';
26
26
  };
27
27
  };/**
28
- * @license wysihtml5x v0.4.14
28
+ * @license wysihtml5x v0.4.15
29
29
  * https://github.com/Edicy/wysihtml5
30
30
  *
31
31
  * Author: Christopher Blum (https://github.com/tiff)
@@ -36,7 +36,7 @@ if(!Array.isArray) {
36
36
  *
37
37
  */
38
38
  var wysihtml5 = {
39
- version: "0.4.14",
39
+ version: "0.4.15",
40
40
 
41
41
  // namespaces
42
42
  commands: {},
@@ -8325,15 +8325,15 @@ wysihtml5.dom.getPastedHtml = function(event) {
8325
8325
  wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) {
8326
8326
  var selBookmark = composer.selection.getBookmark(),
8327
8327
  doc = composer.element.ownerDocument,
8328
- cleanerDiv = coc.createElement('DIV');
8328
+ cleanerDiv = doc.createElement('DIV');
8329
8329
 
8330
+ doc.body.appendChild(cleanerDiv);
8331
+
8330
8332
  cleanerDiv.style.width = "1px";
8331
8333
  cleanerDiv.style.height = "1px";
8332
- cleanerDiv.style.visibility = "hidden";
8333
8334
  cleanerDiv.style.overflow = "hidden";
8334
8335
 
8335
8336
  cleanerDiv.setAttribute('contenteditable', 'true');
8336
- doc.body.appendChild(cleanerDiv);
8337
8337
  cleanerDiv.focus();
8338
8338
 
8339
8339
  setTimeout(function () {
@@ -9491,6 +9491,10 @@ wysihtml5.quirks.ensureProperClearing = (function() {
9491
9491
  return this.getSelection().isCollapsed;
9492
9492
  },
9493
9493
 
9494
+ getHtml: function() {
9495
+ return this.getSelection().toHtml();
9496
+ },
9497
+
9494
9498
  isEndToEndInNode: function(nodeNames) {
9495
9499
  var range = this.getRange(),
9496
9500
  parentElement = range.commonAncestorContainer,
@@ -12863,11 +12867,22 @@ wysihtml5.views.View = Base.extend(
12863
12867
  });
12864
12868
 
12865
12869
  dom.observe(element, pasteEvents, function(event) {
12866
- //setTimeout(function() {
12867
- that.parent.fire(event.type, event).fire(event.type + ":composer", event);
12868
- //}, 0);
12870
+ that.parent.fire(event.type, event).fire(event.type + ":composer", event);
12869
12871
  });
12870
12872
 
12873
+
12874
+ if (this.config.copyedFromMarking) {
12875
+ // If supported the copied source is based directly on selection
12876
+ // Very useful for webkit based browsers where copy will otherwise contain a lot of code and styles based on whatever and not actually in selection.
12877
+ dom.observe(element, "copy", function(event) {
12878
+ if (event.clipboardData) {
12879
+ event.clipboardData.setData("text/html", that.config.copyedFromMarking + that.selection.getHtml());
12880
+ event.preventDefault();
12881
+ }
12882
+ that.parent.fire(event.type, event).fire(event.type + ":composer", event);
12883
+ });
12884
+ }
12885
+
12871
12886
  // --------- neword event ---------
12872
12887
  dom.observe(element, "keyup", function(event) {
12873
12888
  var keyCode = event.keyCode;
@@ -13248,7 +13263,12 @@ wysihtml5.views.View = Base.extend(
13248
13263
  contentEditableMode: false,
13249
13264
  // Classname of container that editor should not touch and pass through
13250
13265
  // Pass false to disable
13251
- uneditableContainerClassname: "wysihtml5-uneditable-container"
13266
+ uneditableContainerClassname: "wysihtml5-uneditable-container",
13267
+ // Browsers that support copied source handling will get a marking of the origin of the copied source (for determinig code cleanup rules on paste)
13268
+ // Also copied source is based directly on selection -
13269
+ // (very useful for webkit based browsers where copy will otherwise contain a lot of code and styles based on whatever and not actually in selection).
13270
+ // If falsy value is passed source override is also disabled
13271
+ copyedFromMarking: '<meta name="copied-from" content="wysihtml5">'
13252
13272
  };
13253
13273
 
13254
13274
  wysihtml5.Editor = wysihtml5.lang.Dispatcher.extend(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wysihtml5x-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.14
4
+ version: 0.4.15
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-09-10 00:00:00.000000000 Z
11
+ date: 2014-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties