@mdxeditor/editor 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -75
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +400 -185
- package/dist/index.js +166 -150
- package/dist/style.css +303 -153
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17,17 +17,16 @@ import { ElementNode, $createParagraphNode, $applyNodeReplacement, DecoratorNode
|
|
|
17
17
|
import { AdmonitionKind } from "lexical";
|
|
18
18
|
import * as React from "react";
|
|
19
19
|
import React__default, { createContext, forwardRef, useMemo, useImperativeHandle, createElement, useCallback, useContext, useState, useEffect } from "react";
|
|
20
|
-
import { directiveToMarkdown, directiveFromMarkdown } from "mdast-util-directive";
|
|
21
|
-
import { frontmatterToMarkdown, frontmatterFromMarkdown } from "mdast-util-frontmatter";
|
|
22
|
-
import { gfmTableToMarkdown, gfmTableFromMarkdown } from "mdast-util-gfm-table";
|
|
23
|
-
import { mdxToMarkdown, mdxFromMarkdown } from "mdast-util-mdx";
|
|
24
|
-
import { toMarkdown } from "mdast-util-to-markdown";
|
|
25
20
|
import { CodeNode } from "@lexical/code";
|
|
26
21
|
import { $isLinkNode, LinkNode, $createLinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
|
|
27
22
|
import { $isListNode, $isListItemNode, ListNode, ListItemNode, $createListNode, $createListItemNode, INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, REMOVE_LIST_COMMAND, $getListDepth } from "@lexical/list";
|
|
28
23
|
import { $isHorizontalRuleNode, HorizontalRuleNode, $createHorizontalRuleNode, INSERT_HORIZONTAL_RULE_COMMAND } from "@lexical/react/LexicalHorizontalRuleNode";
|
|
29
24
|
import { $isHeadingNode, $isQuoteNode, HeadingNode, QuoteNode, $createHeadingNode, $createQuoteNode } from "@lexical/rich-text";
|
|
25
|
+
import { directiveToMarkdown, directiveFromMarkdown } from "mdast-util-directive";
|
|
30
26
|
import { fromMarkdown } from "mdast-util-from-markdown";
|
|
27
|
+
import { frontmatterToMarkdown, frontmatterFromMarkdown } from "mdast-util-frontmatter";
|
|
28
|
+
import { gfmTableToMarkdown, gfmTableFromMarkdown } from "mdast-util-gfm-table";
|
|
29
|
+
import { mdxToMarkdown, mdxFromMarkdown } from "mdast-util-mdx";
|
|
31
30
|
import { directive } from "micromark-extension-directive";
|
|
32
31
|
import { frontmatter } from "micromark-extension-frontmatter";
|
|
33
32
|
import { gfmTable } from "micromark-extension-gfm-table";
|
|
@@ -36,6 +35,7 @@ import { addClassNamesToElement, $insertNodeToNearestRoot, $findMatchingParent,
|
|
|
36
35
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
37
36
|
import { $setBlocksType, $isAtNodeEnd } from "@lexical/selection";
|
|
38
37
|
import { createEmptyHistoryState, HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
|
|
38
|
+
import { toMarkdown } from "mdast-util-to-markdown";
|
|
39
39
|
import * as RadixPopover from "@radix-ui/react-popover";
|
|
40
40
|
import * as Tooltip from "@radix-ui/react-tooltip";
|
|
41
41
|
import { useCombobox } from "downshift";
|
|
@@ -229,7 +229,8 @@ class CodeBlockNode extends DecoratorNode {
|
|
|
229
229
|
);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
function $createCodeBlockNode(
|
|
232
|
+
function $createCodeBlockNode(options) {
|
|
233
|
+
const { code: code2, language, meta } = options;
|
|
233
234
|
return new CodeBlockNode(code2, language, meta);
|
|
234
235
|
}
|
|
235
236
|
function $isCodeBlockNode(node) {
|
|
@@ -249,9 +250,7 @@ class FrontmatterNode extends DecoratorNode {
|
|
|
249
250
|
}
|
|
250
251
|
static importJSON(serializedNode) {
|
|
251
252
|
const { yaml } = serializedNode;
|
|
252
|
-
const node = $createFrontmatterNode(
|
|
253
|
-
yaml
|
|
254
|
-
});
|
|
253
|
+
const node = $createFrontmatterNode(yaml);
|
|
255
254
|
return node;
|
|
256
255
|
}
|
|
257
256
|
exportJSON() {
|
|
@@ -292,7 +291,7 @@ class FrontmatterNode extends DecoratorNode {
|
|
|
292
291
|
);
|
|
293
292
|
}
|
|
294
293
|
}
|
|
295
|
-
function $createFrontmatterNode(
|
|
294
|
+
function $createFrontmatterNode(yaml) {
|
|
296
295
|
return new FrontmatterNode(yaml);
|
|
297
296
|
}
|
|
298
297
|
function $isFrontmatterNode(node) {
|
|
@@ -357,7 +356,6 @@ class ImageNode extends DecoratorNode {
|
|
|
357
356
|
version: 1
|
|
358
357
|
};
|
|
359
358
|
}
|
|
360
|
-
// View
|
|
361
359
|
createDOM(config) {
|
|
362
360
|
const span = document.createElement("span");
|
|
363
361
|
const theme2 = config.theme;
|
|
@@ -386,27 +384,30 @@ class ImageNode extends DecoratorNode {
|
|
|
386
384
|
return /* @__PURE__ */ React__default.createElement("img", { title: this.__title, src: this.__src, alt: this.__altText });
|
|
387
385
|
}
|
|
388
386
|
}
|
|
389
|
-
function $createImageNode(
|
|
387
|
+
function $createImageNode(options) {
|
|
388
|
+
const { altText, title, src, key } = options;
|
|
390
389
|
return new ImageNode(src, altText, title, key);
|
|
391
390
|
}
|
|
392
391
|
function $isImageNode(node) {
|
|
393
392
|
return node instanceof ImageNode;
|
|
394
393
|
}
|
|
395
|
-
const
|
|
396
|
-
const
|
|
397
|
-
const
|
|
398
|
-
const
|
|
399
|
-
const
|
|
400
|
-
const
|
|
401
|
-
const
|
|
402
|
-
const
|
|
403
|
-
const
|
|
404
|
-
const
|
|
405
|
-
const
|
|
406
|
-
const
|
|
407
|
-
const
|
|
408
|
-
const
|
|
394
|
+
const darkTheme = "_dark-theme_13nbk_1";
|
|
395
|
+
const bold = "_bold_13nbk_10";
|
|
396
|
+
const italic = "_italic_13nbk_14";
|
|
397
|
+
const underline = "_underline_13nbk_18";
|
|
398
|
+
const strikethrough = "_strikethrough_13nbk_34";
|
|
399
|
+
const underlineStrikethrough = "_underlineStrikethrough_13nbk_38";
|
|
400
|
+
const subscript = "_subscript_13nbk_42";
|
|
401
|
+
const superscript = "_superscript_13nbk_47";
|
|
402
|
+
const code = "_code_13nbk_52";
|
|
403
|
+
const nestedListItem$1 = "_nestedListItem_13nbk_59";
|
|
404
|
+
const admonitionDanger = "_admonitionDanger_13nbk_63";
|
|
405
|
+
const admonitionInfo = "_admonitionInfo_13nbk_63";
|
|
406
|
+
const admonitionNote = "_admonitionNote_13nbk_63";
|
|
407
|
+
const admonitionTip = "_admonitionTip_13nbk_63";
|
|
408
|
+
const admonitionCaution = "_admonitionCaution_13nbk_63";
|
|
409
409
|
const styles$1 = {
|
|
410
|
+
darkTheme,
|
|
410
411
|
bold,
|
|
411
412
|
italic,
|
|
412
413
|
underline,
|
|
@@ -422,6 +423,115 @@ const styles$1 = {
|
|
|
422
423
|
admonitionTip,
|
|
423
424
|
admonitionCaution
|
|
424
425
|
};
|
|
426
|
+
const editorRoot = "_editorRoot_1x7ym_47";
|
|
427
|
+
const editorWrapper = "_editorWrapper_1x7ym_141";
|
|
428
|
+
const nestedListItem = "_nestedListItem_1x7ym_145";
|
|
429
|
+
const toolbarRoot = "_toolbarRoot_1x7ym_149";
|
|
430
|
+
const toolbarModeSwitch = "_toolbarModeSwitch_1x7ym_170";
|
|
431
|
+
const toolbarToggleItem = "_toolbarToggleItem_1x7ym_179";
|
|
432
|
+
const toolbarGroupOfGroups = "_toolbarGroupOfGroups_1x7ym_189";
|
|
433
|
+
const toolbarToggleSingleGroup = "_toolbarToggleSingleGroup_1x7ym_193";
|
|
434
|
+
const toolbarButton = "_toolbarButton_1x7ym_207";
|
|
435
|
+
const toolbarNodeKindSelectContainer = "_toolbarNodeKindSelectContainer_1x7ym_236";
|
|
436
|
+
const toolbarButtonDropdownContainer = "_toolbarButtonDropdownContainer_1x7ym_237";
|
|
437
|
+
const toolbarCodeBlockLanguageSelectContent = "_toolbarCodeBlockLanguageSelectContent_1x7ym_238";
|
|
438
|
+
const toolbarNodeKindSelectTrigger = "_toolbarNodeKindSelectTrigger_1x7ym_252";
|
|
439
|
+
const toolbarButtonSelectTrigger = "_toolbarButtonSelectTrigger_1x7ym_253";
|
|
440
|
+
const toolbarCodeBlockLanguageSelectTrigger = "_toolbarCodeBlockLanguageSelectTrigger_1x7ym_286";
|
|
441
|
+
const toolbarNodeKindSelectItem = "_toolbarNodeKindSelectItem_1x7ym_292";
|
|
442
|
+
const toolbarNodeKindSelectDropdownArrow = "_toolbarNodeKindSelectDropdownArrow_1x7ym_315";
|
|
443
|
+
const contentEditable = "_contentEditable_1x7ym_319";
|
|
444
|
+
const sandpackWrapper = "_sandpackWrapper_1x7ym_327";
|
|
445
|
+
const frontmatterWrapper = "_frontmatterWrapper_1x7ym_331";
|
|
446
|
+
const frontmatterToggleButton = "_frontmatterToggleButton_1x7ym_341";
|
|
447
|
+
const frontmatterEditorTable = "_frontmatterEditorTable_1x7ym_349";
|
|
448
|
+
const iconButton = "_iconButton_1x7ym_367";
|
|
449
|
+
const frontmatterInput = "_frontmatterInput_1x7ym_373";
|
|
450
|
+
const primaryButton = "_primaryButton_1x7ym_388";
|
|
451
|
+
const linkDialogEditForm = "_linkDialogEditForm_1x7ym_398";
|
|
452
|
+
const linkDialogInputContainer = "_linkDialogInputContainer_1x7ym_404";
|
|
453
|
+
const linkDialogInputWrapper = "_linkDialogInputWrapper_1x7ym_410";
|
|
454
|
+
const linkDialogInput = "_linkDialogInput_1x7ym_404";
|
|
455
|
+
const linkDialogAutocompleteContainer = "_linkDialogAutocompleteContainer_1x7ym_440";
|
|
456
|
+
const linkDialogAnchor = "_linkDialogAnchor_1x7ym_485";
|
|
457
|
+
const linkDialogPopoverContent = "_linkDialogPopoverContent_1x7ym_499";
|
|
458
|
+
const tableColumnEditorPopoverContent = "_tableColumnEditorPopoverContent_1x7ym_499";
|
|
459
|
+
const dialogContent = "_dialogContent_1x7ym_499";
|
|
460
|
+
const linkDialogPreviewAnchor = "_linkDialogPreviewAnchor_1x7ym_513";
|
|
461
|
+
const tooltipContent = "_tooltipContent_1x7ym_535";
|
|
462
|
+
const actionButton = "_actionButton_1x7ym_547";
|
|
463
|
+
const primaryActionButton = "_primaryActionButton_1x7ym_553";
|
|
464
|
+
const tableEditor = "_tableEditor_1x7ym_562";
|
|
465
|
+
const toolCell = "_toolCell_1x7ym_573";
|
|
466
|
+
const tableColumnEditorTrigger = "_tableColumnEditorTrigger_1x7ym_590";
|
|
467
|
+
const tableRowEditorTrigger = "_tableRowEditorTrigger_1x7ym_590";
|
|
468
|
+
const addRowButton = "_addRowButton_1x7ym_590";
|
|
469
|
+
const addColumnButton = "_addColumnButton_1x7ym_590";
|
|
470
|
+
const tableColumnEditorToolbar = "_tableColumnEditorToolbar_1x7ym_624";
|
|
471
|
+
const toggleGroupRoot = "_toggleGroupRoot_1x7ym_636";
|
|
472
|
+
const tableToolsColumn = "_tableToolsColumn_1x7ym_653";
|
|
473
|
+
const leftAlignedCell = "_leftAlignedCell_1x7ym_661";
|
|
474
|
+
const rightAlignedCell = "_rightAlignedCell_1x7ym_665";
|
|
475
|
+
const centeredCell = "_centeredCell_1x7ym_669";
|
|
476
|
+
const dialogOverlay = "_dialogOverlay_1x7ym_697";
|
|
477
|
+
const overlayShow = "_overlayShow_1x7ym_1";
|
|
478
|
+
const contentShow = "_contentShow_1x7ym_1";
|
|
479
|
+
const styles = {
|
|
480
|
+
editorRoot,
|
|
481
|
+
editorWrapper,
|
|
482
|
+
nestedListItem,
|
|
483
|
+
toolbarRoot,
|
|
484
|
+
toolbarModeSwitch,
|
|
485
|
+
toolbarToggleItem,
|
|
486
|
+
toolbarGroupOfGroups,
|
|
487
|
+
toolbarToggleSingleGroup,
|
|
488
|
+
toolbarButton,
|
|
489
|
+
toolbarNodeKindSelectContainer,
|
|
490
|
+
toolbarButtonDropdownContainer,
|
|
491
|
+
toolbarCodeBlockLanguageSelectContent,
|
|
492
|
+
toolbarNodeKindSelectTrigger,
|
|
493
|
+
toolbarButtonSelectTrigger,
|
|
494
|
+
toolbarCodeBlockLanguageSelectTrigger,
|
|
495
|
+
toolbarNodeKindSelectItem,
|
|
496
|
+
toolbarNodeKindSelectDropdownArrow,
|
|
497
|
+
contentEditable,
|
|
498
|
+
sandpackWrapper,
|
|
499
|
+
frontmatterWrapper,
|
|
500
|
+
frontmatterToggleButton,
|
|
501
|
+
frontmatterEditorTable,
|
|
502
|
+
iconButton,
|
|
503
|
+
frontmatterInput,
|
|
504
|
+
primaryButton,
|
|
505
|
+
linkDialogEditForm,
|
|
506
|
+
linkDialogInputContainer,
|
|
507
|
+
linkDialogInputWrapper,
|
|
508
|
+
linkDialogInput,
|
|
509
|
+
linkDialogAutocompleteContainer,
|
|
510
|
+
linkDialogAnchor,
|
|
511
|
+
linkDialogPopoverContent,
|
|
512
|
+
tableColumnEditorPopoverContent,
|
|
513
|
+
dialogContent,
|
|
514
|
+
linkDialogPreviewAnchor,
|
|
515
|
+
tooltipContent,
|
|
516
|
+
actionButton,
|
|
517
|
+
primaryActionButton,
|
|
518
|
+
tableEditor,
|
|
519
|
+
toolCell,
|
|
520
|
+
tableColumnEditorTrigger,
|
|
521
|
+
tableRowEditorTrigger,
|
|
522
|
+
addRowButton,
|
|
523
|
+
addColumnButton,
|
|
524
|
+
tableColumnEditorToolbar,
|
|
525
|
+
toggleGroupRoot,
|
|
526
|
+
tableToolsColumn,
|
|
527
|
+
leftAlignedCell,
|
|
528
|
+
rightAlignedCell,
|
|
529
|
+
centeredCell,
|
|
530
|
+
dialogOverlay,
|
|
531
|
+
overlayShow,
|
|
532
|
+
contentShow
|
|
533
|
+
};
|
|
534
|
+
console.log(styles);
|
|
425
535
|
const theme = {
|
|
426
536
|
text: {
|
|
427
537
|
bold: styles$1.bold,
|
|
@@ -593,8 +703,8 @@ class JsxNode extends DecoratorNode {
|
|
|
593
703
|
);
|
|
594
704
|
}
|
|
595
705
|
}
|
|
596
|
-
function $createJsxNode(
|
|
597
|
-
return new JsxNode(
|
|
706
|
+
function $createJsxNode(options) {
|
|
707
|
+
return new JsxNode(options);
|
|
598
708
|
}
|
|
599
709
|
function $isJsxNode(node) {
|
|
600
710
|
return node instanceof JsxNode;
|
|
@@ -695,7 +805,8 @@ class SandpackNode extends DecoratorNode {
|
|
|
695
805
|
);
|
|
696
806
|
}
|
|
697
807
|
}
|
|
698
|
-
function $createSandpackNode(
|
|
808
|
+
function $createSandpackNode(options) {
|
|
809
|
+
const { code: code2, language, meta } = options;
|
|
699
810
|
return new SandpackNode(code2, language, meta);
|
|
700
811
|
}
|
|
701
812
|
function $isSandpackNode(node) {
|
|
@@ -786,7 +897,7 @@ class TableNode extends DecoratorNode {
|
|
|
786
897
|
const row = table.children[rowIndex];
|
|
787
898
|
const cells = row.children;
|
|
788
899
|
const cellsClone = Array.from(cells);
|
|
789
|
-
const rowClone = { ...row,
|
|
900
|
+
const rowClone = { ...row, children: cellsClone };
|
|
790
901
|
cellsClone.splice(colIndex, 1);
|
|
791
902
|
table.children[rowIndex] = rowClone;
|
|
792
903
|
}
|
|
@@ -912,10 +1023,13 @@ const LexicalQuoteVisitor = {
|
|
|
912
1023
|
};
|
|
913
1024
|
const AdmonitionVisitor = {
|
|
914
1025
|
testLexicalNode: $isAdmonitionNode,
|
|
915
|
-
visitLexicalNode: ({ lexicalNode, actions }) => {
|
|
916
|
-
actions.
|
|
917
|
-
|
|
1026
|
+
visitLexicalNode: ({ mdastParent, lexicalNode, actions }) => {
|
|
1027
|
+
const admonition = actions.appendToParent(mdastParent, {
|
|
1028
|
+
type: "containerDirective",
|
|
1029
|
+
name: lexicalNode.getKind(),
|
|
1030
|
+
children: [{ type: "paragraph", children: [] }]
|
|
918
1031
|
});
|
|
1032
|
+
actions.visitChildren(lexicalNode, admonition.children[0]);
|
|
919
1033
|
}
|
|
920
1034
|
};
|
|
921
1035
|
const SandpackNodeVisitor = {
|
|
@@ -1391,11 +1505,7 @@ const MdastImageVisitor = {
|
|
|
1391
1505
|
const MdastFrontmatterVisitor = {
|
|
1392
1506
|
testNode: "yaml",
|
|
1393
1507
|
visitNode({ mdastNode, actions }) {
|
|
1394
|
-
actions.addAndStepInto(
|
|
1395
|
-
$createFrontmatterNode({
|
|
1396
|
-
yaml: mdastNode.value
|
|
1397
|
-
})
|
|
1398
|
-
);
|
|
1508
|
+
actions.addAndStepInto($createFrontmatterNode(mdastNode.value));
|
|
1399
1509
|
}
|
|
1400
1510
|
};
|
|
1401
1511
|
const MdastMdxJsEsmVisitor = {
|
|
@@ -2264,7 +2374,7 @@ const [EditorSystem, EditorSystemType] = system((r) => {
|
|
|
2264
2374
|
theEditor == null ? void 0 : theEditor.update(() => {
|
|
2265
2375
|
const firstItem = $getRoot().getFirstChild();
|
|
2266
2376
|
if (!$isFrontmatterNode(firstItem)) {
|
|
2267
|
-
const fmNode = $createFrontmatterNode(
|
|
2377
|
+
const fmNode = $createFrontmatterNode('"": ""');
|
|
2268
2378
|
if (firstItem) {
|
|
2269
2379
|
firstItem.insertBefore(fmNode);
|
|
2270
2380
|
} else {
|
|
@@ -2497,9 +2607,17 @@ const defaultSandpackConfig$1 = {
|
|
|
2497
2607
|
}
|
|
2498
2608
|
]
|
|
2499
2609
|
};
|
|
2610
|
+
const defaultCodeBlockLanguages = {
|
|
2611
|
+
js: "JavaScript",
|
|
2612
|
+
ts: "TypeScript",
|
|
2613
|
+
tsx: "TypeScript (React)",
|
|
2614
|
+
jsx: "JavaScript (React)",
|
|
2615
|
+
css: "CSS"
|
|
2616
|
+
};
|
|
2500
2617
|
const [SandpackSystem] = system(
|
|
2501
2618
|
(r, [{ activeEditor, activeEditorType, createEditorSubscription }]) => {
|
|
2502
2619
|
const sandpackConfig = r.node(defaultSandpackConfig$1);
|
|
2620
|
+
const codeBlockLanguages = r.node(defaultCodeBlockLanguages);
|
|
2503
2621
|
const insertSandpack = r.node();
|
|
2504
2622
|
const insertCodeBlock = r.node();
|
|
2505
2623
|
r.pub(createEditorSubscription, (editor) => {
|
|
@@ -2555,6 +2673,7 @@ const [SandpackSystem] = system(
|
|
|
2555
2673
|
});
|
|
2556
2674
|
});
|
|
2557
2675
|
return {
|
|
2676
|
+
codeBlockLanguages,
|
|
2558
2677
|
insertSandpack,
|
|
2559
2678
|
insertCodeBlock,
|
|
2560
2679
|
sandpackConfig
|
|
@@ -2875,7 +2994,8 @@ const {
|
|
|
2875
2994
|
editorRootElementRef: "editorRootElementRef",
|
|
2876
2995
|
viewMode: "viewMode",
|
|
2877
2996
|
linkAutocompleteSuggestions: "linkAutocompleteSuggestions",
|
|
2878
|
-
imageAutocompleteSuggestions: "imageAutocompleteSuggestions"
|
|
2997
|
+
imageAutocompleteSuggestions: "imageAutocompleteSuggestions",
|
|
2998
|
+
codeBlockLanguages: "codeBlockLanguages"
|
|
2879
2999
|
},
|
|
2880
3000
|
events: {
|
|
2881
3001
|
onChange: "onChange"
|
|
@@ -2919,110 +3039,6 @@ const SvgArrowDropDown$1 = (props) => /* @__PURE__ */ React.createElement("svg",
|
|
|
2919
3039
|
maskType: "alpha"
|
|
2920
3040
|
} }, /* @__PURE__ */ React.createElement("path", { d: "M0 0h24v24H0z" })), /* @__PURE__ */ React.createElement("g", { mask: "url(#a)" }, /* @__PURE__ */ React.createElement("path", { d: "m12 15-5-5h10l-5 5Z" })));
|
|
2921
3041
|
const DropDownIcon = SvgArrowDropDown$1;
|
|
2922
|
-
const editorRoot = "_editorRoot_1nlu3_43";
|
|
2923
|
-
const editorWrapper = "_editorWrapper_1nlu3_121";
|
|
2924
|
-
const nestedListItem = "_nestedListItem_1nlu3_125";
|
|
2925
|
-
const toolbarRoot = "_toolbarRoot_1nlu3_129";
|
|
2926
|
-
const toolbarModeSwitch = "_toolbarModeSwitch_1nlu3_150";
|
|
2927
|
-
const toolbarToggleItem = "_toolbarToggleItem_1nlu3_159";
|
|
2928
|
-
const toolbarGroupOfGroups = "_toolbarGroupOfGroups_1nlu3_169";
|
|
2929
|
-
const toolbarToggleSingleGroup = "_toolbarToggleSingleGroup_1nlu3_173";
|
|
2930
|
-
const toolbarButton = "_toolbarButton_1nlu3_187";
|
|
2931
|
-
const toolbarNodeKindSelectContainer = "_toolbarNodeKindSelectContainer_1nlu3_216";
|
|
2932
|
-
const toolbarButtonDropdownContainer = "_toolbarButtonDropdownContainer_1nlu3_217";
|
|
2933
|
-
const toolbarNodeKindSelectTrigger = "_toolbarNodeKindSelectTrigger_1nlu3_230";
|
|
2934
|
-
const toolbarButtonSelectTrigger = "_toolbarButtonSelectTrigger_1nlu3_231";
|
|
2935
|
-
const toolbarNodeKindSelectItem = "_toolbarNodeKindSelectItem_1nlu3_264";
|
|
2936
|
-
const toolbarNodeKindSelectDropdownArrow = "_toolbarNodeKindSelectDropdownArrow_1nlu3_287";
|
|
2937
|
-
const contentEditable = "_contentEditable_1nlu3_291";
|
|
2938
|
-
const sandpackWrapper = "_sandpackWrapper_1nlu3_299";
|
|
2939
|
-
const frontmatterWrapper = "_frontmatterWrapper_1nlu3_303";
|
|
2940
|
-
const frontmatterToggleButton = "_frontmatterToggleButton_1nlu3_313";
|
|
2941
|
-
const frontmatterEditorTable = "_frontmatterEditorTable_1nlu3_321";
|
|
2942
|
-
const iconButton = "_iconButton_1nlu3_339";
|
|
2943
|
-
const frontmatterInput = "_frontmatterInput_1nlu3_345";
|
|
2944
|
-
const primaryButton = "_primaryButton_1nlu3_360";
|
|
2945
|
-
const linkDialogEditForm = "_linkDialogEditForm_1nlu3_370";
|
|
2946
|
-
const linkDialogInputContainer = "_linkDialogInputContainer_1nlu3_376";
|
|
2947
|
-
const linkDialogInputWrapper = "_linkDialogInputWrapper_1nlu3_382";
|
|
2948
|
-
const linkDialogInput = "_linkDialogInput_1nlu3_376";
|
|
2949
|
-
const linkDialogAutocompleteContainer = "_linkDialogAutocompleteContainer_1nlu3_412";
|
|
2950
|
-
const linkDialogAnchor = "_linkDialogAnchor_1nlu3_457";
|
|
2951
|
-
const linkDialogPopoverContent = "_linkDialogPopoverContent_1nlu3_471";
|
|
2952
|
-
const tableColumnEditorPopoverContent = "_tableColumnEditorPopoverContent_1nlu3_471";
|
|
2953
|
-
const dialogContent = "_dialogContent_1nlu3_471";
|
|
2954
|
-
const linkDialogPreviewAnchor = "_linkDialogPreviewAnchor_1nlu3_485";
|
|
2955
|
-
const tooltipContent = "_tooltipContent_1nlu3_507";
|
|
2956
|
-
const actionButton = "_actionButton_1nlu3_519";
|
|
2957
|
-
const primaryActionButton = "_primaryActionButton_1nlu3_525";
|
|
2958
|
-
const tableEditor = "_tableEditor_1nlu3_534";
|
|
2959
|
-
const toolCell = "_toolCell_1nlu3_545";
|
|
2960
|
-
const tableColumnEditorTrigger = "_tableColumnEditorTrigger_1nlu3_562";
|
|
2961
|
-
const tableRowEditorTrigger = "_tableRowEditorTrigger_1nlu3_562";
|
|
2962
|
-
const addRowButton = "_addRowButton_1nlu3_562";
|
|
2963
|
-
const addColumnButton = "_addColumnButton_1nlu3_562";
|
|
2964
|
-
const tableColumnEditorToolbar = "_tableColumnEditorToolbar_1nlu3_596";
|
|
2965
|
-
const toggleGroupRoot = "_toggleGroupRoot_1nlu3_608";
|
|
2966
|
-
const tableToolsColumn = "_tableToolsColumn_1nlu3_625";
|
|
2967
|
-
const leftAlignedCell = "_leftAlignedCell_1nlu3_633";
|
|
2968
|
-
const rightAlignedCell = "_rightAlignedCell_1nlu3_637";
|
|
2969
|
-
const centeredCell = "_centeredCell_1nlu3_641";
|
|
2970
|
-
const dialogOverlay = "_dialogOverlay_1nlu3_669";
|
|
2971
|
-
const overlayShow = "_overlayShow_1nlu3_1";
|
|
2972
|
-
const contentShow = "_contentShow_1nlu3_1";
|
|
2973
|
-
const styles = {
|
|
2974
|
-
editorRoot,
|
|
2975
|
-
editorWrapper,
|
|
2976
|
-
nestedListItem,
|
|
2977
|
-
toolbarRoot,
|
|
2978
|
-
toolbarModeSwitch,
|
|
2979
|
-
toolbarToggleItem,
|
|
2980
|
-
toolbarGroupOfGroups,
|
|
2981
|
-
toolbarToggleSingleGroup,
|
|
2982
|
-
toolbarButton,
|
|
2983
|
-
toolbarNodeKindSelectContainer,
|
|
2984
|
-
toolbarButtonDropdownContainer,
|
|
2985
|
-
toolbarNodeKindSelectTrigger,
|
|
2986
|
-
toolbarButtonSelectTrigger,
|
|
2987
|
-
toolbarNodeKindSelectItem,
|
|
2988
|
-
toolbarNodeKindSelectDropdownArrow,
|
|
2989
|
-
contentEditable,
|
|
2990
|
-
sandpackWrapper,
|
|
2991
|
-
frontmatterWrapper,
|
|
2992
|
-
frontmatterToggleButton,
|
|
2993
|
-
frontmatterEditorTable,
|
|
2994
|
-
iconButton,
|
|
2995
|
-
frontmatterInput,
|
|
2996
|
-
primaryButton,
|
|
2997
|
-
linkDialogEditForm,
|
|
2998
|
-
linkDialogInputContainer,
|
|
2999
|
-
linkDialogInputWrapper,
|
|
3000
|
-
linkDialogInput,
|
|
3001
|
-
linkDialogAutocompleteContainer,
|
|
3002
|
-
linkDialogAnchor,
|
|
3003
|
-
linkDialogPopoverContent,
|
|
3004
|
-
tableColumnEditorPopoverContent,
|
|
3005
|
-
dialogContent,
|
|
3006
|
-
linkDialogPreviewAnchor,
|
|
3007
|
-
tooltipContent,
|
|
3008
|
-
actionButton,
|
|
3009
|
-
primaryActionButton,
|
|
3010
|
-
tableEditor,
|
|
3011
|
-
toolCell,
|
|
3012
|
-
tableColumnEditorTrigger,
|
|
3013
|
-
tableRowEditorTrigger,
|
|
3014
|
-
addRowButton,
|
|
3015
|
-
addColumnButton,
|
|
3016
|
-
tableColumnEditorToolbar,
|
|
3017
|
-
toggleGroupRoot,
|
|
3018
|
-
tableToolsColumn,
|
|
3019
|
-
leftAlignedCell,
|
|
3020
|
-
rightAlignedCell,
|
|
3021
|
-
centeredCell,
|
|
3022
|
-
dialogOverlay,
|
|
3023
|
-
overlayShow,
|
|
3024
|
-
contentShow
|
|
3025
|
-
};
|
|
3026
3042
|
createCommand();
|
|
3027
3043
|
const MAX_SUGGESTIONS$1 = 20;
|
|
3028
3044
|
function LinkEditForm({ initialUrl, onSubmit, onCancel, linkAutocompleteSuggestions }) {
|
|
@@ -3940,8 +3956,8 @@ const SelectItem = React__default.forwardRef(
|
|
|
3940
3956
|
return /* @__PURE__ */ React__default.createElement(Select.Item, { ...props, ref: forwardedRef, className: classNames(className, styles.toolbarNodeKindSelectItem) }, /* @__PURE__ */ React__default.createElement(Select.ItemText, null, children));
|
|
3941
3957
|
}
|
|
3942
3958
|
);
|
|
3943
|
-
const SelectTrigger = ({ placeholder }) => {
|
|
3944
|
-
return /* @__PURE__ */ React__default.createElement(Select.Trigger, { "aria-label": placeholder, className: styles.toolbarNodeKindSelectTrigger }, /* @__PURE__ */ React__default.createElement(Select.Value, { placeholder }), /* @__PURE__ */ React__default.createElement(Select.Icon, { className: styles.toolbarNodeKindSelectDropdownArrow }, /* @__PURE__ */ React__default.createElement(DropDownIcon, null)));
|
|
3959
|
+
const SelectTrigger = ({ placeholder, className }) => {
|
|
3960
|
+
return /* @__PURE__ */ React__default.createElement(Select.Trigger, { "aria-label": placeholder, className: classNames(styles.toolbarNodeKindSelectTrigger, className) }, /* @__PURE__ */ React__default.createElement(Select.Value, { placeholder }), /* @__PURE__ */ React__default.createElement(Select.Icon, { className: styles.toolbarNodeKindSelectDropdownArrow }, /* @__PURE__ */ React__default.createElement(DropDownIcon, null)));
|
|
3945
3961
|
};
|
|
3946
3962
|
const SelectContent = ({
|
|
3947
3963
|
children,
|
|
@@ -3958,7 +3974,7 @@ const SelectButtonTrigger = ({
|
|
|
3958
3974
|
return /* @__PURE__ */ React__default.createElement(Select.Trigger, { className: classNames(styles.toolbarButtonSelectTrigger, className), title }, children, /* @__PURE__ */ React__default.createElement(Select.Icon, { className: styles.toolbarNodeKindSelectDropdownArrow }, /* @__PURE__ */ React__default.createElement(DropDownIcon, null)));
|
|
3959
3975
|
};
|
|
3960
3976
|
function CodeBlockLanguageSelect() {
|
|
3961
|
-
const [activeEditorType, activeEditor] = useEmitterValues("activeEditorType", "activeEditor");
|
|
3977
|
+
const [activeEditorType, activeEditor, codeBlockLanguages] = useEmitterValues("activeEditorType", "activeEditor", "codeBlockLanguages");
|
|
3962
3978
|
const nodeLanguage = React__default.useMemo(() => {
|
|
3963
3979
|
let language;
|
|
3964
3980
|
activeEditor.getEditorState().read(() => {
|
|
@@ -3981,8 +3997,8 @@ function CodeBlockLanguageSelect() {
|
|
|
3981
3997
|
});
|
|
3982
3998
|
}
|
|
3983
3999
|
},
|
|
3984
|
-
/* @__PURE__ */ React__default.createElement(SelectTrigger, { placeholder: "Language" }),
|
|
3985
|
-
/* @__PURE__ */ React__default.createElement(SelectContent,
|
|
4000
|
+
/* @__PURE__ */ React__default.createElement(SelectTrigger, { placeholder: "Language", className: styles.toolbarCodeBlockLanguageSelectTrigger }),
|
|
4001
|
+
/* @__PURE__ */ React__default.createElement(SelectContent, { className: styles.toolbarCodeBlockLanguageSelectContent }, Object.entries(codeBlockLanguages).map(([value, label]) => /* @__PURE__ */ React__default.createElement(SelectItem, { key: value, value }, label)))
|
|
3986
4002
|
);
|
|
3987
4003
|
}
|
|
3988
4004
|
const SvgDelete = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, fill: "currentColor", viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React.createElement("mask", { id: "a", width: 24, height: 24, x: 0, y: 0, maskUnits: "userSpaceOnUse", style: {
|
|
@@ -4052,7 +4068,7 @@ const TableIcon = SvgTable;
|
|
|
4052
4068
|
const BlockTypeSelect = () => {
|
|
4053
4069
|
const [currentBlockType] = useEmitterValues("currentBlockType");
|
|
4054
4070
|
const applyBlockType = usePublisher("applyBlockType");
|
|
4055
|
-
return /* @__PURE__ */ React__default.createElement(Select.Root, { value: currentBlockType || "", onValueChange: applyBlockType }, /* @__PURE__ */ React__default.createElement(SelectTrigger, { placeholder: "Block type" }), /* @__PURE__ */ React__default.createElement(SelectContent, null, /* @__PURE__ */ React__default.createElement(SelectItem, { value: "paragraph" }, "Paragraph"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "quote" }, "Quote"), /* @__PURE__ */ React__default.createElement(Select.Separator, null), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "h1" }, "Heading 1"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "h2" }, "Heading 2"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "h3" }, "Heading 3"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "h4" }, "Heading 4"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "h5" }, "Heading 5"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "h6" }, "Heading 6"), /* @__PURE__ */ React__default.createElement(Select.Separator, null), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "info" }, "Info")));
|
|
4071
|
+
return /* @__PURE__ */ React__default.createElement(Select.Root, { value: currentBlockType || "", onValueChange: applyBlockType }, /* @__PURE__ */ React__default.createElement(SelectTrigger, { placeholder: "Block type" }), /* @__PURE__ */ React__default.createElement(SelectContent, null, /* @__PURE__ */ React__default.createElement(SelectItem, { value: "paragraph" }, "Paragraph"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "quote" }, "Quote"), /* @__PURE__ */ React__default.createElement(Select.Separator, null), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "h1" }, "Heading 1"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "h2" }, "Heading 2"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "h3" }, "Heading 3"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "h4" }, "Heading 4"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "h5" }, "Heading 5"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "h6" }, "Heading 6"), /* @__PURE__ */ React__default.createElement(Select.Separator, null), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "note" }, "Note"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "tip" }, "Tip"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "info" }, "Info"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "caution" }, "Caution"), /* @__PURE__ */ React__default.createElement(SelectItem, { value: "danger" }, "Danger")));
|
|
4056
4072
|
};
|
|
4057
4073
|
const SvgAddPhoto = (props) => /* @__PURE__ */ React.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("mask", { id: "mask0_343_38", style: {
|
|
4058
4074
|
maskType: "alpha"
|