@meowdown/react 0.19.0 → 0.20.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 CHANGED
@@ -42,7 +42,7 @@ The Markdown editor component. Renders inside a `div.meowdown` wrapper that fill
42
42
  - `initialMarkdown?: string`: first render only.
43
43
  - `onDocChange?: VoidFunction`: called on every user-driven document change. Programmatic `setMarkdown` / `setState` on the handle do not fire it.
44
44
  - `onTagSearch?: (query: string) => TagItem[] | Promise<TagItem[]>`: enables the tag menu, which opens when typing `#` followed by text in a rich mode. Returns ranked rows `{ tag, label?, detail?, onSelect? }` (the menu does not re-sort). Selecting a row inserts `#tag ` then runs its `onSelect`. Omit to disable.
45
- - `onWikilinkSearch?: (query: string) => WikilinkItem[] | Promise<WikilinkItem[]>`: enables the wikilink menu, which opens as soon as `[[` is typed in a rich mode. Returns ranked rows `{ target, label?, detail?, onSelect? }` (the menu does not re-sort). Selecting a row inserts `[[target]]` then runs its `onSelect`. Omit to disable.
45
+ - `onWikilinkSearch?: (query: string) => WikilinkItem[] | Promise<WikilinkItem[]>`: enables the wikilink menu, which opens as soon as `[[` or `@` is typed in a rich mode. Returns ranked rows `{ target, label?, detail?, onSelect? }` (the menu does not re-sort). Selecting a row inserts `[[target]]` then runs its `onSelect`. Omit to disable.
46
46
  - `onWikilinkClick?: (payload: { target: string; event: MouseEvent }) => void`: called when a rendered wiki link is clicked. A plain click inside a link the caret already sits in just places the caret; `Mod`-click always fires. Pass a stable function (e.g. from `useCallback`). Ignored in source mode.
47
47
  - `onLinkClick?: (payload: { href: string; event: MouseEvent }) => void`: called with its `href` when a rendered Markdown link (`[text](url)`) is clicked. A plain click inside a link the caret already sits in just places the caret; `Mod`-click always fires. Pass a stable function (e.g. from `useCallback`). Ignored in source mode.
48
48
  - `resolveImageUrl?: (src: string) => string | undefined`: maps an image `src` to a displayable URL (or `undefined` to skip). Enables inline image rendering: `![alt](src)` stays literal text and the image renders beneath its line. Pass a stable function. Ignored in source mode.
package/dist/index.d.ts CHANGED
@@ -71,8 +71,8 @@ interface WikilinkItem {
71
71
  }
72
72
  /**
73
73
  * Searches notes for the wikilink menu. Receives the query typed after
74
- * `[[` (lowercased, punctuation stripped, may be empty or contain spaces)
75
- * and returns the rows to show, either synchronously or as a promise.
74
+ * `[[` or `@` (lowercased, punctuation stripped, may be empty or contain
75
+ * spaces) and returns the rows to show, either synchronously or as a promise.
76
76
  */
77
77
  type WikilinkSearchHandler = (query: string) => WikilinkItem[] | Promise<WikilinkItem[]>;
78
78
  //#endregion
@@ -105,8 +105,8 @@ interface EditorProps {
105
105
  */
106
106
  onTagSearch?: TagSearchHandler;
107
107
  /**
108
- * Searches notes for the wikilink menu, which opens as soon as `[[` is
109
- * typed in a rich mode. Receives the query (lowercased, punctuation
108
+ * Searches notes for the wikilink menu, which opens as soon as `[[` or `@`
109
+ * is typed in a rich mode. Receives the query (lowercased, punctuation
110
110
  * stripped, may be empty) and returns the note names to show,
111
111
  * synchronously or as a promise. Pass a stable function (e.g. from
112
112
  * `useCallback`). Omit to disable the wikilink menu. Ignored in source
package/dist/index.js CHANGED
@@ -695,7 +695,7 @@ function TagMenu({ onTagSearch }) {
695
695
 
696
696
  //#endregion
697
697
  //#region src/components/wikilink-menu.tsx
698
- const regex = /\[\[[^[\]]*$/u;
698
+ const regex = canUseRegexLookbehind() ? /(?:\[\[[^[\]]*|(?<!\S)@(?:[^[\]\s][^[\]]*)?)$/u : /(?:\[\[[^[\]]*|@(?:[^[\]\s][^[\]]*)?)$/u;
699
699
  function WikilinkMenu({ onWikilinkSearch }) {
700
700
  const editor = useEditor$1();
701
701
  const [open, setOpen] = useState(false);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@meowdown/react",
3
3
  "type": "module",
4
- "version": "0.19.0",
4
+ "version": "0.20.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -30,7 +30,7 @@
30
30
  "@prosekit/react": "^0.8.0-beta.9",
31
31
  "clsx": "^2.1.1",
32
32
  "lucide-react": "^1.21.0",
33
- "@meowdown/core": "0.19.0"
33
+ "@meowdown/core": "0.20.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^19.0.0",