@kopexa/tiptap 17.12.6 → 17.12.7

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.
Files changed (3) hide show
  1. package/dist/index.js +55 -14
  2. package/dist/index.mjs +108 -67
  3. package/package.json +25 -25
package/dist/index.js CHANGED
@@ -5074,7 +5074,8 @@ var ColorHighlightButton = ({
5074
5074
  const buttonStyle = (0, import_react37.useMemo)(
5075
5075
  () => ({
5076
5076
  ...style,
5077
- "--highlight-color": highlightColor
5077
+ "--highlight-color": highlightColor,
5078
+ backgroundColor: highlightColor
5078
5079
  }),
5079
5080
  [highlightColor, style]
5080
5081
  );
@@ -5130,6 +5131,32 @@ var import_popover = require("@kopexa/popover");
5130
5131
  var import_toolbar2 = require("@kopexa/toolbar");
5131
5132
  var import_react38 = require("react");
5132
5133
  var import_jsx_runtime17 = require("react/jsx-runtime");
5134
+ function useResolvedHighlightColors(editor, isOpen) {
5135
+ var _a;
5136
+ const [resolved, setResolved] = (0, import_react38.useState)();
5137
+ (0, import_react38.useEffect)(() => {
5138
+ var _a2;
5139
+ if (!isOpen || !((_a2 = editor == null ? void 0 : editor.view) == null ? void 0 : _a2.dom)) return;
5140
+ const editorEl = editor.view.dom;
5141
+ const computed = getComputedStyle(editorEl);
5142
+ const colors = HIGHLIGHT_COLORS.filter(
5143
+ (c) => c.value !== "var(--tt-bg-color)"
5144
+ ).map((color) => {
5145
+ const resolveVar = (v) => {
5146
+ const match = v.match(/^var\((.+)\)$/);
5147
+ if (!match) return v;
5148
+ return computed.getPropertyValue(match[1]).trim() || v;
5149
+ };
5150
+ return {
5151
+ ...color,
5152
+ value: resolveVar(color.value),
5153
+ border: resolveVar(color.border)
5154
+ };
5155
+ });
5156
+ setResolved(colors);
5157
+ }, [isOpen, (_a = editor == null ? void 0 : editor.view) == null ? void 0 : _a.dom]);
5158
+ return resolved;
5159
+ }
5133
5160
  var ColorHighlightPopoverButton = ({
5134
5161
  className,
5135
5162
  children,
@@ -5157,7 +5184,8 @@ function ColorHighlightPopoverContent({
5157
5184
  "var(--tt-color-highlight-red)",
5158
5185
  "var(--tt-color-highlight-purple)",
5159
5186
  "var(--tt-color-highlight-yellow)"
5160
- ])
5187
+ ]),
5188
+ onApplied
5161
5189
  }) {
5162
5190
  const { handleRemoveHighlight } = useColorHighlight({ editor });
5163
5191
  const containerRef = (0, import_react38.useRef)(null);
@@ -5190,6 +5218,7 @@ function ColorHighlightPopoverContent({
5190
5218
  {
5191
5219
  editor,
5192
5220
  highlightColor: color.value,
5221
+ onApplied,
5193
5222
  "aria-label": `${color.label} highlight color`,
5194
5223
  tabIndex: index === selectedIndex ? 0 : -1,
5195
5224
  "data-highlighted": selectedIndex === index
@@ -5202,7 +5231,10 @@ function ColorHighlightPopoverContent({
5202
5231
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "tiptap-button-group", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5203
5232
  import_button8.IconButton,
5204
5233
  {
5205
- onClick: handleRemoveHighlight,
5234
+ onClick: () => {
5235
+ handleRemoveHighlight();
5236
+ onApplied == null ? void 0 : onApplied();
5237
+ },
5206
5238
  "aria-label": "Remove highlight",
5207
5239
  tabIndex: selectedIndex === colors.length ? 0 : -1,
5208
5240
  type: "button",
@@ -5217,23 +5249,25 @@ function ColorHighlightPopoverContent({
5217
5249
  }
5218
5250
  function ColorHighlightPopover({
5219
5251
  editor: providedEditor,
5220
- colors = pickHighlightColorsByValue([
5221
- "var(--tt-color-highlight-green)",
5222
- "var(--tt-color-highlight-blue)",
5223
- "var(--tt-color-highlight-red)",
5224
- "var(--tt-color-highlight-purple)",
5225
- "var(--tt-color-highlight-yellow)"
5226
- ]),
5252
+ colors,
5227
5253
  hideWhenUnavailable = false,
5228
5254
  onApplied,
5229
5255
  ...props
5230
5256
  }) {
5231
5257
  const { editor } = (0, import_editor_utils7.useTiptapEditor)(providedEditor);
5232
5258
  const [isOpen, setIsOpen] = (0, import_react38.useState)(false);
5259
+ const resolvedColors = useResolvedHighlightColors(editor, isOpen);
5260
+ const handleApplied = (0, import_react38.useCallback)(
5261
+ (result) => {
5262
+ setIsOpen(false);
5263
+ onApplied == null ? void 0 : onApplied(result);
5264
+ },
5265
+ [onApplied]
5266
+ );
5233
5267
  const { isVisible, canColorHighlight: canColorHighlight2, isActive, label } = useColorHighlight({
5234
5268
  editor,
5235
5269
  hideWhenUnavailable,
5236
- onApplied
5270
+ onApplied: handleApplied
5237
5271
  });
5238
5272
  if (!isVisible) return null;
5239
5273
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_popover.Popover.Root, { open: isOpen, onOpenChange: setIsOpen, spacing: "dense", children: [
@@ -5254,7 +5288,14 @@ function ColorHighlightPopover({
5254
5288
  )
5255
5289
  }
5256
5290
  ),
5257
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_popover.Popover.Content, { "aria-label": "Highlight colors", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ColorHighlightPopoverContent, { editor, colors }) })
5291
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_popover.Popover.Content, { "aria-label": "Highlight colors", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5292
+ ColorHighlightPopoverContent,
5293
+ {
5294
+ editor,
5295
+ colors: colors != null ? colors : resolvedColors,
5296
+ onApplied: () => setIsOpen(false)
5297
+ }
5298
+ ) })
5258
5299
  ] });
5259
5300
  }
5260
5301
 
@@ -5876,7 +5917,7 @@ var MarkButton = ({
5876
5917
 
5877
5918
  // src/ui/bubble-menu/index.tsx
5878
5919
  var import_jsx_runtime20 = require("react/jsx-runtime");
5879
- function useResolvedHighlightColors(editor) {
5920
+ function useResolvedHighlightColors2(editor) {
5880
5921
  var _a;
5881
5922
  if (!((_a = editor == null ? void 0 : editor.view) == null ? void 0 : _a.dom)) return void 0;
5882
5923
  const editorEl = editor.view.dom;
@@ -5897,7 +5938,7 @@ function useResolvedHighlightColors(editor) {
5897
5938
  );
5898
5939
  }
5899
5940
  function BubbleMenu({ editor }) {
5900
- const resolvedColors = useResolvedHighlightColors(editor);
5941
+ const resolvedColors = useResolvedHighlightColors2(editor);
5901
5942
  if (!editor) {
5902
5943
  return null;
5903
5944
  }
package/dist/index.mjs CHANGED
@@ -4405,7 +4405,7 @@ import {
4405
4405
  EditorContext
4406
4406
  } from "@tiptap/react";
4407
4407
  import {
4408
- useCallback as useCallback39,
4408
+ useCallback as useCallback40,
4409
4409
  useContext as useContext4
4410
4410
  } from "react";
4411
4411
  import { useIntl as useIntl19 } from "react-intl";
@@ -5072,7 +5072,8 @@ var ColorHighlightButton = ({
5072
5072
  const buttonStyle = useMemo13(
5073
5073
  () => ({
5074
5074
  ...style,
5075
- "--highlight-color": highlightColor
5075
+ "--highlight-color": highlightColor,
5076
+ backgroundColor: highlightColor
5076
5077
  }),
5077
5078
  [highlightColor, style]
5078
5079
  );
@@ -5126,8 +5127,34 @@ import { useTiptapEditor as useTiptapEditor4 } from "@kopexa/editor-utils";
5126
5127
  import { BanIcon, HighlighterIcon as HighlighterIcon2 } from "@kopexa/icons";
5127
5128
  import { Popover } from "@kopexa/popover";
5128
5129
  import { ToolbarSeparator } from "@kopexa/toolbar";
5129
- import { useMemo as useMemo14, useRef as useRef9, useState as useState15 } from "react";
5130
+ import { useCallback as useCallback16, useEffect as useEffect16, useMemo as useMemo14, useRef as useRef9, useState as useState15 } from "react";
5130
5131
  import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
5132
+ function useResolvedHighlightColors(editor, isOpen) {
5133
+ var _a;
5134
+ const [resolved, setResolved] = useState15();
5135
+ useEffect16(() => {
5136
+ var _a2;
5137
+ if (!isOpen || !((_a2 = editor == null ? void 0 : editor.view) == null ? void 0 : _a2.dom)) return;
5138
+ const editorEl = editor.view.dom;
5139
+ const computed = getComputedStyle(editorEl);
5140
+ const colors = HIGHLIGHT_COLORS.filter(
5141
+ (c) => c.value !== "var(--tt-bg-color)"
5142
+ ).map((color) => {
5143
+ const resolveVar = (v) => {
5144
+ const match = v.match(/^var\((.+)\)$/);
5145
+ if (!match) return v;
5146
+ return computed.getPropertyValue(match[1]).trim() || v;
5147
+ };
5148
+ return {
5149
+ ...color,
5150
+ value: resolveVar(color.value),
5151
+ border: resolveVar(color.border)
5152
+ };
5153
+ });
5154
+ setResolved(colors);
5155
+ }, [isOpen, (_a = editor == null ? void 0 : editor.view) == null ? void 0 : _a.dom]);
5156
+ return resolved;
5157
+ }
5131
5158
  var ColorHighlightPopoverButton = ({
5132
5159
  className,
5133
5160
  children,
@@ -5155,7 +5182,8 @@ function ColorHighlightPopoverContent({
5155
5182
  "var(--tt-color-highlight-red)",
5156
5183
  "var(--tt-color-highlight-purple)",
5157
5184
  "var(--tt-color-highlight-yellow)"
5158
- ])
5185
+ ]),
5186
+ onApplied
5159
5187
  }) {
5160
5188
  const { handleRemoveHighlight } = useColorHighlight({ editor });
5161
5189
  const containerRef = useRef9(null);
@@ -5188,6 +5216,7 @@ function ColorHighlightPopoverContent({
5188
5216
  {
5189
5217
  editor,
5190
5218
  highlightColor: color.value,
5219
+ onApplied,
5191
5220
  "aria-label": `${color.label} highlight color`,
5192
5221
  tabIndex: index === selectedIndex ? 0 : -1,
5193
5222
  "data-highlighted": selectedIndex === index
@@ -5200,7 +5229,10 @@ function ColorHighlightPopoverContent({
5200
5229
  /* @__PURE__ */ jsx17("div", { className: "tiptap-button-group", children: /* @__PURE__ */ jsx17(
5201
5230
  IconButton6,
5202
5231
  {
5203
- onClick: handleRemoveHighlight,
5232
+ onClick: () => {
5233
+ handleRemoveHighlight();
5234
+ onApplied == null ? void 0 : onApplied();
5235
+ },
5204
5236
  "aria-label": "Remove highlight",
5205
5237
  tabIndex: selectedIndex === colors.length ? 0 : -1,
5206
5238
  type: "button",
@@ -5215,23 +5247,25 @@ function ColorHighlightPopoverContent({
5215
5247
  }
5216
5248
  function ColorHighlightPopover({
5217
5249
  editor: providedEditor,
5218
- colors = pickHighlightColorsByValue([
5219
- "var(--tt-color-highlight-green)",
5220
- "var(--tt-color-highlight-blue)",
5221
- "var(--tt-color-highlight-red)",
5222
- "var(--tt-color-highlight-purple)",
5223
- "var(--tt-color-highlight-yellow)"
5224
- ]),
5250
+ colors,
5225
5251
  hideWhenUnavailable = false,
5226
5252
  onApplied,
5227
5253
  ...props
5228
5254
  }) {
5229
5255
  const { editor } = useTiptapEditor4(providedEditor);
5230
5256
  const [isOpen, setIsOpen] = useState15(false);
5257
+ const resolvedColors = useResolvedHighlightColors(editor, isOpen);
5258
+ const handleApplied = useCallback16(
5259
+ (result) => {
5260
+ setIsOpen(false);
5261
+ onApplied == null ? void 0 : onApplied(result);
5262
+ },
5263
+ [onApplied]
5264
+ );
5231
5265
  const { isVisible, canColorHighlight: canColorHighlight2, isActive, label } = useColorHighlight({
5232
5266
  editor,
5233
5267
  hideWhenUnavailable,
5234
- onApplied
5268
+ onApplied: handleApplied
5235
5269
  });
5236
5270
  if (!isVisible) return null;
5237
5271
  return /* @__PURE__ */ jsxs13(Popover.Root, { open: isOpen, onOpenChange: setIsOpen, spacing: "dense", children: [
@@ -5252,7 +5286,14 @@ function ColorHighlightPopover({
5252
5286
  )
5253
5287
  }
5254
5288
  ),
5255
- /* @__PURE__ */ jsx17(Popover.Content, { "aria-label": "Highlight colors", children: /* @__PURE__ */ jsx17(ColorHighlightPopoverContent, { editor, colors }) })
5289
+ /* @__PURE__ */ jsx17(Popover.Content, { "aria-label": "Highlight colors", children: /* @__PURE__ */ jsx17(
5290
+ ColorHighlightPopoverContent,
5291
+ {
5292
+ editor,
5293
+ colors: colors != null ? colors : resolvedColors,
5294
+ onApplied: () => setIsOpen(false)
5295
+ }
5296
+ ) })
5256
5297
  ] });
5257
5298
  }
5258
5299
 
@@ -5269,7 +5310,7 @@ import {
5269
5310
  import { Input as Input3 } from "@kopexa/input";
5270
5311
  import { Popover as Popover2 } from "@kopexa/popover";
5271
5312
  import { ToolbarButton as ToolbarButton2 } from "@kopexa/toolbar";
5272
- import { useCallback as useCallback17, useEffect as useEffect17, useState as useState17 } from "react";
5313
+ import { useCallback as useCallback18, useEffect as useEffect18, useState as useState17 } from "react";
5273
5314
 
5274
5315
  // src/ui/link-popover/use-link-popover.ts
5275
5316
  import { isMarkInSchema as isMarkInSchema2, useTiptapEditor as useTiptapEditor5 } from "@kopexa/editor-utils";
@@ -5526,7 +5567,7 @@ var LinkMain = ({
5526
5567
  onSave
5527
5568
  }) => {
5528
5569
  const [isEditing, setIsEditing] = useState17(!isActive || !url);
5529
- useEffect17(() => {
5570
+ useEffect18(() => {
5530
5571
  setIsEditing(!isActive || !url);
5531
5572
  }, [isActive, url]);
5532
5573
  const handleKeyDown = (event) => {
@@ -5658,18 +5699,18 @@ function LinkPopover({
5658
5699
  hideWhenUnavailable,
5659
5700
  onSetLink
5660
5701
  });
5661
- const handleOnOpenChange = useCallback17(
5702
+ const handleOnOpenChange = useCallback18(
5662
5703
  (nextIsOpen) => {
5663
5704
  setIsOpen(nextIsOpen);
5664
5705
  onOpenChange == null ? void 0 : onOpenChange(nextIsOpen);
5665
5706
  },
5666
5707
  [onOpenChange]
5667
5708
  );
5668
- const handleSetLink = useCallback17(() => {
5709
+ const handleSetLink = useCallback18(() => {
5669
5710
  setLink();
5670
5711
  setIsOpen(false);
5671
5712
  }, [setLink]);
5672
- const handleClick = useCallback17(
5713
+ const handleClick = useCallback18(
5673
5714
  (event) => {
5674
5715
  onClick == null ? void 0 : onClick(event);
5675
5716
  if (event.defaultPrevented) return;
@@ -5677,7 +5718,7 @@ function LinkPopover({
5677
5718
  },
5678
5719
  [onClick, isOpen]
5679
5720
  );
5680
- useEffect17(() => {
5721
+ useEffect18(() => {
5681
5722
  if (autoOpenOnLinkActive && isActive) {
5682
5723
  setIsOpen(true);
5683
5724
  }
@@ -5744,7 +5785,7 @@ import {
5744
5785
  } from "@kopexa/icons";
5745
5786
  import { ToolbarButton as ToolbarButton3 } from "@kopexa/toolbar";
5746
5787
  import { isNodeSelection as isNodeSelection2 } from "@tiptap/react";
5747
- import { useCallback as useCallback18, useMemo as useMemo15 } from "react";
5788
+ import { useCallback as useCallback19, useMemo as useMemo15 } from "react";
5748
5789
  import { useIntl as useIntl10 } from "react-intl";
5749
5790
  import { jsx as jsx19 } from "react/jsx-runtime";
5750
5791
  var markIcons = {
@@ -5847,7 +5888,7 @@ var MarkButton = ({
5847
5888
  shortcutKey,
5848
5889
  formattedName
5849
5890
  } = useMarkState(editor, type, disabled);
5850
- const handleClick = useCallback18(
5891
+ const handleClick = useCallback19(
5851
5892
  (e) => {
5852
5893
  onClick == null ? void 0 : onClick(e);
5853
5894
  if (!e.defaultPrevented && !isDisabled && editor) {
@@ -5892,7 +5933,7 @@ var MarkButton = ({
5892
5933
 
5893
5934
  // src/ui/bubble-menu/index.tsx
5894
5935
  import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
5895
- function useResolvedHighlightColors(editor) {
5936
+ function useResolvedHighlightColors2(editor) {
5896
5937
  var _a;
5897
5938
  if (!((_a = editor == null ? void 0 : editor.view) == null ? void 0 : _a.dom)) return void 0;
5898
5939
  const editorEl = editor.view.dom;
@@ -5913,7 +5954,7 @@ function useResolvedHighlightColors(editor) {
5913
5954
  );
5914
5955
  }
5915
5956
  function BubbleMenu({ editor }) {
5916
- const resolvedColors = useResolvedHighlightColors(editor);
5957
+ const resolvedColors = useResolvedHighlightColors2(editor);
5917
5958
  if (!editor) {
5918
5959
  return null;
5919
5960
  }
@@ -6063,39 +6104,39 @@ import { IconButton as IconButton8 } from "@kopexa/button";
6063
6104
  import { EditIcon as EditIcon3, ExternalLinkIcon as ExternalLinkIcon2, TrashIcon as TrashIcon4 } from "@kopexa/icons";
6064
6105
  import { Input as Input4 } from "@kopexa/input";
6065
6106
  import { BubbleMenu as TiptapBubbleMenu2 } from "@tiptap/react/menus";
6066
- import { useCallback as useCallback20, useEffect as useEffect20, useState as useState19 } from "react";
6107
+ import { useCallback as useCallback21, useEffect as useEffect21, useState as useState19 } from "react";
6067
6108
  import { useIntl as useIntl11 } from "react-intl";
6068
6109
  import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
6069
6110
  function LinkBubble({ editor }) {
6070
6111
  const intl = useIntl11();
6071
6112
  const [isEditing, setIsEditing] = useState19(false);
6072
6113
  const [url, setUrl] = useState19("");
6073
- const getCurrentUrl = useCallback20(() => {
6114
+ const getCurrentUrl = useCallback21(() => {
6074
6115
  if (!editor) return "";
6075
6116
  const attrs = editor.getAttributes("link");
6076
6117
  return attrs.href || "";
6077
6118
  }, [editor]);
6078
- useEffect20(() => {
6119
+ useEffect21(() => {
6079
6120
  const isLinkActive2 = editor == null ? void 0 : editor.isActive("link");
6080
6121
  if (isLinkActive2) {
6081
6122
  setUrl(getCurrentUrl());
6082
6123
  setIsEditing(false);
6083
6124
  }
6084
6125
  }, [editor, getCurrentUrl]);
6085
- const handleOpenLink = useCallback20(() => {
6126
+ const handleOpenLink = useCallback21(() => {
6086
6127
  const href = getCurrentUrl();
6087
6128
  if (href) {
6088
6129
  window.open(href, "_blank", "noopener,noreferrer");
6089
6130
  }
6090
6131
  }, [getCurrentUrl]);
6091
- const handleRemoveLink = useCallback20(() => {
6132
+ const handleRemoveLink = useCallback21(() => {
6092
6133
  editor == null ? void 0 : editor.chain().focus().unsetLink().run();
6093
6134
  }, [editor]);
6094
- const handleEdit = useCallback20(() => {
6135
+ const handleEdit = useCallback21(() => {
6095
6136
  setUrl(getCurrentUrl());
6096
6137
  setIsEditing(true);
6097
6138
  }, [getCurrentUrl]);
6098
- const handleSave = useCallback20(() => {
6139
+ const handleSave = useCallback21(() => {
6099
6140
  if (url) {
6100
6141
  editor == null ? void 0 : editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
6101
6142
  } else {
@@ -6103,7 +6144,7 @@ function LinkBubble({ editor }) {
6103
6144
  }
6104
6145
  setIsEditing(false);
6105
6146
  }, [editor, url]);
6106
- const handleKeyDown = useCallback20(
6147
+ const handleKeyDown = useCallback21(
6107
6148
  (e) => {
6108
6149
  if (e.key === "Enter") {
6109
6150
  e.preventDefault();
@@ -6256,7 +6297,7 @@ import {
6256
6297
  } from "@kopexa/editor-utils";
6257
6298
  import { TableIcon } from "@kopexa/icons";
6258
6299
  import { isNodeSelection as isNodeSelection4 } from "@tiptap/react";
6259
- import { useCallback as useCallback21, useEffect as useEffect21, useState as useState20 } from "react";
6300
+ import { useCallback as useCallback22, useEffect as useEffect22, useState as useState20 } from "react";
6260
6301
  import { useIntl as useIntl12 } from "react-intl";
6261
6302
  function canToggle(editor) {
6262
6303
  if (!editor || !editor.isEditable) return false;
@@ -6305,7 +6346,7 @@ function useTableBlock(config) {
6305
6346
  const [isVisible, setIsVisible] = useState20(true);
6306
6347
  const canToggleState = canToggle(editor);
6307
6348
  const isActive = (editor == null ? void 0 : editor.isActive("table")) || false;
6308
- useEffect21(() => {
6349
+ useEffect22(() => {
6309
6350
  if (!editor) return;
6310
6351
  const handleSelectionUpdate = () => {
6311
6352
  setIsVisible(shouldShowButton2({ editor, hideWhenUnavailable }));
@@ -6316,7 +6357,7 @@ function useTableBlock(config) {
6316
6357
  editor.off("selectionUpdate", handleSelectionUpdate);
6317
6358
  };
6318
6359
  }, [editor, hideWhenUnavailable]);
6319
- const handleToggle = useCallback21(() => {
6360
+ const handleToggle = useCallback22(() => {
6320
6361
  if (!editor) return false;
6321
6362
  const success = toggleTable(editor);
6322
6363
  if (success) {
@@ -6883,7 +6924,7 @@ import {
6883
6924
  ToolbarSeparator as ToolbarSeparator3
6884
6925
  } from "@kopexa/toolbar";
6885
6926
  import { useIsMobile as useIsMobile3 } from "@kopexa/use-is-mobile";
6886
- import { useEffect as useEffect31, useRef as useRef12, useState as useState30 } from "react";
6927
+ import { useEffect as useEffect32, useRef as useRef12, useState as useState30 } from "react";
6887
6928
  import { useIntl as useIntl18 } from "react-intl";
6888
6929
 
6889
6930
  // src/hooks/use-cursor-visibility.ts
@@ -6994,14 +7035,14 @@ import { DropdownMenu } from "@kopexa/dropdown-menu";
6994
7035
  import { isNodeInSchema as isNodeInSchema4, useTiptapEditor as useTiptapEditor11 } from "@kopexa/editor-utils";
6995
7036
  import { ChevronDownIcon, ListIcon as ListIcon4 } from "@kopexa/icons";
6996
7037
  import { isNodeSelection as isNodeSelection6 } from "@tiptap/react";
6997
- import { useCallback as useCallback25, useMemo as useMemo18, useState as useState23 } from "react";
7038
+ import { useCallback as useCallback26, useMemo as useMemo18, useState as useState23 } from "react";
6998
7039
 
6999
7040
  // src/ui/list-button/index.tsx
7000
7041
  import { Button as Button7 } from "@kopexa/button";
7001
7042
  import { isNodeInSchema as isNodeInSchema3, useTiptapEditor as useTiptapEditor10 } from "@kopexa/editor-utils";
7002
7043
  import { ListIcon as ListIcon3, ListOrderedIcon as ListOrderedIcon2, ListTodoIcon as ListTodoIcon2 } from "@kopexa/icons";
7003
7044
  import { isNodeSelection as isNodeSelection5 } from "@tiptap/react";
7004
- import { useCallback as useCallback24, useMemo as useMemo17 } from "react";
7045
+ import { useCallback as useCallback25, useMemo as useMemo17 } from "react";
7005
7046
  import { jsx as jsx23 } from "react/jsx-runtime";
7006
7047
  var listOptions = [
7007
7048
  {
@@ -7111,7 +7152,7 @@ var ListButton = ({
7111
7152
  type
7112
7153
  );
7113
7154
  const Icon = (listOption == null ? void 0 : listOption.icon) || ListIcon3;
7114
- const handleClick = useCallback24(
7155
+ const handleClick = useCallback25(
7115
7156
  (e) => {
7116
7157
  onClick == null ? void 0 : onClick(e);
7117
7158
  if (!e.defaultPrevented && editor) {
@@ -7191,7 +7232,7 @@ function useListDropdownState(editor, availableTypes) {
7191
7232
  );
7192
7233
  const canToggleAny = canToggleAnyList(editor, availableTypes);
7193
7234
  const isAnyActive = isAnyListActive(editor, availableTypes);
7194
- const handleOpenChange = useCallback25(
7235
+ const handleOpenChange = useCallback26(
7195
7236
  (open, callback) => {
7196
7237
  setIsOpen(open);
7197
7238
  callback == null ? void 0 : callback(open);
@@ -7209,7 +7250,7 @@ function useListDropdownState(editor, availableTypes) {
7209
7250
  };
7210
7251
  }
7211
7252
  function useActiveListIcon(editor, filteredLists) {
7212
- return useCallback25(() => {
7253
+ return useCallback26(() => {
7213
7254
  const activeOption = filteredLists.find(
7214
7255
  (option) => isListActive(editor, option.type)
7215
7256
  );
@@ -7242,7 +7283,7 @@ function ListDropdownMenu({
7242
7283
  canToggleAny
7243
7284
  });
7244
7285
  }, [editor, types, hideWhenUnavailable, listInSchema, canToggleAny]);
7245
- const handleOnOpenChange = useCallback25(
7286
+ const handleOnOpenChange = useCallback26(
7246
7287
  (open) => handleOpenChange(open, onOpenChange),
7247
7288
  [handleOpenChange, onOpenChange]
7248
7289
  );
@@ -7283,7 +7324,7 @@ function ListDropdownMenu({
7283
7324
  // src/ui/table-button/index.tsx
7284
7325
  import { useTiptapEditor as useTiptapEditor12 } from "@kopexa/editor-utils";
7285
7326
  import { ToolbarButton as ToolbarButton4 } from "@kopexa/toolbar";
7286
- import { useCallback as useCallback26 } from "react";
7327
+ import { useCallback as useCallback27 } from "react";
7287
7328
  import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
7288
7329
  var TableButton = ({
7289
7330
  editor: providedEditor,
@@ -7308,7 +7349,7 @@ var TableButton = ({
7308
7349
  hideWhenUnavailable,
7309
7350
  onToggled
7310
7351
  });
7311
- const handleClick = useCallback26(
7352
+ const handleClick = useCallback27(
7312
7353
  (event) => {
7313
7354
  onClick == null ? void 0 : onClick(event);
7314
7355
  if (event.defaultPrevented) return;
@@ -7346,7 +7387,7 @@ var TableButton = ({
7346
7387
  // src/ui/text-align-button/text-align-button.tsx
7347
7388
  import { IconButton as IconButton9 } from "@kopexa/button";
7348
7389
  import { useTiptapEditor as useTiptapEditor14 } from "@kopexa/editor-utils";
7349
- import { useCallback as useCallback28 } from "react";
7390
+ import { useCallback as useCallback29 } from "react";
7350
7391
 
7351
7392
  // src/ui/text-align-button/use-text-align.ts
7352
7393
  import {
@@ -7360,7 +7401,7 @@ import {
7360
7401
  AlignLeftIcon,
7361
7402
  AlignRightIcon
7362
7403
  } from "@kopexa/icons";
7363
- import { useCallback as useCallback27, useEffect as useEffect25, useState as useState24 } from "react";
7404
+ import { useCallback as useCallback28, useEffect as useEffect26, useState as useState24 } from "react";
7364
7405
  import { useIntl as useIntl14 } from "react-intl";
7365
7406
  var TEXT_ALIGN_SHORTCUT_KEYS = {
7366
7407
  left: "mod+shift+l",
@@ -7423,7 +7464,7 @@ function useTextAlign(config) {
7423
7464
  const [isVisible, setIsVisible] = useState24(true);
7424
7465
  const canAlign = canSetTextAlign(editor, align);
7425
7466
  const isActive = isTextAlignActive(editor, align);
7426
- useEffect25(() => {
7467
+ useEffect26(() => {
7427
7468
  if (!editor) return;
7428
7469
  const handleSelectionUpdate = () => {
7429
7470
  setIsVisible(shouldShowButton3({ editor, align, hideWhenUnavailable }));
@@ -7434,7 +7475,7 @@ function useTextAlign(config) {
7434
7475
  editor.off("selectionUpdate", handleSelectionUpdate);
7435
7476
  };
7436
7477
  }, [editor, hideWhenUnavailable, align]);
7437
- const handleTextAlign = useCallback27(() => {
7478
+ const handleTextAlign = useCallback28(() => {
7438
7479
  if (!editor) return false;
7439
7480
  const success = setTextAlign(editor, align);
7440
7481
  if (success) {
@@ -7481,7 +7522,7 @@ var TextAlignButton = ({
7481
7522
  hideWhenUnavailable,
7482
7523
  onAligned
7483
7524
  });
7484
- const handleClick = useCallback28(
7525
+ const handleClick = useCallback29(
7485
7526
  (e) => {
7486
7527
  onClick == null ? void 0 : onClick(e);
7487
7528
  if (e.defaultPrevented) return;
@@ -7711,7 +7752,7 @@ var BlockquoteButton = ({
7711
7752
  import { useTiptapEditor as useTiptapEditor18 } from "@kopexa/editor-utils";
7712
7753
  import { CodeblockIcon as CodeblockIcon2 } from "@kopexa/icons";
7713
7754
  import { ToolbarButton as ToolbarButton6 } from "@kopexa/toolbar";
7714
- import { useCallback as useCallback32 } from "react";
7755
+ import { useCallback as useCallback33 } from "react";
7715
7756
 
7716
7757
  // src/ui/codeblock-button/use-code-block.ts
7717
7758
  import {
@@ -7851,7 +7892,7 @@ var CodeBlockButton = ({
7851
7892
  hideWhenUnavailable,
7852
7893
  onToggled
7853
7894
  });
7854
- const handleClick = useCallback32(
7895
+ const handleClick = useCallback33(
7855
7896
  (event) => {
7856
7897
  onClick == null ? void 0 : onClick(event);
7857
7898
  if (event.defaultPrevented) return;
@@ -8048,7 +8089,7 @@ import { Button as Button10 } from "@kopexa/button";
8048
8089
  import { Chip } from "@kopexa/chip";
8049
8090
  import { useTiptapEditor as useTiptapEditor21 } from "@kopexa/editor-utils";
8050
8091
  import { parseShortcutKeys } from "@kopexa/shared-utils";
8051
- import { useCallback as useCallback35 } from "react";
8092
+ import { useCallback as useCallback36 } from "react";
8052
8093
 
8053
8094
  // src/ui/text-button/use-text.ts
8054
8095
  import {
@@ -8062,7 +8103,7 @@ import {
8062
8103
  import { TypeIcon as TypeIcon2 } from "@kopexa/icons";
8063
8104
  import { useIsMobile as useIsMobile2 } from "@kopexa/use-is-mobile";
8064
8105
  import { NodeSelection as NodeSelection4, TextSelection as TextSelection4 } from "@tiptap/pm/state";
8065
- import { useCallback as useCallback34, useEffect as useEffect28, useState as useState27 } from "react";
8106
+ import { useCallback as useCallback35, useEffect as useEffect29, useState as useState27 } from "react";
8066
8107
  import { useHotkeys as useHotkeys2 } from "react-hotkeys-hook";
8067
8108
  var TEXT_SHORTCUT_KEY = "mod+alt+0";
8068
8109
  function canToggleText(editor, turnInto = true) {
@@ -8158,7 +8199,7 @@ function useText(config) {
8158
8199
  const [isVisible, setIsVisible] = useState27(true);
8159
8200
  const canToggle3 = canToggleText(editor);
8160
8201
  const isActive = isParagraphActive(editor);
8161
- useEffect28(() => {
8202
+ useEffect29(() => {
8162
8203
  if (!editor) return;
8163
8204
  const handleSelectionUpdate = () => {
8164
8205
  setIsVisible(shouldShowButton6({ editor, hideWhenUnavailable }));
@@ -8169,7 +8210,7 @@ function useText(config) {
8169
8210
  editor.off("selectionUpdate", handleSelectionUpdate);
8170
8211
  };
8171
8212
  }, [editor, hideWhenUnavailable]);
8172
- const handleToggle = useCallback34(() => {
8213
+ const handleToggle = useCallback35(() => {
8173
8214
  if (!editor) return false;
8174
8215
  const success = toggleParagraph(editor);
8175
8216
  if (success) {
@@ -8232,7 +8273,7 @@ var TextButton = ({
8232
8273
  hideWhenUnavailable,
8233
8274
  onToggled
8234
8275
  });
8235
- const handleClick = useCallback35(
8276
+ const handleClick = useCallback36(
8236
8277
  (event) => {
8237
8278
  onClick == null ? void 0 : onClick(event);
8238
8279
  if (event.defaultPrevented) return;
@@ -8273,7 +8314,7 @@ var TextButton = ({
8273
8314
  import { useTiptapEditor as useTiptapEditor22 } from "@kopexa/editor-utils";
8274
8315
  import { ChevronDownIcon as ChevronDownIcon2 } from "@kopexa/icons";
8275
8316
  import { NodeSelection as NodeSelection5 } from "@tiptap/pm/state";
8276
- import { useCallback as useCallback36, useEffect as useEffect29, useMemo as useMemo20, useState as useState28 } from "react";
8317
+ import { useCallback as useCallback37, useEffect as useEffect30, useMemo as useMemo20, useState as useState28 } from "react";
8277
8318
  import { useIntl as useIntl15 } from "react-intl";
8278
8319
  var TURN_INTO_BLOCKS = [
8279
8320
  "paragraph",
@@ -8394,7 +8435,7 @@ function useTurnIntoDropdown(config) {
8394
8435
  (opt) => blockTypes.includes(opt.type)
8395
8436
  );
8396
8437
  }, [blockTypes, translatedBlockTypeOptions]);
8397
- const handleOpenChange = useCallback36(
8438
+ const handleOpenChange = useCallback37(
8398
8439
  (open) => {
8399
8440
  if (!editor || !canToggle3) return;
8400
8441
  setIsOpen(open);
@@ -8402,7 +8443,7 @@ function useTurnIntoDropdown(config) {
8402
8443
  },
8403
8444
  [canToggle3, editor, onOpenChange]
8404
8445
  );
8405
- useEffect29(() => {
8446
+ useEffect30(() => {
8406
8447
  if (!editor) return;
8407
8448
  const handleSelectionUpdate = () => {
8408
8449
  setIsVisible(
@@ -8604,12 +8645,12 @@ TurnIntoDropdown.displayName = "TurnIntoDropdown";
8604
8645
  // src/ui/undo-redo-button/undo-redo-button.tsx
8605
8646
  import { useTiptapEditor as useTiptapEditor25 } from "@kopexa/editor-utils";
8606
8647
  import { ToolbarButton as ToolbarButton7 } from "@kopexa/toolbar";
8607
- import { useCallback as useCallback38 } from "react";
8648
+ import { useCallback as useCallback39 } from "react";
8608
8649
 
8609
8650
  // src/ui/undo-redo-button/use-undo-redo.ts
8610
8651
  import { isNodeTypeSelected as isNodeTypeSelected7, useTiptapEditor as useTiptapEditor24 } from "@kopexa/editor-utils";
8611
8652
  import { RedoIcon, UndoIcon } from "@kopexa/icons";
8612
- import { useCallback as useCallback37, useEffect as useEffect30, useState as useState29 } from "react";
8653
+ import { useCallback as useCallback38, useEffect as useEffect31, useState as useState29 } from "react";
8613
8654
  import { useIntl as useIntl17 } from "react-intl";
8614
8655
  var UNDO_REDO_SHORTCUT_KEYS = {
8615
8656
  undo: "mod+z",
@@ -8653,7 +8694,7 @@ function useUndoRedo(config) {
8653
8694
  const { editor } = useTiptapEditor24(providedEditor);
8654
8695
  const [isVisible, setIsVisible] = useState29(true);
8655
8696
  const canExecute = canExecuteUndoRedoAction(editor, action);
8656
- useEffect30(() => {
8697
+ useEffect31(() => {
8657
8698
  if (!editor) return;
8658
8699
  const handleUpdate = () => {
8659
8700
  setIsVisible(shouldShowButton7({ editor, hideWhenUnavailable, action }));
@@ -8664,7 +8705,7 @@ function useUndoRedo(config) {
8664
8705
  editor.off("transaction", handleUpdate);
8665
8706
  };
8666
8707
  }, [editor, hideWhenUnavailable, action]);
8667
- const handleAction = useCallback37(() => {
8708
+ const handleAction = useCallback38(() => {
8668
8709
  if (!editor) return false;
8669
8710
  const success = executeUndoRedoAction(editor, action);
8670
8711
  if (success) {
@@ -8702,7 +8743,7 @@ var UndoRedoButton = ({
8702
8743
  hideWhenUnavailable,
8703
8744
  onExecuted
8704
8745
  });
8705
- const handleClick = useCallback38(
8746
+ const handleClick = useCallback39(
8706
8747
  (event) => {
8707
8748
  onClick == null ? void 0 : onClick(event);
8708
8749
  if (event.defaultPrevented) return;
@@ -8816,7 +8857,7 @@ function MoreOptions({
8816
8857
  const { editor } = useTiptapEditor26(providedEditor);
8817
8858
  const [show, setShow] = useState30(false);
8818
8859
  const moreOptionsLabel = intl.formatMessage(messages7.more_options);
8819
- useEffect31(() => {
8860
+ useEffect32(() => {
8820
8861
  if (!editor) return;
8821
8862
  const handleSelectionUpdate = () => {
8822
8863
  setShow(
@@ -8929,7 +8970,7 @@ var BasicEditor = ({
8929
8970
  ...options
8930
8971
  });
8931
8972
  const styles = editorBasic({ variant, bordered });
8932
- const resolveVariable = useCallback39(
8973
+ const resolveVariable = useCallback40(
8933
8974
  (name) => variableValues == null ? void 0 : variableValues[name],
8934
8975
  [variableValues]
8935
8976
  );
@@ -8966,7 +9007,7 @@ var EditorContentArea = ({
8966
9007
  const { editor } = useContext4(EditorContext);
8967
9008
  const { isDragging } = useUiEditorState(editor);
8968
9009
  useScrollToHash();
8969
- const handleKeyDown = useCallback39(
9010
+ const handleKeyDown = useCallback40(
8970
9011
  (e) => {
8971
9012
  if (!(editor == null ? void 0 : editor.isFocused)) return;
8972
9013
  const isMod = e.metaKey || e.ctrlKey;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kopexa/tiptap",
3
- "version": "17.12.6",
3
+ "version": "17.12.7",
4
4
  "description": "our tiptap components",
5
5
  "keywords": [
6
6
  "tiptap"
@@ -30,7 +30,7 @@
30
30
  "react": ">=19.0.0-rc.0",
31
31
  "react-dom": ">=19.0.0-rc.0",
32
32
  "yjs": "^13.6.0",
33
- "@kopexa/theme": "17.27.0"
33
+ "@kopexa/theme": "17.27.1"
34
34
  },
35
35
  "dependencies": {
36
36
  "@floating-ui/dom": "^1.7.6",
@@ -67,29 +67,29 @@
67
67
  "react-hotkeys-hook": "^5.2.4",
68
68
  "react-intl": "^7.1.14",
69
69
  "y-indexeddb": "^9.0.12",
70
- "@kopexa/button": "17.0.74",
71
- "@kopexa/callout": "17.0.74",
72
- "@kopexa/dropdown-menu": "17.0.74",
73
- "@kopexa/editor-utils": "17.2.15",
74
- "@kopexa/extension-code": "17.0.74",
75
- "@kopexa/sight": "17.13.2",
76
- "@kopexa/extension-controlref": "17.1.56",
77
- "@kopexa/chip": "17.1.71",
78
- "@kopexa/extension-pages": "17.1.5",
79
- "@kopexa/extension-table": "17.1.26",
80
- "@kopexa/icons": "17.10.3",
81
- "@kopexa/input": "17.0.74",
82
- "@kopexa/popover": "17.2.39",
83
- "@kopexa/label": "17.0.74",
84
- "@kopexa/select": "17.2.39",
85
- "@kopexa/react-utils": "17.1.16",
86
- "@kopexa/separator": "17.0.74",
87
- "@kopexa/switch": "17.2.39",
88
- "@kopexa/shared-utils": "17.0.74",
89
- "@kopexa/use-is-mobile": "17.0.74",
90
- "@kopexa/tabs": "17.0.74",
91
- "@kopexa/toolbar": "17.2.39",
92
- "@kopexa/use-composed-ref": "17.0.74"
70
+ "@kopexa/button": "17.0.75",
71
+ "@kopexa/chip": "17.1.72",
72
+ "@kopexa/dropdown-menu": "17.0.75",
73
+ "@kopexa/callout": "17.0.75",
74
+ "@kopexa/sight": "17.13.3",
75
+ "@kopexa/editor-utils": "17.2.16",
76
+ "@kopexa/extension-code": "17.0.75",
77
+ "@kopexa/extension-pages": "17.1.6",
78
+ "@kopexa/extension-controlref": "17.1.57",
79
+ "@kopexa/extension-table": "17.1.27",
80
+ "@kopexa/icons": "17.10.4",
81
+ "@kopexa/input": "17.0.75",
82
+ "@kopexa/label": "17.0.75",
83
+ "@kopexa/popover": "17.2.40",
84
+ "@kopexa/select": "17.2.40",
85
+ "@kopexa/switch": "17.2.40",
86
+ "@kopexa/react-utils": "17.1.17",
87
+ "@kopexa/separator": "17.0.75",
88
+ "@kopexa/tabs": "17.0.75",
89
+ "@kopexa/toolbar": "17.2.40",
90
+ "@kopexa/shared-utils": "17.0.75",
91
+ "@kopexa/use-composed-ref": "17.0.75",
92
+ "@kopexa/use-is-mobile": "17.0.75"
93
93
  },
94
94
  "clean-package": "../../../clean-package.config.json",
95
95
  "module": "dist/index.mjs",