@mdxeditor/editor 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -423,115 +423,6 @@ const styles$1 = {
423
423
  admonitionTip,
424
424
  admonitionCaution
425
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);
535
426
  const theme = {
536
427
  text: {
537
428
  bold: styles$1.bold,
@@ -2731,6 +2622,8 @@ function getStateAsMarkdown(editor, exportParams) {
2731
2622
  });
2732
2623
  }).markdown;
2733
2624
  }
2625
+ const CAN_USE_DOM = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
2626
+ const IS_APPLE = CAN_USE_DOM && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
2734
2627
  function getLinkNodeInSelection(selection) {
2735
2628
  const node = getSelectedNode(selection);
2736
2629
  const parent = node.getParent();
@@ -2804,7 +2697,7 @@ const [LinkDialogSystem, LinkDialogSystemType] = system(
2804
2697
  return editor.registerCommand(
2805
2698
  KEY_MODIFIER_COMMAND,
2806
2699
  (event) => {
2807
- if (event.key === "k" && event.metaKey) {
2700
+ if (event.key === "k" && IS_APPLE ? event.metaKey : event.ctrlKey) {
2808
2701
  r.pub(openLinkEditDialog, true);
2809
2702
  return true;
2810
2703
  }
@@ -3039,6 +2932,114 @@ const SvgArrowDropDown$1 = (props) => /* @__PURE__ */ React.createElement("svg",
3039
2932
  maskType: "alpha"
3040
2933
  } }, /* @__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" })));
3041
2934
  const DropDownIcon = SvgArrowDropDown$1;
2935
+ const editorRoot = "_editorRoot_15boy_47";
2936
+ const editorWrapper = "_editorWrapper_15boy_141";
2937
+ const nestedListItem = "_nestedListItem_15boy_145";
2938
+ const toolbarRoot = "_toolbarRoot_15boy_149";
2939
+ const toolbarModeSwitch = "_toolbarModeSwitch_15boy_170";
2940
+ const toolbarToggleItem = "_toolbarToggleItem_15boy_179";
2941
+ const toolbarGroupOfGroups = "_toolbarGroupOfGroups_15boy_189";
2942
+ const toolbarToggleSingleGroup = "_toolbarToggleSingleGroup_15boy_193";
2943
+ const toolbarButton = "_toolbarButton_15boy_207";
2944
+ const toolbarNodeKindSelectContainer = "_toolbarNodeKindSelectContainer_15boy_236";
2945
+ const toolbarButtonDropdownContainer = "_toolbarButtonDropdownContainer_15boy_237";
2946
+ const toolbarCodeBlockLanguageSelectContent = "_toolbarCodeBlockLanguageSelectContent_15boy_238";
2947
+ const toolbarNodeKindSelectTrigger = "_toolbarNodeKindSelectTrigger_15boy_252";
2948
+ const toolbarButtonSelectTrigger = "_toolbarButtonSelectTrigger_15boy_253";
2949
+ const toolbarCodeBlockLanguageSelectTrigger = "_toolbarCodeBlockLanguageSelectTrigger_15boy_286";
2950
+ const toolbarNodeKindSelectItem = "_toolbarNodeKindSelectItem_15boy_292";
2951
+ const toolbarNodeKindSelectDropdownArrow = "_toolbarNodeKindSelectDropdownArrow_15boy_315";
2952
+ const contentEditable = "_contentEditable_15boy_319";
2953
+ const sandpackWrapper = "_sandpackWrapper_15boy_327";
2954
+ const frontmatterWrapper = "_frontmatterWrapper_15boy_331";
2955
+ const frontmatterToggleButton = "_frontmatterToggleButton_15boy_341";
2956
+ const frontmatterEditorTable = "_frontmatterEditorTable_15boy_349";
2957
+ const iconButton = "_iconButton_15boy_367";
2958
+ const frontmatterInput = "_frontmatterInput_15boy_373";
2959
+ const primaryButton = "_primaryButton_15boy_388";
2960
+ const linkDialogEditForm = "_linkDialogEditForm_15boy_398";
2961
+ const linkDialogInputContainer = "_linkDialogInputContainer_15boy_404";
2962
+ const linkDialogInputWrapper = "_linkDialogInputWrapper_15boy_410";
2963
+ const linkDialogInput = "_linkDialogInput_15boy_404";
2964
+ const linkDialogAutocompleteContainer = "_linkDialogAutocompleteContainer_15boy_440";
2965
+ const linkDialogAnchor = "_linkDialogAnchor_15boy_485";
2966
+ const linkDialogPopoverContent = "_linkDialogPopoverContent_15boy_499";
2967
+ const tableColumnEditorPopoverContent = "_tableColumnEditorPopoverContent_15boy_499";
2968
+ const dialogContent = "_dialogContent_15boy_499";
2969
+ const linkDialogPreviewAnchor = "_linkDialogPreviewAnchor_15boy_513";
2970
+ const tooltipContent = "_tooltipContent_15boy_535";
2971
+ const actionButton = "_actionButton_15boy_547";
2972
+ const primaryActionButton = "_primaryActionButton_15boy_553";
2973
+ const tableEditor = "_tableEditor_15boy_562";
2974
+ const toolCell = "_toolCell_15boy_573";
2975
+ const tableColumnEditorTrigger = "_tableColumnEditorTrigger_15boy_590";
2976
+ const tableRowEditorTrigger = "_tableRowEditorTrigger_15boy_590";
2977
+ const addRowButton = "_addRowButton_15boy_590";
2978
+ const addColumnButton = "_addColumnButton_15boy_590";
2979
+ const tableColumnEditorToolbar = "_tableColumnEditorToolbar_15boy_624";
2980
+ const toggleGroupRoot = "_toggleGroupRoot_15boy_636";
2981
+ const tableToolsColumn = "_tableToolsColumn_15boy_653";
2982
+ const leftAlignedCell = "_leftAlignedCell_15boy_661";
2983
+ const rightAlignedCell = "_rightAlignedCell_15boy_665";
2984
+ const centeredCell = "_centeredCell_15boy_669";
2985
+ const dialogOverlay = "_dialogOverlay_15boy_697";
2986
+ const overlayShow = "_overlayShow_15boy_1";
2987
+ const contentShow = "_contentShow_15boy_1";
2988
+ const styles = {
2989
+ editorRoot,
2990
+ editorWrapper,
2991
+ nestedListItem,
2992
+ toolbarRoot,
2993
+ toolbarModeSwitch,
2994
+ toolbarToggleItem,
2995
+ toolbarGroupOfGroups,
2996
+ toolbarToggleSingleGroup,
2997
+ toolbarButton,
2998
+ toolbarNodeKindSelectContainer,
2999
+ toolbarButtonDropdownContainer,
3000
+ toolbarCodeBlockLanguageSelectContent,
3001
+ toolbarNodeKindSelectTrigger,
3002
+ toolbarButtonSelectTrigger,
3003
+ toolbarCodeBlockLanguageSelectTrigger,
3004
+ toolbarNodeKindSelectItem,
3005
+ toolbarNodeKindSelectDropdownArrow,
3006
+ contentEditable,
3007
+ sandpackWrapper,
3008
+ frontmatterWrapper,
3009
+ frontmatterToggleButton,
3010
+ frontmatterEditorTable,
3011
+ iconButton,
3012
+ frontmatterInput,
3013
+ primaryButton,
3014
+ linkDialogEditForm,
3015
+ linkDialogInputContainer,
3016
+ linkDialogInputWrapper,
3017
+ linkDialogInput,
3018
+ linkDialogAutocompleteContainer,
3019
+ linkDialogAnchor,
3020
+ linkDialogPopoverContent,
3021
+ tableColumnEditorPopoverContent,
3022
+ dialogContent,
3023
+ linkDialogPreviewAnchor,
3024
+ tooltipContent,
3025
+ actionButton,
3026
+ primaryActionButton,
3027
+ tableEditor,
3028
+ toolCell,
3029
+ tableColumnEditorTrigger,
3030
+ tableRowEditorTrigger,
3031
+ addRowButton,
3032
+ addColumnButton,
3033
+ tableColumnEditorToolbar,
3034
+ toggleGroupRoot,
3035
+ tableToolsColumn,
3036
+ leftAlignedCell,
3037
+ rightAlignedCell,
3038
+ centeredCell,
3039
+ dialogOverlay,
3040
+ overlayShow,
3041
+ contentShow
3042
+ };
3042
3043
  createCommand();
3043
3044
  const MAX_SUGGESTIONS$1 = 20;
3044
3045
  function LinkEditForm({ initialUrl, onSubmit, onCancel, linkAutocompleteSuggestions }) {
@@ -3647,15 +3648,15 @@ const TableEditor = ({ mdastNode, parentEditor, lexicalTable }) => {
3647
3648
  const addRowToBottom = React__default.useCallback(() => {
3648
3649
  parentEditor.update(() => {
3649
3650
  lexicalTable.addRowToBottom();
3651
+ setActiveCell([0, lexicalTable.getRowCount()]);
3650
3652
  });
3651
- setActiveCellWithBoundaries([0, lexicalTable.getRowCount()]);
3652
- }, [parentEditor, lexicalTable, setActiveCellWithBoundaries]);
3653
+ }, [parentEditor, lexicalTable]);
3653
3654
  const addColumnToRight = React__default.useCallback(() => {
3654
3655
  parentEditor.update(() => {
3655
3656
  lexicalTable.addColumnToRight();
3657
+ setActiveCell([lexicalTable.getColCount(), 0]);
3656
3658
  });
3657
- setActiveCellWithBoundaries([lexicalTable.getColCount(), 0]);
3658
- }, [parentEditor, lexicalTable, setActiveCellWithBoundaries]);
3659
+ }, [parentEditor, lexicalTable]);
3659
3660
  const [highlightedCoordinates, setHighlightedCoordinates] = React__default.useState([-1, -1]);
3660
3661
  const onTableMouseOver = React__default.useCallback((e) => {
3661
3662
  let tableCell = e.target;
@@ -3951,13 +3952,17 @@ const SourceEditor = () => {
3951
3952
  }
3952
3953
  )));
3953
3954
  };
3955
+ const InstantTooltip = React__default.forwardRef(({ title, children }, ref) => {
3956
+ const [editorRootElementRef] = useEmitterValues("editorRootElementRef");
3957
+ return /* @__PURE__ */ React__default.createElement(Tooltip.Provider, { delayDuration: 100 }, /* @__PURE__ */ React__default.createElement(Tooltip.Root, null, /* @__PURE__ */ React__default.createElement(Tooltip.Trigger, { ref, asChild: true }, children), /* @__PURE__ */ React__default.createElement(Tooltip.Portal, { container: editorRootElementRef == null ? void 0 : editorRootElementRef.current }, /* @__PURE__ */ React__default.createElement(Tooltip.Content, { className: classNames(styles.tooltipContent), sideOffset: 10 }, title))));
3958
+ });
3954
3959
  const SelectItem = React__default.forwardRef(
3955
3960
  ({ children, className, ...props }, forwardedRef) => {
3956
3961
  return /* @__PURE__ */ React__default.createElement(Select.Item, { ...props, ref: forwardedRef, className: classNames(className, styles.toolbarNodeKindSelectItem) }, /* @__PURE__ */ React__default.createElement(Select.ItemText, null, children));
3957
3962
  }
3958
3963
  );
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)));
3964
+ const SelectTrigger = ({ title, placeholder, className }) => {
3965
+ return /* @__PURE__ */ React__default.createElement(InstantTooltip, { title }, /* @__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))));
3961
3966
  };
3962
3967
  const SelectContent = ({
3963
3968
  children,
@@ -3971,7 +3976,7 @@ const SelectButtonTrigger = ({
3971
3976
  title,
3972
3977
  className
3973
3978
  }) => {
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)));
3979
+ return /* @__PURE__ */ React__default.createElement(InstantTooltip, { title }, /* @__PURE__ */ React__default.createElement(Select.Trigger, { className: classNames(styles.toolbarButtonSelectTrigger, className) }, children, /* @__PURE__ */ React__default.createElement(Select.Icon, { className: styles.toolbarNodeKindSelectDropdownArrow }, /* @__PURE__ */ React__default.createElement(DropDownIcon, null))));
3975
3980
  };
3976
3981
  function CodeBlockLanguageSelect() {
3977
3982
  const [activeEditorType, activeEditor, codeBlockLanguages] = useEmitterValues("activeEditorType", "activeEditor", "codeBlockLanguages");
@@ -3997,7 +4002,7 @@ function CodeBlockLanguageSelect() {
3997
4002
  });
3998
4003
  }
