lexxy 0.9.25 → 0.9.26
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/README.md +1 -0
- data/app/assets/javascript/lexxy.js +54 -5
- 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/app/assets/stylesheets/lexxy-editor.css +10 -2
- 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: f5c63b2cb8499843f516d8404a2a7573f93452f753b54672b53d80a60242d0ef
|
|
4
|
+
data.tar.gz: 13d59b10d606353cbc379ea5e940b40647fbe17a497f11a565c633ca1ae51519
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e0b6c3b8763c773fbc0ebe6a4d17cc5c8ee00813c48e66151975640daf3866b9a9558128584812aba21de840982ff0273200158b529343fd98b0992641622b8
|
|
7
|
+
data.tar.gz: 72db851395aea2ad408a62dd78afd2e0cea0843b1484f39a19755f58d6a8a65c482c029bb876d5f109018820bee4b8141365976b35508bfd83adc0c9754dd543
|
data/README.md
CHANGED
|
@@ -21,6 +21,7 @@ A modern rich text editor for Rails.
|
|
|
21
21
|
|
|
22
22
|
- Bug reports and pull requests are welcome on [GitHub Issues](https://github.com/basecamp/lexxy/issues). Help is especially welcome with [those tagged as "Help Wanted"](https://github.com/basecamp/lexxy/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22help%20wanted%22).
|
|
23
23
|
- For questions and general Lexxy discussion, please use the [Discussions section](https://github.com/basecamp/lexxy/discussions)
|
|
24
|
+
- To build with a development version of Lexical, use `bin/link-to-local-lexical`.
|
|
24
25
|
|
|
25
26
|
## License
|
|
26
27
|
|
|
@@ -12485,6 +12485,7 @@ class PastedContentFormatter {
|
|
|
12485
12485
|
this.#stripStyleElements();
|
|
12486
12486
|
this.#unwrapPlaceholderAnchors();
|
|
12487
12487
|
this.#stripTableCellColorStyles();
|
|
12488
|
+
this.#unwrapWrappedListChildren();
|
|
12488
12489
|
this.#nestStrayListChildren();
|
|
12489
12490
|
this.#stripStrayListChildren();
|
|
12490
12491
|
return this.doc
|
|
@@ -12526,6 +12527,29 @@ class PastedContentFormatter {
|
|
|
12526
12527
|
}
|
|
12527
12528
|
}
|
|
12528
12529
|
|
|
12530
|
+
// Some sources wrap runs of <li>s in a stray element (e.g. a <div> directly
|
|
12531
|
+
// inside the list). Dissolve such wrappers so their items become direct
|
|
12532
|
+
// list children and any nested list they hide becomes visible to
|
|
12533
|
+
// #nestStrayListChildren below.
|
|
12534
|
+
#unwrapWrappedListChildren() {
|
|
12535
|
+
for (const list of this.doc.querySelectorAll("ol, ul")) {
|
|
12536
|
+
let wrapper = this.#wrappedListChild(list);
|
|
12537
|
+
while (wrapper) {
|
|
12538
|
+
wrapper.replaceWith(...wrapper.childNodes);
|
|
12539
|
+
wrapper = this.#wrappedListChild(list);
|
|
12540
|
+
}
|
|
12541
|
+
}
|
|
12542
|
+
}
|
|
12543
|
+
|
|
12544
|
+
#wrappedListChild(list) {
|
|
12545
|
+
for (const child of list.children) {
|
|
12546
|
+
if (child.tagName !== "LI" && !this.#isNestedList(child) && this.#containsListItems(child)) {
|
|
12547
|
+
return child
|
|
12548
|
+
}
|
|
12549
|
+
}
|
|
12550
|
+
return null
|
|
12551
|
+
}
|
|
12552
|
+
|
|
12529
12553
|
// Some sources (e.g. Gmail) nest a sublist as a direct child of the parent
|
|
12530
12554
|
// <ol>/<ul> instead of inside a <li>. Move each nested list into its
|
|
12531
12555
|
// preceding <li> so the import preserves the nesting instead of dropping it.
|
|
@@ -12542,15 +12566,40 @@ class PastedContentFormatter {
|
|
|
12542
12566
|
}
|
|
12543
12567
|
}
|
|
12544
12568
|
|
|
12545
|
-
// Only <li> is a valid child of a list
|
|
12546
|
-
//
|
|
12569
|
+
// Only <li> is a valid child of a list. Unwrap remaining stray children
|
|
12570
|
+
// that still hold list items (a nested list with no preceding <li> to nest
|
|
12571
|
+
// under) so the items survive, and drop stray <br>/whitespace so the import
|
|
12572
|
+
// doesn't wrap them into an empty leading item.
|
|
12547
12573
|
#stripStrayListChildren() {
|
|
12548
12574
|
for (const list of this.doc.querySelectorAll("ol, ul")) {
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12575
|
+
let stray = this.#firstStrayListChild(list);
|
|
12576
|
+
while (stray) {
|
|
12577
|
+
if (this.#containsListItems(stray)) {
|
|
12578
|
+
stray.replaceWith(...stray.childNodes);
|
|
12579
|
+
} else {
|
|
12580
|
+
stray.remove();
|
|
12581
|
+
}
|
|
12582
|
+
|
|
12583
|
+
stray = this.#firstStrayListChild(list);
|
|
12584
|
+
}
|
|
12585
|
+
}
|
|
12586
|
+
}
|
|
12587
|
+
|
|
12588
|
+
#firstStrayListChild(list) {
|
|
12589
|
+
for (const child of list.childNodes) {
|
|
12590
|
+
if (child.nodeType !== Node.ELEMENT_NODE || child.tagName !== "LI") {
|
|
12591
|
+
return child
|
|
12552
12592
|
}
|
|
12553
12593
|
}
|
|
12594
|
+
return null
|
|
12595
|
+
}
|
|
12596
|
+
|
|
12597
|
+
#isNestedList(node) {
|
|
12598
|
+
return node.nodeType === Node.ELEMENT_NODE && (node.tagName === "OL" || node.tagName === "UL")
|
|
12599
|
+
}
|
|
12600
|
+
|
|
12601
|
+
#containsListItems(node) {
|
|
12602
|
+
return node.nodeType === Node.ELEMENT_NODE && node.querySelector("li") !== null
|
|
12554
12603
|
}
|
|
12555
12604
|
}
|
|
12556
12605
|
|
|
Binary file
|
|
Binary file
|