@tn-pulse-suivi/notion-ui-comps 1.0.5 → 1.0.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.
package/dist/index.cjs CHANGED
@@ -2625,7 +2625,7 @@ var getSlashMenuItemsTexts = (tNL) => ({
2625
2625
  group: "Upload"
2626
2626
  }
2627
2627
  });
2628
- var getItemImplementations = (commonFns) => {
2628
+ var getItemImplementations = (commonHelpFns) => {
2629
2629
  return {
2630
2630
  // Style
2631
2631
  text: {
@@ -2686,7 +2686,7 @@ var getItemImplementations = (commonFns) => {
2686
2686
  status: {
2687
2687
  check: (editor) => isNodeInSchema("statusNode", editor),
2688
2688
  action: ({ editor }) => {
2689
- const { getSnackCont, t } = commonFns;
2689
+ const { getSnackCont, t } = commonHelpFns;
2690
2690
  const { view, schema } = editor;
2691
2691
  const { state, dispatch } = view;
2692
2692
  const { nodes } = schema;
@@ -2695,12 +2695,12 @@ var getItemImplementations = (commonFns) => {
2695
2695
  const { pos } = $from;
2696
2696
  const selectedNode = doc.cut(pos, $to.pos);
2697
2697
  const { domAtPos } = view;
2698
- const statusNodeDomNode = commonFns.findDomRefAtPos(pos, domAtPos.bind(view));
2698
+ const statusNodeDomNode = commonHelpFns.findDomRefAtPos(pos, domAtPos.bind(view));
2699
2699
  if (statusNodeDomNode.tagName === "STATUS-NODE") {
2700
2700
  const statusNodeDomNodeText = statusNodeDomNode.getAttribute("text");
2701
2701
  const emptyStatusPopupInputPlaceholder = t("emptyStatusPopupInputPlaceholder");
2702
2702
  const nodeAtPos = doc.nodeAt(pos);
2703
- if (commonFns.equalNodeType(nodes.statusNode, nodeAtPos)) {
2703
+ if (commonHelpFns.equalNodeType(nodes.statusNode, nodeAtPos)) {
2704
2704
  if (statusNodeDomNodeText === emptyStatusPopupInputPlaceholder) {
2705
2705
  dispatch(tr.delete(pos, pos + 1));
2706
2706
  } else {
@@ -2708,7 +2708,7 @@ var getItemImplementations = (commonFns) => {
2708
2708
  }
2709
2709
  }
2710
2710
  } else {
2711
- const textNodes = commonFns.findTextNodes(selectedNode);
2711
+ const textNodes = commonHelpFns.findTextNodes(selectedNode);
2712
2712
  const selectedText = textNodes.reduce(function(accumulateur, nodeData) {
2713
2713
  return accumulateur + " " + nodeData.node.text;
2714
2714
  }, "").trim();
@@ -2719,7 +2719,7 @@ var getItemImplementations = (commonFns) => {
2719
2719
  console.error("MenuBar : [statusNode::tr.replaceSelectionWith(newStatusNode)] : error : ", error);
2720
2720
  }
2721
2721
  try {
2722
- commonFns.openStatusPopup(
2722
+ commonHelpFns.openStatusPopup(
2723
2723
  selectedText,
2724
2724
  null,
2725
2725
  pos,
@@ -2739,7 +2739,7 @@ var getItemImplementations = (commonFns) => {
2739
2739
  video: {
2740
2740
  check: (editor) => isNodeInSchema("videoNode", editor),
2741
2741
  action: ({ editor }) => {
2742
- const { setVideoUrlDialogData } = commonFns;
2742
+ const { setVideoUrlDialogData } = commonHelpFns;
2743
2743
  console.log("\u{1F680} ~ getItemImplementations video action ~ FN ? :", Boolean(setVideoUrlDialogData));
2744
2744
  setVideoUrlDialogData({
2745
2745
  onCancel: () => {
@@ -2811,12 +2811,12 @@ function organizeItemsByGroups(items, showGroups) {
2811
2811
  function useSlashDropdownMenu(config) {
2812
2812
  const { t: tNotionLike } = (0, import_react_i18next.useTranslation)("notionLike" /* notionLike */);
2813
2813
  const getSlashMenuItems = (0, import_react38.useCallback)(
2814
- (editor, commonFns) => {
2814
+ (editor, commonHelpFns) => {
2815
2815
  const items = [];
2816
2816
  const texts = getSlashMenuItemsTexts(tNotionLike);
2817
2817
  const enabledItems = config?.enabledItems || Object.keys(texts);
2818
2818
  const showGroups = config?.showGroups !== false;
2819
- const itemImplementations = getItemImplementations(commonFns);
2819
+ const itemImplementations = getItemImplementations(commonHelpFns);
2820
2820
  enabledItems.forEach((itemType) => {
2821
2821
  const itemImpl = itemImplementations[itemType];
2822
2822
  const itemText = texts[itemType];
@@ -2873,7 +2873,7 @@ Separator.displayName = "Separator";
2873
2873
  var import_i18next = __toESM(require("i18next"), 1);
2874
2874
  var import_jsx_runtime24 = require("react/jsx-runtime");
2875
2875
  var SlashDropdownMenu = (props) => {
2876
- const { config, commonFns, ...restProps } = props;
2876
+ const { config, commonHelpFns, ...restProps } = props;
2877
2877
  const { getSlashMenuItems } = useSlashDropdownMenu(config);
2878
2878
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material3.Portal, { container: () => document.body, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2879
2879
  SuggestionMenu,
@@ -2883,7 +2883,7 @@ var SlashDropdownMenu = (props) => {
2883
2883
  decorationClass: "tiptap-slash-decoration " + import_i18next.default.language,
2884
2884
  decorationContent: "Filter...",
2885
2885
  selector: "tiptap-slash-dropdown-menu",
2886
- items: ({ query, editor }) => filterSuggestionItems(getSlashMenuItems(editor, commonFns), query),
2886
+ items: ({ query, editor }) => filterSuggestionItems(getSlashMenuItems(editor, commonHelpFns), query),
2887
2887
  ...restProps,
2888
2888
  children: (props2) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(List, { ...props2, config })
2889
2889
  }
@@ -9067,7 +9067,7 @@ var SubMenuTrigger = ({ icon: Icon, label, children }) => /* @__PURE__ */ (0, im
9067
9067
  children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(MenuContent, { portal: true, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ComboboxList2, { children }) })
9068
9068
  }
9069
9069
  );
9070
- var TransformActionGroup = ({ tNotionLike, commonFns }) => {
9070
+ var TransformActionGroup = ({ tNotionLike, commonHelpFns }) => {
9071
9071
  const actions = useNodeTransformActions(tNotionLike);
9072
9072
  const { canReset, handleResetFormatting, label, Icon } = useResetAllFormatting({
9073
9073
  hideWhenUnavailable: true,
@@ -9077,7 +9077,7 @@ var TransformActionGroup = ({ tNotionLike, commonFns }) => {
9077
9077
  if (!actions && !canReset) return null;
9078
9078
  return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
9079
9079
  actions && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(SubMenuTrigger, { icon: Repeat2Icon, label: tNotionLike("TurnInto"), children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(MenuGroup2, { children: [
9080
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(MenuGroupLabel, { children: commonFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()) }),
9080
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(MenuGroupLabel, { children: commonHelpFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()) }),
9081
9081
  actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(BaseMenuItem, { ...action }, action.label))
9082
9082
  ] }) }),
9083
9083
  canReset && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(BaseMenuItem, { icon: Icon, label, disabled: !canReset, onClick: handleResetFormatting }),
@@ -9183,7 +9183,7 @@ var DragContextMenu = ({
9183
9183
  withSlashCommandTrigger = true,
9184
9184
  mobileBreakpoint = 768,
9185
9185
  tNotionLike,
9186
- commonFns,
9186
+ commonHelpFns,
9187
9187
  ...props
9188
9188
  }) => {
9189
9189
  const { editor } = useTiptapEditor(providedEditor);
@@ -9303,10 +9303,10 @@ var DragContextMenu = ({
9303
9303
  /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ColorMenu, { tNotionLike }),
9304
9304
  /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TableAlignMenu, { tNotionLike }),
9305
9305
  /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TableFitToWidth, { tNotionLike }),
9306
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TransformActionGroup, { tNotionLike, commonFns }),
9306
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TransformActionGroup, { tNotionLike, commonHelpFns }),
9307
9307
  /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ImageActionGroup, {})
9308
9308
  ] }),
9309
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(CoreActionGroup, { tNotionLike, commonFns }),
9309
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(CoreActionGroup, { tNotionLike, commonHelpFns }),
9310
9310
  /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DeleteActionGroup, { tNotionLike })
9311
9311
  ] })
9312
9312
  ] })
@@ -10939,7 +10939,7 @@ var TurnIntoDropdownContent = ({
10939
10939
  blockTypes,
10940
10940
  useCardLayout = true,
10941
10941
  tNotionLike,
10942
- commonFns
10942
+ commonHelpFns
10943
10943
  }) => {
10944
10944
  const filteredOptions = getFilteredBlockTypeOptions(tNotionLike, blockTypes);
10945
10945
  const renderButtons = () => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ButtonGroup, { children: filteredOptions.map(
@@ -10947,7 +10947,7 @@ var TurnIntoDropdownContent = ({
10947
10947
  ) });
10948
10948
  if (!useCardLayout) return renderButtons();
10949
10949
  return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(CardBody, { children: /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(CardItemGroup, { children: [
10950
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(CardGroupLabel, { children: commonFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()) }),
10950
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(CardGroupLabel, { children: commonHelpFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()) }),
10951
10951
  renderButtons()
10952
10952
  ] }) }) });
10953
10953
  };
@@ -10983,7 +10983,7 @@ var TurnIntoDropdown = (0, import_react138.forwardRef)(
10983
10983
  onOpenChange,
10984
10984
  children,
10985
10985
  tNotionLike,
10986
- commonFns,
10986
+ commonHelpFns,
10987
10987
  ...buttonProps
10988
10988
  }, ref) => {
10989
10989
  const { editor } = useTiptapEditor(providedEditor);
@@ -10993,7 +10993,7 @@ var TurnIntoDropdown = (0, import_react138.forwardRef)(
10993
10993
  blockTypes,
10994
10994
  onOpenChange,
10995
10995
  tNotionLike,
10996
- commonFns
10996
+ commonHelpFns
10997
10997
  });
10998
10998
  if (!isVisible) {
10999
10999
  return null;
@@ -11009,7 +11009,7 @@ var TurnIntoDropdown = (0, import_react138.forwardRef)(
11009
11009
  role: "button",
11010
11010
  tabIndex: -1,
11011
11011
  "aria-label": label,
11012
- tooltip: commonFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()),
11012
+ tooltip: commonHelpFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()),
11013
11013
  ...buttonProps,
11014
11014
  ref,
11015
11015
  children: children ?? /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
@@ -11018,7 +11018,7 @@ var TurnIntoDropdown = (0, import_react138.forwardRef)(
11018
11018
  ] })
11019
11019
  }
11020
11020
  ) }),
11021
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(DropdownMenuContent, { align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(TurnIntoDropdownContent, { blockTypes, useCardLayout, tNotionLike, commonFns }) })
11021
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(DropdownMenuContent, { align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(TurnIntoDropdownContent, { blockTypes, useCardLayout, tNotionLike, commonHelpFns }) })
11022
11022
  ] });
11023
11023
  }
11024
11024
  );
@@ -11122,7 +11122,7 @@ function shouldShowTurnInto(params) {
11122
11122
  return true;
11123
11123
  }
11124
11124
  function useTurnIntoDropdown(config) {
11125
- const { editor: providedEditor, hideWhenUnavailable = false, blockTypes, onOpenChange, tNotionLike, commonFns } = config || {};
11125
+ const { editor: providedEditor, hideWhenUnavailable = false, blockTypes, onOpenChange, tNotionLike, commonHelpFns } = config || {};
11126
11126
  const { editor } = useTiptapEditor(providedEditor);
11127
11127
  const [isOpen, setIsOpen] = (0, import_react139.useState)(false);
11128
11128
  const [isVisible, setIsVisible] = (0, import_react139.useState)(true);
@@ -11161,7 +11161,7 @@ function useTurnIntoDropdown(config) {
11161
11161
  activeBlockType,
11162
11162
  handleOpenChange,
11163
11163
  filteredOptions: getFilteredBlockTypeOptions(tNotionLike, blockTypes),
11164
- label: commonFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()) + ` (current: ${activeBlockType?.label || tNotionLike("Text")})`,
11164
+ label: commonHelpFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()) + ` (current: ${activeBlockType?.label || tNotionLike("Text")})`,
11165
11165
  Icon: ChevronDownIcon
11166
11166
  };