3999
4004
  },
4000
- /* @__PURE__ */ React__default.createElement(SelectTrigger, { placeholder: "Language", className: styles.toolbarCodeBlockLanguageSelectTrigger }),
4005
+ /* @__PURE__ */ React__default.createElement(SelectTrigger, { title: "Change code block language", placeholder: "Language", className: styles.toolbarCodeBlockLanguageSelectTrigger }),
4001
4006
  /* @__PURE__ */ React__default.createElement(SelectContent, { className: styles.toolbarCodeBlockLanguageSelectContent }, Object.entries(codeBlockLanguages).map(([value, label]) => /* @__PURE__ */ React__default.createElement(SelectItem, { key: value, value }, label)))
4002
4007
  );
4003
4008
  }
@@ -4068,7 +4073,7 @@ const TableIcon = SvgTable;
4068
4073
  const BlockTypeSelect = () => {
4069
4074
  const [currentBlockType] = useEmitterValues("currentBlockType");
4070
4075
  const applyBlockType = usePublisher("applyBlockType");
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")));
4076
+ return /* @__PURE__ */ React__default.createElement(Select.Root, { value: currentBlockType || "", onValueChange: applyBlockType }, /* @__PURE__ */ React__default.createElement(SelectTrigger, { title: "Select block type", 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")));
4072
4077
  };
4073
4078
  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: {
4074
4079
  maskType: "alpha"
@@ -4085,7 +4090,7 @@ const ImageButton = React__default.forwardRef((props, forwardedRef) => {
4085
4090
  },
4086
4091
  [insertImage]
4087
4092
  );
4088
- return /* @__PURE__ */ React__default.createElement(Dialog.Root, { open, onOpenChange: setOpen }, /* @__PURE__ */ React__default.createElement(Dialog.Trigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { className: styles.toolbarButton, ...props, ref: forwardedRef }, /* @__PURE__ */ React__default.createElement(AddPhotoIcon, null))), /* @__PURE__ */ React__default.createElement(Dialog.Portal, { container: editorRootElementRef.current }, /* @__PURE__ */ React__default.createElement(Dialog.Overlay, { className: styles.dialogOverlay }), /* @__PURE__ */ React__default.createElement(Dialog.Content, { className: styles.dialogContent }, /* @__PURE__ */ React__default.createElement(ImageForm, { initialUrl: "", onSubmit, imageAutocompleteSuggestions }))));
4093
+ return /* @__PURE__ */ React__default.createElement(Dialog.Root, { open, onOpenChange: setOpen }, /* @__PURE__ */ React__default.createElement(Dialog.Trigger, { asChild: true }, /* @__PURE__ */ React__default.createElement(InstantTooltip, { title: "Insert image" }, /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { className: styles.toolbarButton, ...props, ref: forwardedRef }, /* @__PURE__ */ React__default.createElement(AddPhotoIcon, null)))), /* @__PURE__ */ React__default.createElement(Dialog.Portal, { container: editorRootElementRef.current }, /* @__PURE__ */ React__default.createElement(Dialog.Overlay, { className: styles.dialogOverlay }), /* @__PURE__ */ React__default.createElement(Dialog.Content, { className: styles.dialogContent }, /* @__PURE__ */ React__default.createElement(ImageForm, { initialUrl: "", onSubmit, imageAutocompleteSuggestions }))));
4089
4094
  });
