altexxy 0.9.21.4 → 0.9.21.5
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 +115 -12
- 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 +2 -2
- 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: f52a9c970674f4c6bcc36b6bdcc5333ca5212b9af6687fc6147b0fdce6147eb1
|
|
4
|
+
data.tar.gz: f1113e93df072f40705409c1a5ebc7ce586bb1b84065bf661524647fbe3af785
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fd4d4ee0216e66e0bc073dce8704ac65967383a8d2cd40652174d23a27078e21c8f26396a637bf6f929a3ba79f7c7a5c9a7e95836130aa87d75527e23fde1777
|
|
7
|
+
data.tar.gz: a4ecae8a1a0af030031831ecd189b0c7156061a945916524ff7bb8bfbcf771f47cd2a0179903a2d8b78711d038d47f373cb56552e741e3462ba86efa707538b5
|
|
@@ -6218,7 +6218,7 @@ function E$3(e,...t){const n=new URL("https://lexical.dev/docs/error"),o=new URL
|
|
|
6218
6218
|
|
|
6219
6219
|
const ALLOWED_HTML_ATTRIBUTES = [ "class", "contenteditable", "href", "src", "style", "title" ];
|
|
6220
6220
|
|
|
6221
|
-
const ALLOWED_STYLE_PROPERTIES = [ "color", "background-color", "font-size" ];
|
|
6221
|
+
const ALLOWED_STYLE_PROPERTIES = [ "color", "background-color", "font-size", "text-align" ];
|
|
6222
6222
|
|
|
6223
6223
|
function styleFilterHook(_currentNode, hookEvent) {
|
|
6224
6224
|
if (hookEvent.attrName === "style" && hookEvent.attrValue) {
|
|
@@ -6570,6 +6570,26 @@ var ToolbarIcons = {
|
|
|
6570
6570
|
<path d="M2.84155 6V3.01367H2.79053L1.85596 3.64478V2.79614L2.84155 2.12476H3.82715V6H2.84155Z"/>
|
|
6571
6571
|
</svg>`,
|
|
6572
6572
|
|
|
6573
|
+
"alignLeft":
|
|
6574
|
+
`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
6575
|
+
<path d="M2 3.5C2 2.94772 2.44772 2.5 3 2.5H15C15.5523 2.5 16 2.94772 16 3.5C16 4.05228 15.5523 4.5 15 4.5H3C2.44772 4.5 2 4.05228 2 3.5ZM2 7.16667C2 6.61438 2.44772 6.16667 3 6.16667H11C11.5523 6.16667 12 6.61438 12 7.16667C12 7.71895 11.5523 8.16667 11 8.16667H3C2.44772 8.16667 2 7.71895 2 7.16667ZM2 10.8333C2 10.281 2.44772 9.83333 3 9.83333H15C15.5523 9.83333 16 10.281 16 10.8333C16 11.3856 15.5523 11.8333 15 11.8333H3C2.44772 11.8333 2 11.3856 2 10.8333ZM2 14.5C2 13.9477 2.44772 13.5 3 13.5H11C11.5523 13.5 12 13.9477 12 14.5C12 15.0523 11.5523 15.5 11 15.5H3C2.44772 15.5 2 15.0523 2 14.5Z"/>
|
|
6576
|
+
</svg>`,
|
|
6577
|
+
|
|
6578
|
+
"alignCenter":
|
|
6579
|
+
`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
6580
|
+
<path d="M2 3.5C2 2.94772 2.44772 2.5 3 2.5H15C15.5523 2.5 16 2.94772 16 3.5C16 4.05228 15.5523 4.5 15 4.5H3C2.44772 4.5 2 4.05228 2 3.5ZM4 7.16667C4 6.61438 4.44772 6.16667 5 6.16667H13C13.5523 6.16667 14 6.61438 14 7.16667C14 7.71895 13.5523 8.16667 13 8.16667H5C4.44772 8.16667 4 7.71895 4 7.16667ZM2 10.8333C2 10.281 2.44772 9.83333 3 9.83333H15C15.5523 9.83333 16 10.281 16 10.8333C16 11.3856 15.5523 11.8333 15 11.8333H3C2.44772 11.8333 2 11.3856 2 10.8333ZM4 14.5C4 13.9477 4.44772 13.5 5 13.5H13C13.5523 13.5 14 13.9477 14 14.5C14 15.0523 13.5523 15.5 13 15.5H5C4.44772 15.5 4 15.0523 4 14.5Z"/>
|
|
6581
|
+
</svg>`,
|
|
6582
|
+
|
|
6583
|
+
"alignRight":
|
|
6584
|
+
`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
6585
|
+
<path d="M2 3.5C2 2.94772 2.44772 2.5 3 2.5H15C15.5523 2.5 16 2.94772 16 3.5C16 4.05228 15.5523 4.5 15 4.5H3C2.44772 4.5 2 4.05228 2 3.5ZM6 7.16667C6 6.61438 6.44772 6.16667 7 6.16667H15C15.5523 6.16667 16 6.61438 16 7.16667C16 7.71895 15.5523 8.16667 15 8.16667H7C6.44772 8.16667 6 7.71895 6 7.16667ZM2 10.8333C2 10.281 2.44772 9.83333 3 9.83333H15C15.5523 9.83333 16 10.281 16 10.8333C16 11.3856 15.5523 11.8333 15 11.8333H3C2.44772 11.8333 2 11.3856 2 10.8333ZM6 14.5C6 13.9477 6.44772 13.5 7 13.5H15C15.5523 13.5 16 13.9477 16 14.5C16 15.0523 15.5523 15.5 15 15.5H7C6.44772 15.5 6 15.0523 6 14.5Z"/>
|
|
6586
|
+
</svg>`,
|
|
6587
|
+
|
|
6588
|
+
"alignJustify":
|
|
6589
|
+
`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
6590
|
+
<path d="M2 3.5C2 2.94772 2.44772 2.5 3 2.5H15C15.5523 2.5 16 2.94772 16 3.5C16 4.05228 15.5523 4.5 15 4.5H3C2.44772 4.5 2 4.05228 2 3.5ZM2 7.16667C2 6.61438 2.44772 6.16667 3 6.16667H15C15.5523 6.16667 16 6.61438 16 7.16667C16 7.71895 15.5523 8.16667 15 8.16667H3C2.44772 8.16667 2 7.71895 2 7.16667ZM2 10.8333C2 10.281 2.44772 9.83333 3 9.83333H15C15.5523 9.83333 16 10.281 16 10.8333C16 11.3856 15.5523 11.8333 15 11.8333H3C2.44772 11.8333 2 11.3856 2 10.8333ZM2 14.5C2 13.9477 2.44772 13.5 3 13.5H15C15.5523 13.5 16 13.9477 16 14.5C16 15.0523 15.5523 15.5 15 15.5H3C2.44772 15.5 2 15.0523 2 14.5Z"/>
|
|
6591
|
+
</svg>`,
|
|
6592
|
+
|
|
6573
6593
|
"image":
|
|
6574
6594
|
`<svg viewBox="0 0 18 18" xmlns="http://www.w3.org/2000/svg">
|
|
6575
6595
|
<path d="M14 2C15.6569 2 17 3.34315 17 5V13C17 14.6569 15.6569 16 14 16H4C2.34315 16 1 14.6569 1 13V5C1 3.34315 2.34315 2 4 2H14ZM3.06348 13.3496C3.2053 13.7294 3.57078 14 4 14H13.5859L11 11.4141L9.70703 12.707C9.31651 13.0976 8.68349 13.0976 8.29297 12.707C7.90244 12.3165 7.90244 11.6835 8.29297 11.293L8.58594 11L7 9.41406L3.06348 13.3496ZM4 4C3.44772 4 3 4.44772 3 5V10.5859L6.29297 7.29297L6.36914 7.22461C6.76191 6.90427 7.34092 6.92686 7.70703 7.29297L10 9.58594L10.293 9.29297L10.3691 9.22461C10.7619 8.90427 11.3409 8.92686 11.707 9.29297L15 12.5859V5C15 4.44772 14.5523 4 14 4H4ZM12.5 5C13.3284 5 14 5.67157 14 6.5C14 7.32843 13.3284 8 12.5 8C11.6716 8 11 7.32843 11 6.5C11 5.67157 11.6716 5 12.5 5Z"/>
|
|
@@ -6818,7 +6838,7 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
6818
6838
|
if (!anchorNode.getParent()) { return }
|
|
6819
6839
|
|
|
6820
6840
|
const { isBold, isItalic, isStrikethrough, isUnderline, isHighlight, isInLink, isInQuote, isInHeading,
|
|
6821
|
-
headingTag, isInCode, isInList, listType, isInTable } = this.selection.getFormat();
|
|
6841
|
+
alignment, headingTag, isInCode, isInList, listType, isInTable } = this.selection.getFormat();
|
|
6822
6842
|
|
|
6823
6843
|
this.#setButtonPressed("bold", isBold);
|
|
6824
6844
|
this.#setButtonPressed("italic", isItalic);
|
|
@@ -6834,6 +6854,11 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
6834
6854
|
this.#setButtonPressed("heading-5", headingTag === "h5");
|
|
6835
6855
|
this.#setButtonPressed("heading-6", headingTag === "h6");
|
|
6836
6856
|
|
|
6857
|
+
this.#setButtonPressed("align-left", alignment === "left");
|
|
6858
|
+
this.#setButtonPressed("align-center", alignment === "center");
|
|
6859
|
+
this.#setButtonPressed("align-right", alignment === "right");
|
|
6860
|
+
this.#setButtonPressed("align-justify", alignment === "justify");
|
|
6861
|
+
|
|
6837
6862
|
this.#setButtonPressed("lists", isInList);
|
|
6838
6863
|
this.#setButtonPressed("unordered-list", isInList && listType === "bullet");
|
|
6839
6864
|
this.#setButtonPressed("ordered-list", isInList && listType === "number");
|
|
@@ -6879,6 +6904,7 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
6879
6904
|
|
|
6880
6905
|
#refreshOverflow() {
|
|
6881
6906
|
this.#hideOverflowMenuButton();
|
|
6907
|
+
this.#positionNewToolbarItems();
|
|
6882
6908
|
this.#resetToolbarOverflow();
|
|
6883
6909
|
this.#reindexToolbarItems();
|
|
6884
6910
|
this.#compactMenu();
|
|
@@ -6890,14 +6916,31 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
6890
6916
|
this.#showOverflowMenuButton(isOverflowing);
|
|
6891
6917
|
}
|
|
6892
6918
|
|
|
6919
|
+
#positionNewToolbarItems() {
|
|
6920
|
+
let nextPosition = Math.max(
|
|
6921
|
+
-1,
|
|
6922
|
+
...[ ...this.#toolbarItems, ...this.#overflowMenuItems ].map((item) => this.#itemPosition(item))
|
|
6923
|
+
) + 1;
|
|
6924
|
+
|
|
6925
|
+
for (const item of this.#toolbarItems) {
|
|
6926
|
+
if (item.dataset.position == null) {
|
|
6927
|
+
item.dataset.position = nextPosition.toString();
|
|
6928
|
+
nextPosition++;
|
|
6929
|
+
}
|
|
6930
|
+
}
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6893
6933
|
#resetToolbarOverflow() {
|
|
6894
|
-
const
|
|
6895
|
-
|
|
6934
|
+
for (const item of this.#overflowMenuItems) {
|
|
6935
|
+
item.removeAttribute("role");
|
|
6936
|
+
this.insertBefore(item, this.#overflowMenuButton);
|
|
6937
|
+
}
|
|
6938
|
+
|
|
6939
|
+
const items = this.#toolbarItems;
|
|
6940
|
+
items.sort((a, b) => this.#itemPosition(a) - this.#itemPosition(b));
|
|
6896
6941
|
|
|
6897
6942
|
for (const item of items) {
|
|
6898
|
-
|
|
6899
|
-
item.removeAttribute("role");
|
|
6900
|
-
this.insertBefore(item, nextItem);
|
|
6943
|
+
this.insertBefore(item, this.#overflowMenuButton);
|
|
6901
6944
|
}
|
|
6902
6945
|
}
|
|
6903
6946
|
|
|
@@ -6971,6 +7014,10 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
6971
7014
|
return this.#overflowMenuButton?.querySelector(":scope > [data-dropdown-panel]")
|
|
6972
7015
|
}
|
|
6973
7016
|
|
|
7017
|
+
get #overflowMenuItems() {
|
|
7018
|
+
return Array.from(this.#overflowMenuDropdown.children)
|
|
7019
|
+
}
|
|
7020
|
+
|
|
6974
7021
|
get #overflowableItems() {
|
|
6975
7022
|
return Array.from(this.querySelectorAll(":scope > :not(.lexxy-editor__toolbar-overflow):not([data-prevent-overflow])"))
|
|
6976
7023
|
}
|
|
@@ -7141,6 +7188,22 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
7141
7188
|
${ToolbarIcons.ol}
|
|
7142
7189
|
</button>
|
|
7143
7190
|
|
|
7191
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="align-left" data-command="alignLeft" title="Align left">
|
|
7192
|
+
${ToolbarIcons.alignLeft}
|
|
7193
|
+
</button>
|
|
7194
|
+
|
|
7195
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="align-center" data-command="alignCenter" title="Align center">
|
|
7196
|
+
${ToolbarIcons.alignCenter}
|
|
7197
|
+
</button>
|
|
7198
|
+
|
|
7199
|
+
<button class="lexxy-editor__toolbar-button" type="button" name="align-right" data-command="alignRight" title="Align right">
|
|
7200
|
+
${ToolbarIcons.alignRight}
|
|
7201
|
+
</button>
|
|
7202
|
+
|
|
7203
|
+
<button class="lexxy-editor__toolbar-button lexxy-editor__toolbar-group-end" type="button" name="align-justify" data-command="alignJustify" title="Justify">
|
|
7204
|
+
${ToolbarIcons.alignJustify}
|
|
7205
|
+
</button>
|
|
7206
|
+
|
|
7144
7207
|
<button class="lexxy-editor__toolbar-button" type="button" name="table" data-command="insertTable" title="Insert a table">
|
|
7145
7208
|
${ToolbarIcons.table}
|
|
7146
7209
|
</button>
|
|
@@ -10578,6 +10641,10 @@ const COMMANDS = [
|
|
|
10578
10641
|
"setFormatHeadingSmall",
|
|
10579
10642
|
"setFormatParagraph",
|
|
10580
10643
|
"clearFormatting",
|
|
10644
|
+
"alignLeft",
|
|
10645
|
+
"alignCenter",
|
|
10646
|
+
"alignRight",
|
|
10647
|
+
"alignJustify",
|
|
10581
10648
|
"insertUnorderedList",
|
|
10582
10649
|
"insertOrderedList",
|
|
10583
10650
|
"insertQuoteBlock",
|
|
@@ -10867,6 +10934,22 @@ class CommandDispatcher {
|
|
|
10867
10934
|
this.contents.clearFormatting();
|
|
10868
10935
|
}
|
|
10869
10936
|
|
|
10937
|
+
dispatchAlignLeft() {
|
|
10938
|
+
this.editor.dispatchCommand(Re$1, "left");
|
|
10939
|
+
}
|
|
10940
|
+
|
|
10941
|
+
dispatchAlignCenter() {
|
|
10942
|
+
this.editor.dispatchCommand(Re$1, "center");
|
|
10943
|
+
}
|
|
10944
|
+
|
|
10945
|
+
dispatchAlignRight() {
|
|
10946
|
+
this.editor.dispatchCommand(Re$1, "right");
|
|
10947
|
+
}
|
|
10948
|
+
|
|
10949
|
+
dispatchAlignJustify() {
|
|
10950
|
+
this.editor.dispatchCommand(Re$1, "justify");
|
|
10951
|
+
}
|
|
10952
|
+
|
|
10870
10953
|
dispatchUploadImage() {
|
|
10871
10954
|
this.#dispatchUploadAttachment("image/*,video/*");
|
|
10872
10955
|
}
|
|
@@ -11156,6 +11239,7 @@ class Selection {
|
|
|
11156
11239
|
isInQuote: Mt$2(topLevelElement),
|
|
11157
11240
|
isInHeading: headingNode !== null,
|
|
11158
11241
|
isInCode: this.#isInCode(selection, anchorNode),
|
|
11242
|
+
alignment: this.#getNearestBlockElementFormat(anchorNode),
|
|
11159
11243
|
headingTag: headingNode?.getTag() ?? null,
|
|
11160
11244
|
isInList: listType !== null,
|
|
11161
11245
|
listType,
|
|
@@ -11331,6 +11415,17 @@ class Selection {
|
|
|
11331
11415
|
return Tr(anchorNode) && anchorNode.hasFormat("code")
|
|
11332
11416
|
}
|
|
11333
11417
|
|
|
11418
|
+
#getNearestBlockElementFormat(node) {
|
|
11419
|
+
let blockElement;
|
|
11420
|
+
if (Wi(node) && !node.isInline()) {
|
|
11421
|
+
blockElement = node;
|
|
11422
|
+
} else {
|
|
11423
|
+
blockElement = dl(node, parentNode => Wi(parentNode) && !parentNode.isInline());
|
|
11424
|
+
}
|
|
11425
|
+
|
|
11426
|
+
return blockElement?.getFormatType() || null
|
|
11427
|
+
}
|
|
11428
|
+
|
|
11334
11429
|
#getSelectedLinkNode(selection) {
|
|
11335
11430
|
if (selection.isCollapsed()) {
|
|
11336
11431
|
return At$2(selection.anchor.getNode(), F$4)
|
|
@@ -13974,13 +14069,14 @@ class BrowserAdapter {
|
|
|
13974
14069
|
this.editorElement = editorElement;
|
|
13975
14070
|
}
|
|
13976
14071
|
|
|
13977
|
-
dispatchAttributesChange(attributes, link, highlight, headingTag, fontSize) {
|
|
14072
|
+
dispatchAttributesChange(attributes, link, highlight, headingTag, fontSize, alignment) {
|
|
13978
14073
|
dispatch(this.editorElement, "lexxy:attributes-change", {
|
|
13979
14074
|
attributes,
|
|
13980
14075
|
link: typeof link === "string" ? { href: link } : link,
|
|
13981
14076
|
highlight,
|
|
13982
14077
|
headingTag,
|
|
13983
|
-
fontSize
|
|
14078
|
+
fontSize,
|
|
14079
|
+
alignment
|
|
13984
14080
|
});
|
|
13985
14081
|
}
|
|
13986
14082
|
|
|
@@ -16322,6 +16418,7 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
16322
16418
|
let highlight = null;
|
|
16323
16419
|
let headingTag = null;
|
|
16324
16420
|
let fontSize = null;
|
|
16421
|
+
let alignment = null;
|
|
16325
16422
|
let link = null;
|
|
16326
16423
|
|
|
16327
16424
|
this.editor.getEditorState().read(() => {
|
|
@@ -16343,6 +16440,10 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
16343
16440
|
link: { active: linkNode !== null, enabled: true },
|
|
16344
16441
|
quote: { active: format.isInQuote, enabled: true },
|
|
16345
16442
|
heading: { active: format.isInHeading, enabled: true },
|
|
16443
|
+
"align-left": { active: format.alignment === "left", enabled: true },
|
|
16444
|
+
"align-center": { active: format.alignment === "center", enabled: true },
|
|
16445
|
+
"align-right": { active: format.alignment === "right", enabled: true },
|
|
16446
|
+
"align-justify": { active: format.alignment === "justify", enabled: true },
|
|
16346
16447
|
"unordered-list": { active: format.isInList && format.listType === "bullet", enabled: true },
|
|
16347
16448
|
"ordered-list": { active: format.isInList && format.listType === "number", enabled: true },
|
|
16348
16449
|
undo: { active: false, enabled: this.canUndo },
|
|
@@ -16356,10 +16457,11 @@ class LexicalEditorElement extends HTMLElement {
|
|
|
16356
16457
|
}
|
|
16357
16458
|
headingTag = format.headingTag ?? null;
|
|
16358
16459
|
fontSize = getSelectionStyle(selection, "font-size");
|
|
16460
|
+
alignment = format.alignment || null;
|
|
16359
16461
|
});
|
|
16360
16462
|
|
|
16361
16463
|
if (attributes) {
|
|
16362
|
-
this.adapter.dispatchAttributesChange(attributes, link, highlight, headingTag, fontSize);
|
|
16464
|
+
this.adapter.dispatchAttributesChange(attributes, link, highlight, headingTag, fontSize, alignment);
|
|
16363
16465
|
}
|
|
16364
16466
|
}
|
|
16365
16467
|
|
|
@@ -18312,13 +18414,14 @@ class NativeAdapter {
|
|
|
18312
18414
|
this.editorContentElement = editorElement.editorContentElement;
|
|
18313
18415
|
}
|
|
18314
18416
|
|
|
18315
|
-
dispatchAttributesChange(attributes, link, highlight, headingTag, fontSize) {
|
|
18417
|
+
dispatchAttributesChange(attributes, link, highlight, headingTag, fontSize, alignment) {
|
|
18316
18418
|
dispatch(this.editorElement, "lexxy:attributes-change", {
|
|
18317
18419
|
attributes,
|
|
18318
18420
|
link: typeof link === "string" ? { href: link } : link,
|
|
18319
18421
|
highlight,
|
|
18320
18422
|
headingTag,
|
|
18321
|
-
fontSize
|
|
18423
|
+
fontSize,
|
|
18424
|
+
alignment
|
|
18322
18425
|
});
|
|
18323
18426
|
}
|
|
18324
18427
|
|
|
Binary file
|
|
Binary file
|