@haklex/rich-plugin-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":"ToolbarPlugin.d.ts","sourceRoot":"","sources":["../src/ToolbarPlugin.tsx"],"names":[],"mappings":"AAgEA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAkHzD,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,qBAAwD,EACxD,eAAe,GAChB,EAAE,kBAAkB,GAAG,YAAY,CA4YnC"}
1
+ {"version":3,"file":"ToolbarPlugin.d.ts","sourceRoot":"","sources":["../src/ToolbarPlugin.tsx"],"names":[],"mappings":"AAqEA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAoHzD,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,qBAAwD,EACxD,eAAe,GAChB,EAAE,kBAAkB,GAAG,YAAY,CAoZnC"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { collectCommandItems } from "@haklex/rich-editor/commands";
2
+ import { collectCommandItems, $selectionTouchesSpoiler, $toggleSpoilerSelection } from "@haklex/rich-editor/commands";
3
3
  import { TooltipTrigger, TooltipRoot, TooltipContent, DropdownMenuContent, DropdownMenuItem, DropdownMenu, DropdownMenuTrigger, createTooltipHandle, TooltipProvider } from "@haklex/rich-editor-ui";
4
4
  import { $isListNode, INSERT_UNORDERED_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, INSERT_CHECK_LIST_COMMAND } from "@lexical/list";
5
5
  import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
@@ -7,7 +7,7 @@ import { $createHeadingNode, $isHeadingNode } from "@lexical/rich-text";
7
7
  import { $getSelectionStyleValueForProperty, $patchStyleText, $setBlocksType } from "@lexical/selection";
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
- import { ChevronDown, Pilcrow, Heading1, Heading2, Heading3, Undo, Redo, Bold, Italic, Underline, Strikethrough, Code, Highlighter, List, ListOrdered, ListChecks, AlignLeft, AlignCenter, AlignRight, AlignJustify, Ellipsis } from "lucide-react";
10
+ import { ChevronDown, Pilcrow, Heading1, Heading2, Heading3, Undo, Redo, Bold, Italic, Underline, Strikethrough, Code, Highlighter, EyeOff, List, ListOrdered, ListChecks, AlignLeft, AlignCenter, AlignRight, AlignJustify, Ellipsis } from "lucide-react";
11
11
  import { useState, useMemo, useCallback, useEffect } from "react";
12
12
  var toolbarContainer = "_1e1ersc0";
13
13
  var toolbarRow = "_1e1ersc1";
@@ -178,7 +178,8 @@ const INITIAL_STATE = {
178
178
  isUnderline: false,
179
179
  isStrikethrough: false,
180
180
  isCode: false,
181
- isHighlight: false
181
+ isHighlight: false,
182
+ isSpoiler: false
182
183
  };
183
184
  function getBlockType(anchorNode) {
184
185
  if ($isHeadingNode(anchorNode)) {
@@ -244,7 +245,8 @@ function ToolbarPlugin({
244
245
  isUnderline: selection.hasFormat("underline"),
245
246
  isStrikethrough: selection.hasFormat("strikethrough"),
246
247
  isCode: selection.hasFormat("code"),
247
- isHighlight: selection.hasFormat("highlight")
248
+ isHighlight: selection.hasFormat("highlight"),
249
+ isSpoiler: $selectionTouchesSpoiler(selection)
248
250
  }));
249
251
  }, []);
250
252
  useEffect(() => {
@@ -469,6 +471,16 @@ function ToolbarPlugin({
469
471
  onClick: () => editor.dispatchCommand(FORMAT_TEXT_COMMAND, "highlight")
470
472
  }
471
473
  ),
474
+ /* @__PURE__ */ jsx(
475
+ ToolbarButton,
476
+ {
477
+ active: state.isSpoiler,
478
+ icon: /* @__PURE__ */ jsx(EyeOff, { size: ICON_SIZE, strokeWidth: ICON_STROKE }),
479
+ title: "Spoiler",
480
+ tooltipHandle: h,
481
+ onClick: () => editor.update($toggleSpoilerSelection)
482
+ }
483
+ ),
472
484
  /* @__PURE__ */ jsx(ToolbarSeparator, {}),
473
485
  /* @__PURE__ */ jsx(
474
486
  ToolbarButton,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-plugin-toolbar",
3
- "version": "0.0.86",
3
+ "version": "0.0.88",
4
4
  "description": "Top toolbar plugin for rich editor",
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.86",
25
- "@haklex/rich-editor-ui": "0.0.86",
26
- "@haklex/rich-style-token": "0.0.86"
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/list": "^0.42.0",