lexxy 0.9.20 → 0.9.21
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 +46 -14
- data/app/assets/javascript/lexxy.js.br +0 -0
- data/app/assets/javascript/lexxy.js.gz +0 -0
- data/app/assets/javascript/lexxy.js.map +1 -1
- 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 +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a161b79f6c66266f236c0bae71c3ea540237a2a403fb2e047d43828e395bfda
|
|
4
|
+
data.tar.gz: '030840a6e183bc84837825ff7b8f646ebfb74fdd2d582c93c3475b38b88e633e'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c03106f2eed700e7521b00a937ace2b854459633b99ee93f6ef99eb323fd017d95fd9d348d174decc8a5e9e3b028fe9b470f5943066563b3ba6a55d03871c2b
|
|
7
|
+
data.tar.gz: b1d3121c8bc34f2b560192523f0e9a5ec885d869df2b9bdf56da88bd16829b8a5b9c0b0e99fa95507c06b65a1ca381665678df5f74dca94501b81937c658189a
|
|
@@ -12884,7 +12884,7 @@ class Clipboard {
|
|
|
12884
12884
|
}
|
|
12885
12885
|
|
|
12886
12886
|
if (this.#isPlainTextOrURLPasted(clipboardData)) {
|
|
12887
|
-
this.#
|
|
12887
|
+
this.#pastePlainTextOrURL(clipboardData);
|
|
12888
12888
|
event.preventDefault();
|
|
12889
12889
|
return true
|
|
12890
12890
|
}
|
|
@@ -12922,14 +12922,34 @@ class Clipboard {
|
|
|
12922
12922
|
return types.length === 1 && types[0] === "text/plain"
|
|
12923
12923
|
}
|
|
12924
12924
|
|
|
12925
|
+
// Browsers expose a copied URL in several shapes:
|
|
12926
|
+
// Safari [ text/plain, text/uri-list ]
|
|
12927
|
+
// App ShareSheet [ text/uri-list ]
|
|
12928
|
+
// Chromium macOS [ text/plain, text/html, (?:text/link-preview) ]
|
|
12925
12929
|
#isOnlyURLPasted(clipboardData) {
|
|
12926
|
-
|
|
12927
|
-
|
|
12930
|
+
if (this.#isLexicalClipboardData(clipboardData)) return false
|
|
12931
|
+
|
|
12928
12932
|
const types = Array.from(clipboardData.types);
|
|
12929
|
-
|
|
12930
|
-
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
+
if (types.includes("text/uri-list")) {
|
|
12934
|
+
return types.every(type => type === "text/plain" || type === "text/uri-list")
|
|
12935
|
+
}
|
|
12936
|
+
|
|
12937
|
+
if (clipboardData.files.length) return false
|
|
12938
|
+
|
|
12939
|
+
const text = clipboardData.getData("text/plain").trim();
|
|
12940
|
+
if (!isAutolinkableURL(text)) return false
|
|
12941
|
+
|
|
12942
|
+
const html = clipboardData.getData("text/html");
|
|
12943
|
+
return !html || this.#htmlIsBareLinkToURL(html, text)
|
|
12944
|
+
}
|
|
12945
|
+
|
|
12946
|
+
#htmlIsBareLinkToURL(html, url) {
|
|
12947
|
+
const doc = parseHtml(html);
|
|
12948
|
+
if (doc.body.textContent.trim() !== url) return false
|
|
12949
|
+
|
|
12950
|
+
const links = doc.body.querySelectorAll("a");
|
|
12951
|
+
if (links.length === 0) return true
|
|
12952
|
+
return links.length === 1 && links[0].getAttribute("href") === url
|
|
12933
12953
|
}
|
|
12934
12954
|
|
|
12935
12955
|
#isPastingIntoCodeBlock() {
|
|
@@ -12963,14 +12983,12 @@ class Clipboard {
|
|
|
12963
12983
|
}, { tag: jn });
|
|
12964
12984
|
}
|
|
12965
12985
|
|
|
12966
|
-
#
|
|
12967
|
-
const item = clipboardData
|
|
12986
|
+
#pastePlainTextOrURL(clipboardData) {
|
|
12987
|
+
const item = this.#plainTextOrURLItem(clipboardData);
|
|
12968
12988
|
item.getAsString((text) => {
|
|
12969
|
-
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
const nodeKey = this.contents.createLink(text);
|
|
12973
|
-
this.#dispatchLinkInsertEvent(nodeKey, { url: text });
|
|
12989
|
+
const url = text.trim();
|
|
12990
|
+
if (isAutolinkableURL(url)) {
|
|
12991
|
+
this.#pasteURL(url);
|
|
12974
12992
|
} else if (this.editorElement.supportsMarkdown) {
|
|
12975
12993
|
this.#pasteMarkdown(text);
|
|
12976
12994
|
} else {
|
|
@@ -12979,6 +12997,20 @@ class Clipboard {
|
|
|
12979
12997
|
});
|
|
12980
12998
|
}
|
|
12981
12999
|
|
|
13000
|
+
#plainTextOrURLItem(clipboardData) {
|
|
13001
|
+
const items = Array.from(clipboardData.items);
|
|
13002
|
+
return items.find((item) => item.type === "text/plain") || items.find((item) => item.type === "text/uri-list")
|
|
13003
|
+
}
|
|
13004
|
+
|
|
13005
|
+
#pasteURL(url) {
|
|
13006
|
+
if (this.contents.hasSelectedText()) {
|
|
13007
|
+
this.contents.createLinkWithSelectedText(url);
|
|
13008
|
+
} else {
|
|
13009
|
+
const nodeKey = this.contents.createLink(url);
|
|
13010
|
+
this.#dispatchLinkInsertEvent(nodeKey, { url });
|
|
13011
|
+
}
|
|
13012
|
+
}
|
|
13013
|
+
|
|
12982
13014
|
#insertSingleLinkAt(selection, url) {
|
|
12983
13015
|
if (!Fr(selection)) return
|
|
12984
13016
|
|
|
Binary file
|
|
Binary file
|