@haklex/rich-plugin-floating-toolbar 0.0.2 → 0.0.3
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":"AAwBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAuGzC,wBAAgB,qBAAqB,IAAI,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"FloatingToolbarPlugin.d.ts","sourceRoot":"","sources":["../src/FloatingToolbarPlugin.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAuGzC,wBAAgB,qBAAqB,IAAI,YAAY,GAAG,IAAI,CA4L3D"}
|
package/dist/index.mjs
CHANGED
|
@@ -119,18 +119,20 @@ function FloatingToolbarPlugin() {
|
|
|
119
119
|
useEffect(() => {
|
|
120
120
|
if (!visible || !toolbarRef.current) return;
|
|
121
121
|
const positionToolbar = () => {
|
|
122
|
+
const toolbar2 = toolbarRef.current;
|
|
123
|
+
if (!toolbar2) return;
|
|
122
124
|
const nativeSelection = window.getSelection();
|
|
123
125
|
if (!nativeSelection || nativeSelection.rangeCount === 0) {
|
|
124
126
|
setVisible(false);
|
|
125
127
|
return;
|
|
126
128
|
}
|
|
127
|
-
const pos = computePosition(nativeSelection,
|
|
129
|
+
const pos = computePosition(nativeSelection, toolbar2);
|
|
128
130
|
if (!pos) {
|
|
129
131
|
setVisible(false);
|
|
130
132
|
return;
|
|
131
133
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
toolbar2.style.top = `${pos.top}px`;
|
|
135
|
+
toolbar2.style.left = `${pos.left}px`;
|
|
134
136
|
};
|
|
135
137
|
requestAnimationFrame(positionToolbar);
|
|
136
138
|
}, [visible, state]);
|
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.3",
|
|
4
4
|
"description": "Floating toolbar plugin",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"dist"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@haklex/rich-editor-ui": "0.0.
|
|
19
|
+
"@haklex/rich-editor-ui": "0.0.3",
|
|
20
|
+
"@haklex/rich-style-token": "0.0.3"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
23
|
"@lexical/link": "^0.39.0",
|
|
@@ -32,8 +33,7 @@
|
|
|
32
33
|
"react-dom": "19.2.4",
|
|
33
34
|
"typescript": "^5.9.0",
|
|
34
35
|
"vite": "^7.3.1",
|
|
35
|
-
"vite-plugin-dts": "^4.5.0"
|
|
36
|
-
"@haklex/rich-style-token": "0.0.2"
|
|
36
|
+
"vite-plugin-dts": "^4.5.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@lexical/link": "^0.39.0",
|
|
@@ -42,8 +42,7 @@
|
|
|
42
42
|
"lexical": "^0.39.0",
|
|
43
43
|
"lucide-react": "^0.574.0",
|
|
44
44
|
"react": ">=19",
|
|
45
|
-
"react-dom": ">=19"
|
|
46
|
-
"@haklex/rich-style-token": "0.0.2"
|
|
45
|
+
"react-dom": ">=19"
|
|
47
46
|
},
|
|
48
47
|
"publishConfig": {
|
|
49
48
|
"access": "public"
|