4090
4095
  createCommand();
4091
4096
  const MAX_SUGGESTIONS = 20;
@@ -4161,13 +4166,15 @@ const ActionButton = React__default.forwardRef(({ className, ...props }, ref) =>
4161
4166
  return /* @__PURE__ */ React__default.createElement("button", { className: classNames(styles.actionButton, className), ref, ...props });
4162
4167
  });
4163
4168
  const ToggleItem = React__default.forwardRef(
4164
- ({ className: passedClassName, ...props }, forwardedRef) => {
4165
- return /* @__PURE__ */ React__default.createElement(RadixToolbar.ToggleItem, { className: classNames(passedClassName, styles.toolbarToggleItem), ...props, ref: forwardedRef });
4169
+ ({ title, className: passedClassName, ...props }, forwardedRef) => {
4170
+ return /* @__PURE__ */ React__default.createElement(InstantTooltip, { title }, /* @__PURE__ */ React__default.createElement(RadixToolbar.ToggleItem, { className: classNames(passedClassName, styles.toolbarToggleItem), ...props, ref: forwardedRef }));
4171
+ }
4172
+ );
4173
+ const ToolbarButton = React__default.forwardRef(
4174
+ ({ title, ...props }, forwardedRef) => {
4175
+ return /* @__PURE__ */ React__default.createElement(InstantTooltip, { title }, /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { className: styles.toolbarButton, ...props, ref: forwardedRef }));
4166
4176
  }
4167
4177
  );
