@haklex/rich-plugin-slash-menu 0.0.55 → 0.0.57
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/SlashMenuPlugin.d.ts.map +1 -1
- package/dist/index.mjs +3 -11
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlashMenuPlugin.d.ts","sourceRoot":"","sources":["../src/SlashMenuPlugin.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SlashMenuPlugin.d.ts","sourceRoot":"","sources":["../src/SlashMenuPlugin.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,SAAS,CAAA;AAMtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAIpD,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,aAAa,EAAE,CAAA;IACvB,UAAU,CAAC,EAAE,aAAa,EAAE,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,EAAE,CAK5E;AAWD,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,UAAU,EACV,WAAiB,GAClB,EAAE,oBAAoB,2CAuEtB"}
|
package/dist/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import { createElement, useEffect, useMemo, useState, useCallback } from "react"
|
|
|
12
12
|
import { MenuOption, useBasicTypeaheadTriggerMatch, LexicalTypeaheadMenuPlugin } from "@lexical/react/LexicalTypeaheadMenuPlugin";
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
import { useFloating, autoUpdate, offset, flip, shift } from "@floating-ui/react-dom";
|
|
15
|
+
import { collectCommandItems } from "@haklex/rich-editor";
|
|
15
16
|
import { PortalThemeWrapper } from "@haklex/rich-style-token";
|
|
16
17
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
17
18
|
import { createPortal } from "react-dom";
|
|
@@ -270,17 +271,8 @@ function SlashMenuList({
|
|
|
270
271
|
);
|
|
271
272
|
}
|
|
272
273
|
function collectNodeSlashItems(editor) {
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
for (const { klass } of nodes.values()) {
|
|
276
|
-
const configs = klass.slashMenuItems;
|
|
277
|
-
if (configs) {
|
|
278
|
-
for (const config of configs) {
|
|
279
|
-
items.push(new SlashMenuItem(config.title, config));
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
return items;
|
|
274
|
+
const configs = collectCommandItems(editor);
|
|
275
|
+
return configs.filter((c) => !c.placement || c.placement.includes("slash")).map((c) => new SlashMenuItem(c.title, c));
|
|
284
276
|
}
|
|
285
277
|
function filterItems(query, items) {
|
|
286
278
|
if (!query) return items;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-plugin-slash-menu",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.57",
|
|
4
4
|
"description": "Slash command menu plugin",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@floating-ui/react-dom": "^2.1.7",
|
|
20
|
-
"@haklex/rich-
|
|
20
|
+
"@haklex/rich-editor": "0.0.57",
|
|
21
|
+
"@haklex/rich-style-token": "0.0.57"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"@lexical/list": "^0.41.0",
|