Skip to content

Commit e1f9f84

Browse files
committed
Source rebuild
1 parent f107706 commit e1f9f84

File tree

6 files changed

+25
-9
lines changed

6 files changed

+25
-9
lines changed

app/assets/javascript/lexxy.js

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5560,11 +5560,11 @@ class LexicalToolbarElement extends HTMLElement {
55605560

55615561
<div class="lexxy-editor__toolbar-spacer" role="separator"></div>
55625562

5563-
<button class="lexxy-editor__toolbar-button" type="button" name="undo" data-command="undo" title="Undo" data-hotkey="cmd+z ctrl+z">
5563+
<button class="lexxy-editor__toolbar-button" type="button" name="undo" data-command="undo" title="Undo">
55645564
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M5.64648 8.26531C7.93911 6.56386 10.7827 5.77629 13.624 6.05535C16.4655 6.33452 19.1018 7.66079 21.0195 9.77605C22.5839 11.5016 23.5799 13.6516 23.8936 15.9352C24.0115 16.7939 23.2974 17.4997 22.4307 17.4997C21.5641 17.4997 20.8766 16.7915 20.7148 15.9401C20.4295 14.4379 19.7348 13.0321 18.6943 11.8844C17.3 10.3464 15.3835 9.38139 13.3174 9.17839C11.2514 8.97546 9.18359 9.54856 7.5166 10.7858C6.38259 11.6275 5.48981 12.7361 4.90723 13.9997H8.5C9.3283 13.9997 9.99979 14.6714 10 15.4997C10 16.3281 9.32843 16.9997 8.5 16.9997H1.5C0.671573 16.9997 0 16.3281 0 15.4997V8.49968C0.000213656 7.67144 0.671705 6.99968 1.5 6.99968C2.3283 6.99968 2.99979 7.67144 3 8.49968V11.0212C3.7166 9.9704 4.60793 9.03613 5.64648 8.26531Z"/></svg>
55655565
</button>
55665566

5567-
<button class="lexxy-editor__toolbar-button" type="button" name="redo" data-command="redo" title="Redo" data-hotkey="cmd+shift+z ctrl+shift+z ctrl+y">
5567+
<button class="lexxy-editor__toolbar-button" type="button" name="redo" data-command="redo" title="Redo">
55685568
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18.2599 8.26531C15.9672 6.56386 13.1237 5.77629 10.2823 6.05535C7.4408 6.33452 4.80455 7.66079 2.88681 9.77605C1.32245 11.5016 0.326407 13.6516 0.0127834 15.9352C-0.105117 16.7939 0.608975 17.4997 1.47567 17.4997C2.34228 17.4997 3.02969 16.7915 3.19149 15.9401C3.47682 14.4379 4.17156 13.0321 5.212 11.8844C6.60637 10.3464 8.52287 9.38139 10.589 9.17839C12.655 8.97546 14.7227 9.54856 16.3897 10.7858C17.5237 11.6275 18.4165 12.7361 18.9991 13.9997H15.4063C14.578 13.9997 13.9066 14.6714 13.9063 15.4997C13.9063 16.3281 14.5779 16.9997 15.4063 16.9997H22.4063C23.2348 16.9997 23.9063 16.3281 23.9063 15.4997V8.49968C23.9061 7.67144 23.2346 6.99968 22.4063 6.99968C21.578 6.99968 20.9066 7.67144 20.9063 8.49968V11.0212C20.1897 9.9704 19.2984 9.03613 18.2599 8.26531Z"/></svg>
55695569
</button>
55705570

@@ -8764,9 +8764,19 @@ class Contents {
87648764
#unwrap(node) {
87658765
const children = node.getChildren();
87668766

8767-
children.forEach((child) => {
8768-
node.insertBefore(child);
8769-
});
8767+
if (children.length == 0) {
8768+
node.insertBefore(Li());
8769+
} else {
8770+
children.forEach((child) => {
8771+
if (lr(child) && child.getTextContent().trim() !== "") {
8772+
const newParagraph = Li();
8773+
newParagraph.append(child);
8774+
node.insertBefore(newParagraph);
8775+
} else if (!jn(child)) {
8776+
node.insertBefore(child);
8777+
}
8778+
});
8779+
}
87708780

87718781
node.remove();
87728782
}
@@ -9585,7 +9595,7 @@ class LexicalEditorElement extends HTMLElement {
95859595
const root = No();
95869596
root.clear();
95879597
if (html !== "") root.append(...this.#parseHtmlIntoLexicalNodes(html));
9588-
root.select();
9598+
root.selectEnd();
95899599

95909600
this.#toggleEmptyStatus();
95919601

@@ -9597,8 +9607,14 @@ class LexicalEditorElement extends HTMLElement {
95979607
}
95989608

95999609
#parseHtmlIntoLexicalNodes(html) {
9600-
if (!html) html = "<p></p>";
9601-
const nodes = m$1(this.editor, parseHtml(`<div>${html}</div>`));
9610+
const defaultHtml = "<p></p>";
9611+
if (!html) html = defaultHtml;
9612+
let nodes = m$1(this.editor, parseHtml(`<div>${html}</div>`));
9613+
9614+
if (nodes.length === 0) {
9615+
nodes = m$1(this.editor, parseHtml(defaultHtml));
9616+
}
9617+
96029618
// Custom decorator block elements such action-text-attachments get wrapped into <p> automatically by Lexical.
96039619
// We flatten those.
96049620
return nodes.map(node => {

app/assets/javascript/lexxy.js.br

-162 Bytes
Binary file not shown.

app/assets/javascript/lexxy.js.gz

66 Bytes
Binary file not shown.

app/assets/javascript/lexxy.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
-106 Bytes
Binary file not shown.
29 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)