4168
- const ToolbarButton = React__default.forwardRef((props, forwardedRef) => {
4169
- return /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { className: styles.toolbarButton, ...props, ref: forwardedRef });
4170
- });
4171
4178
  const ToggleSingleGroup = React__default.forwardRef(
4172
4179
  ({ children, className, ...props }, forwardedRef) => {
4173
4180
  return /* @__PURE__ */ React__default.createElement(
@@ -4182,8 +4189,8 @@ const ToggleSingleGroup = React__default.forwardRef(
4182
4189
  );
4183
4190
  }
4184
4191
  );
4185
- const ToggleSingleGroupWithItem = React__default.forwardRef(({ on, children, ...props }, forwardedRef) => {
4186
- return /* @__PURE__ */ React__default.createElement(ToggleSingleGroup, { ...props, value: on ? "on" : "off", ref: forwardedRef }, /* @__PURE__ */ React__default.createElement(ToggleItem, { value: "on" }, children));
4192
+ const ToggleSingleGroupWithItem = React__default.forwardRef(({ on, title, children, ...props }, forwardedRef) => {
4193
+ return /* @__PURE__ */ React__default.createElement(ToggleSingleGroup, { ...props, value: on ? "on" : "off", ref: forwardedRef }, /* @__PURE__ */ React__default.createElement(ToggleItem, { title, value: "on" }, children));
4187
4194
  });
4188
4195
  const GroupGroup = ({ children }) => {
4189
4196
  return /* @__PURE__ */ React__default.createElement("div", { className: styles.toolbarGroupOfGroups }, children);
@@ -4192,19 +4199,18 @@ const ToolbarSeparator = RadixToolbar.ToolbarSeparator;
4192
4199
  const BoldItalicUnderlineButtons = () => {
4193
4200
  const [currentFormat] = useEmitterValues("currentFormat", "currentListType");
4194
4201
  const applyFormat = usePublisher("applyFormat");
4195
- return /* @__PURE__ */ React__default.createElement(GroupGroup, null, /* @__PURE__ */ React__default.createElement(ToggleSingleGroupWithItem, { "aria-label": "Bold", on: (currentFormat & IS_BOLD) !== 0, onValueChange: applyFormat.bind(null, "bold") }, /* @__PURE__ */ React__default.createElement(BoldIcon, null)), /* @__PURE__ */ React__default.createElement(
4196
- ToggleSingleGroupWithItem,
4197
- {
4198
- "aria-label": "Italic",
4199
- on: (currentFormat & IS_ITALIC) !== 0,
4200
- onValueChange: applyFormat.bind(null, "italic")
4201
- },
4202
- /* @__PURE__ */ React__default.createElement(ItalicIcon, null)
4203
- ), /* @__PURE__ */ React__default.createElement(
4202
+ const boldIsOn = (currentFormat & IS_BOLD) !== 0;
4203
+ const italicIsOn = (currentFormat & IS_ITALIC) !== 0;
4204
+ const underlineIsOn = (currentFormat & IS_UNDERLINE) !== 0;
4205
+ const boldTitle = boldIsOn ? "Remove bold" : "Bold";
4206
+ const italicTitle = italicIsOn ? "Remove italic" : "Italic";
4207
+ const underlineTitle = underlineIsOn ? "Remove underline" : "Underline";
4208
+ return /* @__PURE__ */ React__default.createElement(GroupGroup, null, /* @__PURE__ */ React__default.createElement(ToggleSingleGroupWithItem, { title: boldTitle, "aria-label": "Bold", on: boldIsOn, onValueChange: applyFormat.bind(null, "bold") }, /* @__PURE__ */ React__default.createElement(BoldIcon, null)), /* @__PURE__ */ React__default.createElement(ToggleSingleGroupWithItem, { title: italicTitle, "aria-label": "Italic", on: italicIsOn, onValueChange: applyFormat.bind(null, "italic") }, /* @__PURE__ */ React__default.createElement(ItalicIcon, null)), /* @__PURE__ */ React__default.createElement(
4204
4209
  ToggleSingleGroupWithItem,
4205
4210
  {
4206
4211
  "aria-label": "Underline",
4207
- on: (currentFormat & IS_UNDERLINE) !== 0,
4212
+ title: underlineTitle,
4213
+ on: underlineIsOn,
4208
4214
  onValueChange: applyFormat.bind(null, "underline")
4209
4215
  },
4210
4216
  /* @__PURE__ */ React__default.createElement(UnderlinedIcon, { style: { transform: "translateY(2px)" } })
@@ -4213,15 +4219,9 @@ const BoldItalicUnderlineButtons = () => {
4213
4219
  const CodeFormattingButton = () => {
4214
4220
  const [currentFormat] = useEmitterValues("currentFormat", "currentListType");
4215
4221
  const applyFormat = usePublisher("applyFormat");
4216
- return /* @__PURE__ */ React__default.createElement(GroupGroup, null, /* @__PURE__ */ React__default.createElement(
4217
- ToggleSingleGroupWithItem,
4218
- {
4219
- "aria-label": "Inline code",
4220
- on: (currentFormat & IS_CODE) !== 0,
4221
- onValueChange: applyFormat.bind(null, "code")
4222
- },
4223
- /* @__PURE__ */ React__default.createElement(CodeIcon, null)
4224
- ));
4222
+ const codeIsOn = (currentFormat & IS_CODE) !== 0;
4223
+ const codeTitle = codeIsOn ? "Remove inline code" : "Inline code";
4224
+ return /* @__PURE__ */ React__default.createElement(GroupGroup, null, /* @__PURE__ */ React__default.createElement(ToggleSingleGroupWithItem, { title: codeTitle, "aria-label": "Inline code", on: codeIsOn, onValueChange: applyFormat.bind(null, "code") }, /* @__PURE__ */ React__default.createElement(CodeIcon, null)));
4225
4225
  };
4226
4226
  const ListButtons = () => {
4227
4227
  const [currentListType] = useEmitterValues("currentListType");
@@ -4234,34 +4234,34 @@ const ListButtons = () => {
4234
4234
  value: currentListType || "",
4235
4235
  onFocus: (e) => e.preventDefault()
4236
4236
  },
4237
- /* @__PURE__ */ React__default.createElement(ToggleItem, { value: "bullet", "aria-label": "Bulleted list" }, /* @__PURE__ */ React__default.createElement(BulletedListIcon, null)),
4238
- /* @__PURE__ */ React__default.createElement(ToggleItem, { value: "number", "aria-label": "Numbered list" }, /* @__PURE__ */ React__default.createElement(NumberedListIcon, null))
4237
+ /* @__PURE__ */ React__default.createElement(ToggleItem, { title: "Bulleted list", value: "bullet", "aria-label": "Bulleted list" }, /* @__PURE__ */ React__default.createElement(BulletedListIcon, null)),
4238
+ /* @__PURE__ */ React__default.createElement(ToggleItem, { title: "Numbered list", value: "number", "aria-label": "Numbered list" }, /* @__PURE__ */ React__default.createElement(NumberedListIcon, null))
4239
4239
  ));
4240
4240
  };
4241
4241
  const LinkButton = () => {
4242
4242
  const openLinkEditDialog = usePublisher("openLinkEditDialog");
4243
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { onClick: openLinkEditDialog.bind(null, true) }, /* @__PURE__ */ React__default.createElement(LinkIcon, null));
4243
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { title: "Create link", onClick: openLinkEditDialog.bind(null, true) }, /* @__PURE__ */ React__default.createElement(LinkIcon, null));
4244
4244
  };
4245
4245
  const TableButton = () => {
4246
4246
  const insertTable = usePublisher("insertTable");
4247
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { onClick: insertTable.bind(null, true) }, /* @__PURE__ */ React__default.createElement(TableIcon, null));
4247
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { title: "Insert table", onClick: insertTable.bind(null, true) }, /* @__PURE__ */ React__default.createElement(TableIcon, null));
4248
4248
  };
4249
4249
  const CodeBlockButton = () => {
4250
4250
  const insertCodeBlock = usePublisher("insertCodeBlock");
4251
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { onClick: insertCodeBlock.bind(null, true) }, /* @__PURE__ */ React__default.createElement(FrameSourceIcon, null));
4251
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { title: "Insert code block", onClick: insertCodeBlock.bind(null, true) }, /* @__PURE__ */ React__default.createElement(FrameSourceIcon, null));
4252
4252
  };
4253
4253
  const HorizontalRuleButton = () => {
4254
4254
  const insertHorizontalRule = usePublisher("insertHorizontalRule");
4255
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { onClick: insertHorizontalRule.bind(null, true) }, /* @__PURE__ */ React__default.createElement(HorizontalRuleIcon, null));
4255
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { title: "Insert horizontal rule", onClick: insertHorizontalRule.bind(null, true) }, /* @__PURE__ */ React__default.createElement(HorizontalRuleIcon, null));
4256
4256
  };
