@docyrus/ui-pro-ai-assistant 0.8.3 → 0.8.4

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
@@ -211,7 +211,7 @@ import '@univerjs/sheets-crosshair-highlight/lib/index.css';
211
211
  import * as XLSX from 'xlsx';
212
212
  import { MarkdownPlugin, remarkMdx, remarkMention, serializeMd, stripMarkdown, deserializeMd } from '@platejs/markdown';
213
213
  import { usePlateEditor, toTPlatePlugin, useEditorContainerRef, createPlatePlugin, usePluginOption, ParagraphPlugin, BlockPlaceholderPlugin, useEditorRef, useElement, Key, createPrimitiveComponent, withHOC, PlateElement, useReadOnly, useEditorPlugin, useEditorMounted, Plate, PlateContent, PlateLeaf, useHotkeys, PlateText, useSelected, useFocused, useEventEditorValue, useComposedRef, useEditorReadOnly, useSelectionAcrossBlocks, useEditorSelector, useElementSelector, MemoizedChildren, useSelectionFragmentProp, useMarkToolbarButtonState, useMarkToolbarButton, PlateContainer, usePlateState } from 'platejs/react';
214
- import { KEYS, TrailingBlockPlugin, isSlateString, isSlateEditor, isSlateElement, getPluginType, PathApi, isHotkey, getPluginTypes, ExitBreakPlugin, nanoid, BaseParagraphPlugin, NodeApi, TextApi, isType, IS_APPLE, RangeApi, getPluginByType, ElementApi, createSlateEditor, isUrl } from 'platejs';
214
+ import { KEYS, TrailingBlockPlugin, isSlateString, isSlateEditor, isSlateElement, getPluginType, PathApi, createSlatePlugin, isHotkey, getPluginTypes, ExitBreakPlugin, nanoid, BaseParagraphPlugin, NodeApi, TextApi, createTextSubstitutionInputRule, isType, IS_APPLE, RangeApi, getPluginByType, ElementApi, createSlateEditor, isUrl } from 'platejs';
215
215
  import { withAIBatch } from '@platejs/ai';
216
216
  import { useAIChatEditor, AIChatPlugin, useChatChunk, streamInsertChunk, applyAISuggestions, rejectAISuggestions, AIPlugin, CopilotPlugin, useLastAssistantMessage, useEditorChat, applyTableCellSuggestion, aiCommentToRange } from '@platejs/ai/react';
217
217
  import { CursorOverlayPlugin, BlockSelectionPlugin, BlockMenuPlugin, useBlockSelected, useCursorOverlay, useIsSelecting, BLOCK_CONTEXT_MENU_ID, useBlockSelectionNodes, useBlockSelectionFragmentProp } from '@platejs/selection/react';
