@mdxeditor/editor 0.2.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.d.ts CHANGED
@@ -274,23 +274,6 @@ export declare type DefaultMdxOptionValues = {
274
274
  */
275
275
  export declare const defaultMdxOptionValues: DefaultMdxOptionValues;
276
276
 
277
- declare interface ExportLexicalTreeOptions {
278
- root: RootNode;
279
- visitors: LexicalVisitor[];
280
- jsxComponentDescriptors: JsxComponentDescriptor[];
281
- }
282
-
283
- declare interface ExportMarkdownFromLexicalOptions extends ExportLexicalTreeOptions {
284
- /**
285
- * the markdown extensions to use
286
- */
287
- toMarkdownExtensions: Array<ToMarkdownExtension>;
288
- /**
289
- * The options to pass to `toMarkdown`
290
- */
291
- toMarkdownOptions: ToMarkdownOptions;
292
- }
293
-
294
277
  declare type ExtendedEditorConfig = EditorConfig & {
295
278
  theme: EditorConfig['theme'] & {
296
279
  nodeDecoratorComponents: NodeDecoratorComponents;
@@ -435,6 +418,24 @@ export declare interface JsxPropertyDescriptor {
435
418
  required?: boolean;
436
419
  }
437
420
 
421
+ /**
422
+ * Configures how the lexical tree is converted to a mdast tree and then to markdown.
423
+ */
424
+ export declare interface LexicalConvertOptions {
425
+ /**
426
+ * The visitors to use when processing the lexical tree
427
+ */
428
+ visitors?: LexicalVisitor[];
429
+ /**
430
+ * the markdown extensions to use
431
+ */
432
+ toMarkdownExtensions?: Array<ToMarkdownExtension>;
433
+ /**
434
+ * The options to pass to `toMarkdown`
435
+ */
436
+ toMarkdownOptions?: ToMarkdownOptions;
437
+ }
438
+
438
439
  /**
439
440
  * Implement this interface in order to process mdast node(s) into a lexical tree.
440
441
  * This is part of the process that converts the editor contents to markdown.
@@ -661,13 +662,14 @@ export declare interface MDXEditorProps {
661
662
  */
662
663
  markdownParseOptions?: Partial<MarkdownParseOptions>;
663
664
  /**
664
- * The {@link https://lexical.dev/ Lexical nodes} used by the editor.
665
+ * The {@link https://lexical.dev/ | Lexical nodes} used by the editor.
665
666
  */
666
667
  lexicalNodes?: Klass<LexicalNode>[];
667
668
  /**
668
669
  * The options used when converting the lexical tree to markdown.
670
+ * @see the {@link LexicalConvertOptions} interface for more details.
669
671
  */
670
- lexicalConvertOptions?: Partial<ExportMarkdownFromLexicalOptions>;
672
+ lexicalConvertOptions?: LexicalConvertOptions;
671
673
  /**
672
674
  * The supported code block languages.
673
675
  */
@@ -683,15 +685,15 @@ declare interface NodeDecoratorComponents {
683
685
  }
684
686
 
685
687
  /**
686
- * The configuration for the available sandpack presets
688
+ * The configuration for the available sandpack presets.
687
689
  */
688
690
  export declare interface SandpackConfig {
689
691
  /**
690
- * The name of the default preset that will be used if no meta (other than live) is set
692
+ * The name of the default preset that will be used if no meta (other than live) is set.
691
693
  */
692
694
  defaultPreset: string;
693
695
  /**
694
- * The list of sandpack presets that can be used
696
+ * The list of sandpack presets that can be used.
695
697
  */
696
698
  presets: Array<SandpackPreset>;
697
699
  }
@@ -737,11 +739,11 @@ export declare class SandpackNode extends DecoratorNode<JSX.Element> {
737
739
  */
738
740
  export declare interface SandpackPreset {
739
741
  /**
740
- * The name of the preset - use this to reference the preset from the defaultPreset field
742
+ * The name of the preset - use this to reference the preset from the defaultPreset field.
741
743
  */
742
744
  name: string;
743
745
  /**
744
- * The label of th preset, displayed in the sandpack button dropdown
746
+ * The label of the preset, displayed in the sandpack button dropdown.
745
747
  */
746
748
  label: string;
747
749
  /**
@@ -757,11 +759,11 @@ export declare interface SandpackPreset {
757
759
  */
758
760
  sandpackTheme: SandpackProviderProps['theme'];
759
761
  /**
760
- * The name of the file that will be created in the sandbox. e.g. "/App.js"
762
+ * The name of the file that will be created in the sandbox. e.g. "/App.js".
761
763
  */
762
764
  snippetFileName: string;
763
765
  /**
764
- * The dependencies that will be added to the sandbox, just like in package.json
766
+ * The dependencies that will be added to the sandbox, just like in package.json.
765
767
  */
766
768
  dependencies?: Record<string, string>;
767
769
  /**
@@ -770,7 +772,7 @@ export declare interface SandpackPreset {
770
772
  */
771
773
  files?: Record<string, string>;
772
774
  /**
773
- * The language used in the editable snippet. e.g. "jsx", "tsx", etc
775
+ * The language used in the editable snippet. e.g. "jsx", "tsx", etc.
774
776
  */
775
777
  snippetLanguage?: string;
776
778
  /**
@@ -907,12 +909,17 @@ export declare const ToolbarComponents: {
907
909
  ListButtons: React_2.FC<{}>;
908
910
  SandpackButton: React_2.FC<{}>;
909
911
  TableButton: React_2.FC<{}>;
910
- ToggleItem: React_2.ForwardRefExoticComponent<RadixToolbar.ToolbarToggleItemProps & React_2.RefAttributes<HTMLButtonElement>>;
912
+ ToggleItem: React_2.ForwardRefExoticComponent<RadixToolbar.ToolbarToggleItemProps & {
913
+ title: string;
914
+ } & React_2.RefAttributes<HTMLButtonElement>>;
911
915
  ToggleSingleGroup: React_2.ForwardRefExoticComponent<Omit<RadixToolbar.ToolbarToggleGroupSingleProps, "type"> & React_2.RefAttributes<HTMLDivElement>>;
912
916
  ToggleSingleGroupWithItem: React_2.ForwardRefExoticComponent<Omit<RadixToolbar.ToolbarToggleGroupSingleProps, "type"> & {
913
917
  on: boolean;
918
+ title: string;
914
919
  } & React_2.RefAttributes<HTMLDivElement>>;
915
- ToolbarButton: React_2.ForwardRefExoticComponent<RadixToolbar.ToolbarButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
920
+ ToolbarButton: React_2.ForwardRefExoticComponent<RadixToolbar.ToolbarButtonProps & {
921
+ title: string;
922
+ } & React_2.RefAttributes<HTMLButtonElement>>;
916
923
  ToolbarSeparator: React_2.ForwardRefExoticComponent<RadixToolbar.ToolbarSeparatorProps & React_2.RefAttributes<HTMLDivElement>>;
917
924
  ImageButton: React_2.ForwardRefExoticComponent<RadixToolbar.ToolbarButtonProps & React_2.RefAttributes<HTMLButtonElement>>;
918
925
  };
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";
@@ -391,21 +391,23 @@ function $createImageNode(options) {
391
391
  function $isImageNode(node) {
392
392
  return node instanceof ImageNode;
393
393
  }
394
- const bold = "_bold_1xdbx_1";
395
- const italic = "_italic_1xdbx_5";
396
- const underline = "_underline_1xdbx_9";
397
- const strikethrough = "_strikethrough_1xdbx_25";
398
- const underlineStrikethrough = "_underlineStrikethrough_1xdbx_29";
399
- const subscript = "_subscript_1xdbx_33";
400
- const superscript = "_superscript_1xdbx_38";
401
- const code = "_code_1xdbx_43";
402
- const nestedListItem$1 = "_nestedListItem_1xdbx_50";
403
- const admonitionDanger = "_admonitionDanger_1xdbx_54";
404
- const admonitionInfo = "_admonitionInfo_1xdbx_54";
405
- const admonitionNote = "_admonitionNote_1xdbx_54";
406
- const admonitionTip = "_admonitionTip_1xdbx_54";
407
- const admonitionCaution = "_admonitionCaution_1xdbx_54";
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";
408
409
  const styles$1 = {
410
+ darkTheme,
409
411
  bold,
410
412
  italic,
411
413
  underline,
@@ -786,7 +788,7 @@ class TableNode extends DecoratorNode {
786
788
  const row = table.children[rowIndex];
787
789
  const cells = row.children;
788
790
  const cellsClone = Array.from(cells);
789
- const rowClone = { ...row, hildren: cellsClone };
791
+ const rowClone = { ...row, children: cellsClone };
790
792
  cellsClone.splice(colIndex, 1);
791
793
  table.children[rowIndex] = rowClone;
792
794
  }
@@ -912,10 +914,13 @@ const LexicalQuoteVisitor = {
912
914
  };
913
915
  const AdmonitionVisitor = {
914
916
  testLexicalNode: $isAdmonitionNode,
915
- visitLexicalNode: ({ lexicalNode, actions }) => {
916
- actions.addAndStepInto("containerDirective", {
917
- name: lexicalNode.getKind()
917
+ visitLexicalNode: ({ mdastParent, lexicalNode, actions }) => {
918
+ const admonition = actions.appendToParent(mdastParent, {
919
+ type: "containerDirective",
920
+ name: lexicalNode.getKind(),
921
+ children: [{ type: "paragraph", children: [] }]
918
922
  });
923
+ actions.visitChildren(lexicalNode, admonition.children[0]);
919
924
  }
920
925
  };
921
926
  const SandpackNodeVisitor = {
@@ -2617,6 +2622,8 @@ function getStateAsMarkdown(editor, exportParams) {
2617
2622
  });
2618
2623
  }).markdown;
2619
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);
2620
2627
  function getLinkNodeInSelection(selection) {
2621
2628
  const node = getSelectedNode(selection);
2622
2629
  const parent = node.getParent();
@@ -2690,7 +2697,7 @@ const [LinkDialogSystem, LinkDialogSystemType] = system(
2690
2697
  return editor.registerCommand(
2691
2698
  KEY_MODIFIER_COMMAND,
2692
2699
  (event) => {
2693
- if (event.key === "k" && event.metaKey) {
2700
+ if (event.key === "k" && IS_APPLE ? event.metaKey : event.ctrlKey) {
2694
2701
  r.pub(openLinkEditDialog, true);
2695
2702
  return true;
2696
2703
  }
@@ -2925,59 +2932,59 @@ const SvgArrowDropDown$1 = (props) => /* @__PURE__ */ React.createElement("svg",
2925
2932
  maskType: "alpha"
2926
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" })));
2927
2934
  const DropDownIcon = SvgArrowDropDown$1;
2928
- const editorRoot = "_editorRoot_1bxeh_43";
2929
- const editorWrapper = "_editorWrapper_1bxeh_121";
2930
- const nestedListItem = "_nestedListItem_1bxeh_125";
2931
- const toolbarRoot = "_toolbarRoot_1bxeh_129";
2932
- const toolbarModeSwitch = "_toolbarModeSwitch_1bxeh_150";
2933
- const toolbarToggleItem = "_toolbarToggleItem_1bxeh_159";
2934
- const toolbarGroupOfGroups = "_toolbarGroupOfGroups_1bxeh_169";
2935
- const toolbarToggleSingleGroup = "_toolbarToggleSingleGroup_1bxeh_173";
2936
- const toolbarButton = "_toolbarButton_1bxeh_187";
2937
- const toolbarNodeKindSelectContainer = "_toolbarNodeKindSelectContainer_1bxeh_216";
2938
- const toolbarButtonDropdownContainer = "_toolbarButtonDropdownContainer_1bxeh_217";
2939
- const toolbarCodeBlockLanguageSelectContent = "_toolbarCodeBlockLanguageSelectContent_1bxeh_218";
2940
- const toolbarNodeKindSelectTrigger = "_toolbarNodeKindSelectTrigger_1bxeh_232";
2941
- const toolbarButtonSelectTrigger = "_toolbarButtonSelectTrigger_1bxeh_233";
2942
- const toolbarCodeBlockLanguageSelectTrigger = "_toolbarCodeBlockLanguageSelectTrigger_1bxeh_266";
2943
- const toolbarNodeKindSelectItem = "_toolbarNodeKindSelectItem_1bxeh_272";
2944
- const toolbarNodeKindSelectDropdownArrow = "_toolbarNodeKindSelectDropdownArrow_1bxeh_295";
2945
- const contentEditable = "_contentEditable_1bxeh_299";
2946
- const sandpackWrapper = "_sandpackWrapper_1bxeh_307";
2947
- const frontmatterWrapper = "_frontmatterWrapper_1bxeh_311";
2948
- const frontmatterToggleButton = "_frontmatterToggleButton_1bxeh_321";
2949
- const frontmatterEditorTable = "_frontmatterEditorTable_1bxeh_329";
2950
- const iconButton = "_iconButton_1bxeh_347";
2951
- const frontmatterInput = "_frontmatterInput_1bxeh_353";
2952
- const primaryButton = "_primaryButton_1bxeh_368";
2953
- const linkDialogEditForm = "_linkDialogEditForm_1bxeh_378";
2954
- const linkDialogInputContainer = "_linkDialogInputContainer_1bxeh_384";
2955
- const linkDialogInputWrapper = "_linkDialogInputWrapper_1bxeh_390";
2956
- const linkDialogInput = "_linkDialogInput_1bxeh_384";
2957
- const linkDialogAutocompleteContainer = "_linkDialogAutocompleteContainer_1bxeh_420";
2958
- const linkDialogAnchor = "_linkDialogAnchor_1bxeh_465";
2959
- const linkDialogPopoverContent = "_linkDialogPopoverContent_1bxeh_479";
2960
- const tableColumnEditorPopoverContent = "_tableColumnEditorPopoverContent_1bxeh_479";
2961
- const dialogContent = "_dialogContent_1bxeh_479";
2962
- const linkDialogPreviewAnchor = "_linkDialogPreviewAnchor_1bxeh_493";
2963
- const tooltipContent = "_tooltipContent_1bxeh_515";
2964
- const actionButton = "_actionButton_1bxeh_527";
2965
- const primaryActionButton = "_primaryActionButton_1bxeh_533";
2966
- const tableEditor = "_tableEditor_1bxeh_542";
2967
- const toolCell = "_toolCell_1bxeh_553";
2968
- const tableColumnEditorTrigger = "_tableColumnEditorTrigger_1bxeh_570";
2969
- const tableRowEditorTrigger = "_tableRowEditorTrigger_1bxeh_570";
2970
- const addRowButton = "_addRowButton_1bxeh_570";
2971
- const addColumnButton = "_addColumnButton_1bxeh_570";
2972
- const tableColumnEditorToolbar = "_tableColumnEditorToolbar_1bxeh_604";
2973
- const toggleGroupRoot = "_toggleGroupRoot_1bxeh_616";
2974
- const tableToolsColumn = "_tableToolsColumn_1bxeh_633";
2975
- const leftAlignedCell = "_leftAlignedCell_1bxeh_641";
2976
- const rightAlignedCell = "_rightAlignedCell_1bxeh_645";
2977
- const centeredCell = "_centeredCell_1bxeh_649";
2978
- const dialogOverlay = "_dialogOverlay_1bxeh_677";
2979
- const overlayShow = "_overlayShow_1bxeh_1";
2980
- const contentShow = "_contentShow_1bxeh_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";
2981
2988
  const styles = {
2982
2989
  editorRoot,
2983
2990
  editorWrapper,
@@ -3641,15 +3648,15 @@ const TableEditor = ({ mdastNode, parentEditor, lexicalTable }) => {
3641
3648
  const addRowToBottom = React__default.useCallback(() => {
3642
3649
  parentEditor.update(() => {
3643
3650
  lexicalTable.addRowToBottom();
3651
+ setActiveCell([0, lexicalTable.getRowCount()]);
3644
3652
  });
3645
- setActiveCellWithBoundaries([0, lexicalTable.getRowCount()]);
3646
- }, [parentEditor, lexicalTable, setActiveCellWithBoundaries]);
3653
+ }, [parentEditor, lexicalTable]);
3647
3654
  const addColumnToRight = React__default.useCallback(() => {
3648
3655
  parentEditor.update(() => {
3649
3656
  lexicalTable.addColumnToRight();
3657
+ setActiveCell([lexicalTable.getColCount(), 0]);
3650
3658
  });
3651
- setActiveCellWithBoundaries([lexicalTable.getColCount(), 0]);
3652
- }, [parentEditor, lexicalTable, setActiveCellWithBoundaries]);
3659
+ }, [parentEditor, lexicalTable]);
3653
3660
  const [highlightedCoordinates, setHighlightedCoordinates] = React__default.useState([-1, -1]);
3654
3661
  const onTableMouseOver = React__default.useCallback((e) => {
3655
3662
  let tableCell = e.target;
@@ -3945,13 +3952,17 @@ const SourceEditor = () => {
3945
3952
  }
3946
3953
  )));
3947
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
+ });
3948
3959
  const SelectItem = React__default.forwardRef(
3949
3960
  ({ children, className, ...props }, forwardedRef) => {
3950
3961
  return /* @__PURE__ */ React__default.createElement(Select.Item, { ...props, ref: forwardedRef, className: classNames(className, styles.toolbarNodeKindSelectItem) }, /* @__PURE__ */ React__default.createElement(Select.ItemText, null, children));
3951
3962
  }
3952
3963
  );
3953
- const SelectTrigger = ({ placeholder, className }) => {
3954
- 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))));
3955
3966
  };