11167
11167
  }
@@ -11643,7 +11643,7 @@ var import_react_i18next3 = require("react-i18next");
11643
11643
  var import_react_fontawesome = require("@fortawesome/react-fontawesome");
11644
11644
  var import_jsx_runtime100 = require("react/jsx-runtime");
11645
11645
  function ImageExpandButton(props) {
11646
- const { commonFns, customIcons } = props;
11646
+ const { commonHelpFns } = props;
11647
11647
  const { t } = (0, import_react_i18next3.useTranslation)("richText" /* richText */);
11648
11648
  const { currentSelectedImgId } = window;
11649
11649
  return currentSelectedImgId ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
@@ -11657,10 +11657,10 @@ function ImageExpandButton(props) {
11657
11657
  "aria-label": "Preview",
11658
11658
  tooltip: t("Preview"),
11659
11659
  onClick: (e) => {
11660
- commonFns.ExpandImgIconClickHAndler(e, currentSelectedImgId);
11661
- commonFns.stopEventPropagation(e);
11660
+ commonHelpFns.ExpandImgIconClickHAndler(e, currentSelectedImgId);
11661
+ commonHelpFns.stopEventPropagation(e);
11662
11662
  },
11663
- children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react_fontawesome.FontAwesomeIcon, { id: "ImageExpandBtnIcon", icon: customIcons.faExpand, style: { height: 20, width: "auto" } })
11663
+ children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react_fontawesome.FontAwesomeIcon, { id: "ImageExpandBtnIcon", icon: commonHelpFns.customIcons.faExpand, style: { height: 20, width: "auto" } })
11664
11664
  }
