Skip to content

Commit 45bec62

Browse files
author
Oliver Pulges
committed
Update version to v0.4.15
1 parent 8893fad commit 45bec62

File tree

3 files changed

+59
-19
lines changed

3 files changed

+59
-19
lines changed

lib/wysihtml5x/rails/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Wysihtml5x
22
module Rails
3-
VERSION = "0.4.14"
3+
VERSION = "0.4.15"
44
end
55
end

vendor/assets/javascripts/wysihtml5x-toolbar.js

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if(!Array.isArray) {
2525
return Object.prototype.toString.call(arg) === '[object Array]';
2626
};
2727
};/**
28-
* @license wysihtml5x v0.4.14
28+
* @license wysihtml5x v0.4.15
2929
* https://github.com/Edicy/wysihtml5
3030
*
3131
* Author: Christopher Blum (https://github.com/tiff)
@@ -36,7 +36,7 @@ if(!Array.isArray) {
3636
*
3737
*/
3838
var wysihtml5 = {
39-
version: "0.4.14",
39+
version: "0.4.15",
4040

4141
// namespaces
4242
commands: {},
@@ -8325,15 +8325,15 @@ wysihtml5.dom.getPastedHtml = function(event) {
83258325
wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) {
83268326
var selBookmark = composer.selection.getBookmark(),
83278327
doc = composer.element.ownerDocument,
8328-
cleanerDiv = coc.createElement('DIV');
8328+
cleanerDiv = doc.createElement('DIV');
83298329

8330+
doc.body.appendChild(cleanerDiv);
8331+
83308332
cleanerDiv.style.width = "1px";
83318333
cleanerDiv.style.height = "1px";
8332-
cleanerDiv.style.visibility = "hidden";
83338334
cleanerDiv.style.overflow = "hidden";
83348335

83358336
cleanerDiv.setAttribute('contenteditable', 'true');
8336-
doc.body.appendChild(cleanerDiv);
83378337
cleanerDiv.focus();
83388338

83398339
setTimeout(function () {
@@ -9491,6 +9491,10 @@ wysihtml5.quirks.ensureProperClearing = (function() {
94919491
return this.getSelection().isCollapsed;
94929492
},
94939493

9494+
getHtml: function() {
9495+
return this.getSelection().toHtml();
9496+
},
9497+
94949498
isEndToEndInNode: function(nodeNames) {
94959499
var range = this.getRange(),
94969500
parentElement = range.commonAncestorContainer,
@@ -12863,11 +12867,22 @@ wysihtml5.views.View = Base.extend(
1286312867
});
1286412868

1286512869
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);
1286912871
});
1287012872

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+
1287112886
// --------- neword event ---------
1287212887
dom.observe(element, "keyup", function(event) {
1287312888
var keyCode = event.keyCode;
@@ -13248,7 +13263,12 @@ wysihtml5.views.View = Base.extend(
1324813263
contentEditableMode: false,
1324913264
// Classname of container that editor should not touch and pass through
1325013265
// 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">'
1325213272
};
1325313273

1325413274
wysihtml5.Editor = wysihtml5.lang.Dispatcher.extend(

vendor/assets/javascripts/wysihtml5x.js

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if(!Array.isArray) {
2525
return Object.prototype.toString.call(arg) === '[object Array]';
2626
};
2727
};/**
28-
* @license wysihtml5x v0.4.14
28+
* @license wysihtml5x v0.4.15
2929
* https://github.com/Edicy/wysihtml5
3030
*
3131
* Author: Christopher Blum (https://github.com/tiff)
@@ -36,7 +36,7 @@ if(!Array.isArray) {
3636
*
3737
*/
3838
var wysihtml5 = {
39-
version: "0.4.14",
39+
version: "0.4.15",
4040

4141
// namespaces
4242
commands: {},
@@ -8325,15 +8325,15 @@ wysihtml5.dom.getPastedHtml = function(event) {
83258325
wysihtml5.dom.getPastedHtmlWithDiv = function (composer, f) {
83268326
var selBookmark = composer.selection.getBookmark(),
83278327
doc = composer.element.ownerDocument,
8328-
cleanerDiv = coc.createElement('DIV');
8328+
cleanerDiv = doc.createElement('DIV');
83298329

8330+
doc.body.appendChild(cleanerDiv);
8331+
83308332
cleanerDiv.style.width = "1px";
83318333
cleanerDiv.style.height = "1px";
8332-
cleanerDiv.style.visibility = "hidden";
83338334
cleanerDiv.style.overflow = "hidden";
83348335

83358336
cleanerDiv.setAttribute('contenteditable', 'true');
8336-
doc.body.appendChild(cleanerDiv);
83378337
cleanerDiv.focus();
83388338

83398339
setTimeout(function () {
@@ -9491,6 +9491,10 @@ wysihtml5.quirks.ensureProperClearing = (function() {
94919491
return this.getSelection().isCollapsed;
94929492
},
94939493

9494+
getHtml: function() {
9495+
return this.getSelection().toHtml();
9496+
},
9497+
94949498
isEndToEndInNode: function(nodeNames) {
94959499
var range = this.getRange(),
94969500
parentElement = range.commonAncestorContainer,
@@ -12863,11 +12867,22 @@ wysihtml5.views.View = Base.extend(
1286312867
});
1286412868

1286512869
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);
1286912871
});
1287012872

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+
1287112886
// --------- neword event ---------
1287212887
dom.observe(element, "keyup", function(event) {
1287312888
var keyCode = event.keyCode;
@@ -13248,7 +13263,12 @@ wysihtml5.views.View = Base.extend(
1324813263
contentEditableMode: false,
1324913264
// Classname of container that editor should not touch and pass through
1325013265
// 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">'
1325213272
};
1325313273

1325413274
wysihtml5.Editor = wysihtml5.lang.Dispatcher.extend(

0 commit comments

Comments
 (0)