wysihtml-rails 0.5.0.beta9 → 0.5.0.beta10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wysihtml/rails/version.rb +1 -1
- data/vendor/assets/javascripts/wysihtml-toolbar.js +66 -13
- data/vendor/assets/javascripts/wysihtml.js +65 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81549cbb9a36c9d74e052ce4fb1ca5c0b232daa6
|
4
|
+
data.tar.gz: 0cb8580a29fa4667a6afc9068f8839138a8612f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ed9c1cadd3b1e82d0bed2bb8d30c54f943193ad80aa96ec79efd3292dd94f3740dae8da8e512daf1f36c28100c81aceb09ac6b6dd85dd74789f7e500221f022
|
7
|
+
data.tar.gz: 3d4c341657f1be7211eedcb52b0bce809b495e328b460ac46f6fa14cb57572958b65bd7d43f5c0fe33d05f1a855f1637cc882f2e88b43eb7521b21068769e4bc
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license wysihtml v0.5.0-
|
2
|
+
* @license wysihtml v0.5.0-beta10
|
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-
|
13
|
+
version: "0.5.0-beta10",
|
14
14
|
|
15
15
|
// namespaces
|
16
16
|
commands: {},
|
@@ -5898,6 +5898,17 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) {
|
|
5898
5898
|
emptyTextNode: function(ignoreWhitespace) {
|
5899
5899
|
var regx = ignoreWhitespace ? (/^\s*$/g) : (/^[\r\n]*$/g);
|
5900
5900
|
return node.nodeType === wysihtml5.TEXT_NODE && (regx).test(node.data);
|
5901
|
+
},
|
5902
|
+
|
5903
|
+
visible: function() {
|
5904
|
+
var isVisible = !(/^\s*$/g).test(wysihtml5.dom.getTextContent(node));
|
5905
|
+
|
5906
|
+
if (!isVisible) {
|
5907
|
+
if (node.nodeType === 1 && node.querySelector('img, br, hr, object, embed, canvas, input, textarea')) {
|
5908
|
+
isVisible = true;
|
5909
|
+
}
|
5910
|
+
}
|
5911
|
+
return isVisible;
|
5901
5912
|
}
|
5902
5913
|
},
|
5903
5914
|
|
@@ -10213,7 +10224,7 @@ wysihtml5.quirks.ensureProperClearing = (function() {
|
|
10213
10224
|
|
10214
10225
|
// Empty elements are cleaned up from extracted content
|
10215
10226
|
for (var i = childNodes.length; i --;) {
|
10216
|
-
if (
|
10227
|
+
if (!wysihtml5.dom.domNode(childNodes[i]).is.visible()) {
|
10217
10228
|
contentAfterRangeStart.removeChild(childNodes[i]);
|
10218
10229
|
}
|
10219
10230
|
}
|
@@ -10237,11 +10248,11 @@ wysihtml5.quirks.ensureProperClearing = (function() {
|
|
10237
10248
|
range.setEndAfter(element);
|
10238
10249
|
}
|
10239
10250
|
|
10240
|
-
if ((
|
10241
|
-
if (element
|
10251
|
+
if (!wysihtml5.dom.domNode(element).is.visible()) {
|
10252
|
+
if (wysihtml5.dom.getTextContent(element) === '') {
|
10242
10253
|
element.parentNode.removeChild(element);
|
10243
10254
|
} else {
|
10244
|
-
|
10255
|
+
element.parentNode.replaceChild(this.doc.createTextNode(" "), element);
|
10245
10256
|
}
|
10246
10257
|
}
|
10247
10258
|
|
@@ -11651,8 +11662,10 @@ wysihtml5.Commands = Base.extend(
|
|
11651
11662
|
var dom = wysihtml5.dom,
|
11652
11663
|
// When the caret is within a H1 and the H4 is invoked, the H1 should turn into H4
|
11653
11664
|
// instead of creating a H4 within a H1 which would result in semantically invalid html
|
11654
|
-
UNNESTABLE_BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre"
|
11655
|
-
BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre, div, blockquote"
|
11665
|
+
UNNESTABLE_BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre",
|
11666
|
+
BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre, div, blockquote",
|
11667
|
+
INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u";
|
11668
|
+
|
11656
11669
|
|
11657
11670
|
// Removes empty block level elements
|
11658
11671
|
function cleanup(composer) {
|
@@ -11687,6 +11700,35 @@ wysihtml5.Commands = Base.extend(
|
|
11687
11700
|
return block;
|
11688
11701
|
}
|
11689
11702
|
|
11703
|
+
function cloneOuterInlines(node, container) {
|
11704
|
+
var n = node,
|
11705
|
+
innerNode,
|
11706
|
+
parentNode,
|
11707
|
+
el = null,
|
11708
|
+
el2;
|
11709
|
+
|
11710
|
+
while (n && container && n !== container) {
|
11711
|
+
if (n.nodeType === 1 && n.matches(INLINE_ELEMENTS)) {
|
11712
|
+
parentNode = n;
|
11713
|
+
if (el === null) {
|
11714
|
+
el = n.cloneNode(false);
|
11715
|
+
innerNode = el;
|
11716
|
+
} else {
|
11717
|
+
el2 = n.cloneNode(false);
|
11718
|
+
el2.appendChild(el);
|
11719
|
+
el = el2;
|
11720
|
+
}
|
11721
|
+
}
|
11722
|
+
n = n.parentNode;
|
11723
|
+
}
|
11724
|
+
|
11725
|
+
return {
|
11726
|
+
parent: parentNode,
|
11727
|
+
outerNode: el,
|
11728
|
+
innerNode: innerNode
|
11729
|
+
};
|
11730
|
+
}
|
11731
|
+
|
11690
11732
|
// Formats an element according to options nodeName, className, styleProperty, styleValue
|
11691
11733
|
// If element is not defined, creates new element
|
11692
11734
|
// if opotions is null, remove format instead
|
@@ -11892,13 +11934,24 @@ wysihtml5.Commands = Base.extend(
|
|
11892
11934
|
|
11893
11935
|
blocks = wysihtml5.lang.array(fragment.childNodes).get();
|
11894
11936
|
}
|
11895
|
-
|
11896
11937
|
if (firstOuterBlock) {
|
11897
11938
|
// If selection starts inside un-nestable block, split-escape the unnestable point and insert node between
|
11898
11939
|
composer.selection.splitElementAtCaret(firstOuterBlock, fragment);
|
11899
11940
|
} else {
|
11900
|
-
//
|
11901
|
-
|
11941
|
+
// Ensure node does not get inserted into an inline where it is not allowed
|
11942
|
+
var outerInlines = cloneOuterInlines(rangeStartContainer, composer.element);
|
11943
|
+
if (outerInlines.outerNode && outerInlines.innerNode && outerInlines.parent) {
|
11944
|
+
if (fragment.childNodes.length === 1) {
|
11945
|
+
while(fragment.firstChild.firstChild) {
|
11946
|
+
outerInlines.innerNode.appendChild(fragment.firstChild.firstChild);
|
11947
|
+
}
|
11948
|
+
fragment.firstChild.appendChild(outerInlines.outerNode);
|
11949
|
+
}
|
11950
|
+
composer.selection.splitElementAtCaret(outerInlines.parent, fragment);
|
11951
|
+
} else {
|
11952
|
+
// Otherwise just insert
|
11953
|
+
r.insertNode(fragment);
|
11954
|
+
}
|
11902
11955
|
}
|
11903
11956
|
|
11904
11957
|
return blocks;
|
@@ -12067,7 +12120,7 @@ wysihtml5.Commands = Base.extend(
|
|
12067
12120
|
(function(wysihtml5) {
|
12068
12121
|
|
12069
12122
|
var defaultTag = "SPAN",
|
12070
|
-
INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select",
|
12123
|
+
INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u",
|
12071
12124
|
queryAliasMap = {
|
12072
12125
|
"b": "b, strong",
|
12073
12126
|
"strong": "b, strong",
|
@@ -15569,7 +15622,7 @@ wysihtml5.views.View = Base.extend(
|
|
15569
15622
|
this.elementToChange = null;
|
15570
15623
|
dom.removeClass(this.link, CLASS_NAME_OPENED);
|
15571
15624
|
this.container.style.display = "none";
|
15572
|
-
this.fire("
|
15625
|
+
this.fire("cancel");
|
15573
15626
|
}
|
15574
15627
|
});
|
15575
15628
|
})(wysihtml5);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license wysihtml v0.5.0-
|
2
|
+
* @license wysihtml v0.5.0-beta10
|
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-
|
13
|
+
version: "0.5.0-beta10",
|
14
14
|
|
15
15
|
// namespaces
|
16
16
|
commands: {},
|
@@ -5898,6 +5898,17 @@ wysihtml5.dom.copyAttributes = function(attributesToCopy) {
|
|
5898
5898
|
emptyTextNode: function(ignoreWhitespace) {
|
5899
5899
|
var regx = ignoreWhitespace ? (/^\s*$/g) : (/^[\r\n]*$/g);
|
5900
5900
|
return node.nodeType === wysihtml5.TEXT_NODE && (regx).test(node.data);
|
5901
|
+
},
|
5902
|
+
|
5903
|
+
visible: function() {
|
5904
|
+
var isVisible = !(/^\s*$/g).test(wysihtml5.dom.getTextContent(node));
|
5905
|
+
|
5906
|
+
if (!isVisible) {
|
5907
|
+
if (node.nodeType === 1 && node.querySelector('img, br, hr, object, embed, canvas, input, textarea')) {
|
5908
|
+
isVisible = true;
|
5909
|
+
}
|
5910
|
+
}
|
5911
|
+
return isVisible;
|
5901
5912
|
}
|
5902
5913
|
},
|
5903
5914
|
|
@@ -10213,7 +10224,7 @@ wysihtml5.quirks.ensureProperClearing = (function() {
|
|
10213
10224
|
|
10214
10225
|
// Empty elements are cleaned up from extracted content
|
10215
10226
|
for (var i = childNodes.length; i --;) {
|
10216
|
-
if (
|
10227
|
+
if (!wysihtml5.dom.domNode(childNodes[i]).is.visible()) {
|
10217
10228
|
contentAfterRangeStart.removeChild(childNodes[i]);
|
10218
10229
|
}
|
10219
10230
|
}
|
@@ -10237,11 +10248,11 @@ wysihtml5.quirks.ensureProperClearing = (function() {
|
|
10237
10248
|
range.setEndAfter(element);
|
10238
10249
|
}
|
10239
10250
|
|
10240
|
-
if ((
|
10241
|
-
if (element
|
10251
|
+
if (!wysihtml5.dom.domNode(element).is.visible()) {
|
10252
|
+
if (wysihtml5.dom.getTextContent(element) === '') {
|
10242
10253
|
element.parentNode.removeChild(element);
|
10243
10254
|
} else {
|
10244
|
-
|
10255
|
+
element.parentNode.replaceChild(this.doc.createTextNode(" "), element);
|
10245
10256
|
}
|
10246
10257
|
}
|
10247
10258
|
|
@@ -11651,8 +11662,10 @@ wysihtml5.Commands = Base.extend(
|
|
11651
11662
|
var dom = wysihtml5.dom,
|
11652
11663
|
// When the caret is within a H1 and the H4 is invoked, the H1 should turn into H4
|
11653
11664
|
// instead of creating a H4 within a H1 which would result in semantically invalid html
|
11654
|
-
UNNESTABLE_BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre"
|
11655
|
-
BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre, div, blockquote"
|
11665
|
+
UNNESTABLE_BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre",
|
11666
|
+
BLOCK_ELEMENTS = "h1, h2, h3, h4, h5, h6, p, pre, div, blockquote",
|
11667
|
+
INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u";
|
11668
|
+
|
11656
11669
|
|
11657
11670
|
// Removes empty block level elements
|
11658
11671
|
function cleanup(composer) {
|
@@ -11687,6 +11700,35 @@ wysihtml5.Commands = Base.extend(
|
|
11687
11700
|
return block;
|
11688
11701
|
}
|
11689
11702
|
|
11703
|
+
function cloneOuterInlines(node, container) {
|
11704
|
+
var n = node,
|
11705
|
+
innerNode,
|
11706
|
+
parentNode,
|
11707
|
+
el = null,
|
11708
|
+
el2;
|
11709
|
+
|
11710
|
+
while (n && container && n !== container) {
|
11711
|
+
if (n.nodeType === 1 && n.matches(INLINE_ELEMENTS)) {
|
11712
|
+
parentNode = n;
|
11713
|
+
if (el === null) {
|
11714
|
+
el = n.cloneNode(false);
|
11715
|
+
innerNode = el;
|
11716
|
+
} else {
|
11717
|
+
el2 = n.cloneNode(false);
|
11718
|
+
el2.appendChild(el);
|
11719
|
+
el = el2;
|
11720
|
+
}
|
11721
|
+
}
|
11722
|
+
n = n.parentNode;
|
11723
|
+
}
|
11724
|
+
|
11725
|
+
return {
|
11726
|
+
parent: parentNode,
|
11727
|
+
outerNode: el,
|
11728
|
+
innerNode: innerNode
|
11729
|
+
};
|
11730
|
+
}
|
11731
|
+
|
11690
11732
|
// Formats an element according to options nodeName, className, styleProperty, styleValue
|
11691
11733
|
// If element is not defined, creates new element
|
11692
11734
|
// if opotions is null, remove format instead
|
@@ -11892,13 +11934,24 @@ wysihtml5.Commands = Base.extend(
|
|
11892
11934
|
|
11893
11935
|
blocks = wysihtml5.lang.array(fragment.childNodes).get();
|
11894
11936
|
}
|
11895
|
-
|
11896
11937
|
if (firstOuterBlock) {
|
11897
11938
|
// If selection starts inside un-nestable block, split-escape the unnestable point and insert node between
|
11898
11939
|
composer.selection.splitElementAtCaret(firstOuterBlock, fragment);
|
11899
11940
|
} else {
|
11900
|
-
//
|
11901
|
-
|
11941
|
+
// Ensure node does not get inserted into an inline where it is not allowed
|
11942
|
+
var outerInlines = cloneOuterInlines(rangeStartContainer, composer.element);
|
11943
|
+
if (outerInlines.outerNode && outerInlines.innerNode && outerInlines.parent) {
|
11944
|
+
if (fragment.childNodes.length === 1) {
|
11945
|
+
while(fragment.firstChild.firstChild) {
|
11946
|
+
outerInlines.innerNode.appendChild(fragment.firstChild.firstChild);
|
11947
|
+
}
|
11948
|
+
fragment.firstChild.appendChild(outerInlines.outerNode);
|
11949
|
+
}
|
11950
|
+
composer.selection.splitElementAtCaret(outerInlines.parent, fragment);
|
11951
|
+
} else {
|
11952
|
+
// Otherwise just insert
|
11953
|
+
r.insertNode(fragment);
|
11954
|
+
}
|
11902
11955
|
}
|
11903
11956
|
|
11904
11957
|
return blocks;
|
@@ -12067,7 +12120,7 @@ wysihtml5.Commands = Base.extend(
|
|
12067
12120
|
(function(wysihtml5) {
|
12068
12121
|
|
12069
12122
|
var defaultTag = "SPAN",
|
12070
|
-
INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select",
|
12123
|
+
INLINE_ELEMENTS = "b, big, i, small, tt, abbr, acronym, cite, code, dfn, em, kbd, strong, samp, var, a, bdo, br, q, span, sub, sup, button, label, textarea, input, select, u",
|
12071
12124
|
queryAliasMap = {
|
12072
12125
|
"b": "b, strong",
|
12073
12126
|
"strong": "b, strong",
|
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.
|
4
|
+
version: 0.5.0.beta10
|
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-06-
|
11
|
+
date: 2015-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|