diff --git a/lib/wysihtml5x/rails/version.rb b/lib/wysihtml5x/rails/version.rb
index a350d24..e7d7b6b 100644
--- a/lib/wysihtml5x/rails/version.rb
+++ b/lib/wysihtml5x/rails/version.rb
@@ -1,5 +1,5 @@
module Wysihtml5x
module Rails
- VERSION = "0.4.14"
+ VERSION = "0.4.15"
end
end
diff --git a/vendor/assets/javascripts/wysihtml5x-toolbar.js b/vendor/assets/javascripts/wysihtml5x-toolbar.js
index 90b1bb8..1a9ace3 100644
--- a/vendor/assets/javascripts/wysihtml5x-toolbar.js
+++ b/vendor/assets/javascripts/wysihtml5x-toolbar.js
@@ -25,7 +25,7 @@ if(!Array.isArray) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
};/**
- * @license wysihtml5x v0.4.14
+ * @license wysihtml5x v0.4.15
* https://github.com/Edicy/wysihtml5
*
* Author: Christopher Blum (https://github.com/tiff)
@@ -36,7 +36,7 @@ if(!Array.isArray) {
*
*/
var wysihtml5 = {
- version: "0.4.14",
+ version: "0.4.15",
// namespaces
commands: {},
@@ -8325,15 +8325,15 @@ wysihtml5.dom.getPastedHtml = function(event) {
wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) {
var selBookmark = composer.selection.getBookmark(),
doc = composer.element.ownerDocument,
- cleanerDiv = coc.createElement('DIV');
+ cleanerDiv = doc.createElement('DIV');
+ doc.body.appendChild(cleanerDiv);
+
cleanerDiv.style.width = "1px";
cleanerDiv.style.height = "1px";
- cleanerDiv.style.visibility = "hidden";
cleanerDiv.style.overflow = "hidden";
cleanerDiv.setAttribute('contenteditable', 'true');
- doc.body.appendChild(cleanerDiv);
cleanerDiv.focus();
setTimeout(function () {
@@ -9491,6 +9491,10 @@ wysihtml5.quirks.ensureProperClearing = (function() {
return this.getSelection().isCollapsed;
},
+ getHtml: function() {
+ return this.getSelection().toHtml();
+ },
+
isEndToEndInNode: function(nodeNames) {
var range = this.getRange(),
parentElement = range.commonAncestorContainer,
@@ -12863,11 +12867,22 @@ wysihtml5.views.View = Base.extend(
});
dom.observe(element, pasteEvents, function(event) {
- //setTimeout(function() {
- that.parent.fire(event.type, event).fire(event.type + ":composer", event);
- //}, 0);
+ that.parent.fire(event.type, event).fire(event.type + ":composer", event);
});
+
+ if (this.config.copyedFromMarking) {
+ // If supported the copied source is based directly on selection
+ // 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.
+ dom.observe(element, "copy", function(event) {
+ if (event.clipboardData) {
+ event.clipboardData.setData("text/html", that.config.copyedFromMarking + that.selection.getHtml());
+ event.preventDefault();
+ }
+ that.parent.fire(event.type, event).fire(event.type + ":composer", event);
+ });
+ }
+
// --------- neword event ---------
dom.observe(element, "keyup", function(event) {
var keyCode = event.keyCode;
@@ -13248,7 +13263,12 @@ wysihtml5.views.View = Base.extend(
contentEditableMode: false,
// Classname of container that editor should not touch and pass through
// Pass false to disable
- uneditableContainerClassname: "wysihtml5-uneditable-container"
+ uneditableContainerClassname: "wysihtml5-uneditable-container",
+ // Browsers that support copied source handling will get a marking of the origin of the copied source (for determinig code cleanup rules on paste)
+ // Also copied source is based directly on selection -
+ // (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).
+ // If falsy value is passed source override is also disabled
+ copyedFromMarking: ''
};
wysihtml5.Editor = wysihtml5.lang.Dispatcher.extend(
diff --git a/vendor/assets/javascripts/wysihtml5x.js b/vendor/assets/javascripts/wysihtml5x.js
index b8b3867..c413c9f 100644
--- a/vendor/assets/javascripts/wysihtml5x.js
+++ b/vendor/assets/javascripts/wysihtml5x.js
@@ -25,7 +25,7 @@ if(!Array.isArray) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
};/**
- * @license wysihtml5x v0.4.14
+ * @license wysihtml5x v0.4.15
* https://github.com/Edicy/wysihtml5
*
* Author: Christopher Blum (https://github.com/tiff)
@@ -36,7 +36,7 @@ if(!Array.isArray) {
*
*/
var wysihtml5 = {
- version: "0.4.14",
+ version: "0.4.15",
// namespaces
commands: {},
@@ -8325,15 +8325,15 @@ wysihtml5.dom.getPastedHtml = function(event) {
wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) {
var selBookmark = composer.selection.getBookmark(),
doc = composer.element.ownerDocument,
- cleanerDiv = coc.createElement('DIV');
+ cleanerDiv = doc.createElement('DIV');
+ doc.body.appendChild(cleanerDiv);
+
cleanerDiv.style.width = "1px";
cleanerDiv.style.height = "1px";
- cleanerDiv.style.visibility = "hidden";
cleanerDiv.style.overflow = "hidden";
cleanerDiv.setAttribute('contenteditable', 'true');
- doc.body.appendChild(cleanerDiv);
cleanerDiv.focus();
setTimeout(function () {
@@ -9491,6 +9491,10 @@ wysihtml5.quirks.ensureProperClearing = (function() {
return this.getSelection().isCollapsed;
},
+ getHtml: function() {
+ return this.getSelection().toHtml();
+ },
+
isEndToEndInNode: function(nodeNames) {
var range = this.getRange(),
parentElement = range.commonAncestorContainer,
@@ -12863,11 +12867,22 @@ wysihtml5.views.View = Base.extend(
});
dom.observe(element, pasteEvents, function(event) {
- //setTimeout(function() {
- that.parent.fire(event.type, event).fire(event.type + ":composer", event);
- //}, 0);
+ that.parent.fire(event.type, event).fire(event.type + ":composer", event);
});
+
+ if (this.config.copyedFromMarking) {
+ // If supported the copied source is based directly on selection
+ // 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.
+ dom.observe(element, "copy", function(event) {
+ if (event.clipboardData) {
+ event.clipboardData.setData("text/html", that.config.copyedFromMarking + that.selection.getHtml());
+ event.preventDefault();
+ }
+ that.parent.fire(event.type, event).fire(event.type + ":composer", event);
+ });
+ }
+
// --------- neword event ---------
dom.observe(element, "keyup", function(event) {
var keyCode = event.keyCode;
@@ -13248,7 +13263,12 @@ wysihtml5.views.View = Base.extend(
contentEditableMode: false,
// Classname of container that editor should not touch and pass through
// Pass false to disable
- uneditableContainerClassname: "wysihtml5-uneditable-container"
+ uneditableContainerClassname: "wysihtml5-uneditable-container",
+ // Browsers that support copied source handling will get a marking of the origin of the copied source (for determinig code cleanup rules on paste)
+ // Also copied source is based directly on selection -
+ // (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).
+ // If falsy value is passed source override is also disabled
+ copyedFromMarking: ''
};
wysihtml5.Editor = wysihtml5.lang.Dispatcher.extend(