@haklex/rich-plugin-toolbar 0.0.60 → 0.0.61
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/ToolbarPlugin.d.ts.map +1 -1
- package/dist/index.mjs +17 -11
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarPlugin.d.ts","sourceRoot":"","sources":["../src/ToolbarPlugin.tsx"],"names":[],"mappings":"AA0DA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAA;AAwHxD,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,EAAE,kBAAkB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"ToolbarPlugin.d.ts","sourceRoot":"","sources":["../src/ToolbarPlugin.tsx"],"names":[],"mappings":"AA0DA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAA;AAwHxD,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,EAAE,kBAAkB,GAAG,YAAY,CAmZ7E"}
|
package/dist/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { $getSelectionStyleValueForProperty, $patchStyleText, $setBlocksType } f
|
|
|
8
8
|
import { $findMatchingParent } from "@lexical/utils";
|
|
9
9
|
import { $getSelection, $isRangeSelection, $isRootOrShadowRoot, $isElementNode, CAN_UNDO_COMMAND, COMMAND_PRIORITY_LOW, CAN_REDO_COMMAND, $createParagraphNode, UNDO_COMMAND, REDO_COMMAND, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND } from "lexical";
|
|
10
10
|
import { ChevronDown, Pilcrow, Heading1, Heading2, Heading3, Undo, Redo, Bold, Italic, Underline, Strikethrough, Code, Highlighter, List, ListOrdered, ListChecks, AlignLeft, AlignCenter, AlignRight, AlignJustify } from "lucide-react";
|
|
11
|
-
import { useState,
|
|
11
|
+
import { useState, useMemo, useCallback, useEffect } from "react";
|
|
12
12
|
var toolbarContainer = "_1e1ersc0";
|
|
13
13
|
var toolbarRow = "_1e1ersc1";
|
|
14
14
|
var toolbarButton = "_1e1ersc2";
|
|
@@ -200,16 +200,15 @@ function getBlockType(anchorNode) {
|
|
|
200
200
|
function ToolbarPlugin({ className }) {
|
|
201
201
|
const [editor] = useLexicalComposerContext();
|
|
202
202
|
const [state, setState] = useState(INITIAL_STATE);
|
|
203
|
-
const [toolbarItems, setToolbarItems] = useState([]);
|
|
204
203
|
const [tooltipHandle] = useState(
|
|
205
204
|
() => createTooltipHandle()
|
|
206
205
|
);
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
const toolbarItems = useMemo(
|
|
207
|
+
() => collectCommandItems(editor).filter(
|
|
209
208
|
(item) => item.placement?.includes("toolbar") && item.group === "insert"
|
|
210
|
-
)
|
|
211
|
-
|
|
212
|
-
|
|
209
|
+
),
|
|
210
|
+
[editor]
|
|
211
|
+
);
|
|
213
212
|
const updateToolbar = useCallback(() => {
|
|
214
213
|
const selection = $getSelection();
|
|
215
214
|
if (!$isRangeSelection(selection)) return;
|
|
@@ -357,10 +356,17 @@ function ToolbarPlugin({ className }) {
|
|
|
357
356
|
const containerClassName = className ? `${toolbarContainer} ${className}` : toolbarContainer;
|
|
358
357
|
const h = tooltipHandle;
|
|
359
358
|
return /* @__PURE__ */ jsxs(TooltipProvider, { delay: 300, children: [
|
|
360
|
-
/* @__PURE__ */ jsx(
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
359
|
+
/* @__PURE__ */ jsx(
|
|
360
|
+
TooltipRoot,
|
|
361
|
+
{
|
|
362
|
+
handle: tooltipHandle,
|
|
363
|
+
disableHoverablePopup: true,
|
|
364
|
+
children: ((props) => props.payload !== void 0 ? /* @__PURE__ */ jsxs(TooltipContent, { side: "bottom", sideOffset: 4, children: [
|
|
365
|
+
props.payload.title,
|
|
366
|
+
props.payload.shortcut && /* @__PURE__ */ jsx("span", { className: tooltipShortcut, children: props.payload.shortcut })
|
|
367
|
+
] }) : null)
|
|
368
|
+
}
|
|
369
|
+
),
|
|
364
370
|
/* @__PURE__ */ jsx(
|
|
365
371
|
"div",
|
|
366
372
|
{
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-plugin-toolbar",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.61",
|
|
5
5
|
"description": "Top toolbar plugin for rich editor",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"react-dom": ">=19"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@haklex/rich-editor": "0.0.
|
|
31
|
-
"@haklex/rich-style-token": "0.0.
|
|
32
|
-
"@haklex/rich-editor-ui": "0.0.
|
|
30
|
+
"@haklex/rich-editor": "0.0.61",
|
|
31
|
+
"@haklex/rich-style-token": "0.0.61",
|
|
32
|
+
"@haklex/rich-editor-ui": "0.0.61"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@lexical/list": "^0.41.0",
|