@@ -225,13 +225,11 @@ import { CaptionPlugin, TextareaAutosize as TextareaAutosize$1, Caption as Capti
225
225
  import { BaseCommentPlugin, getDraftCommentKey, getCommentCount, getTransientCommentKey, getCommentKey } from '@platejs/comment';
226
226
  import { CommentPlugin, useCommentId } from '@platejs/comment/react';
227
227
  import { SuggestionPlugin } from '@platejs/suggestion/react';
228
+ import { BoldRules, MarkComboRules, ItalicRules, UnderlineRules, CodeRules, StrikethroughRules, SubscriptRules, SuperscriptRules, HighlightRules, HeadingRules, BlockquoteRules, HorizontalRuleRules, BaseH1Plugin, BaseH2Plugin, BaseH3Plugin, BaseBlockquotePlugin, BaseHorizontalRulePlugin, BaseBoldPlugin, BaseItalicPlugin, BaseUnderlinePlugin, BaseStrikethroughPlugin, BaseSubscriptPlugin, BaseSuperscriptPlugin, BaseCodePlugin, BaseHighlightPlugin } from '@platejs/basic-nodes';
228
229
  import { BoldPlugin, ItalicPlugin, UnderlinePlugin, CodePlugin, StrikethroughPlugin, SubscriptPlugin, SuperscriptPlugin, HighlightPlugin, H1Plugin, H2Plugin, H3Plugin, BlockquotePlugin, HorizontalRulePlugin } from '@platejs/basic-nodes/react';
229
- import { AutoformatPlugin, autoformatSmartQuotes, autoformatPunctuation, autoformatLegal, autoformatLegalHtml, autoformatArrow, autoformatMath } from '@platejs/autoformat';
230
- import { insertEmptyCodeBlock, insertCodeBlock, BaseCodeBlockPlugin, BaseCodeLinePlugin, BaseCodeSyntaxPlugin } from '@platejs/code-block';
231
- import { expandListItemsWithChildren, BaseListPlugin, toggleList, isOrderedList, someList, ListStyleType } from '@platejs/list';
232
- import { openNextToggles, TogglePlugin, useToggleButtonState, useToggleButton, useToggleToolbarButtonState, useToggleToolbarButton } from '@platejs/toggle/react';
233
230
  import { DndPlugin, useDropLine, useDraggable } from '@platejs/dnd';
234
231
  import { insertCallout, BaseCalloutPlugin } from '@platejs/callout';
232
+ import { insertCodeBlock, CodeBlockRules, BaseCodeBlockPlugin, BaseCodeLinePlugin, BaseCodeSyntaxPlugin } from '@platejs/code-block';
235
233
  import { insertDate, BaseDatePlugin } from '@platejs/date';
236
234
  import { BaseColumnPlugin, BaseColumnItemPlugin, insertColumnGroup, toggleColumnGroup } from '@platejs/layout';
237
235
  import { insertEquation, insertInlineEquation, BaseInlineEquationPlugin, BaseEquationPlugin, getEquationHtml } from '@platejs/math';
@@ -250,6 +248,7 @@ import { DatePlugin } from '@platejs/date/react';
250
248
  import { PlaceholderPlugin, useMediaState, useImage, PlaceholderProvider, usePlaceholderElementState, usePlaceholderPopoverState, ImagePlugin, MediaEmbedPlugin, VideoPlugin, AudioPlugin, FilePlugin, useImagePreviewValue, useImagePreview, PreviewImage as PreviewImage$1, useMediaControllerState, useMediaController, openImagePreview, UploadErrorCode, useScaleInput, useMediaControllerDropDownMenu } from '@platejs/media/react';
251
249
  import { DndProvider } from 'react-dnd';
252
250
  import { HTML5Backend } from 'react-dnd-html5-backend';
251
+ import { expandListItemsWithChildren, isOrderedList, BulletedListRules, OrderedListRules, TaskListRules, BaseListPlugin, someList, ListStyleType, toggleList } from '@platejs/list';
253
252
  import { DocxPlugin } from '@platejs/docx';
254
253
  import { JuicePlugin } from '@platejs/juice';
255
254
  import emojiMartData from '@emoji-mart/data';
@@ -267,11 +266,11 @@ import LiteYouTubeEmbed from 'react-lite-youtube-embed';
267
266
  import ReactPlayer from 'react-player';
268
267
  import { MentionPlugin, MentionInputPlugin } from '@platejs/mention/react';
269
268
  import { SlashPlugin, SlashInputPlugin } from '@platejs/slash-command/react';
270
- import { TableProvider, TablePlugin, useTableElement, TableRowPlugin, TableCellPlugin, TableCellHeaderPlugin, useTableCellElement, useTableCellElementResizable, useTableMergeState } from '@platejs/table/react';
269
+ import { TableProvider, TablePlugin, useTableElement, useTableSelectionDom, TableRowPlugin, TableCellPlugin, TableCellHeaderPlugin, useTableCellElement, useTableCellElementResizable, useTableMergeState } from '@platejs/table/react';
271
270
  import { TocPlugin, useTocElementState, useTocElement } from '@platejs/toc/react';
271
+ import { TogglePlugin, useToggleButtonState, useToggleButton, useToggleToolbarButtonState, useToggleToolbarButton } from '@platejs/toggle/react';
272
272
  import { DocxExportPlugin, importDocx, exportToDocx } from '@platejs/docx-io';
273
273
  import { SlateElement, SlateLeaf, serializeHtml, PlateStatic, getEditorDOMFromHtmlString } from 'platejs/static';
274
- import { BaseH1Plugin, BaseH2Plugin, BaseH3Plugin, BaseBlockquotePlugin, BaseHorizontalRulePlugin, BaseBoldPlugin, BaseItalicPlugin, BaseUnderlinePlugin, BaseStrikethroughPlugin, BaseSubscriptPlugin, BaseSuperscriptPlugin, BaseCodePlugin, BaseHighlightPlugin } from '@platejs/basic-nodes';
275
274
  import { BaseFontColorPlugin, BaseFontBackgroundColorPlugin, BaseFontSizePlugin, BaseFontFamilyPlugin, toUnitLess } from '@platejs/basic-styles';
276
275
  import { BaseIndentPlugin } from '@platejs/indent';
277
276
  import { BaseCaptionPlugin } from '@platejs/caption';
@@ -24026,23 +24025,41 @@ function HighlightLeaf(props) {
24026
24025
 
24027
24026
  // src/internal/plate-editor/editor/plugins/basic-marks-kit.tsx
24028
24027
  var BasicMarksKit = [
24029
- BoldPlugin,
24030
- ItalicPlugin,
24031
- UnderlinePlugin,
24028
+ BoldPlugin.configure({
24029
+ inputRules: [
24030
+ BoldRules.markdown({ variant: "*" }),
24031
+ BoldRules.markdown({ variant: "_" }),
24032
+ MarkComboRules.markdown({ variant: "boldItalic" }),
24033
+ MarkComboRules.markdown({ variant: "boldUnderline" }),
24034
+ MarkComboRules.markdown({ variant: "boldItalicUnderline" }),
24035
+ MarkComboRules.markdown({ variant: "italicUnderline" })
24036
+ ]
24037
+ }),
24038
+ ItalicPlugin.configure({
24039
+ inputRules: [ItalicRules.markdown({ variant: "*" }), ItalicRules.markdown({ variant: "_" })]
24040
+ }),
24041
+ UnderlinePlugin.configure({
24042
+ inputRules: [UnderlineRules.markdown()]
24043
+ }),
24032
24044
  CodePlugin.configure({
24045
+ inputRules: [CodeRules.markdown()],
24033
24046
  node: { component: CodeLeaf },
24034
24047
  shortcuts: { toggle: { keys: "mod+e" } }
24035
24048
  }),
24036
24049
  StrikethroughPlugin.configure({
24050
+ inputRules: [StrikethroughRules.markdown()],
24037
24051
  shortcuts: { toggle: { keys: "mod+shift+x" } }
24038
24052
  }),
24039
24053
  SubscriptPlugin.configure({
24054
+ inputRules: [SubscriptRules.markdown()],
24040
24055
  shortcuts: { toggle: { keys: "mod+comma" } }
24041
24056
  }),
24042
24057
  SuperscriptPlugin.configure({
24058
+ inputRules: [SuperscriptRules.markdown()],
24043
24059
  shortcuts: { toggle: { keys: "mod+period" } }
24044
24060
  }),
24045
24061
  HighlightPlugin.configure({
24062
+ inputRules: [HighlightRules.markdown({ variant: "==" }), HighlightRules.markdown({ variant: "\u2261" })],
24046
24063
  node: { component: HighlightLeaf },
24047
24064
  shortcuts: { toggle: { keys: "mod+shift+h" } }
24048
24065
  })
@@ -25576,196 +25593,139 @@ var insertAIAnchorElement = (editor) => {
25576
25593
  });
25577
25594
  editor.setOption(AIChatPlugin, "streaming", true);
25578
25595
  };
25579
- var autoformatMarks = [
25580
- {
25581
- match: "***",
25582
- mode: "mark",
25583
- type: [KEYS.bold, KEYS.italic]
25584
- },
25585
- {
25586
- match: "__*",
25587
- mode: "mark",
25588
- type: [KEYS.underline, KEYS.italic]
25589
- },
25590
- {
25591
- match: "__**",
25592
- mode: "mark",
25593
- type: [KEYS.underline, KEYS.bold]
25594
- },
25595
- {
25596
- match: "___***",
25597
- mode: "mark",
25598
- type: [KEYS.underline, KEYS.bold, KEYS.italic]
25599
- },
25600
- {
25601
- match: "**",
25602
- mode: "mark",
25603
- type: KEYS.bold
25604
- },
25605
- {
25606
- match: "__",
25607
- mode: "mark",
25608
- type: KEYS.underline
25609
- },
25610
- {
25611
- match: "*",
25612
- mode: "mark",
25613
- type: KEYS.italic
25614
- },
25615
- {
25616
- match: "_",
25617
- mode: "mark",
25618
- type: KEYS.italic
25619
- },
25620
- {
25621
- match: "~~",
25622
- mode: "mark",
25623
- type: KEYS.strikethrough
25624
- },
25625
- {
25626
- match: "^",
25627
- mode: "mark",
25628
- type: KEYS.sup
25629
- },
25630
- {
25631
- match: "~",
25632
- mode: "mark",
25633
- type: KEYS.sub
25634
- },
25635
- {
25636
- match: "`",
25637
- mode: "mark",
25638
- type: KEYS.code
25639
- }
25640
- ];
25641
- var autoformatBlocks = [
25642
- {
25643
- match: "# ",
25644
- mode: "block",
25645
- type: KEYS.h1
25646
- },
25647
- {
25648
- match: "## ",
25649
- mode: "block",
25650
- type: KEYS.h2
25651
- },
25652
- {
25653
- match: "### ",
25654
- mode: "block",
25655
- type: KEYS.h3
25656
- },
25657
- {
25658
- match: "> ",
25659
- mode: "block",
25660
- type: KEYS.blockquote
25661
- },
25662
- {
25663
- match: "```",
25664
- mode: "block",
25665
- type: KEYS.codeBlock,
25666
- format: (editor) => {
25667
- insertEmptyCodeBlock(editor, {
25668
- defaultType: KEYS.p,
25669
- insertNodesOptions: { select: true }
25670
- });
25671
- }
25672
- },
25673
- {
25674
- match: "+ ",
25675
- mode: "block",
25676
- preFormat: openNextToggles,
25677
- type: KEYS.toggle
25678
- },
25679
- {
25680
- match: ["---", "\u2014-", "___ "],
25681
- mode: "block",
25682
- type: KEYS.hr,
25683
- format: (editor) => {
25684
- editor.tf.setNodes({ type: KEYS.hr });
25685
- editor.tf.insertNodes({
25686
- children: [{ text: "" }],
25687
- type: KEYS.p
25688
- });
25689
- }
25690
- }
25691
- ];
25692
- var autoformatLists = [
25693
- {
25694
- match: ["* ", "- "],
25695
- mode: "block",
25696
- type: "list",
25697
- format: (editor) => {
25698
- toggleList(editor, {
25699
- listStyleType: KEYS.ul
25700
- });
25701
- }
25702
- },
25703
- {
25704
- match: [String.raw`^\d+\.$ `, String.raw`^\d+\)$ `],
25705
- matchByRegex: true,
25706
- mode: "block",
25707
- type: "list",
25708
- format: (editor, { matchString }) => {
25709
- toggleList(editor, {
25710
- listRestartPolite: Number(matchString) || 1,
25711
- listStyleType: KEYS.ol
25712
- });
25713
- }
25714
- },
25715
- {
25716
- match: ["[] "],
25717
- mode: "block",
25718
- type: "list",
25719
- format: (editor) => {
25720
- toggleList(editor, {
25721
- listStyleType: KEYS.listTodo
25722
- });
25723
- editor.tf.setNodes({
25724
- checked: false,
25725
- listStyleType: KEYS.listTodo
25726
- });
25727
- }
25728
- },
25729
- {
25730
- match: ["[x] "],
25731
- mode: "block",
25732
- type: "list",
25733
- format: (editor) => {
25734
- toggleList(editor, {
25735
- listStyleType: KEYS.listTodo
25736
- });
25737
- editor.tf.setNodes({
25738
- checked: true,
25739
- listStyleType: KEYS.listTodo
25740
- });
25741
- }
25596
+ var isTextSubstitutionBlocked = (editor) => editor.api.some({
25597
+ match: {
25598
+ type: [editor.getType(KEYS.codeBlock)]
25742
25599
  }
25743
- ];
25744
- var AutoformatKit = [
25745
- AutoformatPlugin.configure({
25746
- options: {
25747
- enableUndoOnDelete: true,
25748
- rules: [
25749
- ...autoformatBlocks,
25750
- ...autoformatMarks,
25751
- ...autoformatSmartQuotes,
25752
- ...autoformatPunctuation,
25753
- ...autoformatLegal,
25754
- ...autoformatLegalHtml,
25755
- ...autoformatArrow,
25756
- ...autoformatMath,
25757
- ...autoformatLists
25758
- ].map(
25759
- (rule) => ({
25760
- ...rule,
25761
- query: (editor) => !editor.api.some({
25762
- match: { type: editor.getType(KEYS.codeBlock) }
25763
- })
25764
- })
25765
- )
25766
- }
25767
- })
25768
- ];
25600
+ });
25601
+ var createAutoformatTextSubstitutionRule = ({
25602
+ patterns
25603
+ }) => createTextSubstitutionInputRule({
25604
+ enabled: ({ editor }) => !isTextSubstitutionBlocked(editor),
25605
+ patterns
25606
+ });
25607
+ var arrowsRule = createAutoformatTextSubstitutionRule({
25608
+ patterns: [
25609
+ { format: "\u2192", match: "->" },
25610
+ { format: "\u2190", match: "<-" },
25611
+ { format: "\u21D2", match: "=>" },
25612
+ { format: "\u21D0", match: ["<=", "\u2264="] }
25613
+ ]
25614
+ });
25615
+ var comparisonsRule = createAutoformatTextSubstitutionRule({
25616
+ patterns: [
25617
+ { format: "\u226F", match: "!>" },
25618
+ { format: "\u226E", match: "!<" },
25619
+ { format: "\u2265", match: ">=" },
25620
+ { format: "\u2264", match: "<=" },
25621
+ { format: "\u2271", match: "!>=" },
25622
+ { format: "\u2270", match: "!<=" }
25623
+ ]
25624
+ });
25625
+ var equalityRule = createAutoformatTextSubstitutionRule({
25626
+ patterns: [
25627
+ { format: "\u2260", match: "!=" },
25628
+ { format: "\u2261", match: "==" },
25629
+ { format: "\u2262", match: ["!==", "\u2260="] },
25630
+ { format: "\u2248", match: "~=" },
25631
+ { format: "\u2249", match: "!~=" }
25632
+ ]
25633
+ });
25634
+ var fractionsRule = createAutoformatTextSubstitutionRule({
25635
+ patterns: [
25636
+ { format: "\xBD", match: "1/2" },
25637
+ { format: "\u2153", match: "1/3" },
25638
+ { format: "\xBC", match: "1/4" },
25639
+ { format: "\u2155", match: "1/5" },
25640
+ { format: "\u2159", match: "1/6" },
25641
+ { format: "\u2150", match: "1/7" },
25642
+ { format: "\u215B", match: "1/8" },
25643
+ { format: "\u2151", match: "1/9" },
25644
+ { format: "\u2152", match: "1/10" },
25645
+ { format: "\u2154", match: "2/3" },
25646
+ { format: "\u2156", match: "2/5" },
25647
+ { format: "\xBE", match: "3/4" },
25648
+ { format: "\u2157", match: "3/5" },
25649
+ { format: "\u215C", match: "3/8" },
25650
+ { format: "\u2158", match: "4/5" },
25651
+ { format: "\u215A", match: "5/6" },
25652
+ { format: "\u215D", match: "5/8" },
25653
+ { format: "\u215E", match: "7/8" }
25654
+ ]
25655
+ });
25656
+ var legalRule = createAutoformatTextSubstitutionRule({
25657
+ patterns: [{ format: "\u2122", match: ["(tm)", "(TM)"] }, { format: "\xAE", match: ["(r)", "(R)"] }, { format: "\xA9", match: ["(c)", "(C)"] }]
25658
+ });
25659
+ var legalHtmlRule = createAutoformatTextSubstitutionRule({
25660
+ patterns: [
25661
+ { format: "\u2122", match: "&trade;" },
25662
+ { format: "\xAE", match: "&reg;" },
25663
+ { format: "\xA9", match: "&copy;" },
25664
+ { format: "\xA7", match: "&sect;" }
25665
+ ]
25666
+ });
25667
+ var operatorsRule = createAutoformatTextSubstitutionRule({
25668
+ patterns: [{ format: "\xB1", match: "+-" }, { format: "\u2030", match: "%%" }, { format: "\u2031", match: ["%%%", "\u2030%"] }]
25669
+ });
25670
+ var punctuationRule = createAutoformatTextSubstitutionRule({
25671
+ patterns: [{ format: "\xBB", match: ">>" }, { format: "\xAB", match: "<<" }]
25672
+ });
25673
+ var smartQuotesRule = createAutoformatTextSubstitutionRule({
25674
+ patterns: [{ format: ["\u201C", "\u201D"], match: '"' }, { format: ["\u2018", "\u2019"], match: "'" }]
25675
+ });
25676
+ var subscriptNumbersRule = createAutoformatTextSubstitutionRule({
25677
+ patterns: [
25678
+ { format: "\u2080", match: "~0" },
25679
+ { format: "\u2081", match: "~1" },
25680
+ { format: "\u2082", match: "~2" },
25681
+ { format: "\u2083", match: "~3" },
25682
+ { format: "\u2084", match: "~4" },
25683
+ { format: "\u2085", match: "~5" },
25684
+ { format: "\u2086", match: "~6" },
25685
+ { format: "\u2087", match: "~7" },
25686
+ { format: "\u2088", match: "~8" },
25687
+ { format: "\u2089", match: "~9" }
25688
+ ]
25689
+ });
25690
+ var subscriptSymbolsRule = createAutoformatTextSubstitutionRule({
25691
+ patterns: [{ format: "\u208A", match: "~+" }, { format: "\u208B", match: "~-" }]
25692
+ });
25693
+ var superscriptNumbersRule = createAutoformatTextSubstitutionRule({
25694
+ patterns: [
25695
+ { format: "\u2070", match: "^0" },
25696
+ { format: "\xB9", match: "^1" },
25697
+ { format: "\xB2", match: "^2" },
25698
+ { format: "\xB3", match: "^3" },
25699
+ { format: "\u2074", match: "^4" },
25700
+ { format: "\u2075", match: "^5" },
25701
+ { format: "\u2076", match: "^6" },
25702
+ { format: "\u2077", match: "^7" },
25703
+ { format: "\u2078", match: "^8" },
25704
+ { format: "\u2079", match: "^9" }
25705
+ ]
25706
+ });
25707
+ var superscriptSymbolsRule = createAutoformatTextSubstitutionRule({
25708
+ patterns: [{ format: "\xB0", match: "^o" }, { format: "\u207A", match: "^+" }, { format: "\u207B", match: "^-" }]
25709
+ });
25710
+ var AutoformatShortcutsPlugin = createSlatePlugin({
25711
+ key: "autoformatShortcuts",
25712
+ inputRules: [
25713
+ legalRule,
25714
+ legalHtmlRule,
25715
+ arrowsRule,
25716
+ comparisonsRule,
25717
+ equalityRule,
25718
+ fractionsRule,
25719
+ operatorsRule,
25720
+ punctuationRule,
25721
+ smartQuotesRule,
25722
+ subscriptNumbersRule,
25723
+ subscriptSymbolsRule,
25724
+ superscriptNumbersRule,
25725
+ superscriptSymbolsRule
25726
+ ]
25727
+ });
25728
+ var AutoformatKit = [AutoformatShortcutsPlugin];
25769
25729
  function BlockquoteElement(props) {
25770
25730
  return /* @__PURE__ */ jsx(PlateElement, { as: "blockquote", className: "my-1 px-0.5 py-[3px]", ...props, children: /* @__PURE__ */ jsx("div", { className: "border-primary border-l-[3px] px-4", children: props.children }) });
25771
25731
  }
@@ -25848,6 +25808,7 @@ function ParagraphElement(props) {
25848
25808
  var BasicBlocksKit = [
25849
25809
  ParagraphPlugin.withComponent(ParagraphElement),
25850
25810
  H1Plugin.configure({
25811
+ inputRules: [HeadingRules.markdown()],
25851
25812
  node: {
25852
25813
  component: H1Element
25853
25814
  },
@@ -25857,6 +25818,7 @@ var BasicBlocksKit = [
25857
25818
  shortcuts: { toggle: { keys: "mod+alt+1" } }
25858
25819
  }),
25859
25820
  H2Plugin.configure({
25821
+ inputRules: [HeadingRules.markdown()],
25860
25822
  node: {
25861
25823
  component: H2Element
25862
25824
  },
@@ -25866,6 +25828,7 @@ var BasicBlocksKit = [
25866
25828
  shortcuts: { toggle: { keys: "mod+alt+2" } }
25867
25829
  }),
25868
25830
  H3Plugin.configure({
25831
+ inputRules: [HeadingRules.markdown()],
25869
25832
  node: {
25870
25833
  component: H3Element
25871
25834
  },
@@ -25875,10 +25838,14 @@ var BasicBlocksKit = [
25875
25838
  shortcuts: { toggle: { keys: "mod+alt+3" } }
25876
25839
  }),
25877
25840
  BlockquotePlugin.configure({
25841
+ inputRules: [BlockquoteRules.markdown()],
25878
25842
  node: { component: BlockquoteElement },
25879
25843
  shortcuts: { toggle: { keys: "mod+shift+period" } }
25880
25844
  }),
25881
- HorizontalRulePlugin.withComponent(HrElement)
25845
+ HorizontalRulePlugin.configure({
25846
+ inputRules: [HorizontalRuleRules.markdown({ variant: "-" }), HorizontalRuleRules.markdown({ variant: "_" })],
25847
+ node: { component: HrElement }
25848
+ })
25882
25849
  ];
25883
25850
  var blockSelectionVariants = cva(
25884
25851
  cn(
@@ -28181,6 +28148,7 @@ var languages = [
28181
28148
  var lowlight = createLowlight(all);
28182
28149
  var CodeBlockKit = [
28183
28150
  CodeBlockPlugin.configure({
28151
+ inputRules: [CodeBlockRules.markdown({ on: "match" })],
28184
28152
  node: { component: CodeBlockElement2 },
28185
28153
  options: { lowlight },
28186
28154
  shortcuts: { toggle: { keys: "mod+alt+8" } }
@@ -29637,7 +29605,30 @@ function TodoLi(props) {
29637
29605
  var ListKit = [
29638
29606
  ...IndentKit,
29639
29607
  ListPlugin.configure({
29608
+ inputRules: [
29609
+ BulletedListRules.markdown({ variant: "-" }),
29610
+ BulletedListRules.markdown({ variant: "*" }),
29611
+ OrderedListRules.markdown({ variant: "." }),
29612
+ OrderedListRules.markdown({ variant: ")" }),
29613
+ TaskListRules.markdown({ checked: false }),
29614
+ TaskListRules.markdown({ checked: true })
29615
+ ],
29640
29616
  inject: {
29617
+ nodeProps: {
29618
+ nodeKey: KEYS.listType,
29619
+ query: ({ nodeProps }) => {
29620
+ const { element } = nodeProps;
29621
+ return !!element?.listStyleType && !isOrderedList(element);
29622
+ },
29623
+ transformProps: ({ props }) => ({
29624
+ ...props,
29625
+ role: "listitem",
29626
+ style: {
29627
+ ...props.style,
29628
+ display: "list-item"
29629
+ }
29630
+ })
29631
+ },
29641
29632
  targetPlugins: [
29642
29633
  ...KEYS.heading,
29643
29634
  KEYS.p,
@@ -30527,7 +30518,7 @@ var PlaceholderElement = withHOC(
30527
30518
  /* @__PURE__ */ jsxs("div", { className: "whitespace-nowrap text-muted-foreground text-sm", children: [
30528
30519
  /* @__PURE__ */ jsx("div", { children: progressing ? file?.name : currentContent.content }),
30529
30520
  progressing && !isImage && /* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center gap-1.5", children: [
30530
- /* @__PURE__ */ jsx("div", { children: formatBytes(file.size) }),
30521
+ /* @__PURE__ */ jsx("div", { children: formatBytes(file?.size ?? 0) }),
30531
30522
  /* @__PURE__ */ jsx("div", { children: "-" }),
30532
30523
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
30533
30524
  /* @__PURE__ */ jsx(Spinner$1, { className: "mr-1 size-3.5" }),
@@ -31491,11 +31482,9 @@ var TableElement2 = withHOC(
31491
31482
  const { editor, element } = props;
31492
31483
  const { tf } = useEditorPlugin(TablePlugin);
31493
31484
  const readOnly = useReadOnly();
31494
- const {
31495
- isSelectingCell,
31496
- marginLeft,
31497
- props: tableProps
31498
- } = useTableElement();
31485
+ const { marginLeft, props: tableProps } = useTableElement();
31486
+ const tableRef = useRef(null);
31487
+ useTableSelectionDom(tableRef);
31499
31488
  const isSelectingTable = useBlockSelected(props.element.id);
31500
31489
  return /* @__PURE__ */ jsx(
31501
31490
  PlateElement,
@@ -31507,9 +31496,14 @@ var TableElement2 = withHOC(
31507
31496
  /* @__PURE__ */ jsx(
31508
31497
  "table",
31509
31498
  {
31499
+ ref: tableRef,
31510
31500
  className: cn(
31511
31501
  "mr-0 ml-px table h-px table-fixed border-collapse",
31512
- isSelectingCell && "selection:bg-transparent"
31502
+ "data-[table-selecting=true]:[&_*::selection]:!bg-transparent",
31503
+ "data-[table-selecting=true]:[&_*::selection]:!text-inherit",
31504
+ "data-[table-selecting=true]:[&_*::-moz-selection]:!bg-transparent",
31505
+ "data-[table-selecting=true]:[&_*::-moz-selection]:!text-inherit",
31506
+ "data-[table-selecting=true]:[&_*]:!caret-transparent"
31513
31507
  ),
31514
31508
  ...tableProps,
31515
31509
  children: /* @__PURE__ */ jsx("tbody", { className: "min-w-full", children: props.children })
@@ -32904,10 +32898,12 @@ var getHeadingList = (editor) => {
32904
32898
  return options3.queryHeading(editor);
32905
32899
  }
32906
32900
  const headingList = [];
32907
- const values = editor.api.nodes({
32908
- at: [],
32909
- match: (n) => isHeading(n)
32910
- });
32901
+ const values = Array.from(
32902
+ editor.api.nodes({
32903
+ at: [],
32904
+ match: (n) => isHeading(n)
32905
+ })
32906
+ );
32911
32907
  if (!values) return [];
32912
32908
  for (const [node, path] of values) {
32913
32909
  const { type } = node;