11665
11665
  ) : "";
11666
11666
  }
@@ -12226,8 +12226,7 @@ var import_jsx_runtime108 = require("react/jsx-runtime");
12226
12226
  function ImageNodeFloating({
12227
12227
  editor: providedEditor,
12228
12228
  tNotionLike,
12229
- commonFns,
12230
- customIcons
12229
+ commonHelpFns
12231
12230
  }) {
12232
12231
  const { editor } = useTiptapEditor(providedEditor);
12233
12232
  const visible = isNodeTypeSelected(editor, ["image"]);
@@ -12235,7 +12234,7 @@ function ImageNodeFloating({
12235
12234
  return null;
12236
12235
  }
12237
12236
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(import_jsx_runtime108.Fragment, { children: [
12238
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(image_expand_button_default, { commonFns, customIcons }),
12237
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(image_expand_button_default, { commonHelpFns }),
12239
12238
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ImageAlignButton, { align: "left" }),
12240
12239
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ImageAlignButton, { align: "center" }),
12241
12240
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ImageAlignButton, { align: "right" }),
@@ -12416,25 +12415,25 @@ function ColorActionGroup({ tNotionLike }) {
12416
12415
  ] }) }) }) })
12417
12416
  ] });
12418
12417
  }
12419
- function TransformActionGroup2({ tNotionLike, commonFns }) {
12418
+ function TransformActionGroup2({ tNotionLike, commonHelpFns }) {
12420
12419
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(DropdownMenuSub, { children: [
12421
12420
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuSubTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Button, { "data-style": "ghost", children: [
12422
12421
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Repeat2Icon, { className: "tiptap-button-icon" }),
12423
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "tiptap-button-text", children: commonFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()) }),
12422
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "tiptap-button-text", children: commonHelpFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()) }),
12424
12423
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Spacer, {}),
12425
12424
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ChevronRightIcon, { className: "tiptap-button-icon" })
12426
12425
  ] }) }),
