tiptap-markdown-react 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/icons/index.d.ts +2 -0
- package/dist/index.js +93 -81
- package/dist/index.js.map +1 -1
- package/dist/style.css +40 -35
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -294,7 +294,7 @@ Ref handle (`MarkdownWysiwygEditorHandle`): `getMarkdown()`, `getHTML()`, `getJS
|
|
|
294
294
|
|
|
295
295
|
#### Find & replace
|
|
296
296
|
|
|
297
|
-
<kbd>Cmd/Ctrl</kbd>+<kbd>F</kbd> (while focus is inside the editor) opens a floating bar: match counter, wrap-around next/previous, match-case
|
|
297
|
+
<kbd>Cmd/Ctrl</kbd>+<kbd>F</kbd> (while focus is inside the editor) opens a floating bar: match counter inside the search field, wrap-around next/previous, match-case and whole-word toggles, replace and replace-all. `Esc` closes it, clears the highlights and returns focus to the editor. Read-only editors (`editable={false}`) can search but not replace.
|
|
298
298
|
|
|
299
299
|
Matching is done by the official extension, so the semantics are its semantics — worth knowing before you rely on them:
|
|
300
300
|
|
|
@@ -302,7 +302,7 @@ Matching is done by the official extension, so the semantics are its semantics
|
|
|
302
302
|
- **Matches may span marks inside one block** (`**bold** tail` is found by `bold tail`) but never cross blocks. What you search is rendered text, not markdown source: `**bold**` does not match.
|
|
303
303
|
- **Replacement takes the marks at the match start**: replacing `bold tail` in `**bold** tail` yields `**X**` — the trailing plain run's formatting is gone.
|
|
304
304
|
- **Replace-all is a single transaction**, so one undo restores everything.
|
|
305
|
-
- **Regex is RE2-compatible** (via `re2js`): no lookarounds or backreferences, replacement text is literal (`$1` is not expanded), and an invalid pattern yields zero matches instead of throwing — the bar shows "Invalid pattern" for that case.
|
|
305
|
+
- **Regex is RE2-compatible** (via `re2js`): no lookarounds or backreferences, replacement text is literal (`$1` is not expanded), and an invalid pattern yields zero matches instead of throwing — the bar shows "Invalid pattern" for that case. The bar ships no regex toggle (find/replace as a plain-text tool); turn it on from your own UI or headlessly with `editor.commands.setUseRegex(true)`.
|
|
306
306
|
|
|
307
307
|
Everything is also callable headlessly — the extension's commands and storage are the API, so AI/agent flows can drive it without the bar:
|
|
308
308
|
|
|
@@ -351,7 +351,7 @@ There is no global locale and no provider: every visible string comes from a `Pa
|
|
|
351
351
|
| Component | Prop | Type |
|
|
352
352
|
| --- | --- | --- |
|
|
353
353
|
| `<EditorToolbar>` | `labels` | `Partial<ToolbarLabels>` (also covers the Import menu and the equation popover) |
|
|
354
|
-
| `<MarkdownWysiwygEditor>` | `findLabels` | `Partial<FindLabels>` |
|
|
354
|
+
| `<MarkdownWysiwygEditor>` | `findLabels` | `Partial<FindLabels>` (replace / replace-all appear as icon buttons, so their labels are the tooltip + accessible name) |
|
|
355
355
|
| `<MarkdownWysiwygEditor>` | `codeBlockLabels` | `Partial<CodeBlockLabels>` |
|
|
356
356
|
| `<TocPanel>` | `labels` | `Partial<TocLabels>` |
|
|
357
357
|
| `<ColorPalette>` | `labels` | `Partial<ColorPaletteLabels>` |
|
package/dist/icons/index.d.ts
CHANGED
|
@@ -31,6 +31,8 @@ export declare const MenuIcon: (p: IconProps) => import("react").JSX.Element;
|
|
|
31
31
|
export declare const SearchIcon: (p: IconProps) => import("react").JSX.Element;
|
|
32
32
|
export declare const XIcon: (p: IconProps) => import("react").JSX.Element;
|
|
33
33
|
export declare const ChevronUpIcon: (p: IconProps) => import("react").JSX.Element;
|
|
34
|
+
export declare const ReplaceIcon: (p: IconProps) => import("react").JSX.Element;
|
|
35
|
+
export declare const ReplaceAllIcon: (p: IconProps) => import("react").JSX.Element;
|
|
34
36
|
export declare const ColumnBeforeIcon: (p: IconProps) => import("react").JSX.Element;
|
|
35
37
|
export declare const ColumnAfterIcon: (p: IconProps) => import("react").JSX.Element;
|
|
36
38
|
export declare const ColumnDeleteIcon: (p: IconProps) => import("react").JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -462,6 +462,26 @@ const XIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
|
|
|
462
462
|
/* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })
|
|
463
463
|
] });
|
|
464
464
|
const ChevronUpIcon = (p) => /* @__PURE__ */ jsx(Svg, { ...p, children: /* @__PURE__ */ jsx("path", { d: "m18 15-6-6-6 6" }) });
|
|
465
|
+
const ReplaceIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
|
|
466
|
+
/* @__PURE__ */ jsx("path", { d: "M14 4a1 1 0 0 1 1-1" }),
|
|
467
|
+
/* @__PURE__ */ jsx("path", { d: "M15 10a1 1 0 0 1-1-1" }),
|
|
468
|
+
/* @__PURE__ */ jsx("path", { d: "M21 4a1 1 0 0 0-1-1" }),
|
|
469
|
+
/* @__PURE__ */ jsx("path", { d: "M21 9a1 1 0 0 1-1 1" }),
|
|
470
|
+
/* @__PURE__ */ jsx("path", { d: "m3 7 3 3 3-3" }),
|
|
471
|
+
/* @__PURE__ */ jsx("path", { d: "M6 10V5a2 2 0 0 1 2-2h2" }),
|
|
472
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" })
|
|
473
|
+
] });
|
|
474
|
+
const ReplaceAllIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
|
|
475
|
+
/* @__PURE__ */ jsx("path", { d: "M14 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1" }),
|
|
476
|
+
/* @__PURE__ */ jsx("path", { d: "M14 4a1 1 0 0 1 1-1" }),
|
|
477
|
+
/* @__PURE__ */ jsx("path", { d: "M15 10a1 1 0 0 1-1-1" }),
|
|
478
|
+
/* @__PURE__ */ jsx("path", { d: "M19 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1" }),
|
|
479
|
+
/* @__PURE__ */ jsx("path", { d: "M21 4a1 1 0 0 0-1-1" }),
|
|
480
|
+
/* @__PURE__ */ jsx("path", { d: "M21 9a1 1 0 0 1-1 1" }),
|
|
481
|
+
/* @__PURE__ */ jsx("path", { d: "m3 7 3 3 3-3" }),
|
|
482
|
+
/* @__PURE__ */ jsx("path", { d: "M6 10V5a2 2 0 0 1 2-2h2" }),
|
|
483
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" })
|
|
484
|
+
] });
|
|
465
485
|
const ColumnBeforeIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
|
|
466
486
|
/* @__PURE__ */ jsx("rect", { x: "10", y: "4", width: "11", height: "16", rx: "1" }),
|
|
467
487
|
/* @__PURE__ */ jsx("path", { d: "M14 4v16" }),
|
|
@@ -614,20 +634,19 @@ const defaultFindLabels = {
|
|
|
614
634
|
invalidRegex: "Invalid pattern",
|
|
615
635
|
readOnly: "Read-only"
|
|
616
636
|
};
|
|
617
|
-
const bar = "
|
|
618
|
-
const row = "
|
|
619
|
-
const field = "
|
|
620
|
-
const fieldIcon = "
|
|
621
|
-
const input = "
|
|
622
|
-
const counter = "
|
|
623
|
-
const counterInvalid = "
|
|
624
|
-
const btn$1 = "
|
|
625
|
-
const toggle = "
|
|
626
|
-
const toggleOn = "
|
|
627
|
-
const
|
|
628
|
-
const
|
|
629
|
-
const
|
|
630
|
-
const readOnly = "_readOnly_1lvby_150";
|
|
637
|
+
const bar = "_bar_1h61e_3";
|
|
638
|
+
const row = "_row_1h61e_25";
|
|
639
|
+
const field = "_field_1h61e_43";
|
|
640
|
+
const fieldIcon = "_fieldIcon_1h61e_62";
|
|
641
|
+
const input = "_input_1h61e_67";
|
|
642
|
+
const counter = "_counter_1h61e_79";
|
|
643
|
+
const counterInvalid = "_counterInvalid_1h61e_89";
|
|
644
|
+
const btn$1 = "_btn_1h61e_93";
|
|
645
|
+
const toggle = "_toggle_1h61e_29";
|
|
646
|
+
const toggleOn = "_toggleOn_1h61e_135";
|
|
647
|
+
const iconGroup = "_iconGroup_1h61e_29";
|
|
648
|
+
const spacer = "_spacer_1h61e_150";
|
|
649
|
+
const readOnly = "_readOnly_1h61e_155";
|
|
631
650
|
const styles$5 = {
|
|
632
651
|
bar,
|
|
633
652
|
row,
|
|
@@ -639,8 +658,7 @@ const styles$5 = {
|
|
|
639
658
|
btn: btn$1,
|
|
640
659
|
toggle,
|
|
641
660
|
toggleOn,
|
|
642
|
-
|
|
643
|
-
textBtn,
|
|
661
|
+
iconGroup,
|
|
644
662
|
spacer,
|
|
645
663
|
readOnly
|
|
646
664
|
};
|
|
@@ -745,8 +763,7 @@ function FindReplaceBar({
|
|
|
745
763
|
const toggle2 = (key, value) => {
|
|
746
764
|
runCommand(() => {
|
|
747
765
|
if (key === "caseSensitive") editor.commands.setCaseSensitive(value);
|
|
748
|
-
else
|
|
749
|
-
else editor.commands.setUseRegex(value);
|
|
766
|
+
else editor.commands.setWholeWord(value);
|
|
750
767
|
});
|
|
751
768
|
};
|
|
752
769
|
if (!hasExtension) return null;
|
|
@@ -781,6 +798,15 @@ function FindReplaceBar({
|
|
|
781
798
|
autoFocus: true,
|
|
782
799
|
spellCheck: false
|
|
783
800
|
}
|
|
801
|
+
),
|
|
802
|
+
/* @__PURE__ */ jsx(
|
|
803
|
+
"span",
|
|
804
|
+
{
|
|
805
|
+
className: `${styles$5.counter}${invalidPattern ? ` ${styles$5.counterInvalid}` : ""}`,
|
|
806
|
+
"aria-live": "polite",
|
|
807
|
+
title: invalidPattern ? t.invalidRegex : void 0,
|
|
808
|
+
children: invalidPattern ? t.invalidRegex : counter2
|
|
809
|
+
}
|
|
784
810
|
)
|
|
785
811
|
] }),
|
|
786
812
|
/* @__PURE__ */ jsx(
|
|
@@ -809,66 +835,46 @@ function FindReplaceBar({
|
|
|
809
835
|
children: "ab"
|
|
810
836
|
}
|
|
811
837
|
),
|
|
812
|
-
/* @__PURE__ */ jsx(
|
|
813
|
-
"button",
|
|
814
|
-
{
|
|
815
|
-
type: "button",
|
|
816
|
-
className: toggleClass(state.useRegex),
|
|
817
|
-
title: t.useRegex,
|
|
818
|
-
"aria-label": t.useRegex,
|
|
819
|
-
"aria-pressed": state.useRegex,
|
|
820
|
-
onMouseDown: keepFocus,
|
|
821
|
-
onClick: () => toggle2("useRegex", !state.useRegex),
|
|
822
|
-
children: ".*"
|
|
823
|
-
}
|
|
824
|
-
),
|
|
825
838
|
/* @__PURE__ */ jsx("span", { className: styles$5.spacer }),
|
|
826
|
-
/* @__PURE__ */
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
"
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
"
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
className: `${styles$5.btn} ${styles$5.closeBtn}`,
|
|
866
|
-
title: t.close,
|
|
867
|
-
"aria-label": t.close,
|
|
868
|
-
onClick: onClose,
|
|
869
|
-
children: /* @__PURE__ */ jsx(XIcon, { size: 16 })
|
|
870
|
-
}
|
|
871
|
-
)
|
|
839
|
+
/* @__PURE__ */ jsxs("span", { className: styles$5.iconGroup, children: [
|
|
840
|
+
/* @__PURE__ */ jsx(
|
|
841
|
+
"button",
|
|
842
|
+
{
|
|
843
|
+
type: "button",
|
|
844
|
+
className: styles$5.btn,
|
|
845
|
+
title: t.previous,
|
|
846
|
+
"aria-label": t.previous,
|
|
847
|
+
disabled: state.total === 0,
|
|
848
|
+
onMouseDown: keepFocus,
|
|
849
|
+
onClick: () => runAction(() => editor.commands.goToPreviousResult()),
|
|
850
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, { size: 16 })
|
|
851
|
+
}
|
|
852
|
+
),
|
|
853
|
+
/* @__PURE__ */ jsx(
|
|
854
|
+
"button",
|
|
855
|
+
{
|
|
856
|
+
type: "button",
|
|
857
|
+
className: styles$5.btn,
|
|
858
|
+
title: t.next,
|
|
859
|
+
"aria-label": t.next,
|
|
860
|
+
disabled: state.total === 0,
|
|
861
|
+
onMouseDown: keepFocus,
|
|
862
|
+
onClick: () => runAction(() => editor.commands.goToNextResult()),
|
|
863
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: 16 })
|
|
864
|
+
}
|
|
865
|
+
),
|
|
866
|
+
/* @__PURE__ */ jsx(
|
|
867
|
+
"button",
|
|
868
|
+
{
|
|
869
|
+
type: "button",
|
|
870
|
+
className: styles$5.btn,
|
|
871
|
+
title: t.close,
|
|
872
|
+
"aria-label": t.close,
|
|
873
|
+
onClick: onClose,
|
|
874
|
+
children: /* @__PURE__ */ jsx(XIcon, { size: 16 })
|
|
875
|
+
}
|
|
876
|
+
)
|
|
877
|
+
] })
|
|
872
878
|
] }),
|
|
873
879
|
editor.isEditable ? /* @__PURE__ */ jsxs("div", { className: styles$5.row, children: [
|
|
874
880
|
/* @__PURE__ */ jsx("span", { className: styles$5.field, children: /* @__PURE__ */ jsx(
|
|
@@ -888,22 +894,26 @@ function FindReplaceBar({
|
|
|
888
894
|
"button",
|
|
889
895
|
{
|
|
890
896
|
type: "button",
|
|
891
|
-
className:
|
|
897
|
+
className: styles$5.btn,
|
|
898
|
+
title: t.replaceOne,
|
|
899
|
+
"aria-label": t.replaceOne,
|
|
892
900
|
disabled: state.total === 0,
|
|
893
901
|
onMouseDown: keepFocus,
|
|
894
902
|
onClick: () => runAction(() => editor.commands.replace()),
|
|
895
|
-
children:
|
|
903
|
+
children: /* @__PURE__ */ jsx(ReplaceIcon, { size: 16 })
|
|
896
904
|
}
|
|
897
905
|
),
|
|
898
906
|
/* @__PURE__ */ jsx(
|
|
899
907
|
"button",
|
|
900
908
|
{
|
|
901
909
|
type: "button",
|
|
902
|
-
className:
|
|
910
|
+
className: styles$5.btn,
|
|
911
|
+
title: t.replaceAll,
|
|
912
|
+
"aria-label": t.replaceAll,
|
|
903
913
|
disabled: state.total === 0,
|
|
904
914
|
onMouseDown: keepFocus,
|
|
905
915
|
onClick: () => runAction(() => editor.commands.replaceAll()),
|
|
906
|
-
children:
|
|
916
|
+
children: /* @__PURE__ */ jsx(ReplaceAllIcon, { size: 16 })
|
|
907
917
|
}
|
|
908
918
|
)
|
|
909
919
|
] }) : /* @__PURE__ */ jsx("div", { className: styles$5.row, children: /* @__PURE__ */ jsx("span", { className: styles$5.readOnly, children: t.readOnly }) })
|
|
@@ -3670,6 +3680,8 @@ export {
|
|
|
3670
3680
|
MenuIcon,
|
|
3671
3681
|
PENDING_ANCHOR_CLASS,
|
|
3672
3682
|
RedoIcon,
|
|
3683
|
+
ReplaceAllIcon,
|
|
3684
|
+
ReplaceIcon,
|
|
3673
3685
|
R2 as ReportContent,
|
|
3674
3686
|
R as ReportContentInteractive,
|
|
3675
3687
|
b as ReportContentWithCharts,
|