3956
3967
  const SelectContent = ({
3957
3968
  children,
@@ -3965,7 +3976,7 @@ const SelectButtonTrigger = ({
3965
3976
  title,
3966
3977
  className
3967
3978
  }) => {
3968
- 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))));
3969
3980
  };
3970
3981
  function CodeBlockLanguageSelect() {
3971
3982
  const [activeEditorType, activeEditor, codeBlockLanguages] = useEmitterValues("activeEditorType", "activeEditor", "codeBlockLanguages");
@@ -3991,7 +4002,7 @@ function CodeBlockLanguageSelect() {
3991
4002
  });
3992
4003
  }
3993
4004
  },
3994
- /* @__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 }),
3995
4006
  /* @__PURE__ */ React__default.createElement(SelectContent, { className: styles.toolbarCodeBlockLanguageSelectContent }, Object.entries(codeBlockLanguages).map(([value, label]) => /* @__PURE__ */ React__default.createElement(SelectItem, { key: value, value }, label)))
3996
4007
  );
3997
4008
  }
@@ -4062,7 +4073,7 @@ const TableIcon = SvgTable;
4062
4073
  const BlockTypeSelect = () => {
4063
4074
  const [currentBlockType] = useEmitterValues("currentBlockType");
4064
4075
  const applyBlockType = usePublisher("applyBlockType");
4065
- 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")));
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")));
4066
4077
  };