12427
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuSubContent, { children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(TurnIntoDropdownContent, { tNotionLike, commonFns }) })
12426
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuSubContent, { children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(TurnIntoDropdownContent, { tNotionLike, commonHelpFns }) })
12428
12427
  ] });
12429
12428
  }
12430
- function DropdownMenuActions({ editor, tNotionLike, commonFns }) {
12429
+ function DropdownMenuActions({ editor, tNotionLike, commonHelpFns }) {
12431
12430
  const isMobile = useIsBreakpoint();
12432
12431
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(CardBody, { children: [
12433
12432
  /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(CardItemGroup, { children: [
12434
12433
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(CardGroupLabel, { children: getNodeDisplayName(editor, tNotionLike) }),
12435
12434
  /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(ButtonGroup, { children: [
12436
12435
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ColorActionGroup, { tNotionLike }),
12437
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(TransformActionGroup2, { tNotionLike, commonFns }),
12436
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(TransformActionGroup2, { tNotionLike, commonHelpFns }),
12438
12437
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ResetAllFormattingButton, { text: tNotionLike("ResetFormatting"), tNotionLike }) })
12439
12438
  ] })
12440
12439
  ] }),
@@ -12462,10 +12461,10 @@ function DropdownMenuActions({ editor, tNotionLike, commonFns }) {
12462
12461
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ButtonGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DeleteNodeButton, { text: tNotionLike("Delete"), showShortcut: !isMobile, tNotionLike }) }) })
12463
12462
  ] }) });
12464
12463
  }
12465
- function MoreActionsDropdown({ editor, tNotionLike, commonFns }) {
12464
+ function MoreActionsDropdown({ editor, tNotionLike, commonHelpFns }) {
12466
12465
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(DropdownMenu, { modal: true, children: [
12467
12466
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Button, { "data-style": "ghost", "data-appearance": "subdued", children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(MoreVerticalIcon, { className: "tiptap-button-icon" }) }) }),
12468
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuContent, { portal: true, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuActions, { editor, tNotionLike, commonFns }) })
12467
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuContent, { portal: true, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuActions, { editor, tNotionLike, commonHelpFns }) })
12469
12468
  ] });
12470
12469
  }