4257
4257
  const SandpackButton = () => {
4258
4258
  const insertSandpack = usePublisher("insertSandpack");
4259
4259
  const [sandpackConfig] = useEmitterValues("sandpackConfig");
4260
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, sandpackConfig.presets.length === 1 ? /* @__PURE__ */ React__default.createElement(ToolbarButton, { onClick: insertSandpack.bind(null, "") }, /* @__PURE__ */ React__default.createElement(LiveCodeIcon, null)) : /* @__PURE__ */ React__default.createElement(Select.Root, { value: "", onValueChange: insertSandpack }, /* @__PURE__ */ React__default.createElement(SelectButtonTrigger, { title: "Insert live code snippet" }, /* @__PURE__ */ React__default.createElement(LiveCodeIcon, null)), /* @__PURE__ */ React__default.createElement(SelectContent, { className: styles.toolbarButtonDropdownContainer }, sandpackConfig.presets.map((preset) => /* @__PURE__ */ React__default.createElement(SelectItem, { key: preset.name, value: preset.meta }, preset.label)))));
4260
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, sandpackConfig.presets.length === 1 ? /* @__PURE__ */ React__default.createElement(ToolbarButton, { title: "Insert live code block", onClick: insertSandpack.bind(null, "") }, /* @__PURE__ */ React__default.createElement(LiveCodeIcon, null)) : /* @__PURE__ */ React__default.createElement(Select.Root, { value: "", onValueChange: insertSandpack }, /* @__PURE__ */ React__default.createElement(SelectButtonTrigger, { title: "Insert live code snippet" }, /* @__PURE__ */ React__default.createElement(LiveCodeIcon, null)), /* @__PURE__ */ React__default.createElement(SelectContent, { className: styles.toolbarButtonDropdownContainer }, sandpackConfig.presets.map((preset) => /* @__PURE__ */ React__default.createElement(SelectItem, { key: preset.name, value: preset.meta }, preset.label)))));
4261
4261
  };