4067
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: {
4068
4079
  maskType: "alpha"
@@ -4079,7 +4090,7 @@ const ImageButton = React__default.forwardRef((props, forwardedRef) => {
4079
4090
  },
4080
4091
  [insertImage]
4081
4092
  );
4082
- 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 }))));
4083
4094
  });
4084
4095
  createCommand();
4085
4096
  const MAX_SUGGESTIONS = 20;
@@ -4155,13 +4166,15 @@ const ActionButton = React__default.forwardRef(({ className, ...props }, ref) =>
4155
4166
  return /* @__PURE__ */ React__default.createElement("button", { className: classNames(styles.actionButton, className), ref, ...props });
4156
4167
  });
4157
4168
  const ToggleItem = React__default.forwardRef(
4158
- ({ className: passedClassName, ...props }, forwardedRef) => {
4159
- 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 }));
4160
4176
  }
4161
4177
  );
4162
- const ToolbarButton = React__default.forwardRef((props, forwardedRef) => {
4163
- return /* @__PURE__ */ React__default.createElement(RadixToolbar.Button, { className: styles.toolbarButton, ...props, ref: forwardedRef });
4164
- });
4165
4178
  const ToggleSingleGroup = React__default.forwardRef(
4166
4179
  ({ children, className, ...props }, forwardedRef) => {
4167
4180
  return /* @__PURE__ */ React__default.createElement(
@@ -4176,8 +4189,8 @@ const ToggleSingleGroup = React__default.forwardRef(
4176
4189
  );
4177
4190
  }
4178
4191
  );
4179
- const ToggleSingleGroupWithItem = React__default.forwardRef(({ on, children, ...props }, forwardedRef) => {
4180
- 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));
4181
4194
  });