12471
12470
  function ToolbarViewButton({ view, isMobile, onViewChange }) {
@@ -12494,15 +12493,14 @@ function MainToolbarContent({
12494
12493
  toolbarViews,
12495
12494
  onViewChange,
12496
12495
  tNotionLike,
12497
- commonFns,
12498
- customIcons
12496
+ commonHelpFns
12499
12497
  }) {
12500
12498
  const hasSelection = hasTextSelection(editor);
12501
12499
  const hasContent = (editor?.getText().length ?? 0) > 0;
12502
12500
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
12503
12501
  /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(ToolbarGroup, { children: [
12504
12502
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(SlashCommandTriggerButton, { tNotionLike }),
12505
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(MoreActionsDropdown, { editor, tNotionLike, commonFns }),
12503
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(MoreActionsDropdown, { editor, tNotionLike, commonHelpFns }),
12506
12504
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ToolbarSeparator, {})
12507
12505
  ] }),
12508
12506
  (hasSelection || hasContent) && /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
@@ -12516,7 +12514,7 @@ function MainToolbarContent({
12516
12514
  editor
12517
12515
  }
12518
12516
  ),
12519
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ImageNodeFloating, { tNotionLike, commonFns, customIcons }),
12517
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ImageNodeFloating, { tNotionLike, commonHelpFns }),
12520
12518
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ScriptGroup, { tNotionLike }),
12521
12519
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(AlignmentGroup, { tNotionLike }),
12522
12520
  /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(ToolbarGroup, { children: [
@@ -12540,7 +12538,7 @@ function SpecializedToolbarContent({ view, onBack }) {
12540
12538
  view.content
12541
12539
  ] });
12542
12540
  }