4262
4262
  const FrontmatterButton = () => {
4263
4263
  const insertFrontmatter = usePublisher("insertFrontmatter");
4264
- return /* @__PURE__ */ React__default.createElement(ToolbarButton, { onClick: insertFrontmatter.bind(null, true) }, /* @__PURE__ */ React__default.createElement(FrontmatterIcon, null));
4264
+ return /* @__PURE__ */ React__default.createElement(ToolbarButton, { title: "Insert frontmatter editor", onClick: insertFrontmatter.bind(null, true) }, /* @__PURE__ */ React__default.createElement(FrontmatterIcon, null));
4265
4265
  };
4266
4266
  const ViewModeSwitch = () => {
4267
4267
  const [viewMode] = useEmitterValues("viewMode", "activeEditorType");
@@ -4278,9 +4278,10 @@ const ViewModeSwitch = () => {
4278
4278
  value: viewMode,
4279
4279
  className: styles.toolbarModeSwitch
4280
4280
  },
4281
- /* @__PURE__ */ React__default.createElement(ToggleItem, { value: "editor", "aria-label": "Rich text", title: "Rich text" }, /* @__PURE__ */ React__default.createElement(RichTextIcon, null)),
4282
- /* @__PURE__ */ React__default.createElement(ToggleItem, { value: "diff", "aria-label": "View diff", title: "Diff" }, /* @__PURE__ */ React__default.createElement(DifferenceIcon, null)),
4283
- /* @__PURE__ */ React__default.createElement(ToggleItem, { value: "markdown", "aria-label": "View Markdown", title: "Markdown" }, /* @__PURE__ */ React__default.createElement(MarkdownIcon, null))
4281
+ /* @__PURE__ */ React__default.createElement(RichTextIcon, null),
4282
+ /* @__PURE__ */ React__default.createElement(ToggleItem, { value: "editor", "aria-label": "Rich text", title: "Rich text mode" }),
4283
+ /* @__PURE__ */ React__default.createElement(ToggleItem, { value: "diff", "aria-label": "View diff", title: "Diff mode" }, /* @__PURE__ */ React__default.createElement(DifferenceIcon, null)),
4284
+ /* @__PURE__ */ React__default.createElement(ToggleItem, { value: "markdown", "aria-label": "View Markdown", title: "Markdown source mode" }, /* @__PURE__ */ React__default.createElement(MarkdownIcon, null))
4284
4285
  );
4285
4286
  };
4286
4287
  const ToolbarComponents = {
@@ -4310,6 +4311,7 @@ const CodeBlockButtonSet = () => {
4310
4311
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(CodeBlockLanguageSelect, null), /* @__PURE__ */ React__default.createElement(
4311
4312
  ToolbarButton,
4312
4313
  {
4314
+ title: "Remove code block",
4313
4315
  onClick: () => {
4314
4316
  activeEditor.update(() => {
4315
4317
  const node = $getNodeByKey(activeEditorType.nodeKey);
@@ -4326,6 +4328,7 @@ const SandpackButtonSet = () => {
4326
4328
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
4327
4329
  ToolbarButton,
4328
4330
  {
4331
+ title: "Remove live code block",
4329
4332
  onClick: () => {
4330
4333
  activeEditor.update(() => {
4331
4334
  const node = $getNodeByKey(activeEditorType.nodeKey);