@haklex/rich-plugin-floating-toolbar 0.0.31 → 0.0.32

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":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAmIzC,wBAAgB,qBAAqB,IAAI,YAAY,GAAG,IAAI,CAoN3D"}
1
+ {"version":3,"file":"FloatingToolbarPlugin.d.ts","sourceRoot":"","sources":["../src/FloatingToolbarPlugin.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAyIzC,wBAAgB,qBAAqB,IAAI,YAAY,GAAG,IAAI,CAoO3D"}
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { $isLinkNode, TOGGLE_LINK_COMMAND } from "@lexical/link";
5
5
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
6
6
  import { $patchStyleText, $getSelectionStyleValueForProperty } from "@lexical/selection";
7
7
  import { $getSelection, $isRangeSelection, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, FORMAT_TEXT_COMMAND } from "lexical";
8
- import { Bold, Italic, Underline, Strikethrough, Code, Highlighter, Link } from "lucide-react";
8
+ import { Bold, Italic, Underline, Strikethrough, Superscript, Subscript, Code, Highlighter, Link } from "lucide-react";
9
9
  import { useRef, useState, useCallback, useEffect } from "react";
10
10
  import { createPortal } from "react-dom";
11
11
  var toolbar = "_1m6axz71";
@@ -18,6 +18,8 @@ const INITIAL_STATE = {
18
18
  isItalic: false,
19
19
  isUnderline: false,
20
20
  isStrikethrough: false,
21
+ isSuperscript: false,
22
+ isSubscript: false,
21
23
  isCode: false,
22
24
  isHighlight: false,
23
25
  isLink: false,
@@ -34,6 +36,8 @@ function getSelectionState(selection) {
34
36
  isItalic: selection.hasFormat("italic"),
35
37
  isUnderline: selection.hasFormat("underline"),
36
38
  isStrikethrough: selection.hasFormat("strikethrough"),
39
+ isSuperscript: selection.hasFormat("superscript"),
40
+ isSubscript: selection.hasFormat("subscript"),
37
41
  isCode: selection.hasFormat("code"),
38
42
  isHighlight: selection.hasFormat("highlight"),
39
43
  isLink: hasLink,
@@ -254,6 +258,24 @@ function FloatingToolbarPlugin() {
254
258
  children: /* @__PURE__ */ jsx(Strikethrough, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
255
259
  }
256
260
  ),
261
+ /* @__PURE__ */ jsx(
262
+ ToolbarButton,
263
+ {
264
+ active: state.isSuperscript,
265
+ onClick: () => handleFormat("superscript"),
266
+ ariaLabel: "Superscript",
267
+ children: /* @__PURE__ */ jsx(Superscript, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
268
+ }
269
+ ),
270
+ /* @__PURE__ */ jsx(
271
+ ToolbarButton,
272
+ {
273
+ active: state.isSubscript,
274
+ onClick: () => handleFormat("subscript"),
275
+ ariaLabel: "Subscript",
276
+ children: /* @__PURE__ */ jsx(Subscript, { size: ICON_SIZE, strokeWidth: ICON_STROKE })
277
+ }
278
+ ),
257
279
  /* @__PURE__ */ jsx("span", { className: separator }),
258
280
  /* @__PURE__ */ jsx(
259
281
  ToolbarButton,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-plugin-floating-toolbar",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "Floating toolbar plugin",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -16,8 +16,8 @@
16
16
  "dist"
17
17
  ],
18
18
  "dependencies": {
19
- "@haklex/rich-editor-ui": "0.0.31",
20
- "@haklex/rich-style-token": "0.0.31"
19
+ "@haklex/rich-editor-ui": "0.0.32",
20
+ "@haklex/rich-style-token": "0.0.32"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@lexical/link": "^0.40.0",