@forgedevstack/ink 1.1.9 → 1.2.1
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/CHANGELOG.md +16 -1
- package/dist/common-components/Box/Box.cjs +1 -1
- package/dist/common-components/Box/Box.js +7 -6
- package/dist/common-components/Button/Button.cjs +1 -1
- package/dist/common-components/Button/Button.js +9 -8
- package/dist/common-components/Canvas/Canvas.cjs +1 -1
- package/dist/common-components/Canvas/Canvas.js +3 -2
- package/dist/common-components/ContextMenu/ContextMenu.cjs +1 -1
- package/dist/common-components/ContextMenu/ContextMenu.js +3 -2
- package/dist/common-components/Field/Field.cjs +1 -1
- package/dist/common-components/Field/Field.js +11 -10
- package/dist/common-components/icons/GripIcon.cjs +1 -1
- package/dist/common-components/icons/GripIcon.js +3 -2
- package/dist/components/InkEditor/InkEditor.cjs +1 -1
- package/dist/components/InkEditor/InkEditor.d.ts.map +1 -1
- package/dist/components/InkEditor/InkEditor.js +1308 -1028
- package/dist/components/InkEditor/components/AiPanel/AiPanel.cjs +1 -1
- package/dist/components/InkEditor/components/AiPanel/AiPanel.js +13 -12
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.cjs +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.cjs +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.d.ts +20 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.const.js +25 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.d.ts +4 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.js +61 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.types.d.ts +11 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.types.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.cjs +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.d.ts +19 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.js +30 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.test.d.ts +2 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/AiSelectionBubble.utils.test.d.ts.map +1 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/index.d.ts +4 -0
- package/dist/components/InkEditor/components/AiSelectionBubble/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.cjs +1 -1
- package/dist/components/InkEditor/components/BlockHandles/BlockHandles.js +7 -6
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.cjs +1 -1
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.d.ts +2 -0
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.d.ts.map +1 -1
- package/dist/components/InkEditor/components/CommentsPanel/CommentsPanel.js +16 -15
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.cjs +1 -1
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.d.ts.map +1 -1
- package/dist/components/InkEditor/components/ExcelSheetPanel/ExcelSheetPanel.js +84 -97
- package/dist/components/InkEditor/components/FindReplace/FindReplace.cjs +1 -1
- package/dist/components/InkEditor/components/FindReplace/FindReplace.js +21 -20
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.cjs +1 -1
- package/dist/components/InkEditor/components/GraphEditModal/GraphEditModal.js +17 -16
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.cjs +1 -1
- package/dist/components/InkEditor/components/GraphPicker/GraphPicker.js +3 -2
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.cjs +1 -1
- package/dist/components/InkEditor/components/HtmlSourcePanel/HtmlSourcePanel.js +7 -6
- package/dist/components/InkEditor/components/ImageFrame/ImageFrame.cjs +1 -0
- package/dist/components/InkEditor/components/ImageFrame/ImageFrame.d.ts +8 -0
- package/dist/components/InkEditor/components/ImageFrame/ImageFrame.d.ts.map +1 -0
- package/dist/components/InkEditor/components/ImageFrame/ImageFrame.js +54 -0
- package/dist/components/InkEditor/components/ImageFrame/index.d.ts +3 -0
- package/dist/components/InkEditor/components/ImageFrame/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.cjs +1 -1
- package/dist/components/InkEditor/components/InlineToolbar/InlineToolbar.js +11 -10
- package/dist/components/InkEditor/components/MentionMenu/MentionMenu.cjs +1 -0
- package/dist/components/InkEditor/components/MentionMenu/MentionMenu.d.ts +16 -0
- package/dist/components/InkEditor/components/MentionMenu/MentionMenu.d.ts.map +1 -0
- package/dist/components/InkEditor/components/MentionMenu/MentionMenu.js +21 -0
- package/dist/components/InkEditor/components/MentionMenu/index.d.ts +3 -0
- package/dist/components/InkEditor/components/MentionMenu/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.cjs +1 -1
- package/dist/components/InkEditor/components/OutlineRail/OutlineRail.js +11 -10
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.cjs +1 -1
- package/dist/components/InkEditor/components/PresenceStack/PresenceStack.js +3 -2
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.cjs +1 -1
- package/dist/components/InkEditor/components/RemoteCursors/RemoteCursors.js +6 -5
- package/dist/components/InkEditor/components/SignPad/SignPad.cjs +1 -1
- package/dist/components/InkEditor/components/SignPad/SignPad.js +7 -6
- package/dist/components/InkEditor/components/SlashMenu/SlashMenu.cjs +1 -1
- package/dist/components/InkEditor/components/SlashMenu/SlashMenu.js +7 -6
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.cjs +1 -1
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.cjs +1 -1
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.const.js +8 -7
- package/dist/components/InkEditor/components/TableSizePicker/TableSizePicker.js +38 -38
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.cjs +1 -1
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.d.ts.map +1 -1
- package/dist/components/InkEditor/components/ThemePicker/ThemePicker.js +56 -39
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.cjs +1 -1
- package/dist/components/InkEditor/components/TitleGallery/TitleGallery.js +3 -2
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarButton/ToolbarButton.js +13 -12
- package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarColorPicker/ToolbarColorPicker.js +9 -8
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.const.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.const.js +9 -8
- package/dist/components/InkEditor/components/ToolbarCustomize/ToolbarCustomize.js +9 -8
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.js +19 -18
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.cjs +1 -1
- package/dist/components/InkEditor/components/ToolbarDropdown/ToolbarDropdown.utils.js +6 -5
- package/dist/components/InkEditor/components/VersionHistory/VersionHistory.cjs +1 -0
- package/dist/components/InkEditor/components/VersionHistory/VersionHistory.d.ts +11 -0
- package/dist/components/InkEditor/components/VersionHistory/VersionHistory.d.ts.map +1 -0
- package/dist/components/InkEditor/components/VersionHistory/VersionHistory.js +22 -0
- package/dist/components/InkEditor/components/VersionHistory/index.d.ts +3 -0
- package/dist/components/InkEditor/components/VersionHistory/index.d.ts.map +1 -0
- package/dist/components/InkEditor/components/index.d.ts +7 -0
- package/dist/components/InkEditor/components/index.d.ts.map +1 -1
- package/dist/components/InkEditor/helpers/format.utils.cjs +3 -2
- package/dist/components/InkEditor/helpers/format.utils.d.ts +1 -0
- package/dist/components/InkEditor/helpers/format.utils.d.ts.map +1 -1
- package/dist/components/InkEditor/helpers/format.utils.js +106 -84
- package/dist/components/InkEditor/helpers/index.d.ts +1 -1
- package/dist/components/InkEditor/helpers/index.d.ts.map +1 -1
- package/dist/components/InkWorkspace/InkWorkspace.cjs +1 -1
- package/dist/components/InkWorkspace/InkWorkspace.d.ts.map +1 -1
- package/dist/components/InkWorkspace/InkWorkspace.js +136 -144
- package/dist/components/InkWorkspace/hooks/useInkWorkspace.cjs +1 -1
- package/dist/components/InkWorkspace/hooks/useInkWorkspace.js +8 -7
- package/dist/constants/contextMenu.const.cjs +1 -1
- package/dist/constants/contextMenu.const.d.ts +8 -0
- package/dist/constants/contextMenu.const.d.ts.map +1 -1
- package/dist/constants/contextMenu.const.js +30 -22
- package/dist/constants/defaultIcons.cjs +1 -1
- package/dist/constants/defaultIcons.js +6 -5
- package/dist/constants/defaults.const.cjs +1 -1
- package/dist/constants/defaults.const.d.ts.map +1 -1
- package/dist/constants/defaults.const.js +150 -138
- package/dist/constants/numbers.cjs +1 -1
- package/dist/constants/numbers.js +28 -27
- package/dist/constants/toolbar.const.cjs +1 -1
- package/dist/constants/toolbar.const.d.ts +7 -0
- package/dist/constants/toolbar.const.d.ts.map +1 -1
- package/dist/constants/toolbar.const.js +16 -9
- package/dist/constants/toolbarMenu.const.cjs +1 -1
- package/dist/constants/toolbarMenu.const.d.ts.map +1 -1
- package/dist/constants/toolbarMenu.const.js +25 -11
- package/dist/hooks/useInkCollaboration.cjs +1 -1
- package/dist/hooks/useInkCollaboration.js +15 -14
- package/dist/hooks/useToolbarOverflow.cjs +1 -1
- package/dist/hooks/useToolbarOverflow.js +12 -11
- package/dist/index.cjs +1 -1
- package/dist/index.js +145 -144
- package/dist/plugins/ai/demoProvider.cjs +1 -1
- package/dist/plugins/ai/demoProvider.js +3 -2
- package/dist/plugins/ai/index.cjs +1 -1
- package/dist/plugins/ai/index.js +25 -24
- package/dist/plugins/excel/excel.utils.cjs +1 -1
- package/dist/plugins/excel/excel.utils.js +17 -16
- package/dist/plugins/graph/graph.utils.cjs +1 -1
- package/dist/plugins/graph/graph.utils.js +7 -6
- package/dist/plugins/theme/inkTheme.cjs +1 -1
- package/dist/plugins/theme/inkTheme.js +22 -19
- package/dist/plugins/titles/titles.const.cjs +1 -1
- package/dist/plugins/titles/titles.const.js +9 -8
- package/dist/plugins/titles/titles.utils.cjs +1 -1
- package/dist/plugins/titles/titles.utils.js +3 -2
- package/dist/styles.css +1 -1
- package/dist/types/collab.types.d.ts +0 -1
- package/dist/types/collab.types.d.ts.map +1 -1
- package/dist/types/features.types.d.ts +1 -1
- package/dist/types/features.types.d.ts.map +1 -1
- package/dist/types/ink.types.d.ts +1 -3
- package/dist/types/ink.types.d.ts.map +1 -1
- package/dist/utils/blocks.utils.cjs +1 -1
- package/dist/utils/blocks.utils.js +19 -18
- package/dist/utils/collab.utils.cjs +1 -1
- package/dist/utils/collab.utils.js +7 -6
- package/dist/utils/comments.utils.cjs +1 -1
- package/dist/utils/comments.utils.d.ts +4 -0
- package/dist/utils/comments.utils.d.ts.map +1 -1
- package/dist/utils/comments.utils.js +26 -18
- package/dist/utils/comments.utils.test.d.ts +2 -0
- package/dist/utils/comments.utils.test.d.ts.map +1 -0
- package/dist/utils/exportDocument.utils.cjs +2 -0
- package/dist/utils/exportDocument.utils.d.ts +16 -0
- package/dist/utils/exportDocument.utils.d.ts.map +1 -0
- package/dist/utils/exportDocument.utils.js +85 -0
- package/dist/utils/exportDocument.utils.test.d.ts +2 -0
- package/dist/utils/exportDocument.utils.test.d.ts.map +1 -0
- package/dist/utils/formatPainter.utils.cjs +1 -0
- package/dist/utils/formatPainter.utils.d.ts +11 -0
- package/dist/utils/formatPainter.utils.d.ts.map +1 -0
- package/dist/utils/formatPainter.utils.js +20 -0
- package/dist/utils/formatPainter.utils.test.d.ts +2 -0
- package/dist/utils/formatPainter.utils.test.d.ts.map +1 -0
- package/dist/utils/history.utils.cjs +1 -1
- package/dist/utils/history.utils.js +3 -2
- package/dist/utils/image.utils.cjs +1 -0
- package/dist/utils/image.utils.d.ts +14 -0
- package/dist/utils/image.utils.d.ts.map +1 -0
- package/dist/utils/image.utils.js +33 -0
- package/dist/utils/image.utils.test.d.ts +2 -0
- package/dist/utils/image.utils.test.d.ts.map +1 -0
- package/dist/utils/index.d.ts +10 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/license.utils.cjs +1 -1
- package/dist/utils/license.utils.js +8 -7
- package/dist/utils/markdown.utils.cjs +11 -0
- package/dist/utils/markdown.utils.d.ts +7 -0
- package/dist/utils/markdown.utils.d.ts.map +1 -0
- package/dist/utils/markdown.utils.js +87 -0
- package/dist/utils/markdown.utils.test.d.ts +2 -0
- package/dist/utils/markdown.utils.test.d.ts.map +1 -0
- package/dist/utils/mentions.utils.cjs +1 -0
- package/dist/utils/mentions.utils.d.ts +13 -0
- package/dist/utils/mentions.utils.d.ts.map +1 -0
- package/dist/utils/mentions.utils.js +23 -0
- package/dist/utils/mentions.utils.test.d.ts +2 -0
- package/dist/utils/mentions.utils.test.d.ts.map +1 -0
- package/dist/utils/outline.utils.cjs +1 -1
- package/dist/utils/outline.utils.js +9 -8
- package/dist/utils/paste.utils.cjs +1 -1
- package/dist/utils/paste.utils.d.ts +2 -0
- package/dist/utils/paste.utils.d.ts.map +1 -1
- package/dist/utils/paste.utils.js +53 -19
- package/dist/utils/paste.utils.test.d.ts +2 -0
- package/dist/utils/paste.utils.test.d.ts.map +1 -0
- package/dist/utils/premium.utils.cjs +1 -1
- package/dist/utils/premium.utils.js +12 -11
- package/dist/utils/selection.utils.cjs +1 -1
- package/dist/utils/selection.utils.js +3 -2
- package/dist/utils/slash.utils.cjs +1 -1
- package/dist/utils/slash.utils.js +10 -9
- package/dist/utils/table.utils.cjs +1 -1
- package/dist/utils/table.utils.d.ts +8 -0
- package/dist/utils/table.utils.d.ts.map +1 -1
- package/dist/utils/table.utils.js +78 -54
- package/dist/utils/toolbarStorage.utils.cjs +1 -1
- package/dist/utils/toolbarStorage.utils.js +15 -14
- package/dist/utils/trackChanges.utils.cjs +1 -1
- package/dist/utils/trackChanges.utils.js +9 -8
- package/dist/utils/typo.utils.cjs +1 -1
- package/dist/utils/typo.utils.js +8 -7
- package/dist/utils/versions.utils.cjs +1 -0
- package/dist/utils/versions.utils.d.ts +11 -0
- package/dist/utils/versions.utils.d.ts.map +1 -0
- package/dist/utils/versions.utils.js +36 -0
- package/dist/utils/versions.utils.test.d.ts +2 -0
- package/dist/utils/versions.utils.test.d.ts.map +1 -0
- package/dist/utils/words.utils.cjs +1 -1
- package/dist/utils/words.utils.js +3 -2
- package/package.json +1 -1
- package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts +0 -3
- package/dist/components/InkEditor/components/ThemePicker/hooks/index.d.ts.map +0 -1
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.cjs +0 -1
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts +0 -13
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.d.ts.map +0 -1
- package/dist/components/InkEditor/components/ThemePicker/hooks/useThemePickerMenu.js +0 -39
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as m, jsx as
|
|
1
|
+
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useState as C, useRef as _, useEffect as K } from "react";
|
|
3
3
|
import { createPortal as M } from "react-dom";
|
|
4
4
|
import { NUMBER_ZERO as l } from "../../../../constants/numbers.js";
|
|
@@ -8,25 +8,26 @@ import { KEY_ESCAPE as Y } from "../../../../constants/keyboard.const.js";
|
|
|
8
8
|
import { INK_CLASS_STYLE_DD as O, INK_CLASS_STYLE_TRIGGER as P, INK_CLASS_STYLE_MENU as y, INK_CLASS_STYLE_MENU_PORTAL as x, INK_CLASS_STYLE_MENU_FORCED as $, INK_CLASS_STYLE_OPTION as k, INK_CLASS_STYLE_OPTION_SEL as G, INK_CLASS_STYLE_CHECK as H, INK_CLASS_STYLE_CHEV as U } from "../../../../constants/defaults.const.js";
|
|
9
9
|
import "../../../../constants/openai.const.js";
|
|
10
10
|
import "../../../../utils/paste.utils.js";
|
|
11
|
+
import "../../../../utils/exportDocument.utils.js";
|
|
11
12
|
import { getToolbarDropdownMenuPosition as W } from "./ToolbarDropdown.utils.js";
|
|
12
|
-
const j = () => /* @__PURE__ */
|
|
13
|
+
const j = () => /* @__PURE__ */ t("svg", { className: U, viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ t("path", { d: "M2 3.5L5 6.5L8 3.5", stroke: "currentColor", strokeWidth: "1.4", fill: "none" }) }), se = (h) => {
|
|
13
14
|
const { options: a, value: E, onChange: I, title: c, disabled: S = !1 } = h, [r, s] = C(!1), [d, b] = C({
|
|
14
15
|
top: l,
|
|
15
16
|
left: l,
|
|
16
17
|
minWidth: l
|
|
17
|
-
}), f = _(null),
|
|
18
|
+
}), f = _(null), p = _(null), L = _(null), u = a.find((e) => e.value === E) ?? a[l], g = (u == null ? void 0 : u.label) ?? w;
|
|
18
19
|
return K(() => {
|
|
19
20
|
if (!r) return;
|
|
20
21
|
const e = () => {
|
|
21
|
-
b(W(
|
|
22
|
+
b(W(p.current));
|
|
22
23
|
};
|
|
23
24
|
e();
|
|
24
|
-
const o = (
|
|
25
|
+
const o = (n) => {
|
|
25
26
|
var N, T;
|
|
26
|
-
const v =
|
|
27
|
-
(N = f.current) != null && N.contains(v) || (T =
|
|
28
|
-
}, i = (
|
|
29
|
-
|
|
27
|
+
const v = n.target;
|
|
28
|
+
(N = f.current) != null && N.contains(v) || (T = L.current) != null && T.contains(v) || s(!1);
|
|
29
|
+
}, i = (n) => {
|
|
30
|
+
n.key === Y && s(!1);
|
|
30
31
|
};
|
|
31
32
|
return document.addEventListener("mousedown", o), document.addEventListener("keydown", i), window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
32
33
|
document.removeEventListener("mousedown", o), document.removeEventListener("keydown", i), window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
@@ -35,7 +36,7 @@ const j = () => /* @__PURE__ */ n("svg", { className: U, viewBox: "0 0 10 10", "
|
|
|
35
36
|
/* @__PURE__ */ m(
|
|
36
37
|
"button",
|
|
37
38
|
{
|
|
38
|
-
ref:
|
|
39
|
+
ref: p,
|
|
39
40
|
type: "button",
|
|
40
41
|
className: P,
|
|
41
42
|
title: c,
|
|
@@ -50,16 +51,16 @@ const j = () => /* @__PURE__ */ n("svg", { className: U, viewBox: "0 0 10 10", "
|
|
|
50
51
|
S || s((e) => !e);
|
|
51
52
|
},
|
|
52
53
|
children: [
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ t("span", { children: g }),
|
|
55
|
+
/* @__PURE__ */ t(j, {})
|
|
55
56
|
]
|
|
56
57
|
}
|
|
57
58
|
),
|
|
58
59
|
r ? M(
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ t(
|
|
60
61
|
"div",
|
|
61
62
|
{
|
|
62
|
-
ref:
|
|
63
|
+
ref: L,
|
|
63
64
|
className: `${y} ${x} ${$}`,
|
|
64
65
|
"data-color-mode": D,
|
|
65
66
|
role: "listbox",
|
|
@@ -74,11 +75,11 @@ const j = () => /* @__PURE__ */ n("svg", { className: U, viewBox: "0 0 10 10", "
|
|
|
74
75
|
role: "option",
|
|
75
76
|
"aria-selected": o,
|
|
76
77
|
className: i,
|
|
77
|
-
onMouseDown: (
|
|
78
|
-
|
|
78
|
+
onMouseDown: (n) => {
|
|
79
|
+
n.preventDefault(), I(e.value), s(!1);
|
|
79
80
|
},
|
|
80
81
|
children: [
|
|
81
|
-
o ? /* @__PURE__ */
|
|
82
|
+
o ? /* @__PURE__ */ t("span", { className: H, "aria-hidden": "true", children: A }) : null,
|
|
82
83
|
e.label
|
|
83
84
|
]
|
|
84
85
|
},
|
|
@@ -92,5 +93,5 @@ const j = () => /* @__PURE__ */ n("svg", { className: U, viewBox: "0 0 10 10", "
|
|
|
92
93
|
] });
|
|
93
94
|
};
|
|
94
95
|
export {
|
|
95
|
-
|
|
96
|
+
se as ToolbarDropdown
|
|
96
97
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../../constants/numbers.cjs");require("../../../../constants/openai.const.cjs");require("react/jsx-runtime");require("../../../../utils/paste.utils.cjs");require("react");require("react-dom");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../../../constants/numbers.cjs");require("../../../../constants/openai.const.cjs");require("react/jsx-runtime");require("../../../../utils/paste.utils.cjs");require("../../../../utils/exportDocument.utils.cjs");require("react");require("react-dom");const u=(E,e=_.INK_STYLE_MENU_ESTIMATED_HEIGHT_PX)=>{if(!E)return{top:_.NUMBER_ZERO,left:_.NUMBER_ZERO,minWidth:_.INK_STYLE_MENU_MIN_WIDTH_PX};const t=E.getBoundingClientRect(),r=window.innerWidth,N=window.innerHeight,o=Math.max(t.width,_.INK_STYLE_MENU_MIN_WIDTH_PX),M=Math.max(_.INK_STYLE_MENU_EDGE_PX,r-o-_.INK_STYLE_MENU_EDGE_PX),T=Math.min(Math.max(t.left,_.INK_STYLE_MENU_EDGE_PX),M),n=e>_.NUMBER_ZERO?e:_.INK_STYLE_MENU_ESTIMATED_HEIGHT_PX,i=t.bottom+_.INK_STYLE_MENU_GAP_PX,I=t.top-n-_.INK_STYLE_MENU_GAP_PX;return{top:i+n>N-_.INK_STYLE_MENU_EDGE_PX?Math.max(_.INK_STYLE_MENU_EDGE_PX,I):i,left:T,minWidth:o}};exports.getToolbarDropdownMenuPosition=u;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { INK_STYLE_MENU_ESTIMATED_HEIGHT_PX as
|
|
1
|
+
import { INK_STYLE_MENU_ESTIMATED_HEIGHT_PX as p, INK_STYLE_MENU_MIN_WIDTH_PX as E, NUMBER_ZERO as n, INK_STYLE_MENU_EDGE_PX as t, INK_STYLE_MENU_GAP_PX as c } from "../../../../constants/numbers.js";
|
|
2
2
|
import "../../../../constants/openai.const.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "../../../../utils/paste.utils.js";
|
|
5
|
+
import "../../../../utils/exportDocument.utils.js";
|
|
5
6
|
import "react";
|
|
6
7
|
import "react-dom";
|
|
7
|
-
const
|
|
8
|
+
const u = (i, e = p) => {
|
|
8
9
|
if (!i)
|
|
9
|
-
return { top: n, left: n, minWidth:
|
|
10
|
-
const o = i.getBoundingClientRect(), M = window.innerWidth, h = window.innerHeight, _ = Math.max(o.width,
|
|
10
|
+
return { top: n, left: n, minWidth: E };
|
|
11
|
+
const o = i.getBoundingClientRect(), M = window.innerWidth, h = window.innerHeight, _ = Math.max(o.width, E), a = Math.max(t, M - _ - t), s = Math.min(Math.max(o.left, t), a), r = e > n ? e : p, m = o.bottom + c, N = o.top - r - c;
|
|
11
12
|
return { top: m + r > h - t ? Math.max(t, N) : m, left: s, minWidth: _ };
|
|
12
13
|
};
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
+
u as getToolbarDropdownMenuPosition
|
|
15
16
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),l=t=>{const{versions:n,onSave:o,onRestore:i,onCompare:r,onClose:a}=t;return s.jsxs("aside",{className:"Ink-Versions","aria-label":"Version history",children:[s.jsxs("div",{className:"Ink-Versions__header",children:[s.jsx("strong",{children:"Versions"}),s.jsx("button",{type:"button",className:"Ink-Editor__button Ink-Editor__button--active",onClick:o,children:"Save snapshot"}),s.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:a,children:"×"})]}),s.jsx("div",{className:"Ink-Versions__list",children:n.length===0?s.jsx("p",{className:"Ink-Versions__empty",children:"No snapshots yet."}):n.map(e=>s.jsxs("article",{className:"Ink-Versions__item",children:[s.jsx("strong",{children:e.name}),s.jsx("time",{children:new Date(e.savedAt).toLocaleString()}),s.jsxs("div",{className:"Ink-Versions__actions",children:[s.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>i(e),children:"Restore"}),s.jsx("button",{type:"button",className:"Ink-Editor__button",onClick:()=>r(e),children:"Compare"})]})]},e.id))})]})};exports.VersionHistory=l;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { InkDocumentVersion } from '../../../../utils/versions.utils';
|
|
3
|
+
export interface VersionHistoryProps {
|
|
4
|
+
versions: InkDocumentVersion[];
|
|
5
|
+
onSave: () => void;
|
|
6
|
+
onRestore: (version: InkDocumentVersion) => void;
|
|
7
|
+
onCompare: (version: InkDocumentVersion) => void;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const VersionHistory: FC<VersionHistoryProps>;
|
|
11
|
+
//# sourceMappingURL=VersionHistory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VersionHistory.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/VersionHistory/VersionHistory.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACjD,SAAS,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACjD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CAmClD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs as e, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
const d = (o) => {
|
|
3
|
+
const { versions: s, onSave: i, onRestore: r, onCompare: a, onClose: l } = o;
|
|
4
|
+
return /* @__PURE__ */ e("aside", { className: "Ink-Versions", "aria-label": "Version history", children: [
|
|
5
|
+
/* @__PURE__ */ e("div", { className: "Ink-Versions__header", children: [
|
|
6
|
+
/* @__PURE__ */ n("strong", { children: "Versions" }),
|
|
7
|
+
/* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button Ink-Editor__button--active", onClick: i, children: "Save snapshot" }),
|
|
8
|
+
/* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button", onClick: l, children: "×" })
|
|
9
|
+
] }),
|
|
10
|
+
/* @__PURE__ */ n("div", { className: "Ink-Versions__list", children: s.length === 0 ? /* @__PURE__ */ n("p", { className: "Ink-Versions__empty", children: "No snapshots yet." }) : s.map((t) => /* @__PURE__ */ e("article", { className: "Ink-Versions__item", children: [
|
|
11
|
+
/* @__PURE__ */ n("strong", { children: t.name }),
|
|
12
|
+
/* @__PURE__ */ n("time", { children: new Date(t.savedAt).toLocaleString() }),
|
|
13
|
+
/* @__PURE__ */ e("div", { className: "Ink-Versions__actions", children: [
|
|
14
|
+
/* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button", onClick: () => r(t), children: "Restore" }),
|
|
15
|
+
/* @__PURE__ */ n("button", { type: "button", className: "Ink-Editor__button", onClick: () => a(t), children: "Compare" })
|
|
16
|
+
] })
|
|
17
|
+
] }, t.id)) })
|
|
18
|
+
] });
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
d as VersionHistory
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/InkEditor/components/VersionHistory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -3,6 +3,9 @@ export { ToolbarDropdown } from './ToolbarDropdown';
|
|
|
3
3
|
export { ToolbarColorPicker } from './ToolbarColorPicker';
|
|
4
4
|
export { CommentsPanel } from './CommentsPanel';
|
|
5
5
|
export { AiPanel } from './AiPanel';
|
|
6
|
+
export { AiSelectionBubble } from './AiSelectionBubble';
|
|
7
|
+
export { capabilityForSelectionAction, htmlFromAiResponse, optionsForSelectionAction, placeAiSelectionBubble, } from './AiSelectionBubble';
|
|
8
|
+
export type { AiSelectionBubbleProps } from './AiSelectionBubble';
|
|
6
9
|
export { AiAutocomplete, AI_AUTOCOMPLETE_DEBOUNCE_MS, AI_AUTOCOMPLETE_MAX_PREFIX_CHARS, AI_AUTOCOMPLETE_COMMAND_INSERT_TEXT, getTextBeforeCaret, getCaretPositionInRoot, } from './AiAutocomplete';
|
|
7
10
|
export type { AiAutocompleteProps, AiAutocompletePosition } from './AiAutocomplete';
|
|
8
11
|
export { BlockHandles, BLOCK_HANDLES_DRAG_EFFECT_MOVE, BLOCK_HANDLES_DRAG_MIME, BLOCK_HANDLES_DRAG_PAYLOAD, } from './BlockHandles';
|
|
@@ -12,6 +15,10 @@ export { SlashMenu } from './SlashMenu';
|
|
|
12
15
|
export { OutlineRail } from './OutlineRail';
|
|
13
16
|
export type { OutlineRailProps } from './OutlineRail';
|
|
14
17
|
export { TrackChangesBar } from './TrackChangesBar';
|
|
18
|
+
export { VersionHistory } from './VersionHistory';
|
|
19
|
+
export type { VersionHistoryProps } from './VersionHistory';
|
|
20
|
+
export { MentionMenu } from './MentionMenu';
|
|
21
|
+
export { ImageFrame } from './ImageFrame';
|
|
15
22
|
export { SignPad } from './SignPad';
|
|
16
23
|
export { FindReplace } from './FindReplace';
|
|
17
24
|
export { ToolbarCustomize } from './ToolbarCustomize';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,cAAc,EACd,2BAA2B,EAC3B,gCAAgC,EAChC,mCAAmC,EACnC,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,YAAY,EACZ,8BAA8B,EAC9B,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,aAAa,EACb,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,EAC9B,kCAAkC,EAClC,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAm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Y,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`)return!1;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../constants/numbers.cjs"),S=require("../../../constants/fonts.const.cjs"),n=require("../../../constants/lists.const.cjs"),M=require("../../../constants/blocks.const.cjs");require("../../../constants/openai.const.cjs");require("react/jsx-runtime");const y=require("../../../utils/blocks.utils.cjs");require("../../../utils/paste.utils.cjs");require("../../../utils/exportDocument.utils.cjs");require("react");require("react-dom");const g="color",I="background-color",U="background",E="color",A="style",D=1,O=3,h="removeFormat",d="insertUnorderedList",f="insertOrderedList",B="superscript",P="subscript",k="styleWithCSS",i=(e,t)=>document.execCommand(e,!1,t),l=e=>document.queryCommandState(e),w=e=>document.queryCommandValue(e),H="http://",m="https://",x="mailto:",v="&",b="<",q=">",F=""",Y=e=>e.replace(/&/g,v).replace(/</g,b).replace(/>/g,q).replace(/"/g,F),W=(e,t="")=>{if(!e)return!1;const r=e.startsWith(H)||e.startsWith(m)||e.startsWith(x)?e:`${m}${e}`,o=window.getSelection();return(!o||o.isCollapsed)&&t?i("insertHTML",`<a href="${r}">${Y(t)}</a>`):i("createLink",r)},K=e=>i("foreColor",e),Z=e=>i("hiliteColor",e),C=e=>i("insertHTML",e),V=(e,t="")=>{const r=t.replace(/"/g,""");return C(`<img src="${e}" alt="${r}" style="max-width:100%;height:auto;" />`)},G=e=>new Promise((t,r)=>{const o=new FileReader;o.onload=()=>t(String(o.result)),o.onerror=r,o.readAsDataURL(e)}),$=()=>{const e=new Set;return l("bold")&&e.add("bold"),l("italic")&&e.add("italic"),l("underline")&&e.add("underline"),l("strikeThrough")&&e.add("strikethrough"),l(d)&&e.add("bulletList"),l(f)&&e.add("orderedList"),l(B)&&e.add("superscript"),l(P)&&e.add("subscript"),e},R=e=>{e.style.removeProperty(g),e.style.removeProperty(I),e.style.removeProperty(U),e.hasAttribute(E)&&e.removeAttribute(E);const t=e.getAttribute(A);t!==null&&!t.trim()&&e.removeAttribute(A)},p=()=>{const e=window.getSelection();if(!e||e.rangeCount===c.NUMBER_ZERO)return;const r=e.getRangeAt(c.NUMBER_ZERO).commonAncestorContainer,o=r.nodeType===D?r:r.parentElement;o&&(o instanceof HTMLElement&&e.containsNode(o,!0)&&R(o),o.querySelectorAll("*").forEach(s=>{s instanceof HTMLElement&&e.containsNode(s,!0)&&R(s)}))},X=()=>{const e=i(h);return p(),e},j=e=>{const t=S.FONT_FAMILY_BY_VALUE[e]??e;if(i(k,"true"),e===S.FONT_VALUE_SYSTEM){const r=window.getSelection();if(!r||r.rangeCount===c.NUMBER_ZERO||r.isCollapsed)return i(S.FONT_COMMAND_NAME,t);const o=r.getRangeAt(c.NUMBER_ZERO),s=document.createElement("span");s.style.setProperty(S.FONT_STYLE_PROPERTY,t);try{return o.surroundContents(s),!0}catch{return i(S.FONT_COMMAND_NAME,t)}}return i(S.FONT_COMMAND_NAME,e)},Q=e=>{e.classList.remove(n.LIST_CLASS_DASH,n.LIST_CLASS_ALPHA),e.style.removeProperty("list-style-type")},z=e=>{e===n.LIST_VALUE_BULLET||e===n.LIST_VALUE_DASH?i(d):i(f);const t=window.getSelection();let o=(t==null?void 0:t.anchorNode)??null,s=null;for(;o;){if(o instanceof HTMLElement&&(o.tagName===n.LIST_TAG_UL||o.tagName===n.LIST_TAG_OL)){s=o;break}o=o.parentNode}return s&&(Q(s),e===n.LIST_VALUE_BULLET?s.style.listStyleType=n.LIST_STYLE_DISC:e===n.LIST_VALUE_DASH?s.classList.add(n.LIST_CLASS_DASH):e===n.LIST_VALUE_NUMBERS?s.style.listStyleType=n.LIST_STYLE_DECIMAL:e===n.LIST_VALUE_LETTERS&&(s.classList.add(n.LIST_CLASS_ALPHA),s.style.listStyleType=n.LIST_STYLE_LOWER_ALPHA)),!0},J=()=>{const e=window.getSelection();let t=(e==null?void 0:e.anchorNode)??null;for(;t;){if(t instanceof HTMLElement){if(t.tagName===n.LIST_TAG_UL)return t.classList.contains(n.LIST_CLASS_DASH)?n.LIST_VALUE_DASH:n.LIST_VALUE_BULLET;if(t.tagName===n.LIST_TAG_OL)return t.classList.contains(n.LIST_CLASS_ALPHA)||t.style.listStyleType===n.LIST_STYLE_LOWER_ALPHA?n.LIST_VALUE_LETTERS:n.LIST_VALUE_NUMBERS}t=t.parentNode}return n.LIST_VALUE_BULLET},ee=(e,t)=>{const r=window.getSelection(),o=y.getBlockElement((r==null?void 0:r.anchorNode)??null,e);return o?(o.setAttribute(M.DIR_ATTRIBUTE,t),!0):!1},te=[{prefix:"###",command:"formatBlock",value:"h3"},{prefix:"##",command:"formatBlock",value:"h2"},{prefix:"#",command:"formatBlock",value:"h1"},{prefix:">",command:"formatBlock",value:"blockquote"},{prefix:"1.",command:f}],re=e=>{if(e.key!==n.LIST_MARKDOWN_SPACE)return!1;const t=window.getSelection();if(!t||!t.isCollapsed||t.rangeCount===c.NUMBER_ZERO)return!1;const r=t.anchorNode;if(!r||r.nodeType!==O)return!1;const o=r.textContent??"",s=t.anchorOffset,T=o.slice(c.NUMBER_ZERO,s),a=te.find(N=>T.endsWith(N.prefix));if(!a)return!1;const _=s-a.prefix.length,u=_>c.NUMBER_ZERO?T[_-1]:"";if(u&&u!==`
|
|
2
|
+
`)return!1;e.preventDefault();const L=t.getRangeAt(c.NUMBER_ZERO);return L.setStart(r,_),L.setEnd(r,s),L.deleteContents(),a.value?i(a.command,a.value):i(a.command),!0},ne=e=>{if(e.key!==n.LIST_MARKDOWN_SPACE)return!1;const t=window.getSelection();if(!t||!t.isCollapsed||t.rangeCount===c.NUMBER_ZERO)return!1;const r=t.anchorNode;if(!r||r.nodeType!==O)return!1;const o=r.textContent??"",s=t.anchorOffset,T=o.slice(c.NUMBER_ZERO,s),a=T.endsWith(n.LIST_MARKDOWN_DASH)?n.LIST_MARKDOWN_DASH:T.endsWith(n.LIST_MARKDOWN_STAR)?n.LIST_MARKDOWN_STAR:null;if(!a)return!1;const _=s-a.length;if(_<c.NUMBER_ZERO)return!1;const u=_>c.NUMBER_ZERO?T[_-1]:"";if(u&&u!==`
|
|
3
|
+
`)return!1;e.preventDefault();const L=t.getRangeAt(c.NUMBER_ZERO);return L.setStart(r,_),L.setEnd(r,s),L.deleteContents(),i(d),!0};exports.applyFontFamily=j;exports.applyListType=z;exports.clearFormatDeep=X;exports.detectListType=J;exports.execCommand=i;exports.fileToDataUrl=G;exports.getActiveFormats=$;exports.insertHTML=C;exports.insertImage=V;exports.insertLink=W;exports.queryCommandState=l;exports.queryCommandValue=w;exports.setBlockDirection=ee;exports.setHighlightColor=Z;exports.setTextColor=K;exports.stripSelectionColors=p;exports.tryConvertMarkdownBlockPrefix=re;exports.tryConvertMarkdownListPrefix=ne;
|
|
@@ -16,6 +16,7 @@ export declare const applyFontFamily: (fontValue: string) => boolean;
|
|
|
16
16
|
export declare const applyListType: (listValue: string) => boolean;
|
|
17
17
|
export declare const detectListType: () => string;
|
|
18
18
|
export declare const setBlockDirection: (root: HTMLElement, direction: typeof DIR_LTR | typeof DIR_RTL) => boolean;
|
|
19
|
+
export declare const tryConvertMarkdownBlockPrefix: (event: KeyboardEvent) => boolean;
|
|
19
20
|
export declare const tryConvertMarkdownListPrefix: (event: KeyboardEvent) => boolean;
|
|
20
21
|
export declare const isSelectionInListItem: () => boolean;
|
|
21
22
|
export declare const applyFormat: (format: ToolbarOption) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/helpers/format.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAEL,OAAO,EACP,OAAO,EAqBR,MAAM,oBAAoB,CAAC;AAiB5B,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,EAAE,QAAQ,M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,6BAA6B,GAAI,OAAO,aAAa,KAAG,OAsBpE,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,OAAO,aAAa,KAAG,OA4BnE,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,OAUxC,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,QAAQ,aAAa,KAAG,OA6BnD,CAAC"}
|
|
@@ -1,119 +1,141 @@
|
|
|
1
|
-
import { NUMBER_ZERO as
|
|
2
|
-
import { FONT_VALUE_SYSTEM as
|
|
3
|
-
import {
|
|
4
|
-
import { DIR_ATTRIBUTE as
|
|
1
|
+
import { NUMBER_ZERO as c } from "../../../constants/numbers.js";
|
|
2
|
+
import { FONT_VALUE_SYSTEM as U, FONT_FAMILY_BY_VALUE as x, FONT_COMMAND_NAME as m, FONT_STYLE_PROPERTY as Y } from "../../../constants/fonts.const.js";
|
|
3
|
+
import { LIST_MARKDOWN_SPACE as h, LIST_MARKDOWN_DASH as A, LIST_MARKDOWN_STAR as C, LIST_TAG_UL as R, LIST_CLASS_DASH as _, LIST_VALUE_DASH as L, LIST_VALUE_BULLET as u, LIST_TAG_OL as M, LIST_CLASS_ALPHA as S, LIST_STYLE_LOWER_ALPHA as I, LIST_VALUE_LETTERS as D, LIST_VALUE_NUMBERS as P, LIST_STYLE_DISC as v, LIST_STYLE_DECIMAL as B } from "../../../constants/lists.const.js";
|
|
4
|
+
import { DIR_ATTRIBUTE as b } from "../../../constants/blocks.const.js";
|
|
5
5
|
import "../../../constants/openai.const.js";
|
|
6
6
|
import "react/jsx-runtime";
|
|
7
|
-
import { getBlockElement as
|
|
7
|
+
import { getBlockElement as H } from "../../../utils/blocks.utils.js";
|
|
8
8
|
import "../../../utils/paste.utils.js";
|
|
9
|
+
import "../../../utils/exportDocument.utils.js";
|
|
9
10
|
import "react";
|
|
10
11
|
import "react-dom";
|
|
11
|
-
const
|
|
12
|
+
const F = "color", W = "background-color", K = "background", g = "color", y = "style", q = 1, w = 3, $ = "removeFormat", p = "insertUnorderedList", E = "insertOrderedList", G = "superscript", V = "subscript", X = "styleWithCSS", s = (t, e) => document.execCommand(t, !1, e), l = (t) => document.queryCommandState(t), St = (t) => document.queryCommandValue(t), Q = "http://", O = "https://", Z = "mailto:", j = "&", z = "<", J = ">", tt = """, et = (t) => t.replace(/&/g, j).replace(/</g, z).replace(/>/g, J).replace(/"/g, tt), pt = (t, e = "") => {
|
|
12
13
|
if (!t) return !1;
|
|
13
|
-
const
|
|
14
|
-
return (!
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
return
|
|
18
|
-
},
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
}),
|
|
14
|
+
const o = t.startsWith(Q) || t.startsWith(O) || t.startsWith(Z) ? t : `${O}${t}`, n = window.getSelection();
|
|
15
|
+
return (!n || n.isCollapsed) && e ? s("insertHTML", `<a href="${o}">${et(e)}</a>`) : s("createLink", o);
|
|
16
|
+
}, Et = (t) => s("foreColor", t), At = (t) => s("hiliteColor", t), ot = (t) => s("insertHTML", t), Ct = (t, e = "") => {
|
|
17
|
+
const o = e.replace(/"/g, """);
|
|
18
|
+
return ot(`<img src="${t}" alt="${o}" style="max-width:100%;height:auto;" />`);
|
|
19
|
+
}, gt = (t) => new Promise((e, o) => {
|
|
20
|
+
const n = new FileReader();
|
|
21
|
+
n.onload = () => e(String(n.result)), n.onerror = o, n.readAsDataURL(t);
|
|
22
|
+
}), yt = () => {
|
|
22
23
|
const t = /* @__PURE__ */ new Set();
|
|
23
|
-
return
|
|
24
|
-
},
|
|
25
|
-
t.style.removeProperty(
|
|
24
|
+
return l("bold") && t.add("bold"), l("italic") && t.add("italic"), l("underline") && t.add("underline"), l("strikeThrough") && t.add("strikethrough"), l(p) && t.add("bulletList"), l(E) && t.add("orderedList"), l(G) && t.add("superscript"), l(V) && t.add("subscript"), t;
|
|
25
|
+
}, N = (t) => {
|
|
26
|
+
t.style.removeProperty(F), t.style.removeProperty(W), t.style.removeProperty(K), t.hasAttribute(g) && t.removeAttribute(g);
|
|
26
27
|
const e = t.getAttribute(y);
|
|
27
28
|
e !== null && !e.trim() && t.removeAttribute(y);
|
|
28
|
-
},
|
|
29
|
+
}, nt = () => {
|
|
29
30
|
const t = window.getSelection();
|
|
30
|
-
if (!t || t.rangeCount ===
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
if (!t || t.rangeCount === c) return;
|
|
32
|
+
const o = t.getRangeAt(c).commonAncestorContainer, n = o.nodeType === q ? o : o.parentElement;
|
|
33
|
+
n && (n instanceof HTMLElement && t.containsNode(n, !0) && N(n), n.querySelectorAll("*").forEach((r) => {
|
|
34
|
+
r instanceof HTMLElement && t.containsNode(r, !0) && N(r);
|
|
34
35
|
}));
|
|
35
|
-
},
|
|
36
|
-
const t = s(
|
|
37
|
-
return
|
|
38
|
-
},
|
|
39
|
-
const e =
|
|
40
|
-
if (s(
|
|
41
|
-
const
|
|
42
|
-
if (!
|
|
43
|
-
return s(
|
|
44
|
-
const
|
|
45
|
-
|
|
36
|
+
}, Ot = () => {
|
|
37
|
+
const t = s($);
|
|
38
|
+
return nt(), t;
|
|
39
|
+
}, Nt = (t) => {
|
|
40
|
+
const e = x[t] ?? t;
|
|
41
|
+
if (s(X, "true"), t === U) {
|
|
42
|
+
const o = window.getSelection();
|
|
43
|
+
if (!o || o.rangeCount === c || o.isCollapsed)
|
|
44
|
+
return s(m, e);
|
|
45
|
+
const n = o.getRangeAt(c), r = document.createElement("span");
|
|
46
|
+
r.style.setProperty(Y, e);
|
|
46
47
|
try {
|
|
47
|
-
return
|
|
48
|
+
return n.surroundContents(r), !0;
|
|
48
49
|
} catch {
|
|
49
|
-
return s(
|
|
50
|
+
return s(m, e);
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
|
-
return s(
|
|
53
|
-
},
|
|
54
|
-
t.classList.remove(_,
|
|
55
|
-
},
|
|
56
|
-
s(t ===
|
|
53
|
+
return s(m, t);
|
|
54
|
+
}, rt = (t) => {
|
|
55
|
+
t.classList.remove(_, S), t.style.removeProperty("list-style-type");
|
|
56
|
+
}, ht = (t) => {
|
|
57
|
+
s(t === u || t === L ? p : E);
|
|
57
58
|
const e = window.getSelection();
|
|
58
|
-
let
|
|
59
|
-
for (;
|
|
60
|
-
if (
|
|
61
|
-
|
|
59
|
+
let n = (e == null ? void 0 : e.anchorNode) ?? null, r = null;
|
|
60
|
+
for (; n; ) {
|
|
61
|
+
if (n instanceof HTMLElement && (n.tagName === R || n.tagName === M)) {
|
|
62
|
+
r = n;
|
|
62
63
|
break;
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
+
n = n.parentNode;
|
|
65
66
|
}
|
|
66
|
-
return
|
|
67
|
-
},
|
|
67
|
+
return r && (rt(r), t === u ? r.style.listStyleType = v : t === L ? r.classList.add(_) : t === P ? r.style.listStyleType = B : t === D && (r.classList.add(S), r.style.listStyleType = I)), !0;
|
|
68
|
+
}, Rt = () => {
|
|
68
69
|
const t = window.getSelection();
|
|
69
70
|
let e = (t == null ? void 0 : t.anchorNode) ?? null;
|
|
70
71
|
for (; e; ) {
|
|
71
72
|
if (e instanceof HTMLElement) {
|
|
72
|
-
if (e.tagName === N)
|
|
73
|
-
return e.classList.contains(_) ? u : l;
|
|
74
73
|
if (e.tagName === R)
|
|
75
|
-
return e.classList.contains(
|
|
74
|
+
return e.classList.contains(_) ? L : u;
|
|
75
|
+
if (e.tagName === M)
|
|
76
|
+
return e.classList.contains(S) || e.style.listStyleType === I ? D : P;
|
|
76
77
|
}
|
|
77
78
|
e = e.parentNode;
|
|
78
79
|
}
|
|
79
|
-
return
|
|
80
|
-
},
|
|
81
|
-
const
|
|
82
|
-
return
|
|
83
|
-
},
|
|
84
|
-
|
|
80
|
+
return u;
|
|
81
|
+
}, Mt = (t, e) => {
|
|
82
|
+
const o = window.getSelection(), n = H((o == null ? void 0 : o.anchorNode) ?? null, t);
|
|
83
|
+
return n ? (n.setAttribute(b, e), !0) : !1;
|
|
84
|
+
}, st = [
|
|
85
|
+
{ prefix: "###", command: "formatBlock", value: "h3" },
|
|
86
|
+
{ prefix: "##", command: "formatBlock", value: "h2" },
|
|
87
|
+
{ prefix: "#", command: "formatBlock", value: "h1" },
|
|
88
|
+
{ prefix: ">", command: "formatBlock", value: "blockquote" },
|
|
89
|
+
{ prefix: "1.", command: E }
|
|
90
|
+
], It = (t) => {
|
|
91
|
+
if (t.key !== h) return !1;
|
|
85
92
|
const e = window.getSelection();
|
|
86
|
-
if (!e || !e.isCollapsed || e.rangeCount ===
|
|
93
|
+
if (!e || !e.isCollapsed || e.rangeCount === c) return !1;
|
|
94
|
+
const o = e.anchorNode;
|
|
95
|
+
if (!o || o.nodeType !== w) return !1;
|
|
96
|
+
const n = o.textContent ?? "", r = e.anchorOffset, d = n.slice(c, r), i = st.find((k) => d.endsWith(k.prefix));
|
|
97
|
+
if (!i) return !1;
|
|
98
|
+
const a = r - i.prefix.length, T = a > c ? d[a - 1] : "";
|
|
99
|
+
if (T && T !== `
|
|
100
|
+
`) return !1;
|
|
101
|
+
t.preventDefault();
|
|
102
|
+
const f = e.getRangeAt(c);
|
|
103
|
+
return f.setStart(o, a), f.setEnd(o, r), f.deleteContents(), i.value ? s(i.command, i.value) : s(i.command), !0;
|
|
104
|
+
}, Dt = (t) => {
|
|
105
|
+
if (t.key !== h) return !1;
|
|
106
|
+
const e = window.getSelection();
|
|
107
|
+
if (!e || !e.isCollapsed || e.rangeCount === c)
|
|
87
108
|
return !1;
|
|
88
|
-
const
|
|
89
|
-
if (!
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
92
|
-
const a =
|
|
93
|
-
if (a <
|
|
94
|
-
const
|
|
95
|
-
if (
|
|
109
|
+
const o = e.anchorNode;
|
|
110
|
+
if (!o || o.nodeType !== w) return !1;
|
|
111
|
+
const n = o.textContent ?? "", r = e.anchorOffset, d = n.slice(c, r), i = d.endsWith(A) ? A : d.endsWith(C) ? C : null;
|
|
112
|
+
if (!i) return !1;
|
|
113
|
+
const a = r - i.length;
|
|
114
|
+
if (a < c) return !1;
|
|
115
|
+
const T = a > c ? d[a - 1] : "";
|
|
116
|
+
if (T && T !== `
|
|
96
117
|
`) return !1;
|
|
97
118
|
t.preventDefault();
|
|
98
|
-
const
|
|
99
|
-
return
|
|
119
|
+
const f = e.getRangeAt(c);
|
|
120
|
+
return f.setStart(o, a), f.setEnd(o, r), f.deleteContents(), s(p), !0;
|
|
100
121
|
};
|
|
101
122
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
123
|
+
Nt as applyFontFamily,
|
|
124
|
+
ht as applyListType,
|
|
125
|
+
Ot as clearFormatDeep,
|
|
126
|
+
Rt as detectListType,
|
|
106
127
|
s as execCommand,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
128
|
+
gt as fileToDataUrl,
|
|
129
|
+
yt as getActiveFormats,
|
|
130
|
+
ot as insertHTML,
|
|
131
|
+
Ct as insertImage,
|
|
132
|
+
pt as insertLink,
|
|
133
|
+
l as queryCommandState,
|
|
134
|
+
St as queryCommandValue,
|
|
135
|
+
Mt as setBlockDirection,
|
|
136
|
+
At as setHighlightColor,
|
|
137
|
+
Et as setTextColor,
|
|
138
|
+
nt as stripSelectionColors,
|
|
139
|
+
It as tryConvertMarkdownBlockPrefix,
|
|
140
|
+
Dt as tryConvertMarkdownListPrefix
|
|
119
141
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { execCommand, queryCommandState, queryCommandValue, insertLink, setTextColor, setHighlightColor, insertHTML, insertImage, fileToDataUrl, getActiveFormats, applyFormat, applyFontFamily, applyListType, detectListType, setBlockDirection, clearFormatDeep, stripSelectionColors, tryConvertMarkdownListPrefix, isSelectionInListItem, } from './format.utils';
|
|
1
|
+
export { execCommand, queryCommandState, queryCommandValue, insertLink, setTextColor, setHighlightColor, insertHTML, insertImage, fileToDataUrl, getActiveFormats, applyFormat, applyFontFamily, applyListType, detectListType, setBlockDirection, clearFormatDeep, stripSelectionColors, tryConvertMarkdownBlockPrefix, tryConvertMarkdownListPrefix, isSelectionInListItem, } from './format.utils';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/InkEditor/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,6BAA6B,EAC7B,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),H=require("../InkTabs/InkTabs.cjs"),j=require("../InkEditor/InkEditor.cjs"),f=require("../InkEditor/components/PresenceStack/PresenceStack.cjs"),X=require("./hooks/useInkWorkspace.cjs"),t=require("./components/WorkspaceIcons.cjs"),P=require("../../constants/numbers.cjs"),A=require("../../constants/generals.const.cjs");require("../../constants/openai.const.cjs");const d=require("../../utils/cn.utils.cjs");require("../../utils/paste.utils.cjs");require("../../utils/exportDocument.utils.cjs");const i=require("../../common-components/Button/Button.cjs");require("react");require("react-dom");const n=require("../../constants/workspace.const.cjs"),G=p=>{const{documents:E,activeDocumentId:O,onActiveDocumentChange:T,onDocumentChange:r,onDocumentDelete:N,onDocumentRename:b,onDocumentSave:u,folders:S=[],onFolderCreate:K,onFolderDelete:m,collaboration:o,editorProps:C={},className:W=A.EMPTY_STRING,style:D}=p,{sidebarOpen:k,setSidebarOpen:v,splitMode:_,setSplitMode:I,setSecondaryDocId:w,searchQuery:y,setSearchQuery:B,editingDocId:g,editTitle:q,setEditTitle:M,activeDocument:l,secondaryDocument:c,filteredDocs:F,handleCreateDocument:R,handleStartRename:x,handleSaveRename:h,handleCancelRename:U}=X.useInkWorkspace(p);return e.jsxs("div",{className:d.cn("ink-workspace-root",W),style:D,"data-split-mode":_,children:[e.jsxs("header",{className:"ink-workspace-header",children:[e.jsxs("div",{className:"ink-workspace-header-left",children:[e.jsx(i.Button,{type:"button",className:"ink-workspace-toggle-btn",onClick:()=>v(!k),title:k?n.INK_WORKSPACE_HIDE_EXPLORER_TITLE:n.INK_WORKSPACE_SHOW_EXPLORER_TITLE,"aria-label":k?n.INK_WORKSPACE_HIDE_EXPLORER_TITLE:n.INK_WORKSPACE_SHOW_EXPLORER_TITLE,children:e.jsx(t.SidebarToggleIcon,{})}),e.jsx("span",{className:"ink-workspace-title",children:n.INK_WORKSPACE_TITLE}),e.jsxs("span",{className:"ink-workspace-count",children:["(",E.length," ",n.INK_WORKSPACE_DOCS_SUFFIX,")"]})]}),e.jsxs("div",{className:"ink-workspace-header-right",children:[e.jsxs("div",{className:"ink-workspace-split-controls",role:"group","aria-label":n.INK_WORKSPACE_SPLIT_VIEW_LABEL,children:[e.jsx(i.Button,{type:"button",className:d.cn("ink-workspace-icon-btn",_===n.INK_SPLIT_MODE_NONE&&"ink-active"),onClick:()=>I(n.INK_SPLIT_MODE_NONE),title:n.INK_WORKSPACE_SINGLE_VIEW_TITLE,children:e.jsx(t.SingleViewIcon,{})}),e.jsx(i.Button,{type:"button",className:d.cn("ink-workspace-icon-btn",_===n.INK_SPLIT_MODE_VERTICAL&&"ink-active"),onClick:()=>I(n.INK_SPLIT_MODE_VERTICAL),title:n.INK_WORKSPACE_SPLIT_SIDE_TITLE,children:e.jsx(t.SplitVerticalIcon,{})}),e.jsx(i.Button,{type:"button",className:d.cn("ink-workspace-icon-btn",_===n.INK_SPLIT_MODE_HORIZONTAL&&"ink-active"),onClick:()=>I(n.INK_SPLIT_MODE_HORIZONTAL),title:n.INK_WORKSPACE_SPLIT_STACKED_TITLE,children:e.jsx(t.SplitHorizontalIcon,{})})]}),u&&l&&e.jsx(i.Button,{type:"button",className:"ink-workspace-icon-btn",onClick:()=>u(l.id),title:n.INK_WORKSPACE_SAVE_TITLE,"aria-label":n.INK_WORKSPACE_SAVE_TITLE,children:e.jsx(t.SaveDocIcon,{})}),(o==null?void 0:o.collaborators)&&e.jsx(f.PresenceStack,{collaborators:o.collaborators,maxAvatars:o.maxAvatars})]})]}),e.jsxs("div",{className:"ink-workspace-body",children:[k&&e.jsxs("aside",{className:"ink-workspace-sidebar","aria-label":n.INK_WORKSPACE_TITLE,children:[e.jsxs("div",{className:"ink-workspace-sidebar-toolbar",children:[e.jsx("input",{type:"text",className:"ink-workspace-search-input",placeholder:n.INK_WORKSPACE_SEARCH_PLACEHOLDER,value:y,onChange:s=>B(s.target.value)}),e.jsx(i.Button,{type:"button",className:"ink-workspace-new-doc-btn",onClick:R,title:n.INK_WORKSPACE_NEW_DOC_BUTTON,"aria-label":n.INK_WORKSPACE_NEW_DOC_BUTTON,children:n.INK_WORKSPACE_NEW_DOC_BUTTON}),K&&e.jsx(i.Button,{type:"button",className:"ink-workspace-icon-btn",onClick:()=>K(n.INK_WORKSPACE_NEW_FOLDER),title:n.INK_WORKSPACE_NEW_FOLDER,"aria-label":n.INK_WORKSPACE_NEW_FOLDER,children:e.jsx(t.NewFolderIcon,{})})]}),S.length>P.NUMBER_ZERO&&e.jsx("div",{className:"ink-workspace-folders-section",children:S.map(s=>e.jsxs("div",{className:"ink-workspace-folder-item",children:[e.jsx("span",{className:"ink-doc-icon",children:"📁"}),e.jsx("span",{className:"ink-doc-title",children:s.name}),m&&e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn ink-delete",onClick:()=>m(s.id),title:n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON,"aria-label":n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON,children:n.INK_WORKSPACE_CLOSE_FOLDER_BUTTON})]},s.id))}),e.jsx("div",{className:"ink-workspace-doc-list",role:"tree",children:F.map(s=>{const L=s.id===O,V=g===s.id;return e.jsxs("div",{role:"treeitem","aria-selected":L,className:d.cn("ink-workspace-doc-item",L&&"ink-doc-active"),onClick:()=>T(s.id),children:[e.jsx("span",{className:"ink-doc-icon",children:s.icon||e.jsx(t.FileDocumentIcon,{})}),V?e.jsx("input",{type:"text",className:"ink-doc-title-input",value:q,autoFocus:!0,onChange:a=>M(a.target.value),onBlur:()=>h(s.id),onKeyDown:a=>{a.key==="Enter"&&h(s.id),a.key==="Escape"&&U()},onClick:a=>a.stopPropagation()}):e.jsx("span",{className:"ink-doc-title",onDoubleClick:a=>x(s.id,s.title,a),children:s.title||n.INK_WORKSPACE_UNTITLED_FALLBACK}),s.isDirty&&e.jsx("span",{className:"ink-doc-dirty-dot"}),e.jsxs("div",{className:"ink-doc-actions",children:[e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn",onClick:a=>x(s.id,s.title,a),title:n.INK_WORKSPACE_RENAME_TITLE,"aria-label":n.INK_WORKSPACE_RENAME_TITLE,children:e.jsx(t.RenamePencilIcon,{})}),E.length>P.NUMBER_ONE&&N&&e.jsx(i.Button,{type:"button",className:"ink-doc-action-btn ink-delete",onClick:a=>{a.stopPropagation(),N(s.id)},title:n.INK_WORKSPACE_DELETE_TITLE,"aria-label":n.INK_WORKSPACE_DELETE_TITLE,children:e.jsx(t.CloseCrossIcon,{})})]})]},s.id)})})]}),e.jsxs("main",{className:d.cn("ink-workspace-main-area",`ink-split-${_}`),children:[e.jsxs("section",{className:"ink-workspace-pane ink-primary-pane",children:[e.jsx(H.InkTabs,{documents:E,activeDocumentId:O,onTabSelect:T,onTabClose:N,onTabAdd:R,onTabRename:b}),l&&e.jsx("div",{className:"ink-workspace-editor-wrapper",children:e.jsx(j.InkEditor,{value:l.content,onChange:s=>r==null?void 0:r(l.id,s),readOnly:l.readOnly,collaboration:o,...C},l.id)})]}),_!==n.INK_SPLIT_MODE_NONE&&e.jsxs("section",{className:"ink-workspace-pane ink-secondary-pane",children:[e.jsxs("div",{className:"ink-secondary-pane-header",children:[e.jsx("span",{className:"ink-secondary-pane-label",children:n.INK_WORKSPACE_SPLIT_VIEW_LABEL}),e.jsx("select",{className:"ink-secondary-pane-select",value:(c==null?void 0:c.id)||A.EMPTY_STRING,onChange:s=>w(s.target.value),"aria-label":n.INK_WORKSPACE_SPLIT_VIEW_LABEL,children:E.map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))})]}),c&&e.jsx("div",{className:"ink-workspace-editor-wrapper",children:e.jsx(j.InkEditor,{value:c.content,onChange:s=>r==null?void 0:r(c.id,s),readOnly:c.readOnly,...C},`sec-${c.id}`)})]})]})]})]})};exports.InkWorkspace=G;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkWorkspace.d.ts","sourceRoot":"","sources":["../../../src/components/InkWorkspace/InkWorkspace.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"InkWorkspace.d.ts","sourceRoot":"","sources":["../../../src/components/InkWorkspace/InkWorkspace.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA2CjD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA0SpD,CAAC"}
|