@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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../constants/numbers.cjs"),_=require("../constants/generals.const.cjs"),u=require("../constants/defaults.const.cjs");require("../constants/openai.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");require("react");require("react-dom");const N=`${u.INK_OUTLINE_HEADING_SELECTOR}, [${u.INK_ATTR_TITLE}]`,O={H1:e.NUMBER_ONE,H2:e.NUMBER_TWO,H3:e.NUMBER_THREE},R=t=>t.hasAttribute(u.INK_ATTR_TITLE)?e.NUMBER_ONE:O[t.tagName]??null,f=t=>{if(!t)return[];const o=t.querySelectorAll(N),n=[];return o.forEach((r,l)=>{if(!(r instanceof HTMLElement))return;const i=R(r);if(!i)return;const s=(r.textContent??_.EMPTY_STRING).trim();s&&n.push({index:l,level:i,text:s})}),n},M=(t,o)=>{const r=t.querySelectorAll(N).item(o);r instanceof HTMLElement&&r.scrollIntoView({block:"center",behavior:"smooth"})},T=t=>{if(!t)return{line:e.NUMBER_ONE,col:e.NUMBER_ONE};const o=window.getSelection();if(!o||o.rangeCount===e.NUMBER_ZERO)return{line:e.NUMBER_ONE,col:e.NUMBER_ONE};const n=o.getRangeAt(e.NUMBER_ZERO);if(!t.contains(n.startContainer))return{line:e.NUMBER_ONE,col:e.NUMBER_ONE};const r=t.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, pre");let l=e.NUMBER_ONE,i=!1;r.forEach((E,a)=>{i||!(E instanceof HTMLElement)||(E.contains(n.startContainer)||E===n.startContainer)&&(l=a+e.NUMBER_ONE,i=!0)});const s=i?r.item(l-e.NUMBER_ONE):null;if(!(s instanceof HTMLElement))return{line:l,col:e.NUMBER_ONE};const c=n.cloneRange();return c.selectNodeContents(s),c.setEnd(n.startContainer,n.startOffset),{line:l,col:c.toString().length+e.NUMBER_ONE}};exports.collectOutlineItems=f;exports.getCaretLineCol=T;exports.scrollOutlineHeading=M;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../constants/numbers.cjs"),_=require("../constants/generals.const.cjs"),u=require("../constants/defaults.const.cjs");require("../constants/openai.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");require("./exportDocument.utils.cjs");require("react");require("react-dom");const N=`${u.INK_OUTLINE_HEADING_SELECTOR}, [${u.INK_ATTR_TITLE}]`,O={H1:e.NUMBER_ONE,H2:e.NUMBER_TWO,H3:e.NUMBER_THREE},R=t=>t.hasAttribute(u.INK_ATTR_TITLE)?e.NUMBER_ONE:O[t.tagName]??null,f=t=>{if(!t)return[];const o=t.querySelectorAll(N),n=[];return o.forEach((r,l)=>{if(!(r instanceof HTMLElement))return;const i=R(r);if(!i)return;const s=(r.textContent??_.EMPTY_STRING).trim();s&&n.push({index:l,level:i,text:s})}),n},M=(t,o)=>{const r=t.querySelectorAll(N).item(o);r instanceof HTMLElement&&r.scrollIntoView({block:"center",behavior:"smooth"})},T=t=>{if(!t)return{line:e.NUMBER_ONE,col:e.NUMBER_ONE};const o=window.getSelection();if(!o||o.rangeCount===e.NUMBER_ZERO)return{line:e.NUMBER_ONE,col:e.NUMBER_ONE};const n=o.getRangeAt(e.NUMBER_ZERO);if(!t.contains(n.startContainer))return{line:e.NUMBER_ONE,col:e.NUMBER_ONE};const r=t.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, pre");let l=e.NUMBER_ONE,i=!1;r.forEach((E,a)=>{i||!(E instanceof HTMLElement)||(E.contains(n.startContainer)||E===n.startContainer)&&(l=a+e.NUMBER_ONE,i=!0)});const s=i?r.item(l-e.NUMBER_ONE):null;if(!(s instanceof HTMLElement))return{line:l,col:e.NUMBER_ONE};const c=n.cloneRange();return c.selectNodeContents(s),c.setEnd(n.startContainer,n.startOffset),{line:l,col:c.toString().length+e.NUMBER_ONE}};exports.collectOutlineItems=f;exports.getCaretLineCol=T;exports.scrollOutlineHeading=M;
|
|
@@ -4,26 +4,27 @@ import { INK_OUTLINE_HEADING_SELECTOR as h, INK_ATTR_TITLE as E } from "../const
|
|
|
4
4
|
import "../constants/openai.const.js";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "./paste.utils.js";
|
|
7
|
+
import "./exportDocument.utils.js";
|
|
7
8
|
import "react";
|
|
8
9
|
import "react-dom";
|
|
9
|
-
const f = `${h}, [${E}]`,
|
|
10
|
+
const f = `${h}, [${E}]`, p = {
|
|
10
11
|
H1: t,
|
|
11
12
|
H2: N,
|
|
12
13
|
H3: T
|
|
13
|
-
},
|
|
14
|
+
}, g = (e) => e.hasAttribute(E) ? t : p[e.tagName] ?? null, U = (e) => {
|
|
14
15
|
if (!e) return [];
|
|
15
16
|
const o = e.querySelectorAll(f), n = [];
|
|
16
17
|
return o.forEach((r, i) => {
|
|
17
18
|
if (!(r instanceof HTMLElement)) return;
|
|
18
|
-
const l =
|
|
19
|
+
const l = g(r);
|
|
19
20
|
if (!l) return;
|
|
20
21
|
const c = (r.textContent ?? _).trim();
|
|
21
22
|
c && n.push({ index: i, level: l, text: c });
|
|
22
23
|
}), n;
|
|
23
|
-
},
|
|
24
|
+
}, b = (e, o) => {
|
|
24
25
|
const r = e.querySelectorAll(f).item(o);
|
|
25
26
|
r instanceof HTMLElement && r.scrollIntoView({ block: "center", behavior: "smooth" });
|
|
26
|
-
},
|
|
27
|
+
}, d = (e) => {
|
|
27
28
|
if (!e) return { line: t, col: t };
|
|
28
29
|
const o = window.getSelection();
|
|
29
30
|
if (!o || o.rangeCount === u)
|
|
@@ -43,7 +44,7 @@ const f = `${h}, [${E}]`, g = {
|
|
|
43
44
|
return s.selectNodeContents(c), s.setEnd(n.startContainer, n.startOffset), { line: i, col: s.toString().length + t };
|
|
44
45
|
};
|
|
45
46
|
export {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
U as collectOutlineItems,
|
|
48
|
+
d as getCaretLineCol,
|
|
49
|
+
b as scrollOutlineHeading
|
|
49
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../constants/openai.const.cjs");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../constants/openai.const.cjs");const m=require("../constants/premium.const.cjs");require("react/jsx-runtime");require("./exportDocument.utils.cjs");require("react");require("react-dom");const d=new Set(m.INK_PASTE_ALLOWED_TAGS),E=new Set(m.INK_PASTE_ALLOWED_ATTRS),a=(e,o)=>{if(e.nodeType===Node.TEXT_NODE){o.appendChild(e.cloneNode(!0));return}if(e.nodeType!==Node.ELEMENT_NODE)return;const i=e,t=i.tagName.toLowerCase();if(t==="script"||t==="style"||t==="iframe"||t==="object")return;if(!d.has(t)){Array.from(i.childNodes).forEach(r=>a(r,o));return}const s=document.createElement(t);Array.from(i.attributes).forEach(r=>{const n=r.name.toLowerCase();E.has(n)&&(n.startsWith("on")||(n==="href"||n==="src")&&r.value.trim().toLowerCase().startsWith("javascript:")||s.setAttribute(r.name,r.value))}),Array.from(i.childNodes).forEach(r=>a(r,s)),o.appendChild(s)},T=/mso-|urn:schemas-microsoft-com|docs-internal-guid/i,A=/MsoListParagraph/i,L=/mso-list/i,u=e=>{const o=e.parentNode;if(o){for(;e.firstChild;)o.insertBefore(e.firstChild,e);e.remove()}},l=e=>T.test(e),f=e=>{if(!e.trim()||!l(e))return e;const o=document.createElement("div");o.innerHTML=e,o.querySelectorAll("style, meta, link, script").forEach(t=>t.remove());let i=null;return Array.from(o.querySelectorAll("p")).forEach(t=>{const s=t.getAttribute("style")??"",r=t.getAttribute("class")??"";if(!(A.test(r)||L.test(s))){i=null;return}const c=document.createElement("li");c.innerHTML=t.innerHTML,i?t.remove():(i=document.createElement("ul"),t.replaceWith(i)),i.appendChild(c)}),Array.from(o.querySelectorAll("*")).forEach(t=>{const s=t.tagName.toLowerCase();if(s.includes(":")){u(t);return}Array.from(t.attributes).forEach(r=>{const n=r.name.toLowerCase(),c=r.value;n==="style"&&/mso-|docs-/i.test(c)&&t.removeAttribute(r.name),n==="class"&&/mso|apple-|docs-/i.test(c)&&t.removeAttribute(r.name),n==="id"&&/docs-internal/i.test(c)&&t.removeAttribute(r.name)}),s==="span"&&t.attributes.length===0&&u(t)}),o.innerHTML},p=e=>{const o=l(e)?f(e):e;if(!o.trim())return"";const i=document.createElement("template");i.innerHTML=o;const t=document.createElement("div");return Array.from(i.content.childNodes).forEach(s=>a(s,t)),t.innerHTML},y=e=>e&&e.getData("text/html")||"",_=e=>e&&e.getData("text/plain")||"";exports.cleanOfficeHtml=f;exports.extractClipboardHtml=y;exports.extractClipboardText=_;exports.isOfficeHtml=l;exports.sanitizePastedHtml=p;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare const isOfficeHtml: (html: string) => boolean;
|
|
2
|
+
export declare const cleanOfficeHtml: (html: string) => string;
|
|
1
3
|
export declare const sanitizePastedHtml: (html: string) => string;
|
|
2
4
|
export declare const extractClipboardHtml: (data: DataTransfer | null) => string;
|
|
3
5
|
export declare const extractClipboardText: (data: DataTransfer | null) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paste.utils.d.ts","sourceRoot":"","sources":["../../src/utils/paste.utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paste.utils.d.ts","sourceRoot":"","sources":["../../src/utils/paste.utils.ts"],"names":[],"mappings":"AAqDA,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,KAAG,OAAyC,CAAC;AAEtF,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,MA2C9C,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,MAQjD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,YAAY,GAAG,IAAI,KAAG,MAGhE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,YAAY,GAAG,IAAI,KAAG,MAGhE,CAAC"}
|
|
@@ -1,35 +1,69 @@
|
|
|
1
1
|
import "../constants/openai.const.js";
|
|
2
|
-
import { INK_PASTE_ALLOWED_TAGS as
|
|
2
|
+
import { INK_PASTE_ALLOWED_TAGS as u, INK_PASTE_ALLOWED_ATTRS as f } from "../constants/premium.const.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
|
+
import "./exportDocument.utils.js";
|
|
4
5
|
import "react";
|
|
5
6
|
import "react-dom";
|
|
6
|
-
const
|
|
7
|
+
const d = new Set(u), E = new Set(f), a = (t, o) => {
|
|
7
8
|
if (t.nodeType === Node.TEXT_NODE) {
|
|
8
|
-
|
|
9
|
+
o.appendChild(t.cloneNode(!0));
|
|
9
10
|
return;
|
|
10
11
|
}
|
|
11
12
|
if (t.nodeType !== Node.ELEMENT_NODE) return;
|
|
12
|
-
const
|
|
13
|
+
const n = t, e = n.tagName.toLowerCase();
|
|
13
14
|
if (e === "script" || e === "style" || e === "iframe" || e === "object")
|
|
14
15
|
return;
|
|
15
|
-
if (!
|
|
16
|
-
Array.from(
|
|
16
|
+
if (!d.has(e)) {
|
|
17
|
+
Array.from(n.childNodes).forEach((r) => a(r, o));
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
19
|
-
const
|
|
20
|
-
Array.from(
|
|
20
|
+
const s = document.createElement(e);
|
|
21
|
+
Array.from(n.attributes).forEach((r) => {
|
|
21
22
|
const i = r.name.toLowerCase();
|
|
22
|
-
|
|
23
|
-
}), Array.from(
|
|
24
|
-
}, A = (t) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
E.has(i) && (i.startsWith("on") || (i === "href" || i === "src") && r.value.trim().toLowerCase().startsWith("javascript:") || s.setAttribute(r.name, r.value));
|
|
24
|
+
}), Array.from(n.childNodes).forEach((r) => a(r, s)), o.appendChild(s);
|
|
25
|
+
}, A = /mso-|urn:schemas-microsoft-com|docs-internal-guid/i, T = /MsoListParagraph/i, L = /mso-list/i, l = (t) => {
|
|
26
|
+
const o = t.parentNode;
|
|
27
|
+
if (o) {
|
|
28
|
+
for (; t.firstChild; ) o.insertBefore(t.firstChild, t);
|
|
29
|
+
t.remove();
|
|
30
|
+
}
|
|
31
|
+
}, m = (t) => A.test(t), p = (t) => {
|
|
32
|
+
if (!t.trim() || !m(t)) return t;
|
|
28
33
|
const o = document.createElement("div");
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
o.innerHTML = t, o.querySelectorAll("style, meta, link, script").forEach((e) => e.remove());
|
|
35
|
+
let n = null;
|
|
36
|
+
return Array.from(o.querySelectorAll("p")).forEach((e) => {
|
|
37
|
+
const s = e.getAttribute("style") ?? "", r = e.getAttribute("class") ?? "";
|
|
38
|
+
if (!(T.test(r) || L.test(s))) {
|
|
39
|
+
n = null;
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const c = document.createElement("li");
|
|
43
|
+
c.innerHTML = e.innerHTML, n ? e.remove() : (n = document.createElement("ul"), e.replaceWith(n)), n.appendChild(c);
|
|
44
|
+
}), Array.from(o.querySelectorAll("*")).forEach((e) => {
|
|
45
|
+
const s = e.tagName.toLowerCase();
|
|
46
|
+
if (s.includes(":")) {
|
|
47
|
+
l(e);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
Array.from(e.attributes).forEach((r) => {
|
|
51
|
+
const i = r.name.toLowerCase(), c = r.value;
|
|
52
|
+
i === "style" && /mso-|docs-/i.test(c) && e.removeAttribute(r.name), i === "class" && /mso|apple-|docs-/i.test(c) && e.removeAttribute(r.name), i === "id" && /docs-internal/i.test(c) && e.removeAttribute(r.name);
|
|
53
|
+
}), s === "span" && e.attributes.length === 0 && l(e);
|
|
54
|
+
}), o.innerHTML;
|
|
55
|
+
}, v = (t) => {
|
|
56
|
+
const o = m(t) ? p(t) : t;
|
|
57
|
+
if (!o.trim()) return "";
|
|
58
|
+
const n = document.createElement("template");
|
|
59
|
+
n.innerHTML = o;
|
|
60
|
+
const e = document.createElement("div");
|
|
61
|
+
return Array.from(n.content.childNodes).forEach((s) => a(s, e)), e.innerHTML;
|
|
62
|
+
}, b = (t) => t && t.getData("text/html") || "", H = (t) => t && t.getData("text/plain") || "";
|
|
31
63
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
64
|
+
p as cleanOfficeHtml,
|
|
65
|
+
b as extractClipboardHtml,
|
|
66
|
+
H as extractClipboardText,
|
|
67
|
+
m as isOfficeHtml,
|
|
68
|
+
v as sanitizePastedHtml
|
|
35
69
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paste.utils.test.d.ts","sourceRoot":"","sources":["../../src/utils/paste.utils.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../constants/openai.const.cjs");const s=require("../constants/premium.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");require("react");require("react-dom");const E=()=>Object.fromEntries(s.INK_PREMIUM_FEATURES.map(e=>[e,!1])),n=()=>Object.fromEntries(s.INK_PREMIUM_FEATURES.map(e=>[e,!0])),l=/^[A-Z0-9]{4}(?:_[A-Z0-9]{4}){3}$/,a=e=>{if(!e)return!1;const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../constants/openai.const.cjs");const s=require("../constants/premium.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");require("./exportDocument.utils.cjs");require("react");require("react-dom");const E=()=>Object.fromEntries(s.INK_PREMIUM_FEATURES.map(e=>[e,!1])),n=()=>Object.fromEntries(s.INK_PREMIUM_FEATURES.map(e=>[e,!0])),l=/^[A-Z0-9]{4}(?:_[A-Z0-9]{4}){3}$/,a=e=>{if(!e)return!1;const r=e.trim();if(!r.startsWith(s.INK_PREMIUM_LICENSE_PREFIX))return!1;const t=r.slice(s.INK_PREMIUM_LICENSE_PREFIX.length);return l.test(t)},I=e=>{const r=!!(e!=null&&e.enabled||a(e==null?void 0:e.licenseKey));if(!r)return{active:!1,features:E()};const t=n();if(e!=null&&e.features)for(const u of s.INK_PREMIUM_FEATURES)e.features[u]===!1&&(t[u]=!1);return{active:r,features:t}},_=(e,r)=>e.active&&e.features[r],i=e=>{if(!e)return{};const r={};return Object.keys(s.INK_THEME_CSS_VARS).forEach(t=>{const u=e[t];u&&(r[s.INK_THEME_CSS_VARS[t]]=u)}),r};exports.hasInkPremiumFeature=_;exports.isInkPremiumLicenseKey=a;exports.resolveInkPremium=I;exports.themeTokensToStyle=i;
|
|
@@ -1,35 +1,36 @@
|
|
|
1
1
|
import "../constants/openai.const.js";
|
|
2
|
-
import { INK_PREMIUM_LICENSE_PREFIX as u, INK_PREMIUM_FEATURES as a, INK_THEME_CSS_VARS as
|
|
2
|
+
import { INK_PREMIUM_LICENSE_PREFIX as u, INK_PREMIUM_FEATURES as a, INK_THEME_CSS_VARS as m } from "../constants/premium.const.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "./paste.utils.js";
|
|
5
|
+
import "./exportDocument.utils.js";
|
|
5
6
|
import "react";
|
|
6
7
|
import "react-dom";
|
|
7
|
-
const
|
|
8
|
+
const o = () => Object.fromEntries(a.map((e) => [e, !1])), l = () => Object.fromEntries(a.map((e) => [e, !0])), n = /^[A-Z0-9]{4}(?:_[A-Z0-9]{4}){3}$/, E = (e) => {
|
|
8
9
|
if (!e) return !1;
|
|
9
10
|
const t = e.trim();
|
|
10
11
|
if (!t.startsWith(u)) return !1;
|
|
11
12
|
const r = t.slice(u.length);
|
|
12
13
|
return n.test(r);
|
|
13
|
-
},
|
|
14
|
+
}, S = (e) => {
|
|
14
15
|
const t = !!(e != null && e.enabled || E(e == null ? void 0 : e.licenseKey));
|
|
15
16
|
if (!t)
|
|
16
|
-
return { active: !1, features:
|
|
17
|
-
const r =
|
|
17
|
+
return { active: !1, features: o() };
|
|
18
|
+
const r = l();
|
|
18
19
|
if (e != null && e.features)
|
|
19
20
|
for (const s of a)
|
|
20
21
|
e.features[s] === !1 && (r[s] = !1);
|
|
21
22
|
return { active: t, features: r };
|
|
22
|
-
},
|
|
23
|
+
}, N = (e, t) => e.active && e.features[t], O = (e) => {
|
|
23
24
|
if (!e) return {};
|
|
24
25
|
const t = {};
|
|
25
|
-
return Object.keys(
|
|
26
|
+
return Object.keys(m).forEach((r) => {
|
|
26
27
|
const s = e[r];
|
|
27
|
-
s && (t[
|
|
28
|
+
s && (t[m[r]] = s);
|
|
28
29
|
}), t;
|
|
29
30
|
};
|
|
30
31
|
export {
|
|
31
|
-
|
|
32
|
+
N as hasInkPremiumFeature,
|
|
32
33
|
E as isInkPremiumLicenseKey,
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
S as resolveInkPremium,
|
|
35
|
+
O as themeTokensToStyle
|
|
35
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../constants/numbers.cjs");require("../constants/openai.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");require("react");require("react-dom");const g=3,i=(e,n)=>{const t=[];let r=n;for(;r&&r!==e;){const o=r.parentNode;if(!o)return[];t.unshift(Array.from(o.childNodes).indexOf(r)),r=o}return t},a=(e,n)=>{let t=e;for(const r of n){const o=t.childNodes[r];if(!o)return null;t=o}return t},u=e=>{var n;return e.nodeType===g?((n=e.textContent)==null?void 0:n.length)??c.NUMBER_ZERO:e.childNodes.length},f=e=>{if(!e)return null;const n=window.getSelection();if(!n||n.rangeCount===c.NUMBER_ZERO)return null;const t=n.getRangeAt(c.NUMBER_ZERO);return e.contains(t.commonAncestorContainer)?{startPath:i(e,t.startContainer),startOffset:t.startOffset,endPath:i(e,t.endContainer),endOffset:t.endOffset}:null},l=(e,n)=>{if(!e||!n)return;const t=a(e,n.startPath),r=a(e,n.endPath);if(!t||!r)return;const o=window.getSelection();if(o)try{const s=document.createRange(),d=Math.min(n.startOffset,u(t)),h=Math.min(n.endOffset,u(r));s.setStart(t,d),s.setEnd(r,h),o.removeAllRanges(),o.addRange(s)}catch{return}},O=(e,n)=>{const t=!!(e&&document.activeElement===e),r=t?f(e):null;n(),t&&r&&l(e,r)};exports.captureSelectionInRoot=f;exports.restoreSelectionInRoot=l;exports.withPreservedSelection=O;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../constants/numbers.cjs");require("../constants/openai.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");require("./exportDocument.utils.cjs");require("react");require("react-dom");const g=3,i=(e,n)=>{const t=[];let r=n;for(;r&&r!==e;){const o=r.parentNode;if(!o)return[];t.unshift(Array.from(o.childNodes).indexOf(r)),r=o}return t},a=(e,n)=>{let t=e;for(const r of n){const o=t.childNodes[r];if(!o)return null;t=o}return t},u=e=>{var n;return e.nodeType===g?((n=e.textContent)==null?void 0:n.length)??c.NUMBER_ZERO:e.childNodes.length},f=e=>{if(!e)return null;const n=window.getSelection();if(!n||n.rangeCount===c.NUMBER_ZERO)return null;const t=n.getRangeAt(c.NUMBER_ZERO);return e.contains(t.commonAncestorContainer)?{startPath:i(e,t.startContainer),startOffset:t.startOffset,endPath:i(e,t.endContainer),endOffset:t.endOffset}:null},l=(e,n)=>{if(!e||!n)return;const t=a(e,n.startPath),r=a(e,n.endPath);if(!t||!r)return;const o=window.getSelection();if(o)try{const s=document.createRange(),d=Math.min(n.startOffset,u(t)),h=Math.min(n.endOffset,u(r));s.setStart(t,d),s.setEnd(r,h),o.removeAllRanges(),o.addRange(s)}catch{return}},O=(e,n)=>{const t=!!(e&&document.activeElement===e),r=t?f(e):null;n(),t&&r&&l(e,r)};exports.captureSelectionInRoot=f;exports.restoreSelectionInRoot=l;exports.withPreservedSelection=O;
|
|
@@ -2,6 +2,7 @@ import { NUMBER_ZERO as c } from "../constants/numbers.js";
|
|
|
2
2
|
import "../constants/openai.const.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "./paste.utils.js";
|
|
5
|
+
import "./exportDocument.utils.js";
|
|
5
6
|
import "react";
|
|
6
7
|
import "react-dom";
|
|
7
8
|
const u = 3, i = (t, n) => {
|
|
@@ -47,12 +48,12 @@ const u = 3, i = (t, n) => {
|
|
|
47
48
|
} catch {
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
|
-
},
|
|
51
|
+
}, w = (t, n) => {
|
|
51
52
|
const e = !!(t && document.activeElement === t), r = e ? h(t) : null;
|
|
52
53
|
n(), e && r && m(t, r);
|
|
53
54
|
};
|
|
54
55
|
export {
|
|
55
56
|
h as captureSelectionInRoot,
|
|
56
57
|
m as restoreSelectionInRoot,
|
|
57
|
-
|
|
58
|
+
w as withPreservedSelection
|
|
58
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../constants/numbers.cjs"),o=require("../constants/defaults.const.cjs");require("../constants/openai.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");require("react");require("react-dom");const a=(r,e)=>r.label.toLowerCase().includes(e)||r.description.toLowerCase().includes(e)||r.category.toLowerCase().includes(e)||r.shortcut.toLowerCase().includes(e)?!0:r.keywords.some(t=>t.includes(e)),S=r=>{const e=r.trim().toLowerCase();return e?o.INK_SLASH_COMMANDS.filter(t=>a(t,e)).slice(0,c.INK_SLASH_MENU_MAX_ITEMS):o.INK_SLASH_COMMANDS.slice(0,c.INK_SLASH_MENU_MAX_ITEMS)},i=r=>{const e=[],t=new Map;return r.forEach(s=>{const u=s.category||o.SLASH_CATEGORY_BASIC,n=t.get(u);if(!n){e.push(u),t.set(u,[s]);return}n.push(s)}),e.map(s=>({category:s,items:t.get(s)??[]}))},l=r=>{const e=r.match(/(?:^|\s)\/([^\s]*)$/);return e?e[1]??"":null};exports.extractSlashQuery=l;exports.filterSlashCommands=S;exports.groupSlashCommands=i;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../constants/numbers.cjs"),o=require("../constants/defaults.const.cjs");require("../constants/openai.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");require("./exportDocument.utils.cjs");require("react");require("react-dom");const a=(r,e)=>r.label.toLowerCase().includes(e)||r.description.toLowerCase().includes(e)||r.category.toLowerCase().includes(e)||r.shortcut.toLowerCase().includes(e)?!0:r.keywords.some(t=>t.includes(e)),S=r=>{const e=r.trim().toLowerCase();return e?o.INK_SLASH_COMMANDS.filter(t=>a(t,e)).slice(0,c.INK_SLASH_MENU_MAX_ITEMS):o.INK_SLASH_COMMANDS.slice(0,c.INK_SLASH_MENU_MAX_ITEMS)},i=r=>{const e=[],t=new Map;return r.forEach(s=>{const u=s.category||o.SLASH_CATEGORY_BASIC,n=t.get(u);if(!n){e.push(u),t.set(u,[s]);return}n.push(s)}),e.map(s=>({category:s,items:t.get(s)??[]}))},l=r=>{const e=r.match(/(?:^|\s)\/([^\s]*)$/);return e?e[1]??"":null};exports.extractSlashQuery=l;exports.filterSlashCommands=S;exports.groupSlashCommands=i;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { INK_SLASH_MENU_MAX_ITEMS as u } from "../constants/numbers.js";
|
|
2
|
-
import { INK_SLASH_COMMANDS as c, SLASH_CATEGORY_BASIC as
|
|
2
|
+
import { INK_SLASH_COMMANDS as c, SLASH_CATEGORY_BASIC as i } from "../constants/defaults.const.js";
|
|
3
3
|
import "../constants/openai.const.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "./paste.utils.js";
|
|
6
|
+
import "./exportDocument.utils.js";
|
|
6
7
|
import "react";
|
|
7
8
|
import "react-dom";
|
|
8
|
-
const
|
|
9
|
+
const a = (t, r) => t.label.toLowerCase().includes(r) || t.description.toLowerCase().includes(r) || t.category.toLowerCase().includes(r) || t.shortcut.toLowerCase().includes(r) ? !0 : t.keywords.some((e) => e.includes(r)), L = (t) => {
|
|
9
10
|
const r = t.trim().toLowerCase();
|
|
10
|
-
return r ? c.filter((e) =>
|
|
11
|
+
return r ? c.filter((e) => a(e, r)).slice(
|
|
11
12
|
0,
|
|
12
13
|
u
|
|
13
14
|
) : c.slice(0, u);
|
|
14
|
-
},
|
|
15
|
+
}, _ = (t) => {
|
|
15
16
|
const r = [], e = /* @__PURE__ */ new Map();
|
|
16
17
|
return t.forEach((o) => {
|
|
17
|
-
const s = o.category ||
|
|
18
|
+
const s = o.category || i, n = e.get(s);
|
|
18
19
|
if (!n) {
|
|
19
20
|
r.push(s), e.set(s, [o]);
|
|
20
21
|
return;
|
|
@@ -24,12 +25,12 @@ const i = (t, r) => t.label.toLowerCase().includes(r) || t.description.toLowerCa
|
|
|
24
25
|
category: o,
|
|
25
26
|
items: e.get(o) ?? []
|
|
26
27
|
}));
|
|
27
|
-
},
|
|
28
|
+
}, w = (t) => {
|
|
28
29
|
const r = t.match(/(?:^|\s)\/([^\s]*)$/);
|
|
29
30
|
return r ? r[1] ?? "" : null;
|
|
30
31
|
};
|
|
31
32
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
w as extractSlashQuery,
|
|
34
|
+
L as filterSlashCommands,
|
|
35
|
+
_ as groupSlashCommands
|
|
35
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../constants/numbers.cjs"),L=require("../constants/generals.const.cjs");require("../constants/openai.const.cjs");require("react/jsx-runtime");const r=require("../constants/table.const.cjs");require("./paste.utils.cjs");require("./exportDocument.utils.cjs");require("react");require("react-dom");const m=(t,e,n)=>Math.min(n,Math.max(e,t)),E=t=>{const e=document.createElement(t);return e.contentEditable="true",e.innerHTML="<br>",e},f=t=>{const e=t.parentElement;return e?Array.from(e.cells).indexOf(t):0},h=(t=T.INK_DEFAULT_TABLE_ROWS,e=T.INK_DEFAULT_TABLE_COLS)=>{const n=m(t,T.INK_TABLE_MIN_ROWS,T.INK_TABLE_MAX_ROWS),o=m(e,T.INK_TABLE_MIN_COLS,T.INK_TABLE_MAX_COLS),l=Array.from({length:o},(c,a)=>`<th contenteditable="true">${r.TABLE_HEADER_PREFIX}${a+1}</th>`).join(L.EMPTY_STRING),s=Array.from({length:Math.max(0,n-1)},()=>`<tr>${Array.from({length:o},()=>'<td contenteditable="true"><br></td>').join(L.EMPTY_STRING)}</tr>`).join(L.EMPTY_STRING),i=`<${r.TABLE_COLGROUP}>${Array.from({length:o},()=>`<${r.TABLE_COL}>`).join(L.EMPTY_STRING)}</${r.TABLE_COLGROUP}>`;return`<table class="${r.TABLE_CLASS_NAME}">${i}<thead><tr>${l}</tr></thead><tbody>${s}</tbody></table><p><br></p>`},O=()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return null;let e=t.anchorNode;return e&&e.nodeType===Node.TEXT_NODE&&(e=e.parentElement),e instanceof Element?e.closest(r.TABLE_CELL_SELECTOR):null},R=(t,e)=>{var a,_;const n=t.closest(r.TABLE_ROW_TAG),o=t.closest(r.TABLE_TAG);if(!n||!o)return!1;const l=n.cells.length;if(o.rows.length>=T.INK_TABLE_MAX_ROWS)return!1;const i=!!n.closest(r.TABLE_SECTION_THEAD)?r.TABLE_CELL_TAG_TH:r.TABLE_CELL_TAG_TD,c=document.createElement(r.TABLE_ROW_TAG);for(let u=0;u<l;u+=1)c.appendChild(E(i));return e==="before"?(a=n.parentElement)==null||a.insertBefore(c,n):(_=n.parentElement)==null||_.insertBefore(c,n.nextSibling),!0},N=(t,e)=>{const n=t.closest(r.TABLE_TAG);if(!n)return!1;const o=f(t);if(o<0)return!1;const l=n.rows[0];if(!l||l.cells.length>=T.INK_TABLE_MAX_COLS)return!1;const s=e==="before"?o:o+1;return Array.from(n.rows).forEach(i=>{const c=i.cells[s]??null,a=i.closest(r.TABLE_SECTION_THEAD)?r.TABLE_CELL_TAG_TH:r.TABLE_CELL_TAG_TD,_=E(a);c?i.insertBefore(_,c):i.appendChild(_)}),A(n),!0},p=t=>{const e=t.closest(r.TABLE_ROW_TAG),n=t.closest(r.TABLE_TAG);return!e||!n||n.rows.length<=T.INK_TABLE_MIN_ROWS?!1:(e.remove(),!0)},I=t=>{const e=t.closest(r.TABLE_TAG);if(!e)return!1;const n=f(t);if(n<0)return!1;const o=e.rows[0];return!o||o.cells.length<=T.INK_TABLE_MIN_COLS?!1:(Array.from(e.rows).forEach(l=>{const s=l.cells[n];s&&s.remove()}),A(e),!0)},S=t=>{const e=t.closest(r.TABLE_TAG);if(!e)return!1;const n=e.tHead,o=n==null?void 0:n.querySelector(r.TABLE_ROW_TAG);if(n&&o){const a=e.tBodies[0]??e.createTBody(),_=document.createElement(r.TABLE_ROW_TAG);return Array.from(o.cells).forEach(u=>{const C=E(r.TABLE_CELL_TAG_TD);C.innerHTML=u.innerHTML,_.appendChild(C)}),a.insertBefore(_,a.firstChild),n.remove(),!0}const l=e.tBodies[0]??e.querySelector(r.TABLE_SECTION_TBODY),s=l==null?void 0:l.querySelector(r.TABLE_ROW_TAG);if(!l||!s)return!1;const i=e.createTHead(),c=document.createElement(r.TABLE_ROW_TAG);return Array.from(s.cells).forEach((a,_)=>{const u=E(r.TABLE_CELL_TAG_TH);u.innerHTML=a.innerHTML||`${r.TABLE_HEADER_PREFIX}${_+1}`,c.appendChild(u)}),i.appendChild(c),s.remove(),!0},A=t=>{var o,l;let e=t.querySelector(r.TABLE_COLGROUP);const n=((o=t.rows[0])==null?void 0:o.cells.length)??0;for(e||(e=document.createElement(r.TABLE_COLGROUP),t.insertBefore(e,t.firstChild));e.children.length<n;)e.appendChild(document.createElement(r.TABLE_COL));for(;e.children.length>n;)(l=e.lastElementChild)==null||l.remove();return e.getElementsByTagName(r.TABLE_COL)},G=(t,e,n)=>{const o=e.getBoundingClientRect();return Math.abs(o.right-t)>n?null:f(e)},B="#e0e7ff",d="top",b="middle",g="bottom",M=t=>{var n;const e=t.nextElementSibling;return e instanceof HTMLTableCellElement?(t.colSpan+=e.colSpan,(n=e.textContent)!=null&&n.trim()&&(t.append(document.createTextNode(" ")),t.append(...Array.from(e.childNodes))),e.remove(),!0):!1},y=t=>{if(t.colSpan<=1)return!1;t.colSpan-=1;const e=document.createElement(t.tagName.toLowerCase());return e.innerHTML="<br>",t.after(e),!0},w=t=>{const e=t.style.backgroundColor;return t.style.backgroundColor=e?"":B,!0},H=t=>{const e=[d,b,g],n=t.style.verticalAlign,o=e.indexOf(n);return t.style.verticalAlign=e[(o+1)%e.length]??d,!0},x=(t,e,n)=>{const l=A(t).item(e);if(!l)return;const s=Math.max(T.INK_TABLE_COL_MIN_WIDTH_PX,n);l.style.width=`${s}px`};exports.CELL_ALIGN_BOTTOM=g;exports.CELL_ALIGN_MIDDLE=b;exports.CELL_ALIGN_TOP=d;exports.CELL_BACKGROUND=B;exports.buildTableHtml=h;exports.deleteTableColumn=I;exports.deleteTableRow=p;exports.ensureTableColgroup=A;exports.getColumnResizeIndex=G;exports.getTableCellFromSelection=O;exports.insertTableColumn=N;exports.insertTableRow=R;exports.mergeTableCellRight=M;exports.setTableCellBackground=w;exports.setTableCellVerticalAlign=H;exports.setTableColumnWidth=x;exports.splitTableCell=y;exports.toggleTableHeaderRow=S;
|
|
@@ -7,5 +7,13 @@ export declare const deleteTableColumn: (cell: HTMLTableCellElement) => boolean;
|
|
|
7
7
|
export declare const toggleTableHeaderRow: (cell: HTMLTableCellElement) => boolean;
|
|
8
8
|
export declare const ensureTableColgroup: (table: HTMLTableElement) => HTMLCollectionOf<HTMLTableColElement>;
|
|
9
9
|
export declare const getColumnResizeIndex: (clientX: number, cell: HTMLTableCellElement, edgePx: number) => number | null;
|
|
10
|
+
export declare const CELL_BACKGROUND = "#e0e7ff";
|
|
11
|
+
export declare const CELL_ALIGN_TOP = "top";
|
|
12
|
+
export declare const CELL_ALIGN_MIDDLE = "middle";
|
|
13
|
+
export declare const CELL_ALIGN_BOTTOM = "bottom";
|
|
14
|
+
export declare const mergeTableCellRight: (cell: HTMLTableCellElement) => boolean;
|
|
15
|
+
export declare const splitTableCell: (cell: HTMLTableCellElement) => boolean;
|
|
16
|
+
export declare const setTableCellBackground: (cell: HTMLTableCellElement) => boolean;
|
|
17
|
+
export declare const setTableCellVerticalAlign: (cell: HTMLTableCellElement) => boolean;
|
|
10
18
|
export declare const setTableColumnWidth: (table: HTMLTableElement, columnIndex: number, widthPx: number) => void;
|
|
11
19
|
//# sourceMappingURL=table.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.utils.d.ts","sourceRoot":"","sources":["../../src/utils/table.utils.ts"],"names":[],"mappings":"AAwCA,eAAO,MAAM,cAAc,GACzB,aAA6B,EAC7B,aAA6B,KAC5B,MAeF,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAO,oBAAoB,GAAG,IASnE,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,MAAM,oBAAoB,EAC1B,UAAU,QAAQ,GAAG,OAAO,KAC3B,OAkBF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,MAAM,oBAAoB,EAC1B,UAAU,QAAQ,GAAG,OAAO,KAC3B,OAuBF,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,oBAAoB,KAAG,OAO3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,oBAAoB,KAAG,OAa9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,oBAAoB,KAAG,OA8BjE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,OAAO,gBAAgB,KAAG,gBAAgB,CAAC,mBAAmB,CAcjG,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,EACf,MAAM,oBAAoB,EAC1B,QAAQ,MAAM,KACb,MAAM,GAAG,IAIX,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,OAAO,gBAAgB,EACvB,aAAa,MAAM,EACnB,SAAS,MAAM,KACd,IAMF,CAAC"}
|
|
1
|
+
{"version":3,"file":"table.utils.d.ts","sourceRoot":"","sources":["../../src/utils/table.utils.ts"],"names":[],"mappings":"AAwCA,eAAO,MAAM,cAAc,GACzB,aAA6B,EAC7B,aAA6B,KAC5B,MAeF,CAAC;AAEF,eAAO,MAAM,yBAAyB,QAAO,oBAAoB,GAAG,IASnE,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,MAAM,oBAAoB,EAC1B,UAAU,QAAQ,GAAG,OAAO,KAC3B,OAkBF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,MAAM,oBAAoB,EAC1B,UAAU,QAAQ,GAAG,OAAO,KAC3B,OAuBF,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,oBAAoB,KAAG,OAO3D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,MAAM,oBAAoB,KAAG,OAa9D,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,MAAM,oBAAoB,KAAG,OA8BjE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,OAAO,gBAAgB,KAAG,gBAAgB,CAAC,mBAAmB,CAcjG,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,EACf,MAAM,oBAAoB,EAC1B,QAAQ,MAAM,KACb,MAAM,GAAG,IAIX,CAAC;AAEF,eAAO,MAAM,eAAe,YAAY,CAAC;AACzC,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAC1C,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,eAAO,MAAM,mBAAmB,GAAI,MAAM,oBAAoB,KAAG,OAUhE,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,oBAAoB,KAAG,OAO3D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,MAAM,oBAAoB,KAAG,OAInE,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,MAAM,oBAAoB,KAAG,OAMtE,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,OAAO,gBAAgB,EACvB,aAAa,MAAM,EACnB,SAAS,MAAM,KACd,IAMF,CAAC"}
|
|
@@ -1,111 +1,135 @@
|
|
|
1
|
-
import { INK_DEFAULT_TABLE_ROWS as
|
|
1
|
+
import { INK_DEFAULT_TABLE_ROWS as x, INK_DEFAULT_TABLE_COLS as O, INK_TABLE_MIN_COLS as B, INK_TABLE_MIN_ROWS as N, INK_TABLE_MAX_COLS as y, INK_TABLE_MAX_ROWS as S, INK_TABLE_COL_MIN_WIDTH_PX as R } from "../constants/numbers.js";
|
|
2
2
|
import { EMPTY_STRING as m } from "../constants/generals.const.js";
|
|
3
3
|
import "../constants/openai.const.js";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
|
-
import { TABLE_HEADER_PREFIX as
|
|
5
|
+
import { TABLE_HEADER_PREFIX as w, TABLE_COLGROUP as T, TABLE_COL as L, TABLE_CLASS_NAME as M, TABLE_TAG as d, TABLE_ROW_TAG as f, TABLE_CELL_SELECTOR as H, TABLE_SECTION_THEAD as I, TABLE_CELL_TAG_TH as _, TABLE_CELL_TAG_TD as C, TABLE_SECTION_TBODY as $ } from "../constants/table.const.js";
|
|
6
6
|
import "./paste.utils.js";
|
|
7
|
+
import "./exportDocument.utils.js";
|
|
7
8
|
import "react";
|
|
8
9
|
import "react-dom";
|
|
9
10
|
const g = (t, e, n) => Math.min(n, Math.max(e, t)), E = (t) => {
|
|
10
11
|
const e = document.createElement(t);
|
|
11
12
|
return e.contentEditable = "true", e.innerHTML = "<br>", e;
|
|
12
|
-
},
|
|
13
|
+
}, h = (t) => {
|
|
13
14
|
const e = t.parentElement;
|
|
14
15
|
return e ? Array.from(e.cells).indexOf(t) : 0;
|
|
15
|
-
},
|
|
16
|
-
const n = g(t,
|
|
16
|
+
}, Y = (t = x, e = O) => {
|
|
17
|
+
const n = g(t, N, S), r = g(e, B, y), o = Array.from(
|
|
17
18
|
{ length: r },
|
|
18
|
-
(s, c) => `<th contenteditable="true">${
|
|
19
|
+
(s, c) => `<th contenteditable="true">${w}${c + 1}</th>`
|
|
19
20
|
).join(m), l = Array.from({ length: Math.max(0, n - 1) }, () => `<tr>${Array.from(
|
|
20
21
|
{ length: r },
|
|
21
22
|
() => '<td contenteditable="true"><br></td>'
|
|
22
|
-
).join(m)}</tr>`).join(m), a = `<${T}>${Array.from({ length: r }, () => `<${
|
|
23
|
-
return `<table class="${
|
|
24
|
-
},
|
|
23
|
+
).join(m)}</tr>`).join(m), a = `<${T}>${Array.from({ length: r }, () => `<${L}>`).join(m)}</${T}>`;
|
|
24
|
+
return `<table class="${M}">${a}<thead><tr>${o}</tr></thead><tbody>${l}</tbody></table><p><br></p>`;
|
|
25
|
+
}, z = () => {
|
|
25
26
|
const t = window.getSelection();
|
|
26
27
|
if (!t || t.rangeCount === 0) return null;
|
|
27
28
|
let e = t.anchorNode;
|
|
28
|
-
return e && e.nodeType === Node.TEXT_NODE && (e = e.parentElement), e instanceof Element ? e.closest(
|
|
29
|
-
},
|
|
29
|
+
return e && e.nodeType === Node.TEXT_NODE && (e = e.parentElement), e instanceof Element ? e.closest(H) : null;
|
|
30
|
+
}, V = (t, e) => {
|
|
30
31
|
var c, i;
|
|
31
|
-
const n = t.closest(
|
|
32
|
+
const n = t.closest(f), r = t.closest(d);
|
|
32
33
|
if (!n || !r) return !1;
|
|
33
34
|
const o = n.cells.length;
|
|
34
|
-
if (r.rows.length >=
|
|
35
|
-
const a = !!n.closest(
|
|
36
|
-
for (let
|
|
35
|
+
if (r.rows.length >= S) return !1;
|
|
36
|
+
const a = !!n.closest(I) ? _ : C, s = document.createElement(f);
|
|
37
|
+
for (let u = 0; u < o; u += 1)
|
|
37
38
|
s.appendChild(E(a));
|
|
38
39
|
return e === "before" ? (c = n.parentElement) == null || c.insertBefore(s, n) : (i = n.parentElement) == null || i.insertBefore(s, n.nextSibling), !0;
|
|
39
|
-
},
|
|
40
|
+
}, J = (t, e) => {
|
|
40
41
|
const n = t.closest(d);
|
|
41
42
|
if (!n) return !1;
|
|
42
|
-
const r =
|
|
43
|
+
const r = h(t);
|
|
43
44
|
if (r < 0) return !1;
|
|
44
45
|
const o = n.rows[0];
|
|
45
|
-
if (!o || o.cells.length >=
|
|
46
|
+
if (!o || o.cells.length >= y) return !1;
|
|
46
47
|
const l = e === "before" ? r : r + 1;
|
|
47
48
|
return Array.from(n.rows).forEach((a) => {
|
|
48
|
-
const s = a.cells[l] ?? null, c = a.closest(
|
|
49
|
+
const s = a.cells[l] ?? null, c = a.closest(I) ? _ : C, i = E(c);
|
|
49
50
|
s ? a.insertBefore(i, s) : a.appendChild(i);
|
|
50
|
-
}),
|
|
51
|
-
},
|
|
52
|
-
const e = t.closest(
|
|
53
|
-
return !e || !n || n.rows.length <=
|
|
54
|
-
},
|
|
51
|
+
}), A(n), !0;
|
|
52
|
+
}, Q = (t) => {
|
|
53
|
+
const e = t.closest(f), n = t.closest(d);
|
|
54
|
+
return !e || !n || n.rows.length <= N ? !1 : (e.remove(), !0);
|
|
55
|
+
}, Z = (t) => {
|
|
55
56
|
const e = t.closest(d);
|
|
56
57
|
if (!e) return !1;
|
|
57
|
-
const n =
|
|
58
|
+
const n = h(t);
|
|
58
59
|
if (n < 0) return !1;
|
|
59
60
|
const r = e.rows[0];
|
|
60
61
|
return !r || r.cells.length <= B ? !1 : (Array.from(e.rows).forEach((o) => {
|
|
61
62
|
const l = o.cells[n];
|
|
62
63
|
l && l.remove();
|
|
63
|
-
}),
|
|
64
|
-
},
|
|
64
|
+
}), A(e), !0);
|
|
65
|
+
}, ee = (t) => {
|
|
65
66
|
const e = t.closest(d);
|
|
66
67
|
if (!e) return !1;
|
|
67
|
-
const n = e.tHead, r = n == null ? void 0 : n.querySelector(
|
|
68
|
+
const n = e.tHead, r = n == null ? void 0 : n.querySelector(f);
|
|
68
69
|
if (n && r) {
|
|
69
|
-
const c = e.tBodies[0] ?? e.createTBody(), i = document.createElement(
|
|
70
|
-
return Array.from(r.cells).forEach((
|
|
71
|
-
const p = E(
|
|
72
|
-
p.innerHTML =
|
|
70
|
+
const c = e.tBodies[0] ?? e.createTBody(), i = document.createElement(f);
|
|
71
|
+
return Array.from(r.cells).forEach((u) => {
|
|
72
|
+
const p = E(C);
|
|
73
|
+
p.innerHTML = u.innerHTML, i.appendChild(p);
|
|
73
74
|
}), c.insertBefore(i, c.firstChild), n.remove(), !0;
|
|
74
75
|
}
|
|
75
|
-
const o = e.tBodies[0] ?? e.querySelector(
|
|
76
|
+
const o = e.tBodies[0] ?? e.querySelector($), l = o == null ? void 0 : o.querySelector(f);
|
|
76
77
|
if (!o || !l) return !1;
|
|
77
|
-
const a = e.createTHead(), s = document.createElement(
|
|
78
|
+
const a = e.createTHead(), s = document.createElement(f);
|
|
78
79
|
return Array.from(l.cells).forEach((c, i) => {
|
|
79
|
-
const
|
|
80
|
-
|
|
80
|
+
const u = E(_);
|
|
81
|
+
u.innerHTML = c.innerHTML || `${w}${i + 1}`, s.appendChild(u);
|
|
81
82
|
}), a.appendChild(s), l.remove(), !0;
|
|
82
|
-
},
|
|
83
|
+
}, A = (t) => {
|
|
83
84
|
var r, o;
|
|
84
85
|
let e = t.querySelector(T);
|
|
85
86
|
const n = ((r = t.rows[0]) == null ? void 0 : r.cells.length) ?? 0;
|
|
86
87
|
for (e || (e = document.createElement(T), t.insertBefore(e, t.firstChild)); e.children.length < n; )
|
|
87
|
-
e.appendChild(document.createElement(
|
|
88
|
+
e.appendChild(document.createElement(L));
|
|
88
89
|
for (; e.children.length > n; )
|
|
89
90
|
(o = e.lastElementChild) == null || o.remove();
|
|
90
|
-
return e.getElementsByTagName(
|
|
91
|
-
},
|
|
91
|
+
return e.getElementsByTagName(L);
|
|
92
|
+
}, te = (t, e, n) => {
|
|
92
93
|
const r = e.getBoundingClientRect();
|
|
93
|
-
return Math.abs(r.right - t) > n ? null :
|
|
94
|
-
},
|
|
95
|
-
|
|
94
|
+
return Math.abs(r.right - t) > n ? null : h(e);
|
|
95
|
+
}, D = "#e0e7ff", b = "top", G = "middle", v = "bottom", ne = (t) => {
|
|
96
|
+
var n;
|
|
97
|
+
const e = t.nextElementSibling;
|
|
98
|
+
return e instanceof HTMLTableCellElement ? (t.colSpan += e.colSpan, (n = e.textContent) != null && n.trim() && (t.append(document.createTextNode(" ")), t.append(...Array.from(e.childNodes))), e.remove(), !0) : !1;
|
|
99
|
+
}, re = (t) => {
|
|
100
|
+
if (t.colSpan <= 1) return !1;
|
|
101
|
+
t.colSpan -= 1;
|
|
102
|
+
const e = document.createElement(t.tagName.toLowerCase());
|
|
103
|
+
return e.innerHTML = "<br>", t.after(e), !0;
|
|
104
|
+
}, oe = (t) => {
|
|
105
|
+
const e = t.style.backgroundColor;
|
|
106
|
+
return t.style.backgroundColor = e ? "" : D, !0;
|
|
107
|
+
}, le = (t) => {
|
|
108
|
+
const e = [b, G, v], n = t.style.verticalAlign, r = e.indexOf(n);
|
|
109
|
+
return t.style.verticalAlign = e[(r + 1) % e.length] ?? b, !0;
|
|
110
|
+
}, se = (t, e, n) => {
|
|
111
|
+
const o = A(t).item(e);
|
|
96
112
|
if (!o) return;
|
|
97
|
-
const l = Math.max(
|
|
113
|
+
const l = Math.max(R, n);
|
|
98
114
|
o.style.width = `${l}px`;
|
|
99
115
|
};
|
|
100
116
|
export {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
117
|
+
v as CELL_ALIGN_BOTTOM,
|
|
118
|
+
G as CELL_ALIGN_MIDDLE,
|
|
119
|
+
b as CELL_ALIGN_TOP,
|
|
120
|
+
D as CELL_BACKGROUND,
|
|
121
|
+
Y as buildTableHtml,
|
|
122
|
+
Z as deleteTableColumn,
|
|
123
|
+
Q as deleteTableRow,
|
|
124
|
+
A as ensureTableColgroup,
|
|
125
|
+
te as getColumnResizeIndex,
|
|
126
|
+
z as getTableCellFromSelection,
|
|
127
|
+
J as insertTableColumn,
|
|
128
|
+
V as insertTableRow,
|
|
129
|
+
ne as mergeTableCellRight,
|
|
130
|
+
oe as setTableCellBackground,
|
|
131
|
+
le as setTableCellVerticalAlign,
|
|
132
|
+
se as setTableColumnWidth,
|
|
133
|
+
re as splitTableCell,
|
|
134
|
+
ee as toggleTableHeaderRow
|
|
111
135
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../constants/numbers.cjs"),c=require("../constants/generals.const.cjs"),n=require("../constants/toolbarMenu.const.cjs");require("../constants/openai.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");const T=require("./storage.utils.cjs");require("react");require("react-dom");const a=()=>typeof sessionStorage<"u",s=(e
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../constants/numbers.cjs"),c=require("../constants/generals.const.cjs"),n=require("../constants/toolbarMenu.const.cjs");require("../constants/openai.const.cjs");require("react/jsx-runtime");require("./paste.utils.cjs");const T=require("./storage.utils.cjs");require("./exportDocument.utils.cjs");require("react");require("react-dom");const a=()=>typeof sessionStorage<"u",s=(t,e)=>e?`${t}:${e}`:t,i=t=>t?T.isLocalStorageAvailable()?localStorage:null:a()?sessionStorage:null,_=(t,e)=>{const r=i(t);if(!r)return null;try{const o=r.getItem(s(n.TOOLBAR_STORAGE_KEY_HIDDEN,e));return o===null?null:o===n.TOOLBAR_STORAGE_VALUE_TRUE}catch{return null}},E=(t,e,r)=>{const o=i(e);if(o)try{o.setItem(s(n.TOOLBAR_STORAGE_KEY_HIDDEN,r),t?n.TOOLBAR_STORAGE_VALUE_TRUE:n.TOOLBAR_STORAGE_VALUE_FALSE)}catch{return}},R=t=>typeof t=="string"&&t.length>l.NUMBER_ZERO,u=t=>{if(!t||t===c.EMPTY_STRING)return null;try{const e=JSON.parse(t);if(!Array.isArray(e))return null;const r=e.filter(R);return r.length>l.NUMBER_ZERO?r:null}catch{return null}},I=(t,e)=>{const r=i(t);if(!r)return null;try{const o=r.getItem(s(n.TOOLBAR_STORAGE_KEY_ITEMS,e));return o===null?null:u(o)}catch{return null}},b=(t,e,r)=>{const o=i(e);if(o)try{o.setItem(s(n.TOOLBAR_STORAGE_KEY_ITEMS,r),JSON.stringify(t))}catch{return}},O=t=>{const e=[];for(const r of t){if(r===n.TOOLBAR_OPTION_DIVIDER){if(e.length===l.NUMBER_ZERO||e[e.length-1]===n.TOOLBAR_OPTION_DIVIDER)continue;e.push(r);continue}e.push(r)}for(;e.length>l.NUMBER_ZERO&&e[e.length-1]===n.TOOLBAR_OPTION_DIVIDER;)e.pop();return e},g=(t,e)=>O(t.filter(r=>r===n.TOOLBAR_OPTION_DIVIDER||e.has(r))),A=t=>{const e=new Set,r=[];for(const o of t)o!==n.TOOLBAR_OPTION_DIVIDER&&(e.has(o)||(e.add(o),r.push(o)));return r};exports.buildToolbarStorageKey=s;exports.buildVisibleToolbarItems=g;exports.isSessionStorageAvailable=a;exports.listCustomizableToolbarOptions=A;exports.normalizeToolbarItems=O;exports.parseToolbarItems=u;exports.readToolbarHidden=_;exports.readToolbarItems=I;exports.writeToolbarHidden=E;exports.writeToolbarItems=b;
|