@examind/block-editor 0.7.0 → 0.8.0
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.
- package/dist/index.css +19 -24
- package/dist/index.js +29 -29
- package/dist/index.mjs +30 -29
- package/package.json +2 -2
package/dist/index.css
CHANGED
|
@@ -1632,38 +1632,33 @@ sl-progress-bar {
|
|
|
1632
1632
|
cursor: pointer;
|
|
1633
1633
|
}
|
|
1634
1634
|
.excel-copy-text {
|
|
1635
|
-
position: relative;
|
|
1636
1635
|
border-radius: var(--sl-border-radius-small);
|
|
1637
1636
|
outline-offset: 1px;
|
|
1638
|
-
padding-right:
|
|
1637
|
+
padding-right: 0.5em;
|
|
1639
1638
|
padding-left: 0;
|
|
1640
|
-
.excel-copy-text-icon {
|
|
1641
|
-
font-size: 11px;
|
|
1642
|
-
line-height: 1;
|
|
1643
|
-
position: absolute;
|
|
1644
|
-
right: 4px;
|
|
1645
|
-
top: 4px;
|
|
1646
|
-
color: var(--sl-color-neutral-400);
|
|
1647
|
-
width: 1em;
|
|
1648
|
-
height: 1em;
|
|
1649
|
-
display: inline-block;
|
|
1650
|
-
user-select: none;
|
|
1651
|
-
cursor: pointer;
|
|
1652
|
-
}
|
|
1653
|
-
.excel-copy-text-icon:hover {
|
|
1654
|
-
color: var(--sl-color-primary-500);
|
|
1655
|
-
}
|
|
1656
|
-
.excel-copy-text-icon::before {
|
|
1657
|
-
content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
|
|
1658
|
-
display: block;
|
|
1659
|
-
width: 100%;
|
|
1660
|
-
height: 100%;
|
|
1661
|
-
}
|
|
1662
1639
|
}
|
|
1663
1640
|
.excel-copy-text[data-selected] {
|
|
1664
1641
|
outline: 1px dashed var(--sl-color-neutral-500);
|
|
1665
1642
|
background-color: var(--sl-color-neutral-100);
|
|
1666
1643
|
}
|
|
1644
|
+
.excel-copy-text::after {
|
|
1645
|
+
background-color: var(--sl-color-neutral-400);
|
|
1646
|
+
content: "";
|
|
1647
|
+
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E") no-repeat center;
|
|
1648
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E") no-repeat center;
|
|
1649
|
+
-webkit-mask-size: contain;
|
|
1650
|
+
mask-size: contain;
|
|
1651
|
+
display: inline-block;
|
|
1652
|
+
margin-block: auto;
|
|
1653
|
+
width: 1em;
|
|
1654
|
+
height: 1em;
|
|
1655
|
+
font-size: 11px;
|
|
1656
|
+
line-height: 1;
|
|
1657
|
+
margin-left: 0.5em;
|
|
1658
|
+
}
|
|
1659
|
+
.excel-copy-text:hover::after {
|
|
1660
|
+
background-color: var(--sl-color-primary-500);
|
|
1661
|
+
}
|
|
1667
1662
|
}
|
|
1668
1663
|
|
|
1669
1664
|
/* src/styles/article-fill-in-the-blank-question.css */
|
package/dist/index.js
CHANGED
|
@@ -4714,33 +4714,12 @@ var ExcelCopyTextNode = class _ExcelCopyTextNode extends import_lexical23.Elemen
|
|
|
4714
4714
|
const dom = document.createElement("span");
|
|
4715
4715
|
dom.setAttribute("x-copy-text", "true");
|
|
4716
4716
|
dom.className = "excel-copy-text";
|
|
4717
|
-
|
|
4718
|
-
copyIconElement.className = "excel-copy-text-icon";
|
|
4719
|
-
copyIconElement.contentEditable = "false";
|
|
4720
|
-
copyIconElement.addEventListener("click", (e) => {
|
|
4721
|
-
e.stopPropagation();
|
|
4722
|
-
e.preventDefault();
|
|
4723
|
-
window.dispatchEvent(
|
|
4724
|
-
new CustomEvent(
|
|
4725
|
-
EXCEL_COPY_TEXT_REMOVE_COMMAND,
|
|
4726
|
-
{
|
|
4727
|
-
detail: {
|
|
4728
|
-
nodeKey: this.__key
|
|
4729
|
-
}
|
|
4730
|
-
}
|
|
4731
|
-
)
|
|
4732
|
-
);
|
|
4733
|
-
});
|
|
4734
|
-
copyIconElement.addEventListener("mouseenter", () => {
|
|
4717
|
+
dom.addEventListener("mouseenter", () => {
|
|
4735
4718
|
dom.setAttribute("data-selected", "true");
|
|
4736
4719
|
});
|
|
4737
|
-
|
|
4720
|
+
dom.addEventListener("mouseleave", () => {
|
|
4738
4721
|
dom.removeAttribute("data-selected");
|
|
4739
4722
|
});
|
|
4740
|
-
const tooltip = document.createElement("sl-tooltip");
|
|
4741
|
-
tooltip.setAttribute("content", "Click to remove copy mark.");
|
|
4742
|
-
tooltip.appendChild(copyIconElement);
|
|
4743
|
-
dom.appendChild(tooltip);
|
|
4744
4723
|
return dom;
|
|
4745
4724
|
}
|
|
4746
4725
|
exportDOM() {
|
|
@@ -4782,6 +4761,7 @@ var EXCEL_COPY_TEXT_CREATE_COMMAND = (0, import_lexical24.createCommand)("EXCEL_
|
|
|
4782
4761
|
function ExcelCopyTextPlugin() {
|
|
4783
4762
|
const [editor] = (0, import_LexicalComposerContext19.useLexicalComposerContext)();
|
|
4784
4763
|
function createNode() {
|
|
4764
|
+
let copyTextNode = void 0;
|
|
4785
4765
|
editor.update(() => {
|
|
4786
4766
|
const selection = (0, import_lexical24.$getSelection)();
|
|
4787
4767
|
if ((0, import_lexical24.$isRangeSelection)(selection)) {
|
|
@@ -4801,7 +4781,7 @@ function ExcelCopyTextPlugin() {
|
|
|
4801
4781
|
for (const node of nodes) {
|
|
4802
4782
|
if ((0, import_lexical24.$isTextNode)(node)) {
|
|
4803
4783
|
if (node.getFormat() !== 0) {
|
|
4804
|
-
|
|
4784
|
+
copyTextNode = $createExcelCopyTextNode();
|
|
4805
4785
|
node.insertBefore(copyTextNode);
|
|
4806
4786
|
copyTextNode.append(node);
|
|
4807
4787
|
copyTextNode.select();
|
|
@@ -4817,7 +4797,7 @@ function ExcelCopyTextPlugin() {
|
|
|
4817
4797
|
node.remove();
|
|
4818
4798
|
isAppended = true;
|
|
4819
4799
|
} else if ($isExcelWorksheetLinkNode(node)) {
|
|
4820
|
-
|
|
4800
|
+
copyTextNode = $createExcelCopyTextNode();
|
|
4821
4801
|
node.insertBefore(copyTextNode);
|
|
4822
4802
|
copyTextNode.append(node);
|
|
4823
4803
|
copyTextNode.select();
|
|
@@ -4830,7 +4810,7 @@ function ExcelCopyTextPlugin() {
|
|
|
4830
4810
|
if (!isAppended) {
|
|
4831
4811
|
const anchorNode = $extractSelectionNode();
|
|
4832
4812
|
if (anchorNode) {
|
|
4833
|
-
|
|
4813
|
+
copyTextNode = $createExcelCopyTextNode();
|
|
4834
4814
|
anchorNode.insertBefore(copyTextNode);
|
|
4835
4815
|
copyTextNode.append(anchorNode);
|
|
4836
4816
|
copyTextNode.select();
|
|
@@ -14412,6 +14392,18 @@ function TextToolbarPlugin() {
|
|
|
14412
14392
|
}
|
|
14413
14393
|
});
|
|
14414
14394
|
}
|
|
14395
|
+
function createExcelWorkspaceLink() {
|
|
14396
|
+
let currentSelection;
|
|
14397
|
+
activeEditorRef.current?.getEditorState().read(() => {
|
|
14398
|
+
currentSelection = (0, import_lexical75.$getSelection)()?.clone();
|
|
14399
|
+
if (currentSelection) {
|
|
14400
|
+
activeEditorRef.current?.dispatchCommand(
|
|
14401
|
+
EXCEL_WORKSHEET_LINK_CREATE_COMMAND,
|
|
14402
|
+
void 0
|
|
14403
|
+
);
|
|
14404
|
+
}
|
|
14405
|
+
});
|
|
14406
|
+
}
|
|
14415
14407
|
function createSpaceFromSelection() {
|
|
14416
14408
|
if (hasModule("Questions")) {
|
|
14417
14409
|
if (activeDecoratorRef.current === FillInTheBlankQuestionNode) {
|
|
@@ -14484,6 +14476,10 @@ function TextToolbarPlugin() {
|
|
|
14484
14476
|
);
|
|
14485
14477
|
e.preventDefault();
|
|
14486
14478
|
e.stopPropagation();
|
|
14479
|
+
} else if (e.shiftKey && (e.key === "k" || e.key === "K")) {
|
|
14480
|
+
createExcelWorkspaceLink();
|
|
14481
|
+
e.preventDefault();
|
|
14482
|
+
e.stopPropagation();
|
|
14487
14483
|
} else if (e.shiftKey && (e.key === "b" || e.key === "B")) {
|
|
14488
14484
|
createSpaceFromSelection();
|
|
14489
14485
|
e.preventDefault();
|
|
@@ -14526,6 +14522,10 @@ function TextToolbarPlugin() {
|
|
|
14526
14522
|
);
|
|
14527
14523
|
e.preventDefault();
|
|
14528
14524
|
e.stopPropagation();
|
|
14525
|
+
} else if (e.ctrlKey && e.shiftKey && (e.key === "k" || e.key === "K")) {
|
|
14526
|
+
createExcelWorkspaceLink();
|
|
14527
|
+
e.preventDefault();
|
|
14528
|
+
e.stopPropagation();
|
|
14529
14529
|
} else if (e.ctrlKey && e.shiftKey && (e.key === "b" || e.key === "B")) {
|
|
14530
14530
|
createSpaceFromSelection();
|
|
14531
14531
|
e.preventDefault();
|
|
@@ -14766,7 +14766,7 @@ function TextToolbarPlugin() {
|
|
|
14766
14766
|
}
|
|
14767
14767
|
}
|
|
14768
14768
|
);
|
|
14769
|
-
if (hasModule("Link")
|
|
14769
|
+
if (hasModule("Link")) {
|
|
14770
14770
|
resultList.push({
|
|
14771
14771
|
id: "link",
|
|
14772
14772
|
label: "",
|
|
@@ -14781,8 +14781,8 @@ function TextToolbarPlugin() {
|
|
|
14781
14781
|
resultList.push({
|
|
14782
14782
|
id: "link",
|
|
14783
14783
|
label: "",
|
|
14784
|
-
Icon: import_lucide_react20.
|
|
14785
|
-
tooltip: `Link Worksheet ${plt === "macOS" /* macOS */ ? "(\
|
|
14784
|
+
Icon: import_lucide_react20.FileSymlink,
|
|
14785
|
+
tooltip: `Link Worksheet ${plt === "macOS" /* macOS */ ? "(\u2318\u21E7K)" : "(Ctrl+Shift+K)"}`,
|
|
14786
14786
|
onClick: () => {
|
|
14787
14787
|
activeEditorRef.current?.dispatchCommand(
|
|
14788
14788
|
EXCEL_WORKSHEET_LINK_CREATE_COMMAND,
|
package/dist/index.mjs
CHANGED
|
@@ -4830,33 +4830,12 @@ var ExcelCopyTextNode = class _ExcelCopyTextNode extends ElementNode2 {
|
|
|
4830
4830
|
const dom = document.createElement("span");
|
|
4831
4831
|
dom.setAttribute("x-copy-text", "true");
|
|
4832
4832
|
dom.className = "excel-copy-text";
|
|
4833
|
-
|
|
4834
|
-
copyIconElement.className = "excel-copy-text-icon";
|
|
4835
|
-
copyIconElement.contentEditable = "false";
|
|
4836
|
-
copyIconElement.addEventListener("click", (e) => {
|
|
4837
|
-
e.stopPropagation();
|
|
4838
|
-
e.preventDefault();
|
|
4839
|
-
window.dispatchEvent(
|
|
4840
|
-
new CustomEvent(
|
|
4841
|
-
EXCEL_COPY_TEXT_REMOVE_COMMAND,
|
|
4842
|
-
{
|
|
4843
|
-
detail: {
|
|
4844
|
-
nodeKey: this.__key
|
|
4845
|
-
}
|
|
4846
|
-
}
|
|
4847
|
-
)
|
|
4848
|
-
);
|
|
4849
|
-
});
|
|
4850
|
-
copyIconElement.addEventListener("mouseenter", () => {
|
|
4833
|
+
dom.addEventListener("mouseenter", () => {
|
|
4851
4834
|
dom.setAttribute("data-selected", "true");
|
|
4852
4835
|
});
|
|
4853
|
-
|
|
4836
|
+
dom.addEventListener("mouseleave", () => {
|
|
4854
4837
|
dom.removeAttribute("data-selected");
|
|
4855
4838
|
});
|
|
4856
|
-
const tooltip = document.createElement("sl-tooltip");
|
|
4857
|
-
tooltip.setAttribute("content", "Click to remove copy mark.");
|
|
4858
|
-
tooltip.appendChild(copyIconElement);
|
|
4859
|
-
dom.appendChild(tooltip);
|
|
4860
4839
|
return dom;
|
|
4861
4840
|
}
|
|
4862
4841
|
exportDOM() {
|
|
@@ -4898,6 +4877,7 @@ var EXCEL_COPY_TEXT_CREATE_COMMAND = createCommand4("EXCEL_COPY_TEXT_CREATE_COMM
|
|
|
4898
4877
|
function ExcelCopyTextPlugin() {
|
|
4899
4878
|
const [editor] = useLexicalComposerContext19();
|
|
4900
4879
|
function createNode() {
|
|
4880
|
+
let copyTextNode = void 0;
|
|
4901
4881
|
editor.update(() => {
|
|
4902
4882
|
const selection = $getSelection5();
|
|
4903
4883
|
if ($isRangeSelection3(selection)) {
|
|
@@ -4917,7 +4897,7 @@ function ExcelCopyTextPlugin() {
|
|
|
4917
4897
|
for (const node of nodes) {
|
|
4918
4898
|
if ($isTextNode2(node)) {
|
|
4919
4899
|
if (node.getFormat() !== 0) {
|
|
4920
|
-
|
|
4900
|
+
copyTextNode = $createExcelCopyTextNode();
|
|
4921
4901
|
node.insertBefore(copyTextNode);
|
|
4922
4902
|
copyTextNode.append(node);
|
|
4923
4903
|
copyTextNode.select();
|
|
@@ -4933,7 +4913,7 @@ function ExcelCopyTextPlugin() {
|
|
|
4933
4913
|
node.remove();
|
|
4934
4914
|
isAppended = true;
|
|
4935
4915
|
} else if ($isExcelWorksheetLinkNode(node)) {
|
|
4936
|
-
|
|
4916
|
+
copyTextNode = $createExcelCopyTextNode();
|
|
4937
4917
|
node.insertBefore(copyTextNode);
|
|
4938
4918
|
copyTextNode.append(node);
|
|
4939
4919
|
copyTextNode.select();
|
|
@@ -4946,7 +4926,7 @@ function ExcelCopyTextPlugin() {
|
|
|
4946
4926
|
if (!isAppended) {
|
|
4947
4927
|
const anchorNode = $extractSelectionNode();
|
|
4948
4928
|
if (anchorNode) {
|
|
4949
|
-
|
|
4929
|
+
copyTextNode = $createExcelCopyTextNode();
|
|
4950
4930
|
anchorNode.insertBefore(copyTextNode);
|
|
4951
4931
|
copyTextNode.append(anchorNode);
|
|
4952
4932
|
copyTextNode.select();
|
|
@@ -14692,6 +14672,7 @@ import {
|
|
|
14692
14672
|
Brush,
|
|
14693
14673
|
Circle,
|
|
14694
14674
|
ClipboardCheck,
|
|
14675
|
+
FileSymlink,
|
|
14695
14676
|
Highlighter,
|
|
14696
14677
|
Italic,
|
|
14697
14678
|
Link2,
|
|
@@ -14860,6 +14841,18 @@ function TextToolbarPlugin() {
|
|
|
14860
14841
|
}
|
|
14861
14842
|
});
|
|
14862
14843
|
}
|
|
14844
|
+
function createExcelWorkspaceLink() {
|
|
14845
|
+
let currentSelection;
|
|
14846
|
+
activeEditorRef.current?.getEditorState().read(() => {
|
|
14847
|
+
currentSelection = $getSelection13()?.clone();
|
|
14848
|
+
if (currentSelection) {
|
|
14849
|
+
activeEditorRef.current?.dispatchCommand(
|
|
14850
|
+
EXCEL_WORKSHEET_LINK_CREATE_COMMAND,
|
|
14851
|
+
void 0
|
|
14852
|
+
);
|
|
14853
|
+
}
|
|
14854
|
+
});
|
|
14855
|
+
}
|
|
14863
14856
|
function createSpaceFromSelection() {
|
|
14864
14857
|
if (hasModule("Questions")) {
|
|
14865
14858
|
if (activeDecoratorRef.current === FillInTheBlankQuestionNode) {
|
|
@@ -14932,6 +14925,10 @@ function TextToolbarPlugin() {
|
|
|
14932
14925
|
);
|
|
14933
14926
|
e.preventDefault();
|
|
14934
14927
|
e.stopPropagation();
|
|
14928
|
+
} else if (e.shiftKey && (e.key === "k" || e.key === "K")) {
|
|
14929
|
+
createExcelWorkspaceLink();
|
|
14930
|
+
e.preventDefault();
|
|
14931
|
+
e.stopPropagation();
|
|
14935
14932
|
} else if (e.shiftKey && (e.key === "b" || e.key === "B")) {
|
|
14936
14933
|
createSpaceFromSelection();
|
|
14937
14934
|
e.preventDefault();
|
|
@@ -14974,6 +14971,10 @@ function TextToolbarPlugin() {
|
|
|
14974
14971
|
);
|
|
14975
14972
|
e.preventDefault();
|
|
14976
14973
|
e.stopPropagation();
|
|
14974
|
+
} else if (e.ctrlKey && e.shiftKey && (e.key === "k" || e.key === "K")) {
|
|
14975
|
+
createExcelWorkspaceLink();
|
|
14976
|
+
e.preventDefault();
|
|
14977
|
+
e.stopPropagation();
|
|
14977
14978
|
} else if (e.ctrlKey && e.shiftKey && (e.key === "b" || e.key === "B")) {
|
|
14978
14979
|
createSpaceFromSelection();
|
|
14979
14980
|
e.preventDefault();
|
|
@@ -15214,7 +15215,7 @@ function TextToolbarPlugin() {
|
|
|
15214
15215
|
}
|
|
15215
15216
|
}
|
|
15216
15217
|
);
|
|
15217
|
-
if (hasModule("Link")
|
|
15218
|
+
if (hasModule("Link")) {
|
|
15218
15219
|
resultList.push({
|
|
15219
15220
|
id: "link",
|
|
15220
15221
|
label: "",
|
|
@@ -15229,8 +15230,8 @@ function TextToolbarPlugin() {
|
|
|
15229
15230
|
resultList.push({
|
|
15230
15231
|
id: "link",
|
|
15231
15232
|
label: "",
|
|
15232
|
-
Icon:
|
|
15233
|
-
tooltip: `Link Worksheet ${plt === "macOS" /* macOS */ ? "(\
|
|
15233
|
+
Icon: FileSymlink,
|
|
15234
|
+
tooltip: `Link Worksheet ${plt === "macOS" /* macOS */ ? "(\u2318\u21E7K)" : "(Ctrl+Shift+K)"}`,
|
|
15234
15235
|
onClick: () => {
|
|
15235
15236
|
activeEditorRef.current?.dispatchCommand(
|
|
15236
15237
|
EXCEL_WORKSHEET_LINK_CREATE_COMMAND,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@examind/block-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"@comment version": [
|
|
5
5
|
"Don't specify package version here. It will be injected by publish workflow."
|
|
6
6
|
],
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"tsup": "^8.3.5",
|
|
63
63
|
"typescript": "^5.7.2",
|
|
64
64
|
"typescript-eslint": "^8.18.2",
|
|
65
|
-
"@examind/block-types": "0.
|
|
65
|
+
"@examind/block-types": "0.8.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@dnd-kit/core": "6.3.1",
|