12543
- function MobileToolbar({ editor: providedEditor, tNotionLike, commonFns, customIcons }) {
12541
+ function MobileToolbar({ editor: providedEditor, tNotionLike, commonHelpFns }) {
12544
12542
  const { editor } = useTiptapEditor(providedEditor);
12545
12543
  const isMobile = useIsBreakpoint("max", 480);
12546
12544
  const toolbarRef = (0, import_react155.useRef)(null);
@@ -12573,8 +12571,7 @@ function MobileToolbar({ editor: providedEditor, tNotionLike, commonFns, customI
12573
12571
  toolbarViews,
12574
12572
  onViewChange: toolbarState.showView,
12575
12573
  tNotionLike,
12576
- commonFns,
12577
- customIcons
12574
+ commonHelpFns
12578
12575
  }
12579
12576
  ) : currentView && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(SpecializedToolbarContent, { view: currentView, onBack: toolbarState.showMainView })
12580
12577
  }
@@ -12832,7 +12829,7 @@ var isElementWithinEditor = (editor, element) => {
12832
12829
 
12833
12830
  // src/components/tiptap-templates/notion-like/notion-like-editor-toolbar-floating.tsx
12834
12831
  var import_jsx_runtime112 = require("react/jsx-runtime");
12835
- function NotionToolbarFloating({ tNotionLike, commonFns, customIcons }) {
12832
+ function NotionToolbarFloating({ tNotionLike, commonHelpFns }) {
12836
12833
  const { editor } = useTiptapEditor();
12837
12834
  const isMobile = useIsBreakpoint("max", 480);
12838
12835
  const { lockDragHandle, commentInputVisible } = useUiEditorState(editor);
@@ -12843,7 +12840,7 @@ function NotionToolbarFloating({ tNotionLike, commonFns, customIcons }) {
12843
12840
  });
12844
12841
  if (lockDragHandle || isMobile) return null;
12845
12842
  return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(FloatingElement, { shouldShow, children: /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(Toolbar, { variant: "floating", lOrigin: "NotionToolbarFloating", children: [
12846
- /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(TurnIntoDropdown, { hideWhenUnavailable: true, tNotionLike, commonFns }) }),
12843
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(TurnIntoDropdown, { hideWhenUnavailable: true, tNotionLike, commonHelpFns }) }),
12847
12844
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarSeparator, {}),
12848
12845
  /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(ToolbarGroup, { children: [
12849
12846
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(MarkButton, { type: "bold", hideWhenUnavailable: true, tNotionLike }),
@@ -12853,7 +12850,7 @@ function NotionToolbarFloating({ tNotionLike, commonFns, customIcons }) {
12853
12850
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(MarkButton, { type: "code", hideWhenUnavailable: true, tNotionLike })
12854
12851
  ] }),
12855
12852
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarSeparator, {}),
12856
- /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ImageNodeFloating, { tNotionLike, commonFns, customIcons }) }),
12853
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ImageNodeFloating, { tNotionLike, commonHelpFns }) }),
12857
12854
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(VideoNodeFloating, { tNotionLike }) }),
12858
12855
  /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(ToolbarGroup, { children: [
12859
12856
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(LinkPopover, { autoOpenOnLinkActive: false, hideWhenUnavailable: true, tNotionLike }),
@@ -19373,8 +19370,9 @@ var useResizeHandles = (args) => {
19373
19370
  leftResizeHandleRef,
19374
19371
  rightResizeHandleRef,
19375
19372
  nodeId,
19376
- commonFns
19373
+ commonHelpFns
19377
19374
  } = args;
19375
+ console.log("\u{1F680} ~ useResizeHandles ~ commonHelpFns:", commonHelpFns);
19378
19376
  const resizeParamsRef = (0, import_react197.useRef)(void 0);
19379
19377
  const widthRef = (0, import_react197.useRef)(width);
19380
19378
  widthRef.current = width;
@@ -19382,7 +19380,7 @@ var useResizeHandles = (args) => {
19382
19380
  heightRef.current = height;
19383
19381
  const windowMouseMoveHandler = (0, import_react197.useCallback)(
19384
19382
  (event) => {
19385
- commonFns.stopEventPropagation(event);
19383
+ commonHelpFns.stopEventPropagation(event);
19386
19384
  const { current: resizeParamsFromRef } = resizeParamsRef;
19387
19385
  if (!resizeParamsFromRef || !editor || !isMountedRef.current) {
19388
19386
  return;
@@ -19540,12 +19538,12 @@ var import_jsx_runtime134 = require("react/jsx-runtime");
19540
19538
  function ImageNodeView(props) {
19541
19539
  const { editor, node, updateAttributes, getPos } = props;
19542
19540
  const hasContent = node.content.size > 0;
19543
- const { commonFns } = (0, import_react198.useContext)(import_react199.EditorContext);
19544
- console.log("\u{1F680} ~ ImageNodeView ~ commonFns:", commonFns);
19545
- if (!commonFns) {
19546
- console.error("ImageNodeView :: commonFns NOT PROVIDED !!!!");
19541
+ const { commonHelpFns } = (0, import_react198.useContext)(import_react199.EditorContext);
19542
+ console.log("\u{1F680} ~ ImageNodeView ~ commonHelpFns:", commonHelpFns);
19543
+ if (!commonHelpFns) {
19544
+ console.error("ImageNodeView :: commonHelpFns NOT PROVIDED !!!!");
19547
19545
  }
19548
- const { getFileUrl } = commonFns || {};
19546
+ const { getFileUrl } = commonHelpFns || {};
19549
19547
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
19550
19548
  ResizableImage,
19551
19549
  {
@@ -19571,7 +19569,7 @@ function ImageNodeView(props) {
19571
19569
  },
19572
19570
  onUpdateAttributes: updateAttributes,
19573
19571
  getPos,
19574
- commonFns
19572
+ commonHelpFns
19575
19573
  }
19576
19574
  );
19577
19575
  }
@@ -19591,8 +19589,9 @@ var ResizableImage = ({
19591
19589
  onImageResize,
19592
19590
  onUpdateAttributes,
19593
19591
  getPos,
19594
- commonFns
19592
+ commonHelpFns
19595
19593
  }) => {
19594
+ console.log("\u{1F680} ~ ResizableImage ~ commonHelpFns:", commonHelpFns);
19596
19595
  const [width, setWidth] = (0, import_react198.useState)(initialWidth);
19597
19596
  const [height, setHeight] = (0, import_react198.useState)(initialHeight);
19598
19597
  const [showHandles, setShowHandles] = (0, import_react198.useState)(false);
@@ -19632,7 +19631,7 @@ var ResizableImage = ({
19632
19631
  leftResizeHandleRef,
19633
19632
  rightResizeHandleRef,
19634
19633
  nodeId: id,
19635
- commonFns
19634
+ commonHelpFns
19636
19635
  });
19637
19636
  (0, import_react198.useEffect)(() => {
19638
19637
  if (!editor || !showCaption) return;
@@ -19683,8 +19682,8 @@ var ResizableImage = ({
19683
19682
  className: "tiptap-image-container",
19684
19683
  style: { width: width ? `${width}px` : "fit-content" },
19685
19684
  onDoubleClick: (e) => {
19686
- commonFns.ExpandImgIconClickHAndler(e, id);
19687
- commonFns.stopEventPropagation(e);
19685
+ commonHelpFns.ExpandImgIconClickHAndler(e, id);
19686
+ commonHelpFns.stopEventPropagation(e);
19688
19687
  },
19689
19688
  children: [
19690
19689
  /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "tiptap-image-content", children: [
@@ -20475,8 +20474,8 @@ var ImageUploadNode = (props) => {
20475
20474
  onSuccess: extension.options.onSuccess,
20476
20475
  onError: extension.options.onError
20477
20476
  };
20478
- const { commonFns } = (0, import_react202.useContext)(import_react203.EditorContext);
20479
- console.log("\u{1F680} ~ ImageUploadNode ~ commonFns:", commonFns);
20477
+ const { commonHelpFns } = (0, import_react202.useContext)(import_react203.EditorContext);
20478
+ console.log("\u{1F680} ~ ImageUploadNode ~ commonHelpFns:", commonHelpFns);
20480
20479
  const { fileItems, uploadFiles, removeFileItem, clearAllFiles } = useFileUpload(uploadOptions);
20481
20480
  const handleUpload = async (files) => {
20482
20481
  const imgsInfos = await uploadFiles(files);
@@ -20859,7 +20858,7 @@ var useNotionLikeExtensions = (args) => {
20859
20858
  setTocContent,
20860
20859
  ignore,
20861
20860
  customExtensions = [],
20862
- commonFns
20861
+ commonHelpFns
20863
20862
  } = args;
20864
20863
  const editable = Boolean(isEditable);
20865
20864
  const localHandleImageUpload = (0, import_react206.useCallback)(
@@ -20869,7 +20868,7 @@ var useNotionLikeExtensions = (args) => {
20869
20868
  }
20870
20869
  const { current: editor } = editorRef;
20871
20870
  const { view } = editor;
20872
- commonFns.uploadImageForNotion({
20871
+ commonHelpFns.uploadImageForNotion({
20873
20872
  file,
20874
20873
  view,
20875
20874
  onProgress,
@@ -20880,7 +20879,7 @@ var useNotionLikeExtensions = (args) => {
20880
20879
  [MAX_FILE_SIZE]
20881
20880
  );
20882
20881
  if (ignore) {
20883
- return void 0;
20882
+ return [];
20884
20883
  }
20885
20884
  let extensions = [
20886
20885
  import_starter_kit.StarterKit.configure({
@@ -20986,7 +20985,7 @@ var useNotionLikeExtensions_default = useNotionLikeExtensions;
20986
20985
  // src/components/tiptap-node/toc-node/ui/toc-sidebar/toc-sidebar.tsx
20987
20986
  var import_react207 = require("react");
20988
20987
  var import_jsx_runtime137 = require("react/jsx-runtime");
20989
- function TocSidebar({ className, maxShowCount = 20, topOffset = 0, commonFns, ...props }) {
20988
+ function TocSidebar({ className, maxShowCount = 20, topOffset = 0, commonHelpFns, ...props }) {
20990
20989
  const { tocContent, normalizeHeadingDepths: normalizeHeadingDepths2 } = useToc();
20991
20990
  const tocContainerRef = (0, import_react207.useRef)(null);
20992
20991
  const [manualActiveId, setManualActiveId] = (0, import_react207.useState)(null);
@@ -21031,14 +21030,14 @@ function TocSidebar({ className, maxShowCount = 20, topOffset = 0, commonFns, ..
21031
21030
  e.stopPropagation();
21032
21031
  if (target.closest(".toc-sidebar-item")) {
21033
21032
  const element = item.editor.view.dom.querySelector(`[data-toc-id="${item.id}"`);
21034
- commonFns.scrollToElementInsideContainerEl(tocContainerRef.current, element, true);
21033
+ commonHelpFns.scrollToElementInsideContainerEl(tocContainerRef.current, element, true);
21035
21034
  }
21036
21035
  },
21037
21036
  [topOffset]
21038
21037
  );
21039
21038
  const bpOnScrollEventHandler = (0, import_react207.useCallback)(() => {
21040
21039
  const { current: manualActiveIdFromRef } = manualActiveIdRef;
21041
- commonFns.periodicallyExecute(
21040
+ commonHelpFns.periodicallyExecute(
21042
21041
  "bpOnScrollEventHandler",
21043
21042
  function(mAId) {
21044
21043
  if (mAId !== null) {
@@ -21102,8 +21101,6 @@ function TocSidebar({ className, maxShowCount = 20, topOffset = 0, commonFns, ..
21102
21101
  var import_jsx_runtime138 = require("react/jsx-runtime");
21103
21102
  function EditorProvider(props) {
21104
21103
  const {
21105
- // provider,
21106
- // ydoc,
21107
21104
  placeholder = "Start writing...",
21108
21105
  getInchangeableProps,
21109
21106
  className,
@@ -21126,9 +21123,7 @@ function EditorProvider(props) {
21126
21123
  withTables,
21127
21124
  withVideo,
21128
21125
  pSwipeIsOpen,
21129
- showToCInBookPages,
21130
- customExtensions,
21131
- customIcons
21126
+ showToCInBookPages
21132
21127
  } = props;
21133
21128
  const { setTocContent } = useToc();
21134
21129
  const { t: tBook } = (0, import_react_i18next8.useTranslation)("book" /* book */);
@@ -21152,9 +21147,10 @@ function EditorProvider(props) {
21152
21147
  setAutoFocusOnPopupIsReady,
21153
21148
  ExpandImgIconClickHAndler,
21154
21149
  tNotionLike,
21155
- commonFns
21150
+ commonHelpFns,
21151
+ customExtensions
21156
21152
  } = getInchangeableProps();
21157
- const { getUpdatedProseMirrorViewVars, urlToFile, ...restCommonFns } = commonFns;
21153
+ const { getUpdatedProseMirrorViewVars, urlToFile, ...restCommonFns } = commonHelpFns;
21158
21154
  const extensions = useNotionLikeExtensions_default({
21159
21155
  isEditable,
21160
21156
  withImages,
@@ -21164,7 +21160,7 @@ function EditorProvider(props) {
21164
21160
  withVideo,
21165
21161
  setTocContent,
21166
21162
  customExtensions,
21167
- commonFns: restCommonFns
21163
+ commonHelpFns: restCommonFns
21168
21164
  });
21169
21165
  const imageIndexRef = (0, import_react208.useRef)(0);
21170
21166
  const transformNode = (args) => {
@@ -21270,7 +21266,7 @@ function EditorProvider(props) {
21270
21266
  const sliceIsEmpty = slice.content.size === 0;
21271
21267
  console.log("\u{1F680} handlePaste ~ slice:", slice);
21272
21268
  console.log("\u{1F680} handlePaste ~ sliceIsEmpty:", sliceIsEmpty);
21273
- commonFns.stopEventPropagation(event);
21269
+ commonHelpFns.stopEventPropagation(event);
21274
21270
  const { schema } = editorRef.current;
21275
21271
  const { image: imageType, imageUpload: imageUploadType } = schema.nodes;
21276
21272
  const bookmark = view.state.selection.getBookmark();
@@ -21527,7 +21523,7 @@ function EditorProvider(props) {
21527
21523
  },
21528
21524
  onPaste(event, slice) {
21529
21525
  console.log("\u{1F680} onPaste ~ slice:", slice);
21530
- commonFns.stopEventPropagation(event);
21526
+ commonHelpFns.stopEventPropagation(event);
21531
21527
  return true;
21532
21528
  },
21533
21529
  editable: Boolean(isEditable)
@@ -21567,17 +21563,16 @@ function EditorProvider(props) {
21567
21563
  ...extraStyle
21568
21564
  },
21569
21565
  children: [
21570
- /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_react209.EditorContext.Provider, { value: { editor, commonFns: { ...restCommonFns, getFileUrl, ExpandImgIconClickHAndler } }, children: [
21566
+ /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_react209.EditorContext.Provider, { value: { editor, commonHelpFns: { ...restCommonFns, getFileUrl, ExpandImgIconClickHAndler } }, children: [
21571
21567
  /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
21572
21568
  EditorContentArea,
21573
21569
  {
21574
21570
  mentionListRef,
21575
21571
  tNotionLike,
21576
- commonFns: restCommonFns,
21577
- customIcons
21572
+ commonHelpFns: restCommonFns
21578
21573
  }
21579
21574
  ),
21580
- withToc && showToCInBookPages ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(TocSidebar, { topOffset: 48, commonFns: restCommonFns }) : "",
21575
+ withToc && showToCInBookPages ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(TocSidebar, { topOffset: 48, commonHelpFns: restCommonFns }) : "",
21581
21576
  /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(TableExtendRowColumnButtons, {}),
21582
21577
  /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(TableHandle, { tNotionLike }),
21583
21578
  /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
@@ -21622,7 +21617,7 @@ function LoadingSpinner({ text = "Connecting..." }) {
21622
21617
  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { className: "spinner-loading-text", children: text })
21623
21618
  ] }) });
21624
21619
  }
21625
- function EditorContentArea({ mentionListRef, tNotionLike, commonFns, customIcons }) {
21620
+ function EditorContentArea({ mentionListRef, tNotionLike, commonHelpFns }) {
21626
21621
  const { editor } = (0, import_react210.useContext)(import_react211.EditorContext);
21627
21622
  const { isDragging } = useUiEditorState(editor);
21628
21623
  useScrollToHash();
@@ -21639,13 +21634,13 @@ function EditorContentArea({ mentionListRef, tNotionLike, commonFns, customIcons
21639
21634
  cursor: isDragging ? "grabbing" : "auto"
21640
21635
  },
21641
21636
  children: [
21642
- /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(DragContextMenu, { tNotionLike, commonFns }),
21637
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(DragContextMenu, { tNotionLike, commonHelpFns }),
21643
21638
  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(EmojiDropdownMenu, {}),
21644
21639
  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(MentionDropdownMenu, { mentionListRef }),
21645
- /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(SlashDropdownMenu, { commonFns }),
21646
- /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(NotionToolbarFloating, { tNotionLike, commonFns, customIcons }),
21640
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(SlashDropdownMenu, { commonHelpFns }),
21641
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(NotionToolbarFloating, { tNotionLike, commonHelpFns }),
21647
21642
  (0, import_react_dom.createPortal)(
21648
- /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(MobileToolbar, { tNotionLike, commonFns, customIcons }),
21643
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(MobileToolbar, { tNotionLike, commonHelpFns }),
21649
21644
  document.body
21650
21645
  )
21651
21646
  ]