lexxy 0.9.24 → 0.9.25
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 +66 -9
- 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: 92ba1a84cc251d9d9b65ab65cb2dbd24fb1e8180456855cc32620efa0d3b5e85
|
|
4
|
+
data.tar.gz: 5f2f17fe5d328e1e8961067cd297692d87fa70901c81b9c55527cb5ac3887503
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b281de9a7ad1d3ca00bee0ddb2f5841eda6db4747d20421d127fb375f01d20b509052bb006cd168a8def21ff59c1c2f71cd0362817cca70aa7881caf6883e1b2
|
|
7
|
+
data.tar.gz: bf512346a4f6bfab93053150eda97fa1f0c04915a29fc2c06a1187ce76b295bd3c5cfb0dc72d14698d6a0cf7631af9ffa6a2e5edb10ae4627693502877d14f6d
|
|
@@ -7473,9 +7473,9 @@ class ToolbarDropdown extends HTMLElement {
|
|
|
7473
7473
|
const HEADING_BUTTON_SELECTOR = "button.lexxy-heading-button";
|
|
7474
7474
|
|
|
7475
7475
|
const HEADING_PRESETS = [
|
|
7476
|
-
{ label: "Large Heading", name: "heading-large" },
|
|
7477
|
-
{ label: "Medium Heading", name: "heading-medium" },
|
|
7478
|
-
{ label: "Small Heading", name: "heading-small" }
|
|
7476
|
+
{ label: "Large Heading", name: "heading-large", command: "setFormatHeadingLarge" },
|
|
7477
|
+
{ label: "Medium Heading", name: "heading-medium", command: "setFormatHeadingMedium" },
|
|
7478
|
+
{ label: "Small Heading", name: "heading-small", command: "setFormatHeadingSmall" }
|
|
7479
7479
|
];
|
|
7480
7480
|
|
|
7481
7481
|
class HeadingDropdown extends HTMLElement {
|
|
@@ -7505,6 +7505,14 @@ class HeadingDropdown extends HTMLElement {
|
|
|
7505
7505
|
}
|
|
7506
7506
|
}
|
|
7507
7507
|
|
|
7508
|
+
static commandFor(index) {
|
|
7509
|
+
if (index < HEADING_PRESETS.length) {
|
|
7510
|
+
return HEADING_PRESETS[index].command
|
|
7511
|
+
} else {
|
|
7512
|
+
return "applyHeadingFormat"
|
|
7513
|
+
}
|
|
7514
|
+
}
|
|
7515
|
+
|
|
7508
7516
|
#listeners = new ListenerBin()
|
|
7509
7517
|
|
|
7510
7518
|
connectedCallback() {
|
|
@@ -7567,6 +7575,7 @@ class HeadingDropdown extends HTMLElement {
|
|
|
7567
7575
|
const button = document.createElement("button");
|
|
7568
7576
|
button.type = "button";
|
|
7569
7577
|
button.dataset.heading = tag;
|
|
7578
|
+
button.dataset.command = HeadingDropdown.commandFor(index);
|
|
7570
7579
|
button.classList.add("lexxy-heading-button");
|
|
7571
7580
|
button.name = name;
|
|
7572
7581
|
button.title = label;
|
|
@@ -7581,7 +7590,7 @@ class HeadingDropdown extends HTMLElement {
|
|
|
7581
7590
|
if (!this.#editor) return
|
|
7582
7591
|
|
|
7583
7592
|
event.preventDefault();
|
|
7584
|
-
this.#editor.dispatchCommand(
|
|
7593
|
+
this.#editor.dispatchCommand(button.dataset.command, button.dataset.heading);
|
|
7585
7594
|
this.#editor.focus();
|
|
7586
7595
|
}));
|
|
7587
7596
|
});
|
|
@@ -8450,14 +8459,29 @@ function $shrinkSelectionPastBlockEdges(selection) {
|
|
|
8450
8459
|
if (!anchorBlock || !focusBlock || anchorBlock.is(focusBlock)) return
|
|
8451
8460
|
|
|
8452
8461
|
if ($isAtBlockEnd(selection.anchor, anchorBlock)) {
|
|
8453
|
-
const nextBlock = anchorBlock
|
|
8462
|
+
const nextBlock = $nearestElementSibling(anchorBlock, "next");
|
|
8454
8463
|
if (nextBlock) selection.anchor.set(nextBlock.getKey(), 0, "element");
|
|
8455
8464
|
}
|
|
8456
8465
|
|
|
8457
8466
|
if ($isAtBlockStart(selection.focus, focusBlock)) {
|
|
8458
|
-
const previousBlock = focusBlock
|
|
8467
|
+
const previousBlock = $nearestElementSibling(focusBlock, "previous");
|
|
8459
8468
|
if (previousBlock) selection.focus.set(previousBlock.getKey(), previousBlock.getChildrenSize(), "element");
|
|
8460
8469
|
}
|
|
8470
|
+
|
|
8471
|
+
// Shrinking moves the endpoints toward each other, so they can cross when
|
|
8472
|
+
// both were flush against block edges; callers assume a forward selection.
|
|
8473
|
+
j$6(selection);
|
|
8474
|
+
}
|
|
8475
|
+
|
|
8476
|
+
// Top-level decorator blocks (attachments, horizontal dividers) can't hold a
|
|
8477
|
+
// selection point, so walk past them to the nearest element sibling. Returns
|
|
8478
|
+
// null when no element sibling exists in that direction.
|
|
8479
|
+
function $nearestElementSibling(block, direction) {
|
|
8480
|
+
let sibling = block;
|
|
8481
|
+
do {
|
|
8482
|
+
sibling = direction === "next" ? sibling.getNextSibling() : sibling.getPreviousSibling();
|
|
8483
|
+
} while (sibling && !Wi(sibling))
|
|
8484
|
+
return sibling
|
|
8461
8485
|
}
|
|
8462
8486
|
|
|
8463
8487
|
function $isAtBlockEnd(point, block) {
|
|
@@ -10309,6 +10333,9 @@ const COMMANDS = [
|
|
|
10309
10333
|
"unlink",
|
|
10310
10334
|
"toggleHighlight",
|
|
10311
10335
|
"removeHighlight",
|
|
10336
|
+
"setFormatHeadingLarge",
|
|
10337
|
+
"setFormatHeadingMedium",
|
|
10338
|
+
"setFormatHeadingSmall",
|
|
10312
10339
|
"setFormatParagraph",
|
|
10313
10340
|
"applyHeadingFormat",
|
|
10314
10341
|
"clearFormatting",
|
|
@@ -10502,6 +10529,18 @@ class CommandDispatcher {
|
|
|
10502
10529
|
Pt$3(new HorizontalDividerNode);
|
|
10503
10530
|
}
|
|
10504
10531
|
|
|
10532
|
+
dispatchSetFormatHeadingLarge() {
|
|
10533
|
+
this.#applyConfiguredHeadingFormat(0);
|
|
10534
|
+
}
|
|
10535
|
+
|
|
10536
|
+
dispatchSetFormatHeadingMedium() {
|
|
10537
|
+
this.#applyConfiguredHeadingFormat(1);
|
|
10538
|
+
}
|
|
10539
|
+
|
|
10540
|
+
dispatchSetFormatHeadingSmall() {
|
|
10541
|
+
this.#applyConfiguredHeadingFormat(2);
|
|
10542
|
+
}
|
|
10543
|
+
|
|
10505
10544
|
dispatchSetFormatParagraph() {
|
|
10506
10545
|
this.contents.applyParagraphFormat();
|
|
10507
10546
|
}
|
|
@@ -10558,6 +10597,11 @@ class CommandDispatcher {
|
|
|
10558
10597
|
this.#listeners.dispose();
|
|
10559
10598
|
}
|
|
10560
10599
|
|
|
10600
|
+
#applyConfiguredHeadingFormat(index) {
|
|
10601
|
+
const tag = this.editorElement.config.get("headings")[index];
|
|
10602
|
+
if (tag) this.contents.applyHeadingFormat(tag);
|
|
10603
|
+
}
|
|
10604
|
+
|
|
10561
10605
|
#registerCommands() {
|
|
10562
10606
|
for (const command of COMMANDS) {
|
|
10563
10607
|
const methodName = `dispatch${capitalize(command)}`;
|
|
@@ -12128,11 +12172,11 @@ class ActionTextAttachmentUploadNode extends ActionTextAttachmentNode {
|
|
|
12128
12172
|
}
|
|
12129
12173
|
|
|
12130
12174
|
#forgetUploadRequest() {
|
|
12131
|
-
this.#editorElement
|
|
12175
|
+
this.#editorElement?.uploadRequests.forget(this.getKey());
|
|
12132
12176
|
}
|
|
12133
12177
|
|
|
12134
12178
|
#rememberUploadRequest(request) {
|
|
12135
|
-
this.#editorElement
|
|
12179
|
+
this.#editorElement?.uploadRequests.track(this.getKey(), request);
|
|
12136
12180
|
}
|
|
12137
12181
|
|
|
12138
12182
|
get #editorElement() {
|
|
@@ -12438,6 +12482,7 @@ class PastedContentFormatter {
|
|
|
12438
12482
|
}
|
|
12439
12483
|
|
|
12440
12484
|
format() {
|
|
12485
|
+
this.#stripStyleElements();
|
|
12441
12486
|
this.#unwrapPlaceholderAnchors();
|
|
12442
12487
|
this.#stripTableCellColorStyles();
|
|
12443
12488
|
this.#nestStrayListChildren();
|
|
@@ -12445,6 +12490,18 @@ class PastedContentFormatter {
|
|
|
12445
12490
|
return this.doc
|
|
12446
12491
|
}
|
|
12447
12492
|
|
|
12493
|
+
// Spreadsheets (e.g. Excel) copy a <style> block whose rules (td { color:
|
|
12494
|
+
// black }, .xlNN { ... }) cascade onto the imported text. That color rides
|
|
12495
|
+
// in through the cascade rather than an inline style, so it slips past both
|
|
12496
|
+
// the cell-level stripping below and the paste style canonicalizer, leaving
|
|
12497
|
+
// pasted tables with foreign text colors that don't adapt to the theme. Drop
|
|
12498
|
+
// foreign style sheets so nothing cascades into imported content.
|
|
12499
|
+
#stripStyleElements() {
|
|
12500
|
+
for (const style of this.doc.querySelectorAll("style")) {
|
|
12501
|
+
style.remove();
|
|
12502
|
+
}
|
|
12503
|
+
}
|
|
12504
|
+
|
|
12448
12505
|
// Anchors with non-meaningful hrefs (e.g. "#", "") appear in content copied
|
|
12449
12506
|
// from rendered views where mentions and interactive elements are wrapped in
|
|
12450
12507
|
// <a href="#"> tags. Unwrap them so their text content pastes as plain text
|
|
@@ -16046,7 +16103,7 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
16046
16103
|
{ label: "Normal", command: "setFormatParagraph", tag: null },
|
|
16047
16104
|
...headings.map((tag, index) => ({
|
|
16048
16105
|
label: HeadingDropdown.labelFor(tag, index),
|
|
16049
|
-
command:
|
|
16106
|
+
command: HeadingDropdown.commandFor(index),
|
|
16050
16107
|
tag
|
|
16051
16108
|
}))
|
|
16052
16109
|
]
|
|
Binary file
|
|
Binary file
|