4182
4195
  const GroupGroup = ({ children }) => {
4183
4196
  return /* @__PURE__ */ React__default.createElement("div", { className: styles.toolbarGroupOfGroups }, children);
@@ -4186,19 +4199,18 @@ const ToolbarSeparator = RadixToolbar.ToolbarSeparator;
4186
4199
  const BoldItalicUnderlineButtons = () => {
4187
4200
  const [currentFormat] = useEmitterValues("currentFormat", "currentListType");
4188
4201
  const applyFormat = usePublisher("applyFormat");
4189
- 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(
4190
- ToggleSingleGroupWithItem,
4191
- {
4192
- "aria-label": "Italic",
4193
- on: (currentFormat & IS_ITALIC) !== 0,
4194
- onValueChange: applyFormat.bind(null, "italic")
4195
- },
4196
- /* @__PURE__ */ React__default.createElement(ItalicIcon, null)
4197
- ), /* @__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(
4198
4209
  ToggleSingleGroupWithItem,
4199
4210
  {
4200
4211
  "aria-label": "Underline",
4201
- on: (currentFormat & IS_UNDERLINE) !== 0,
4212
+ title: underlineTitle,
4213
+ on: underlineIsOn,
4202
4214
  onValueChange: applyFormat.bind(null, "underline")
4203
4215
  },
4204
4216
  /* @__PURE__ */ React__default.createElement(UnderlinedIcon, { style: { transform: "translateY(2px)" } })
@@ -4207,15 +4219,9 @@ const BoldItalicUnderlineButtons = () => {
4207
4219
  const CodeFormattingButton = () => {
4208
4220
  const [currentFormat] = useEmitterValues("currentFormat", "currentListType");
4209
4221
  const applyFormat = usePublisher("applyFormat");
4210
- return /* @__PURE__ */ React__default.createElement(GroupGroup, null, /* @__PURE__ */ React__default.createElement(
4211
- ToggleSingleGroupWithItem,
4212
- {
4213
- "aria-label": "Inline code",
4214
- on: (currentFormat & IS_CODE) !== 0,
4215
- onValueChange: applyFormat.bind(null, "code")
4216
- },
4217
- /* @__PURE__ */ React__default.createElement(CodeIcon, null)
4218
- ));
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)));
4219
4225
  };
