@meowdown/react 0.10.0 → 0.11.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 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"
@@ -480,6 +480,7 @@ function EditorExtensions({ markMode, onDocChange, onWikilinkClick, resolveImage
480
480
  var autocomplete_menu_module_default = {
481
481
  "Detail": "meow_Detail_Dqll0G",
482
482
  "Item": "meow_Item_Dqll0G",
483
+ "Label": "meow_Label_Dqll0G",
483
484
  "Popup": "meow_Popup_Dqll0G",
484
485
  "Positioner": "meow_Positioner_Dqll0G"
485
486
  };
@@ -826,7 +827,10 @@ function TagMenu({ onTagSearch }) {
826
827
  editor.commands.insertText({ text: `#${item.tag} ` });
827
828
  item.onSelect?.();
828
829
  },
829
- children: [/* @__PURE__ */ jsx("span", { children: item.label ?? `#${item.tag}` }), item.detail ? /* @__PURE__ */ jsx("span", {
830
+ children: [/* @__PURE__ */ jsx("span", {
831
+ className: autocomplete_menu_module_default.Label,
832
+ children: item.label ?? `#${item.tag}`
833
+ }), item.detail ? /* @__PURE__ */ jsx("span", {
830
834
  className: autocomplete_menu_module_default.Detail,
831
835
  children: item.detail
832
836
  }) : null]
@@ -886,7 +890,10 @@ function WikilinkMenu({ onWikilinkSearch }) {
886
890
  editor.commands.insertText({ text: `[[${item.target}]]` });
887
891
  item.onSelect?.();
888
892
  },
889
- children: [/* @__PURE__ */ jsx("span", { children: item.label ?? item.target }), item.detail ? /* @__PURE__ */ jsx("span", {
893
+ children: [/* @__PURE__ */ jsx("span", {
894
+ className: autocomplete_menu_module_default.Label,
895
+ children: item.label ?? item.target
896
+ }), item.detail ? /* @__PURE__ */ jsx("span", {
890
897
  className: autocomplete_menu_module_default.Detail,
891
898
  children: item.detail
892
899
  }) : null]
@@ -1090,4 +1097,4 @@ function MeowdownEditor({ mode = "focus", initialMarkdown, onDocChange, onTagSea
1090
1097
  }
1091
1098
 
1092
1099
  //#endregion
1093
- export { MeowdownEditor, useEditor };
1100
+ export { MeowdownEditor, useEditor, useExtension, useKeymap };
package/dist/style.css CHANGED
@@ -264,7 +264,7 @@
264
264
  }
265
265
  .meow_Positioner_Dqll0G {
266
266
  z-index: 50;
267
- width: min-content;
267
+ width: min(24rem, 100vw - 1rem);
268
268
  height: min-content;
269
269
  display: block;
270
270
  overflow: visible;
@@ -279,11 +279,13 @@
279
279
  background: light-dark(#fff, #18181b);
280
280
  border-radius: .75rem;
281
281
  flex-direction: column;
282
- min-width: 15rem;
282
+ width: 100%;
283
+ min-width: min(15rem, 100%);
284
+ max-width: 100%;
283
285
  max-height: 25rem;
284
286
  padding: .25rem;
285
287
  display: flex;
286
- overflow-y: auto;
288
+ overflow: hidden auto;
287
289
  box-shadow: 0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;
288
290
  }
289
291
 
@@ -297,6 +299,7 @@
297
299
  justify-content: space-between;
298
300
  align-items: center;
299
301
  gap: 1.5rem;
302
+ min-width: 0;
300
303
  padding: .375rem .75rem;
301
304
  scroll-margin: .25rem;
302
305
  font-size: .875rem;
@@ -318,10 +321,19 @@
318
321
  }
319
322
  }
320
323
 
324
+ .meow_Label_Dqll0G {
325
+ text-overflow: ellipsis;
326
+ min-width: 0;
327
+ overflow: hidden;
328
+ }
329
+
321
330
  .meow_Detail_Dqll0G {
331
+ text-overflow: ellipsis;
332
+ max-width: 40%;
322
333
  color: var(--meowdown-muted);
323
334
  flex-shrink: 0;
324
335
  font-size: .8125rem;
336
+ overflow: hidden;
325
337
  }
326
338
  .meow_Positioner_hpZLgq, .meow_MenuPositioner_hpZLgq {
327
339
  z-index: 50;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meowdown/react",
3
3
  "type": "module",
4
- "version": "0.10.0",
4
+ "version": "0.11.1",
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.10.0"
31
+ "@meowdown/core": "0.11.1"
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.8",
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.8",
56
+ "vitest": "^4.1.9",
57
57
  "vitest-browser-commands": "^0.2.1",
58
58
  "vitest-browser-react": "^2.2.0"
59
59
  },