@collabchron/notiq 0.3.0 → 1.0.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/LICENSE +21 -0
- package/README.md +230 -39
- package/dist/CodeActionMenuPlugin-EINOY4U4.mjs +15 -0
- package/dist/DynamicBlockComponent-NRQJ4WW4.mjs +161 -0
- package/dist/EquationComponent-CB6DFIHV.mjs +154 -0
- package/dist/ExcalidrawComponent-XW6646OH.mjs +528 -0
- package/dist/ExcalidrawPlugin-ZFHT62IF.mjs +14 -0
- package/dist/ExportPlugin-V2RLM63S.mjs +11 -0
- package/dist/FloatingLinkEditorPlugin-TRTCMSP4.mjs +12 -0
- package/dist/FloatingTextFormatToolbarPlugin-F2GY6LMI.mjs +30 -0
- package/dist/HintComponet-BRL6EAMS.mjs +217 -0
- package/dist/InlineImageComponent-UWIUWBHI.mjs +453 -0
- package/dist/MobileToolbar-BOOZAMQE.mjs +268 -0
- package/dist/SlashCommand-GMT5JI33.mjs +28 -0
- package/dist/StoryBuilderComponent-JGDBM5JU.mjs +562 -0
- package/{src/components/editor/plugins/TableCellActionMenuPlugin/index.tsx → dist/TableCellActionMenuPlugin-PGK2K3VG.mjs} +667 -759
- package/{src/components/editor/plugins/TableHoverActionsPlugin/index.tsx → dist/TableHoverActionsPlugin-GJVE6VRW.mjs} +258 -314
- package/dist/TemplatePlugin-ZD3QEVTI.mjs +9 -0
- package/dist/ToolbarPlugin-YKYA4NB4.mjs +1547 -0
- package/dist/babel-JZ2EV6AX.mjs +7233 -0
- package/dist/background-color-XZTYLGO2.mjs +362 -0
- package/dist/block-format-YJCV2DIY.mjs +15 -0
- package/dist/chunk-2FNEAMSP.mjs +127 -0
- package/dist/chunk-3CPBODXA.mjs +84 -0
- package/dist/chunk-3G37YKTV.mjs +83 -0
- package/dist/chunk-3JVFG7ER.mjs +184 -0
- package/dist/chunk-456TN7IM.mjs +110 -0
- package/dist/chunk-4EXYCTGJ.mjs +27 -0
- package/{src/utils/getSelectedNode.ts → dist/chunk-4HBCVSE6.mjs} +26 -27
- package/dist/chunk-4MEDW3T6.mjs +125 -0
- package/dist/chunk-4VWFVWYP.mjs +36 -0
- package/dist/chunk-5BAKY5KN.mjs +84 -0
- package/dist/chunk-5QSNIVIG.mjs +333 -0
- package/dist/chunk-64Z3FI7T.mjs +37 -0
- package/{src/components/editor/nodes/Stepper/index.tsx → dist/chunk-6RNZQOH2.mjs} +214 -260
- package/dist/chunk-77KXU36M.mjs +64 -0
- package/dist/chunk-77UA6HYR.mjs +165 -0
- package/dist/chunk-7NZAPJ4G.mjs +102 -0
- package/dist/chunk-7VUMHWWL.mjs +152 -0
- package/dist/chunk-AMMKBSST.mjs +1256 -0
- package/dist/chunk-BIU7WTLX.mjs +95 -0
- package/dist/chunk-EGMI62PP.mjs +83 -0
- package/dist/chunk-EHNQD5KO.mjs +88 -0
- package/dist/chunk-FSM26655.mjs +37 -0
- package/{src/components/editor/nodes/Hint/index.tsx → dist/chunk-G53GLEAY.mjs} +158 -190
- package/dist/chunk-GK35L7UY.mjs +28 -0
- package/dist/chunk-GXYD4VZM.mjs +193 -0
- package/dist/chunk-GYIOYVCN.mjs +538 -0
- package/dist/chunk-GZPNVR7L.mjs +157 -0
- package/dist/chunk-JXDPPUJI.mjs +52 -0
- package/dist/chunk-K36V4SIW.mjs +141 -0
- package/dist/chunk-KJ6AJ44Q.mjs +128 -0
- package/dist/chunk-KJV3FAZ7.mjs +142 -0
- package/{src/components/editor/plugins/ImagesPlugin/index.tsx → dist/chunk-LGG4IUIA.mjs} +189 -222
- package/dist/chunk-LQN3CMKV.mjs +1906 -0
- package/dist/chunk-N3WN46VL.mjs +236 -0
- package/dist/chunk-PBD6LMLC.mjs +366 -0
- package/dist/chunk-POGRR73N.mjs +33 -0
- package/{src/components/editor/utils/editorFormatting.ts → dist/chunk-PZSUSXQG.mjs} +238 -282
- package/dist/chunk-QEIFVK5M.mjs +29 -0
- package/dist/chunk-QHIQKMVN.mjs +427 -0
- package/dist/chunk-TCYK7DM7.mjs +36 -0
- package/dist/chunk-TTHQCW5F.mjs +47 -0
- package/dist/chunk-U47ABU5Z.mjs +53 -0
- package/dist/chunk-WDG7J2DY.mjs +116 -0
- package/dist/chunk-WJRHXI2C.mjs +733 -0
- package/dist/chunk-XLER2DHM.mjs +357 -0
- package/dist/chunk-XWC4TK2N.mjs +315 -0
- package/dist/chunk-YHPNOWFH.mjs +15 -0
- package/dist/chunk-YKC3SO4Z.mjs +32 -0
- package/dist/chunk-YMBXLRW5.mjs +374 -0
- package/dist/chunk-YPHOEJ46.mjs +64 -0
- package/dist/chunk-YUDCJRJM.mjs +25 -0
- package/dist/chunk-Z4EWP7BI.mjs +65 -0
- package/dist/chunk-ZB5LZQKC.mjs +191 -0
- package/dist/chunk-ZJRKATOJ.mjs +65 -0
- package/dist/color-BPKOPQKN.mjs +12 -0
- package/dist/estree-XC56IUFX.mjs +4414 -0
- package/dist/font-FEZ3GKSF.mjs +13 -0
- package/dist/font-size-EK775WRH.mjs +15 -0
- package/dist/html-S3ACX7NI.mjs +2738 -0
- package/dist/image-2PJIAYAT.mjs +993 -0
- package/dist/index.d.mts +145 -0
- package/dist/index.d.ts +145 -0
- package/dist/index.js +57855 -0
- package/dist/index.mjs +1790 -0
- package/dist/insert-gif-SAIDYURE.mjs +100 -0
- package/dist/insert-image-U3RJN3OW.mjs +259 -0
- package/dist/insert-node-5P2CRJ7S.mjs +201 -0
- package/dist/insert-poll-HCPM7MO6.mjs +33 -0
- package/dist/insert-table-24XYUS2W.mjs +66 -0
- package/dist/markdown-SNVBOSRA.mjs +3487 -0
- package/dist/poll-component-2R4MDLHS.mjs +303 -0
- package/dist/postcss-ONF3VDIM.mjs +5051 -0
- package/dist/standalone-EOIALU3M.mjs +2373 -0
- package/dist/stepper-FSARL6X6.mjs +304 -0
- package/dist/styles/notiq.css +1149 -0
- package/dist/text-align-VLECWO4H.mjs +118 -0
- package/dist/text-format-BG5WOOPZ.mjs +16 -0
- package/dist/typescript-AMPI6OVS.mjs +13135 -0
- package/package.json +67 -11
- package/src/styles/notiq.css +1149 -0
- package/src/styles/tailwind-plugin.ts +134 -0
- package/components.json +0 -21
- package/eslint.config.mjs +0 -16
- package/next.config.ts +0 -12
- package/postcss.config.mjs +0 -5
- package/public/file.svg +0 -1
- package/public/globe.svg +0 -1
- package/public/images/icons/plus.svg +0 -10
- package/public/next.svg +0 -1
- package/public/vercel.svg +0 -1
- package/public/window.svg +0 -1
- package/src/app/actions.ts +0 -2
- package/src/app/api/ai/route.ts +0 -175
- package/src/app/api/edgestore/[...edgestore]/route.ts +0 -28
- package/src/app/favicon.ico +0 -0
- package/src/app/globals.css +0 -205
- package/src/app/layout.tsx +0 -38
- package/src/app/page.tsx +0 -12
- package/src/components/editor/Core.tsx +0 -220
- package/src/components/editor/hooks/instructions-messages.ts +0 -300
- package/src/components/editor/hooks/use-mobile.ts +0 -19
- package/src/components/editor/hooks/useReport.ts +0 -67
- package/src/components/editor/hooks/useResizeObservert.ts +0 -22
- package/src/components/editor/index.tsx +0 -39
- package/src/components/editor/lexical-on-change.tsx +0 -28
- package/src/components/editor/nodes/CollapsibleNode/CollapsibleContainerNode.ts +0 -92
- package/src/components/editor/nodes/CollapsibleNode/CollapsibleContentNode.ts +0 -65
- package/src/components/editor/nodes/CollapsibleNode/CollapsibleTitleNode.ts +0 -105
- package/src/components/editor/nodes/EquationNode/EquationComponent.tsx +0 -143
- package/src/components/editor/nodes/EquationNode/EquationNode.tsx +0 -170
- package/src/components/editor/nodes/ExcalidrawNode/ExcalidrawComponent.tsx +0 -228
- package/src/components/editor/nodes/ExcalidrawNode/ExcalidrawImage.tsx +0 -137
- package/src/components/editor/nodes/ExcalidrawNode/ImageResizer.tsx +0 -317
- package/src/components/editor/nodes/ExcalidrawNode/index.tsx +0 -204
- package/src/components/editor/nodes/FigmaNode/FigmaNode.tsx +0 -134
- package/src/components/editor/nodes/Hint/HintComponet.tsx +0 -221
- package/src/components/editor/nodes/ImageNode/index.tsx +0 -328
- package/src/components/editor/nodes/InlineImageNode/InlineImageComponent.tsx +0 -383
- package/src/components/editor/nodes/InlineImageNode/InlineImageNode.css +0 -94
- package/src/components/editor/nodes/InlineImageNode/InlineImageNode.tsx +0 -309
- package/src/components/editor/nodes/LayoutNode/LayoutContainerNode.ts +0 -146
- package/src/components/editor/nodes/LayoutNode/LayoutItemNode.ts +0 -79
- package/src/components/editor/nodes/PollNode/index.tsx +0 -204
- package/src/components/editor/nodes/TweetNode/index.tsx +0 -214
- package/src/components/editor/nodes/index.ts +0 -81
- package/src/components/editor/plugins/AutoEmbedPlugin/index.tsx +0 -350
- package/src/components/editor/plugins/AutoLinkPlugin/index.tsx +0 -56
- package/src/components/editor/plugins/CodeActionMenuPlugin/components/CopyButton.tsx +0 -70
- package/src/components/editor/plugins/CodeActionMenuPlugin/components/PrettierButton.tsx +0 -192
- package/src/components/editor/plugins/CodeActionMenuPlugin/index.tsx +0 -217
- package/src/components/editor/plugins/CodeActionMenuPlugin/utils.ts +0 -26
- package/src/components/editor/plugins/CodeHighlightPlugin/index.ts +0 -21
- package/src/components/editor/plugins/CollapsiblePlugin/Collapsible.css +0 -76
- package/src/components/editor/plugins/CollapsiblePlugin/index.ts +0 -228
- package/src/components/editor/plugins/DragDropPastePlugin/index.tsx +0 -44
- package/src/components/editor/plugins/DraggableBlockPlugin/index.tsx +0 -52
- package/src/components/editor/plugins/EquationsPlugin/index.tsx +0 -85
- package/src/components/editor/plugins/ExcalidrawPlugin/index.tsx +0 -98
- package/src/components/editor/plugins/FigmaPlugin/index.tsx +0 -42
- package/src/components/editor/plugins/FloatingLinkEditorPlugin/index.tsx +0 -445
- package/src/components/editor/plugins/FloatingTextFormatToolbarPlugin/index.tsx +0 -275
- package/src/components/editor/plugins/InlineImagePlugin/index.tsx +0 -351
- package/src/components/editor/plugins/LayoutPlugin/index.tsx +0 -238
- package/src/components/editor/plugins/LinkPlugin/index.tsx +0 -36
- package/src/components/editor/plugins/LinkWithMetaData/index.tsx +0 -271
- package/src/components/editor/plugins/MarkdownShortcutPlugin/index.tsx +0 -11
- package/src/components/editor/plugins/MarkdownTransformers/index.tsx +0 -304
- package/src/components/editor/plugins/PollPlugin/index.tsx +0 -49
- package/src/components/editor/plugins/ShortcutsPlugin/index.tsx +0 -180
- package/src/components/editor/plugins/ShortcutsPlugin/shortcuts.ts +0 -253
- package/src/components/editor/plugins/SlashCommand/index.tsx +0 -621
- package/src/components/editor/plugins/SpeechToTextPlugin/index.ts +0 -127
- package/src/components/editor/plugins/TabFocusPlugin/index.ts +0 -58
- package/src/components/editor/plugins/TableCellResizer/index.tsx +0 -438
- package/src/components/editor/plugins/TablePlugin/index.tsx +0 -99
- package/src/components/editor/plugins/ToolbarPlugin/index.tsx +0 -522
- package/src/components/editor/plugins/TwitterPlugin/index.ts +0 -35
- package/src/components/editor/plugins/YouTubeNode/index.tsx +0 -179
- package/src/components/editor/plugins/YouTubePlugin/index.ts +0 -41
- package/src/components/editor/themes/editor-theme.ts +0 -113
- package/src/components/editor/themes/theme.css +0 -377
- package/src/components/editor/utils/ai.ts +0 -291
- package/src/components/editor/utils/canUseDOM.ts +0 -12
- package/src/components/editor/utils/environment.ts +0 -50
- package/src/components/editor/utils/extract-data.ts +0 -166
- package/src/components/editor/utils/getAllLexicalChildren.ts +0 -13
- package/src/components/editor/utils/getDOMRangeRect.ts +0 -27
- package/src/components/editor/utils/getSelectedNode.ts +0 -27
- package/src/components/editor/utils/gif.ts +0 -29
- package/src/components/editor/utils/invariant.ts +0 -15
- package/src/components/editor/utils/setFloatingElemPosition.ts +0 -51
- package/src/components/editor/utils/setFloatingElemPositionForLinkEditor.ts +0 -40
- package/src/components/editor/utils/setNodePlaceholderFromSelection/getNodePlaceholder.ts +0 -51
- package/src/components/editor/utils/setNodePlaceholderFromSelection/setNodePlaceholderFromSelection.ts +0 -15
- package/src/components/editor/utils/setNodePlaceholderFromSelection/setPlaceholderOnSelection.ts +0 -114
- package/src/components/editor/utils/setNodePlaceholderFromSelection/styles.css +0 -6
- package/src/components/editor/utils/url.ts +0 -109
- package/src/components/editor/utils/useLayoutEffect.ts +0 -13
- package/src/components/providers/QueryProvider.tsx +0 -15
- package/src/components/providers/SharedHistoryContext.tsx +0 -28
- package/src/components/providers/ToolbarContext.tsx +0 -123
- package/src/components/providers/theme-provider.tsx +0 -11
- package/src/components/theme/ModeToggle.tsx +0 -40
- package/src/components/ui/FileInput.tsx +0 -40
- package/src/components/ui/Input.css +0 -32
- package/src/components/ui/Select.css +0 -42
- package/src/components/ui/Select.tsx +0 -36
- package/src/components/ui/TextInput.tsx +0 -48
- package/src/components/ui/ai/ai-button.tsx +0 -574
- package/src/components/ui/ai/border.tsx +0 -99
- package/src/components/ui/ai/placeholder-input-vanish.tsx +0 -282
- package/src/components/ui/button.tsx +0 -89
- package/src/components/ui/card.tsx +0 -76
- package/src/components/ui/checkbox.tsx +0 -30
- package/src/components/ui/command.tsx +0 -153
- package/src/components/ui/dialog/Dialog.css +0 -25
- package/src/components/ui/dialog/Dialog.tsx +0 -34
- package/src/components/ui/dialog.tsx +0 -122
- package/src/components/ui/drop-downs/background-color.tsx +0 -183
- package/src/components/ui/drop-downs/block-format.tsx +0 -159
- package/src/components/ui/drop-downs/code.tsx +0 -42
- package/src/components/ui/drop-downs/color.tsx +0 -177
- package/src/components/ui/drop-downs/font-size.tsx +0 -138
- package/src/components/ui/drop-downs/font.tsx +0 -155
- package/src/components/ui/drop-downs/index.tsx +0 -122
- package/src/components/ui/drop-downs/insert-node.tsx +0 -213
- package/src/components/ui/drop-downs/text-align.tsx +0 -123
- package/src/components/ui/drop-downs/text-format.tsx +0 -104
- package/src/components/ui/dropdown-menu.tsx +0 -201
- package/src/components/ui/equation/EquationEditor.css +0 -38
- package/src/components/ui/equation/EquationEditor.tsx +0 -56
- package/src/components/ui/equation/KatexEquationAlterer.css +0 -41
- package/src/components/ui/equation/KatexEquationAlterer.tsx +0 -83
- package/src/components/ui/equation/KatexRenderer.tsx +0 -66
- package/src/components/ui/excalidraw/ExcalidrawModal.css +0 -64
- package/src/components/ui/excalidraw/ExcalidrawModal.tsx +0 -234
- package/src/components/ui/excalidraw/Modal.css +0 -62
- package/src/components/ui/excalidraw/Modal.tsx +0 -110
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/image/error-image.tsx +0 -17
- package/src/components/ui/image/file-upload.tsx +0 -240
- package/src/components/ui/image/image-resizer.tsx +0 -297
- package/src/components/ui/image/image-toolbar.tsx +0 -264
- package/src/components/ui/image/index.tsx +0 -408
- package/src/components/ui/image/lazy-image.tsx +0 -68
- package/src/components/ui/image/lazy-video.tsx +0 -71
- package/src/components/ui/input.tsx +0 -22
- package/src/components/ui/models/custom-dialog.tsx +0 -320
- package/src/components/ui/models/insert-gif.tsx +0 -90
- package/src/components/ui/models/insert-image.tsx +0 -52
- package/src/components/ui/models/insert-poll.tsx +0 -29
- package/src/components/ui/models/insert-table.tsx +0 -62
- package/src/components/ui/models/use-model.tsx +0 -91
- package/src/components/ui/poll/poll-component.tsx +0 -304
- package/src/components/ui/popover.tsx +0 -33
- package/src/components/ui/progress.tsx +0 -28
- package/src/components/ui/scroll-area.tsx +0 -48
- package/src/components/ui/separator.tsx +0 -31
- package/src/components/ui/skeleton.tsx +0 -15
- package/src/components/ui/sonner.tsx +0 -31
- package/src/components/ui/stepper/step.tsx +0 -179
- package/src/components/ui/stepper/stepper.tsx +0 -89
- package/src/components/ui/textarea.tsx +0 -22
- package/src/components/ui/toggle.tsx +0 -71
- package/src/components/ui/tooltip.tsx +0 -32
- package/src/components/ui/write/text-format-floting-toolbar.tsx +0 -346
- package/src/lib/edgestore.ts +0 -9
- package/src/lib/pinecone-client.ts +0 -0
- package/src/lib/utils.ts +0 -6
- package/src/utils/docSerialization.ts +0 -77
- package/src/utils/emoji-list.ts +0 -16615
- package/src/utils/getDOMRangeRect.ts +0 -27
- package/src/utils/getThemeSelector.ts +0 -25
- package/src/utils/isMobileWidth.ts +0 -7
- package/src/utils/joinClasses.ts +0 -13
- package/src/utils/setFloatingElemPosition.ts +0 -74
- package/src/utils/setFloatingElemPositionForLinkEditor.ts +0 -46
- package/src/utils/swipe.ts +0 -127
- package/src/utils/url.ts +0 -38
- package/tsconfig.json +0 -27
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_react_shim
|
|
3
|
+
} from "./chunk-77KXU36M.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/editor/plugins/ShortcutsPlugin/shortcuts.ts
|
|
6
|
+
init_react_shim();
|
|
7
|
+
|
|
8
|
+
// src/components/editor/utils/environment.ts
|
|
9
|
+
init_react_shim();
|
|
10
|
+
|
|
11
|
+
// src/components/editor/utils/canUseDOM.ts
|
|
12
|
+
init_react_shim();
|
|
13
|
+
var CAN_USE_DOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
14
|
+
|
|
15
|
+
// src/components/editor/utils/environment.ts
|
|
16
|
+
var documentMode = CAN_USE_DOM && "documentMode" in document ? document.documentMode : null;
|
|
17
|
+
var IS_APPLE = CAN_USE_DOM && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
18
|
+
var IS_FIREFOX = CAN_USE_DOM && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
|
|
19
|
+
var CAN_USE_BEFORE_INPUT = CAN_USE_DOM && "InputEvent" in window && !documentMode ? "getTargetRanges" in new window.InputEvent("input") : false;
|
|
20
|
+
var IS_SAFARI = CAN_USE_DOM && /Version\/[\d.]+.*Safari/.test(navigator.userAgent);
|
|
21
|
+
var IS_IOS = CAN_USE_DOM && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
|
22
|
+
var IS_ANDROID = CAN_USE_DOM && /Android/.test(navigator.userAgent);
|
|
23
|
+
var IS_CHROME = CAN_USE_DOM && /^(?=.*Chrome).*/i.test(navigator.userAgent);
|
|
24
|
+
var IS_APPLE_WEBKIT = CAN_USE_DOM && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !IS_CHROME;
|
|
25
|
+
|
|
26
|
+
// src/components/editor/plugins/ShortcutsPlugin/shortcuts.ts
|
|
27
|
+
var SHORTCUTS = Object.freeze({
|
|
28
|
+
// (Ctrl|⌘) + (Alt|Option) + <key> shortcuts
|
|
29
|
+
NORMAL: IS_APPLE ? "\u2318+Opt+0" : "Ctrl+Alt+0",
|
|
30
|
+
HEADING1: IS_APPLE ? "\u2318+Opt+1" : "Ctrl+Alt+1",
|
|
31
|
+
HEADING2: IS_APPLE ? "\u2318+Opt+2" : "Ctrl+Alt+2",
|
|
32
|
+
HEADING3: IS_APPLE ? "\u2318+Opt+3" : "Ctrl+Alt+3",
|
|
33
|
+
BULLET_LIST: IS_APPLE ? "\u2318+Opt+4" : "Ctrl+Alt+4",
|
|
34
|
+
NUMBERED_LIST: IS_APPLE ? "\u2318+Opt+5" : "Ctrl+Alt+5",
|
|
35
|
+
CHECK_LIST: IS_APPLE ? "\u2318+Opt+6" : "Ctrl+Alt+6",
|
|
36
|
+
CODE_BLOCK: IS_APPLE ? "\u2318+Opt+C" : "Ctrl+Alt+C",
|
|
37
|
+
QUOTE: IS_APPLE ? "\u2318+Opt+Q" : "Ctrl+Alt+Q",
|
|
38
|
+
// (Ctrl|⌘) + Shift + <key> shortcuts
|
|
39
|
+
INCREASE_FONT_SIZE: IS_APPLE ? "\u2318+Shift+." : "Ctrl+Shift+.",
|
|
40
|
+
DECREASE_FONT_SIZE: IS_APPLE ? "\u2318+Shift+," : "Ctrl+Shift+,",
|
|
41
|
+
INSERT_CODE_BLOCK: IS_APPLE ? "\u2318+Shift+C" : "Ctrl+Shift+C",
|
|
42
|
+
STRIKETHROUGH: IS_APPLE ? "\u2318+Shift+S" : "Ctrl+Shift+S",
|
|
43
|
+
LOWERCASE: IS_APPLE ? "\u2318+Shift+1" : "Ctrl+Shift+1",
|
|
44
|
+
UPPERCASE: IS_APPLE ? "\u2318+Shift+2" : "Ctrl+Shift+2",
|
|
45
|
+
CAPITALIZE: IS_APPLE ? "\u2318+Shift+3" : "Ctrl+Shift+3",
|
|
46
|
+
CENTER_ALIGN: IS_APPLE ? "\u2318+Shift+E" : "Ctrl+Shift+E",
|
|
47
|
+
JUSTIFY_ALIGN: IS_APPLE ? "\u2318+Shift+J" : "Ctrl+Shift+J",
|
|
48
|
+
LEFT_ALIGN: IS_APPLE ? "\u2318+Shift+L" : "Ctrl+Shift+L",
|
|
49
|
+
RIGHT_ALIGN: IS_APPLE ? "\u2318+Shift+R" : "Ctrl+Shift+R",
|
|
50
|
+
// (Ctrl|⌘) + <key> shortcuts
|
|
51
|
+
SUBSCRIPT: IS_APPLE ? "\u2318+," : "Ctrl+,",
|
|
52
|
+
SUPERSCRIPT: IS_APPLE ? "\u2318+." : "Ctrl+.",
|
|
53
|
+
INDENT: IS_APPLE ? "\u2318+]" : "Ctrl+]",
|
|
54
|
+
OUTDENT: IS_APPLE ? "\u2318+[" : "Ctrl+[",
|
|
55
|
+
CLEAR_FORMATTING: IS_APPLE ? "\u2318+\\" : "Ctrl+\\",
|
|
56
|
+
REDO: IS_APPLE ? "\u2318+Shift+Z" : "Ctrl+Y",
|
|
57
|
+
UNDO: IS_APPLE ? "\u2318+Z" : "Ctrl+Z",
|
|
58
|
+
BOLD: IS_APPLE ? "\u2318+B" : "Ctrl+B",
|
|
59
|
+
ITALIC: IS_APPLE ? "\u2318+I" : "Ctrl+I",
|
|
60
|
+
UNDERLINE: IS_APPLE ? "\u2318+U" : "Ctrl+U",
|
|
61
|
+
INSERT_LINK: IS_APPLE ? "\u2318+K" : "Ctrl+K"
|
|
62
|
+
});
|
|
63
|
+
function controlOrMeta(metaKey, ctrlKey) {
|
|
64
|
+
return IS_APPLE ? metaKey : ctrlKey;
|
|
65
|
+
}
|
|
66
|
+
function isFormatParagraph(event) {
|
|
67
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
68
|
+
return (code === "Numpad0" || code === "Digit0") && !shiftKey && altKey && controlOrMeta(metaKey, ctrlKey);
|
|
69
|
+
}
|
|
70
|
+
function isFormatHeading(event) {
|
|
71
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
72
|
+
const keyNumber = code[code.length - 1];
|
|
73
|
+
return ["1", "2", "3"].includes(keyNumber) && !shiftKey && altKey && controlOrMeta(metaKey, ctrlKey);
|
|
74
|
+
}
|
|
75
|
+
function isFormatBulletList(event) {
|
|
76
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
77
|
+
return (code === "Numpad4" || code === "Digit4") && !shiftKey && altKey && controlOrMeta(metaKey, ctrlKey);
|
|
78
|
+
}
|
|
79
|
+
function isFormatNumberedList(event) {
|
|
80
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
81
|
+
return (code === "Numpad5" || code === "Digit5") && !shiftKey && altKey && controlOrMeta(metaKey, ctrlKey);
|
|
82
|
+
}
|
|
83
|
+
function isFormatCheckList(event) {
|
|
84
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
85
|
+
return (code === "Numpad6" || code === "Digit6") && !shiftKey && altKey && controlOrMeta(metaKey, ctrlKey);
|
|
86
|
+
}
|
|
87
|
+
function isFormatCode(event) {
|
|
88
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
89
|
+
return code === "KeyC" && !shiftKey && altKey && controlOrMeta(metaKey, ctrlKey);
|
|
90
|
+
}
|
|
91
|
+
function isFormatQuote(event) {
|
|
92
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
93
|
+
return code === "KeyQ" && !shiftKey && altKey && controlOrMeta(metaKey, ctrlKey);
|
|
94
|
+
}
|
|
95
|
+
function isLowercase(event) {
|
|
96
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
97
|
+
return (code === "Numpad1" || code === "Digit1") && shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
98
|
+
}
|
|
99
|
+
function isUppercase(event) {
|
|
100
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
101
|
+
return (code === "Numpad2" || code === "Digit2") && shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
102
|
+
}
|
|
103
|
+
function isCapitalize(event) {
|
|
104
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
105
|
+
return (code === "Numpad3" || code === "Digit3") && shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
106
|
+
}
|
|
107
|
+
function isStrikeThrough(event) {
|
|
108
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
109
|
+
return code === "KeyS" && shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
110
|
+
}
|
|
111
|
+
function isIndent(event) {
|
|
112
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
113
|
+
return code === "BracketRight" && !shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
114
|
+
}
|
|
115
|
+
function isOutdent(event) {
|
|
116
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
117
|
+
return code === "BracketLeft" && !shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
118
|
+
}
|
|
119
|
+
function isCenterAlign(event) {
|
|
120
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
121
|
+
return code === "KeyE" && shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
122
|
+
}
|
|
123
|
+
function isLeftAlign(event) {
|
|
124
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
125
|
+
return code === "KeyL" && shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
126
|
+
}
|
|
127
|
+
function isRightAlign(event) {
|
|
128
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
129
|
+
return code === "KeyR" && shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
130
|
+
}
|
|
131
|
+
function isJustifyAlign(event) {
|
|
132
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
133
|
+
return code === "KeyJ" && shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
134
|
+
}
|
|
135
|
+
function isSubscript(event) {
|
|
136
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
137
|
+
return code === "Comma" && !shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
138
|
+
}
|
|
139
|
+
function isSuperscript(event) {
|
|
140
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
141
|
+
return code === "Period" && !shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
142
|
+
}
|
|
143
|
+
function isInsertCodeBlock(event) {
|
|
144
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
145
|
+
return code === "KeyC" && shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
146
|
+
}
|
|
147
|
+
function isIncreaseFontSize(event) {
|
|
148
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
149
|
+
return code === "Period" && shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
150
|
+
}
|
|
151
|
+
function isDecreaseFontSize(event) {
|
|
152
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
153
|
+
return code === "Comma" && shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
154
|
+
}
|
|
155
|
+
function isClearFormatting(event) {
|
|
156
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
157
|
+
return code === "Backslash" && !shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
158
|
+
}
|
|
159
|
+
function isInsertLink(event) {
|
|
160
|
+
const { code, shiftKey, altKey, metaKey, ctrlKey } = event;
|
|
161
|
+
return code === "KeyK" && !shiftKey && !altKey && controlOrMeta(metaKey, ctrlKey);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export {
|
|
165
|
+
CAN_USE_DOM,
|
|
166
|
+
SHORTCUTS,
|
|
167
|
+
isFormatParagraph,
|
|
168
|
+
isFormatHeading,
|
|
169
|
+
isFormatBulletList,
|
|
170
|
+
isFormatNumberedList,
|
|
171
|
+
isFormatCheckList,
|
|
172
|
+
isFormatCode,
|
|
173
|
+
isFormatQuote,
|
|
174
|
+
isLowercase,
|
|
175
|
+
isUppercase,
|
|
176
|
+
isCapitalize,
|
|
177
|
+
isStrikeThrough,
|
|
178
|
+
isIndent,
|
|
179
|
+
isOutdent,
|
|
180
|
+
isCenterAlign,
|
|
181
|
+
isLeftAlign,
|
|
182
|
+
isRightAlign,
|
|
183
|
+
isJustifyAlign,
|
|
184
|
+
isSubscript,
|
|
185
|
+
isSuperscript,
|
|
186
|
+
isInsertCodeBlock,
|
|
187
|
+
isIncreaseFontSize,
|
|
188
|
+
isDecreaseFontSize,
|
|
189
|
+
isClearFormatting,
|
|
190
|
+
isInsertLink
|
|
191
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
init_react_shim
|
|
3
|
+
} from "./chunk-77KXU36M.mjs";
|
|
4
|
+
|
|
5
|
+
// src/components/editor/plugins/ExportPlugin/index.tsx
|
|
6
|
+
init_react_shim();
|
|
7
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
8
|
+
import { $convertToMarkdownString, TRANSFORMERS } from "@lexical/markdown";
|
|
9
|
+
import { COMMAND_PRIORITY_LOW, createCommand } from "lexical";
|
|
10
|
+
import { useEffect } from "react";
|
|
11
|
+
import { toPng } from "html-to-image";
|
|
12
|
+
import jsPDF from "jspdf";
|
|
13
|
+
var EXPORT_MARKDOWN_COMMAND = createCommand("EXPORT_MARKDOWN_COMMAND");
|
|
14
|
+
var EXPORT_PDF_COMMAND = createCommand("EXPORT_PDF_COMMAND");
|
|
15
|
+
function ExportPlugin() {
|
|
16
|
+
const [editor] = useLexicalComposerContext();
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
return editor.registerCommand(
|
|
19
|
+
EXPORT_MARKDOWN_COMMAND,
|
|
20
|
+
() => {
|
|
21
|
+
editor.update(() => {
|
|
22
|
+
const markdown = $convertToMarkdownString(TRANSFORMERS);
|
|
23
|
+
const blob = new Blob([markdown], { type: "text/markdown" });
|
|
24
|
+
const url = URL.createObjectURL(blob);
|
|
25
|
+
const link = document.createElement("a");
|
|
26
|
+
link.href = url;
|
|
27
|
+
link.download = `document-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.md`;
|
|
28
|
+
link.click();
|
|
29
|
+
URL.revokeObjectURL(url);
|
|
30
|
+
});
|
|
31
|
+
return true;
|
|
32
|
+
},
|
|
33
|
+
COMMAND_PRIORITY_LOW
|
|
34
|
+
);
|
|
35
|
+
}, [editor]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
return editor.registerCommand(
|
|
38
|
+
EXPORT_PDF_COMMAND,
|
|
39
|
+
() => {
|
|
40
|
+
const rootElement = editor.getRootElement();
|
|
41
|
+
if (rootElement) {
|
|
42
|
+
toPng(rootElement, { cacheBust: true }).then((imgData) => {
|
|
43
|
+
const pdf = new jsPDF("p", "mm", "a4");
|
|
44
|
+
const imgProps = pdf.getImageProperties(imgData);
|
|
45
|
+
const pdfWidth = pdf.internal.pageSize.getWidth();
|
|
46
|
+
const pdfHeight = imgProps.height * pdfWidth / imgProps.width;
|
|
47
|
+
pdf.addImage(imgData, "PNG", 0, 0, pdfWidth, pdfHeight);
|
|
48
|
+
pdf.save(`document-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.pdf`);
|
|
49
|
+
}).catch((err) => {
|
|
50
|
+
console.error("Failed to export PDF:", err);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
},
|
|
55
|
+
COMMAND_PRIORITY_LOW
|
|
56
|
+
);
|
|
57
|
+
}, [editor]);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
EXPORT_MARKDOWN_COMMAND,
|
|
63
|
+
EXPORT_PDF_COMMAND,
|
|
64
|
+
ExportPlugin
|
|
65
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Color
|
|
3
|
+
} from "./chunk-YMBXLRW5.mjs";
|
|
4
|
+
import "./chunk-64Z3FI7T.mjs";
|
|
5
|
+
import "./chunk-3CPBODXA.mjs";
|
|
6
|
+
import "./chunk-POGRR73N.mjs";
|
|
7
|
+
import "./chunk-BIU7WTLX.mjs";
|
|
8
|
+
import "./chunk-YHPNOWFH.mjs";
|
|
9
|
+
import "./chunk-77KXU36M.mjs";
|
|
10
|
+
export {
|
|
11
|
+
Color as default
|
|
12
|
+
};
|