4220
4226
  const ListButtons = () => {
4221
4227
  const [currentListType] = useEmitterValues("currentListType");
@@ -4228,34 +4234,34 @@ const ListButtons = () => {
4228
4234
  value: currentListType || "",
4229
4235
  onFocus: (e) => e.preventDefault()
4230
4236
  },
4231
- /* @__PURE__ */ React__default.createElement(ToggleItem, { value: "bullet", "aria-label": "Bulleted list" }, /* @__PURE__ */ React__default.createElement(BulletedListIcon, null)),
4232
- /* @__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))
4233
4239
  ));
4234
4240
  };
4235
4241
  const LinkButton = () => {
4236
4242
  const openLinkEditDialog = usePublisher("openLinkEditDialog");
4237
- 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));
4238
4244
  };
4239
4245
  const TableButton = () => {
4240
4246
  const insertTable = usePublisher("insertTable");
4241
- 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));
4242
4248
  };
4243
4249
  const CodeBlockButton = () => {
4244
4250
  const insertCodeBlock = usePublisher("insertCodeBlock");
4245
- 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));
4246
4252
  };
4247
4253
  const HorizontalRuleButton = () => {
4248
4254
  const insertHorizontalRule = usePublisher("insertHorizontalRule");
4249
- 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));
4250
4256
  };
4251
4257
  const SandpackButton = () => {
4252
4258
  const insertSandpack = usePublisher("insertSandpack");
4253
4259
  const [sandpackConfig] = useEmitterValues("sandpackConfig");
4254
- 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)))));
4255
4261
  };
4256
4262
  const FrontmatterButton = () => {
4257
4263
  const insertFrontmatter = usePublisher("insertFrontmatter");
4258
- 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));
4259
4265
  };
4260
4266
  const ViewModeSwitch = () => {
4261
4267
  const [viewMode] = useEmitterValues("viewMode", "activeEditorType");
@@ -4272,9 +4278,10 @@ const ViewModeSwitch = () => {
4272
4278
  value: viewMode,
4273
4279
  className: styles.toolbarModeSwitch
4274
4280
  },
4275
- /* @__PURE__ */ React__default.createElement(ToggleItem, { value: "editor", "aria-label": "Rich text", title: "Rich text" }, /* @__PURE__ */ React__default.createElement(RichTextIcon, null)),
4276
- /* @__PURE__ */ React__default.createElement(ToggleItem, { value: "diff", "aria-label": "View diff", title: "Diff" }, /* @__PURE__ */ React__default.createElement(DifferenceIcon, null)),
4277
- /* @__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))
4278
4285
  );
4279
4286
  };
4280
4287
  const ToolbarComponents = {
@@ -4304,6 +4311,7 @@ const CodeBlockButtonSet = () => {
4304
4311
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(CodeBlockLanguageSelect, null), /* @__PURE__ */ React__default.createElement(
4305
4312
  ToolbarButton,
4306
4313
  {
4314
+ title: "Remove code block",
4307
4315
  onClick: () => {
4308
4316
  activeEditor.update(() => {
4309
4317
  const node = $getNodeByKey(activeEditorType.nodeKey);
@@ -4320,6 +4328,7 @@ const SandpackButtonSet = () => {
4320
4328
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
4321
4329
  ToolbarButton,
4322
4330
  {
4331
+ title: "Remove live code block",
4323
4332
  onClick: () => {
4324
4333
  activeEditor.update(() => {
4325
4334
  const node = $getNodeByKey(activeEditorType.nodeKey);