@meowdown/react 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +10 -10
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -62,6 +62,14 @@ The Markdown editor component. Renders inside a `div.meowdown` wrapper that fill
|
|
|
62
62
|
|
|
63
63
|
Re-exported from `@prosekit/react`. Call it from a component passed as `children` to read the live editor instance.
|
|
64
64
|
|
|
65
|
+
### `useKeymap`
|
|
66
|
+
|
|
67
|
+
Re-exported from `@prosekit/react`. Registers a keymap on the editor from a `children` component; set its priority with `Priority` from `@meowdown/core`.
|
|
68
|
+
|
|
69
|
+
### `useExtension`
|
|
70
|
+
|
|
71
|
+
Re-exported from `@prosekit/react`. Applies an extension to the editor from a `children` component.
|
|
72
|
+
|
|
65
73
|
### `EditorHandle`
|
|
66
74
|
|
|
67
75
|
Imperative handle for the editor, attached via `handleRef`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode, Ref } from "react";
|
|
2
2
|
import { ImageOptions, MarkMode, PlaceholderOptions, TypedEditor, WikilinkClickHandler } from "@meowdown/core";
|
|
3
3
|
import { SelectionJSON, SelectionJSON as SelectionJSON$1 } from "@prosekit/core";
|
|
4
|
-
import { useEditor } from "@prosekit/react";
|
|
4
|
+
import { useEditor, useExtension, useKeymap } from "@prosekit/react";
|
|
5
5
|
|
|
6
6
|
//#region src/components/types.d.ts
|
|
7
7
|
/** A selection to restore: an exact JSON selection, or a document edge. */
|
|
@@ -194,4 +194,4 @@ declare function MeowdownEditor({
|
|
|
194
194
|
children
|
|
195
195
|
}: EditorProps): import("react").JSX.Element;
|
|
196
196
|
//#endregion
|
|
197
|
-
export { type EditorHandle, type EditorMode, type EditorProps, type EditorStateSnapshot, MeowdownEditor, type SelectionHint, type SelectionJSON, type TagItem, type TagSearchHandler, type WikilinkItem, type WikilinkSearchHandler, useEditor };
|
|
197
|
+
export { type EditorHandle, type EditorMode, type EditorProps, type EditorStateSnapshot, MeowdownEditor, type SelectionHint, type SelectionJSON, type TagItem, type TagSearchHandler, type WikilinkItem, type WikilinkSearchHandler, useEditor, useExtension, useKeymap };
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
import { codeBlockLanguages, defineBulletAfterHeading, defineEditorExtension, defineEmbedPaste, defineImages, defineMarkMode, definePlaceholder, defineReadonly, defineWikilinkClickHandler, docToMarkdown, markdownToDoc } from "@meowdown/core";
|
|
11
11
|
import { canUseRegexLookbehind, createEditor, defineDocChangeHandler, union } from "@prosekit/core";
|
|
12
12
|
import { Selection, TextSelection } from "@prosekit/pm/state";
|
|
13
|
-
import { ProseKit, defineReactNodeView, useEditor, useEditor as useEditor$1, useEditorDerivedValue, useExtension } from "@prosekit/react";
|
|
13
|
+
import { ProseKit, defineReactNodeView, useEditor, useEditor as useEditor$1, useEditorDerivedValue, useExtension, useExtension as useExtension$1, useKeymap } from "@prosekit/react";
|
|
14
14
|
import { Combobox } from "@base-ui/react/combobox";
|
|
15
15
|
import { BlockHandleAdd, BlockHandleDraggable, BlockHandlePopup, BlockHandlePositioner, BlockHandleRoot } from "@prosekit/react/block-handle";
|
|
16
16
|
import { DropIndicator } from "@prosekit/react/drop-indicator";
|
|
@@ -437,19 +437,19 @@ function DropIndicator$1() {
|
|
|
437
437
|
//#endregion
|
|
438
438
|
//#region src/components/editor-extensions.tsx
|
|
439
439
|
function EditorExtensions({ markMode, onDocChange, onWikilinkClick, resolveImageUrl, onImagePaste, onImageSaveError, embedPaste, bulletAfterHeading, placeholder, readOnly }) {
|
|
440
|
-
useExtension(useMemo(() => {
|
|
440
|
+
useExtension$1(useMemo(() => {
|
|
441
441
|
return defineMarkMode(markMode);
|
|
442
442
|
}, [markMode]));
|
|
443
|
-
useExtension(useMemo(() => {
|
|
443
|
+
useExtension$1(useMemo(() => {
|
|
444
444
|
return readOnly ? defineReadonly() : null;
|
|
445
445
|
}, [readOnly]));
|
|
446
|
-
useExtension(useMemo(() => {
|
|
446
|
+
useExtension$1(useMemo(() => {
|
|
447
447
|
return onDocChange ? defineDocChangeHandler(onDocChange) : null;
|
|
448
448
|
}, [onDocChange]));
|
|
449
|
-
useExtension(useMemo(() => {
|
|
449
|
+
useExtension$1(useMemo(() => {
|
|
450
450
|
return onWikilinkClick ? defineWikilinkClickHandler(onWikilinkClick) : null;
|
|
451
451
|
}, [onWikilinkClick]));
|
|
452
|
-
useExtension(useMemo(() => {
|
|
452
|
+
useExtension$1(useMemo(() => {
|
|
453
453
|
return resolveImageUrl ? defineImages({
|
|
454
454
|
resolveImageUrl,
|
|
455
455
|
onImagePaste,
|
|
@@ -460,13 +460,13 @@ function EditorExtensions({ markMode, onDocChange, onWikilinkClick, resolveImage
|
|
|
460
460
|
onImagePaste,
|
|
461
461
|
onImageSaveError
|
|
462
462
|
]));
|
|
463
|
-
useExtension(useMemo(() => {
|
|
463
|
+
useExtension$1(useMemo(() => {
|
|
464
464
|
return embedPaste && resolveImageUrl ? defineEmbedPaste() : null;
|
|
465
465
|
}, [embedPaste, resolveImageUrl]));
|
|
466
|
-
useExtension(useMemo(() => {
|
|
466
|
+
useExtension$1(useMemo(() => {
|
|
467
467
|
return bulletAfterHeading ? defineBulletAfterHeading() : null;
|
|
468
468
|
}, [bulletAfterHeading]));
|
|
469
|
-
useExtension(useMemo(() => {
|
|
469
|
+
useExtension$1(useMemo(() => {
|
|
470
470
|
return placeholder ? definePlaceholder({
|
|
471
471
|
placeholder,
|
|
472
472
|
strategy: "doc"
|
|
@@ -1090,4 +1090,4 @@ function MeowdownEditor({ mode = "focus", initialMarkdown, onDocChange, onTagSea
|
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
1092
|
//#endregion
|
|
1093
|
-
export { MeowdownEditor, useEditor };
|
|
1093
|
+
export { MeowdownEditor, useEditor, useExtension, useKeymap };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meowdown/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.11.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@prosekit/pm": "^0.1.18",
|
|
29
29
|
"@prosekit/react": "^0.8.0-beta.2",
|
|
30
30
|
"clsx": "^2.1.1",
|
|
31
|
-
"@meowdown/core": "0.
|
|
31
|
+
"@meowdown/core": "0.11.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": "^19.0.0",
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"@tsdown/css": "^0.22.2",
|
|
49
49
|
"@types/react": "^19.2.17",
|
|
50
50
|
"@types/react-dom": "^19.2.3",
|
|
51
|
-
"@vitest/browser-playwright": "^4.1.
|
|
51
|
+
"@vitest/browser-playwright": "^4.1.9",
|
|
52
52
|
"dedent": "^1.7.2",
|
|
53
53
|
"react": "^19.2.7",
|
|
54
54
|
"react-dom": "^19.2.7",
|
|
55
55
|
"tsdown": "^0.22.2",
|
|
56
|
-
"vitest": "^4.1.
|
|
56
|
+
"vitest": "^4.1.9",
|
|
57
57
|
"vitest-browser-commands": "^0.2.1",
|
|
58
58
|
"vitest-browser-react": "^2.2.0"
|
|
59
59
|
},
|