lexxy 0.1.16.beta → 0.1.18.beta
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/app/assets/javascript/lexxy.js +51 -12
- data/app/assets/javascript/lexxy.js.br +0 -0
- data/app/assets/javascript/lexxy.js.gz +0 -0
- data/app/assets/javascript/lexxy.min.js +1 -1
- data/app/assets/javascript/lexxy.min.js.br +0 -0
- data/app/assets/javascript/lexxy.min.js.gz +0 -0
- data/lib/lexxy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d349d41ecbbcda9310a94ca35f54b0c888dd484a6edb7728a34c02a1576f0a36
|
|
4
|
+
data.tar.gz: b806d34fb4fc44969d94f1d625fbb0edf2410ab4eb91c3d71abe66170bc3483b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7062ff796823d7218ad93683b81bc215813a9c7844da2d57626da33021fb6c25a4049d8b7f534a28df2f210a7f8ae2f9f19324f542417743556e9955871ab606
|
|
7
|
+
data.tar.gz: 38049c719a2bce471c97281f034040aaf26fd2c673b0839d9a36f44568405f5200bb2250be665ffba747db2f637f6711390881558ac199fcb0a566bf46d4a640
|
|
@@ -6132,7 +6132,19 @@ class CommandDispatcher {
|
|
|
6132
6132
|
}
|
|
6133
6133
|
|
|
6134
6134
|
dispatchLink(url) {
|
|
6135
|
-
this
|
|
6135
|
+
this.editor.update(() => {
|
|
6136
|
+
const selection = Lr();
|
|
6137
|
+
if (!yr(selection)) return
|
|
6138
|
+
|
|
6139
|
+
if (selection.isCollapsed()) {
|
|
6140
|
+
const autoLinkNode = I$1(url);
|
|
6141
|
+
const textNode = sr(url);
|
|
6142
|
+
autoLinkNode.append(textNode);
|
|
6143
|
+
selection.insertNodes([ autoLinkNode ]);
|
|
6144
|
+
} else {
|
|
6145
|
+
J$1(url);
|
|
6146
|
+
}
|
|
6147
|
+
});
|
|
6136
6148
|
}
|
|
6137
6149
|
|
|
6138
6150
|
dispatchUnlink() {
|
|
@@ -7053,6 +7065,8 @@ class FormatEscaper {
|
|
|
7053
7065
|
|
|
7054
7066
|
const anchorNode = selection.anchor.getNode();
|
|
7055
7067
|
|
|
7068
|
+
if (!this.#isInsideBlockquote(anchorNode)) return false
|
|
7069
|
+
|
|
7056
7070
|
return this.#handleLists(event, anchorNode)
|
|
7057
7071
|
|| this.#handleBlockquotes(event, anchorNode)
|
|
7058
7072
|
}
|
|
@@ -7077,6 +7091,19 @@ class FormatEscaper {
|
|
|
7077
7091
|
return false
|
|
7078
7092
|
}
|
|
7079
7093
|
|
|
7094
|
+
#isInsideBlockquote(node) {
|
|
7095
|
+
let currentNode = node;
|
|
7096
|
+
|
|
7097
|
+
while (currentNode) {
|
|
7098
|
+
if (Ot$1(currentNode)) {
|
|
7099
|
+
return true
|
|
7100
|
+
}
|
|
7101
|
+
currentNode = currentNode.getParent();
|
|
7102
|
+
}
|
|
7103
|
+
|
|
7104
|
+
return false
|
|
7105
|
+
}
|
|
7106
|
+
|
|
7080
7107
|
#shouldEscapeFromEmptyListItem(node) {
|
|
7081
7108
|
const listItem = this.#getListItemNode(node);
|
|
7082
7109
|
if (!listItem) return false
|
|
@@ -7374,10 +7401,10 @@ class Contents {
|
|
|
7374
7401
|
const selection = Lr();
|
|
7375
7402
|
if (!yr(selection)) return
|
|
7376
7403
|
|
|
7377
|
-
const topLevelElement = selection.anchor.getNode().
|
|
7404
|
+
const topLevelElement = selection.anchor.getNode().getTopLevelElement();
|
|
7378
7405
|
|
|
7379
7406
|
// Check if format is already applied
|
|
7380
|
-
if (isFormatAppliedFn(topLevelElement)) {
|
|
7407
|
+
if (topLevelElement && isFormatAppliedFn(topLevelElement)) {
|
|
7381
7408
|
this.#unwrap(topLevelElement);
|
|
7382
7409
|
} else {
|
|
7383
7410
|
this.#insertNodeWrappingAllSelectedNodes(newNodeFn);
|
|
@@ -7607,10 +7634,7 @@ class Contents {
|
|
|
7607
7634
|
const node = xo(nodeKey);
|
|
7608
7635
|
if (!node) return
|
|
7609
7636
|
|
|
7610
|
-
|
|
7611
|
-
try {
|
|
7612
|
-
previousNode = node.getTopLevelElementOrThrow();
|
|
7613
|
-
} catch {}
|
|
7637
|
+
const previousNode = node.getTopLevelElement() || node;
|
|
7614
7638
|
|
|
7615
7639
|
const newNode = options.attachment ? this.#createCustomAttachmentNodeWithHtml(html, options.attachment) : this.#createHtmlNodeWith(html);
|
|
7616
7640
|
previousNode.insertAfter(newNode);
|
|
@@ -7637,16 +7661,21 @@ class Contents {
|
|
|
7637
7661
|
if (!yr(selection)) return
|
|
7638
7662
|
|
|
7639
7663
|
const selectedNodes = selection.extract();
|
|
7640
|
-
if (selectedNodes.length === 0)
|
|
7641
|
-
|
|
7664
|
+
if (selectedNodes.length === 0) {
|
|
7665
|
+
return
|
|
7666
|
+
}
|
|
7642
7667
|
const topLevelElements = new Set();
|
|
7643
7668
|
selectedNodes.forEach((node) => {
|
|
7644
7669
|
const topLevel = node.getTopLevelElementOrThrow();
|
|
7645
7670
|
topLevelElements.add(topLevel);
|
|
7646
7671
|
});
|
|
7647
7672
|
|
|
7648
|
-
const elements = this.#
|
|
7649
|
-
if (elements.length === 0)
|
|
7673
|
+
const elements = this.#withoutTrailingEmptyParagraphs(Array.from(topLevelElements));
|
|
7674
|
+
if (elements.length === 0) {
|
|
7675
|
+
this.#removeStandaloneEmptyParagraph();
|
|
7676
|
+
this.insertAtCursor(newNodeFn());
|
|
7677
|
+
return
|
|
7678
|
+
}
|
|
7650
7679
|
|
|
7651
7680
|
const wrappingNode = newNodeFn();
|
|
7652
7681
|
elements[0].insertBefore(wrappingNode);
|
|
@@ -7658,7 +7687,7 @@ class Contents {
|
|
|
7658
7687
|
});
|
|
7659
7688
|
}
|
|
7660
7689
|
|
|
7661
|
-
#
|
|
7690
|
+
#withoutTrailingEmptyParagraphs(elements) {
|
|
7662
7691
|
let lastNonEmptyIndex = elements.length - 1;
|
|
7663
7692
|
|
|
7664
7693
|
// Find the last non-empty paragraph
|
|
@@ -7682,6 +7711,16 @@ class Contents {
|
|
|
7682
7711
|
return children.length === 0 || children.every(child => jn(child))
|
|
7683
7712
|
}
|
|
7684
7713
|
|
|
7714
|
+
#removeStandaloneEmptyParagraph() {
|
|
7715
|
+
const root = No();
|
|
7716
|
+
if (root.getChildrenSize() === 1) {
|
|
7717
|
+
const firstChild = root.getFirstChild();
|
|
7718
|
+
if (firstChild && Ii(firstChild) && this.#isElementEmpty(firstChild)) {
|
|
7719
|
+
firstChild.remove();
|
|
7720
|
+
}
|
|
7721
|
+
}
|
|
7722
|
+
}
|
|
7723
|
+
|
|
7685
7724
|
#insertNodeWrappingAllSelectedLines(newNodeFn) {
|
|
7686
7725
|
this.editor.update(() => {
|
|
7687
7726
|
const selection = Lr();
|
|
Binary file
|
|
Binary file
|