@haklex/rich-plugin-floating-toolbar 0.0.86 → 0.0.88
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingToolbarPlugin.d.ts","sourceRoot":"","sources":["../src/FloatingToolbarPlugin.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FloatingToolbarPlugin.d.ts","sourceRoot":"","sources":["../src/FloatingToolbarPlugin.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAgM1C,wBAAgB,qBAAqB,IAAI,YAAY,GAAG,IAAI,CAogB3D"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { $toggleSpoilerSelection, $selectionTouchesSpoiler } from "@haklex/rich-editor/commands";
|
|
2
3
|
import { $createRubyNode, $isRubyNode } from "@haklex/rich-editor/nodes";
|
|
3
4
|
import { ColorPicker } from "@haklex/rich-editor-ui";
|
|
4
5
|
import { usePortalTheme, usePortalContainer, vars } from "@haklex/rich-style-token";
|
|
@@ -6,7 +7,7 @@ import { TOGGLE_LINK_COMMAND, $isLinkNode, $isAutoLinkNode } from "@lexical/link
|
|
|
6
7
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
7
8
|
import { $patchStyleText, $getSelectionStyleValueForProperty } from "@lexical/selection";
|
|
8
9
|
import { $getSelection, $isRangeSelection, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, FORMAT_TEXT_COMMAND, $createTextNode, $getNodeByKey } from "lexical";
|
|
9
|
-
import { Bold, Italic, Underline, Strikethrough, Superscript, Subscript, Code, Highlighter, Link, Languages, Check, X, Trash2 } from "lucide-react";
|
|
10
|
+
import { Bold, Italic, Underline, Strikethrough, Superscript, Subscript, Code, Highlighter, EyeOff, Link, Languages, Check, X, Trash2 } from "lucide-react";
|
|
10
11
|
import { useRef, useState, useCallback, useEffect } from "react";
|
|
11
12
|
import { createPortal } from "react-dom";
|
|
12
13
|
var toolbar = "_1m6axz71";
|
|
@@ -53,6 +54,7 @@ const INITIAL_STATE = {
|
|
|
53
54
|
isHighlight: false,
|
|
54
55
|
isLink: false,
|
|
55
56
|
isRuby: false,
|
|
57
|
+
isSpoiler: false,
|
|
56
58
|
fontColor: ""
|
|
57
59
|
};
|
|
58
60
|
function findRubyAncestor(node) {
|
|
@@ -93,6 +95,7 @@ function getSelectionState(selection) {
|
|
|
93
95
|
isHighlight: selection.hasFormat("highlight"),
|
|
94
96
|
isLink: hasLink,
|
|
95
97
|
isRuby: hasRuby,
|
|
98
|
+
isSpoiler: $selectionTouchesSpoiler(selection),
|
|
96
99
|
fontColor: $getSelectionStyleValueForProperty(selection, "color", "")
|
|
97
100
|
};
|
|
98
101
|
}
|
|
@@ -514,6 +517,15 @@ function FloatingToolbarPlugin() {
|
|
|
514
517
|
children: /* @__PURE__ */ jsx(Highlighter, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
515
518
|
}
|
|
516
519
|
),
|
|
520
|
+
/* @__PURE__ */ jsx(
|
|
521
|
+
ToolbarButton,
|
|
522
|
+
{
|
|
523
|
+
active: state.isSpoiler,
|
|
524
|
+
ariaLabel: "Spoiler",
|
|
525
|
+
onClick: () => editor.update($toggleSpoilerSelection),
|
|
526
|
+
children: /* @__PURE__ */ jsx(EyeOff, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
|
|
527
|
+
}
|
|
528
|
+
),
|
|
517
529
|
/* @__PURE__ */ jsx(ToolbarButton, { active: state.isLink, ariaLabel: "Link", onClick: handleLink, children: /* @__PURE__ */ jsx(Link, { size: ICON_SIZE, strokeWidth: ICON_STROKE }) }),
|
|
518
530
|
/* @__PURE__ */ jsx(ToolbarButton, { active: state.isRuby, ariaLabel: "Ruby annotation", onClick: handleRuby, children: /* @__PURE__ */ jsx(Languages, { size: ICON_SIZE, strokeWidth: ICON_STROKE }) }),
|
|
519
531
|
/* @__PURE__ */ jsx("span", { className: separator }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-plugin-floating-toolbar",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.88",
|
|
4
4
|
"description": "Floating toolbar plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@haklex/rich-editor": "0.0.
|
|
25
|
-
"@haklex/rich-
|
|
26
|
-
"@haklex/rich-
|
|
24
|
+
"@haklex/rich-editor": "0.0.88",
|
|
25
|
+
"@haklex/rich-editor-ui": "0.0.88",
|
|
26
|
+
"@haklex/rich-style-token": "0.0.88"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@lexical/link": "^0.42.0",
|