@tn-pulse-suivi/notion-ui-comps 1.0.6 → 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 } = 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: commonFns.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,7 +12226,7 @@ var import_jsx_runtime108 = require("react/jsx-runtime");
12226
12226
  function ImageNodeFloating({
12227
12227
  editor: providedEditor,
12228
12228
  tNotionLike,
12229
- commonFns
12229
+ commonHelpFns
12230
12230
  }) {
12231
12231
  const { editor } = useTiptapEditor(providedEditor);
12232
12232
  const visible = isNodeTypeSelected(editor, ["image"]);
@@ -12234,7 +12234,7 @@ function ImageNodeFloating({
12234
12234
  return null;
12235
12235
  }
12236
12236
  return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(import_jsx_runtime108.Fragment, { children: [
12237
- /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(image_expand_button_default, { commonFns }),
12237
+ /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(image_expand_button_default, { commonHelpFns }),
12238
12238
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ImageAlignButton, { align: "left" }),
12239
12239
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ImageAlignButton, { align: "center" }),
12240
12240
  /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ImageAlignButton, { align: "right" }),
@@ -12415,25 +12415,25 @@ function ColorActionGroup({ tNotionLike }) {
12415
12415
  ] }) }) }) })
12416
12416
  ] });
12417
12417
  }
12418
- function TransformActionGroup2({ tNotionLike, commonFns }) {
12418
+ function TransformActionGroup2({ tNotionLike, commonHelpFns }) {
12419
12419
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(DropdownMenuSub, { children: [
12420
12420
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuSubTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Button, { "data-style": "ghost", children: [
12421
12421
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Repeat2Icon, { className: "tiptap-button-icon" }),
12422
- /* @__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()) }),
12423
12423
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Spacer, {}),
12424
12424
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ChevronRightIcon, { className: "tiptap-button-icon" })
12425
12425
  ] }) }),
12426
- /* @__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 }) })
12427
12427
  ] });
12428
12428
  }
12429
- function DropdownMenuActions({ editor, tNotionLike, commonFns }) {
12429
+ function DropdownMenuActions({ editor, tNotionLike, commonHelpFns }) {
12430
12430
  const isMobile = useIsBreakpoint();
12431
12431
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(CardBody, { children: [
12432
12432
  /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(CardItemGroup, { children: [
12433
12433
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(CardGroupLabel, { children: getNodeDisplayName(editor, tNotionLike) }),
12434
12434
  /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(ButtonGroup, { children: [
12435
12435
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ColorActionGroup, { tNotionLike }),
12436
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(TransformActionGroup2, { tNotionLike, commonFns }),
12436
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(TransformActionGroup2, { tNotionLike, commonHelpFns }),
12437
12437
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ResetAllFormattingButton, { text: tNotionLike("ResetFormatting"), tNotionLike }) })
12438
12438
  ] })
12439
12439
  ] }),
@@ -12461,10 +12461,10 @@ function DropdownMenuActions({ editor, tNotionLike, commonFns }) {
12461
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 }) }) })
12462
12462
  ] }) });
12463
12463
  }
12464
- function MoreActionsDropdown({ editor, tNotionLike, commonFns }) {
12464
+ function MoreActionsDropdown({ editor, tNotionLike, commonHelpFns }) {
12465
12465
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(DropdownMenu, { modal: true, children: [
12466
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" }) }) }),
12467
- /* @__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 }) })
12468
12468
  ] });
12469
12469
  }
12470
12470
  function ToolbarViewButton({ view, isMobile, onViewChange }) {
@@ -12493,14 +12493,14 @@ function MainToolbarContent({
12493
12493
  toolbarViews,
12494
12494
  onViewChange,
12495
12495
  tNotionLike,
12496
- commonFns
12496
+ commonHelpFns
12497
12497
  }) {
12498
12498
  const hasSelection = hasTextSelection(editor);
12499
12499
  const hasContent = (editor?.getText().length ?? 0) > 0;
12500
12500
  return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
12501
12501
  /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(ToolbarGroup, { children: [
12502
12502
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(SlashCommandTriggerButton, { tNotionLike }),
12503
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(MoreActionsDropdown, { editor, tNotionLike, commonFns }),
12503
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(MoreActionsDropdown, { editor, tNotionLike, commonHelpFns }),
12504
12504
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ToolbarSeparator, {})
12505
12505
  ] }),
12506
12506
  (hasSelection || hasContent) && /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
@@ -12514,7 +12514,7 @@ function MainToolbarContent({
12514
12514
  editor
12515
12515
  }
12516
12516
  ),
12517
- /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ImageNodeFloating, { tNotionLike, commonFns }),
12517
+ /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ImageNodeFloating, { tNotionLike, commonHelpFns }),
12518
12518
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ScriptGroup, { tNotionLike }),
12519
12519
  /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(AlignmentGroup, { tNotionLike }),
12520
12520
  /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(ToolbarGroup, { children: [
@@ -12538,7 +12538,7 @@ function SpecializedToolbarContent({ view, onBack }) {
12538
12538
  view.content
12539
12539
  ] });
12540
12540
  }
12541
- function MobileToolbar({ editor: providedEditor, tNotionLike, commonFns }) {
12541
+ function MobileToolbar({ editor: providedEditor, tNotionLike, commonHelpFns }) {
12542
12542
  const { editor } = useTiptapEditor(providedEditor);
12543
12543
  const isMobile = useIsBreakpoint("max", 480);
12544
12544
  const toolbarRef = (0, import_react155.useRef)(null);
@@ -12571,7 +12571,7 @@ function MobileToolbar({ editor: providedEditor, tNotionLike, commonFns }) {
12571
12571
  toolbarViews,
12572
12572
  onViewChange: toolbarState.showView,
12573
12573
  tNotionLike,
12574
- commonFns
12574
+ commonHelpFns
12575
12575
  }
12576
12576
  ) : currentView && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(SpecializedToolbarContent, { view: currentView, onBack: toolbarState.showMainView })
12577
12577
  }
@@ -12829,7 +12829,7 @@ var isElementWithinEditor = (editor, element) => {
12829
12829
 
12830
12830
  // src/components/tiptap-templates/notion-like/notion-like-editor-toolbar-floating.tsx
12831
12831
  var import_jsx_runtime112 = require("react/jsx-runtime");
12832
- function NotionToolbarFloating({ tNotionLike, commonFns }) {
12832
+ function NotionToolbarFloating({ tNotionLike, commonHelpFns }) {
12833
12833
  const { editor } = useTiptapEditor();
12834
12834
  const isMobile = useIsBreakpoint("max", 480);
12835
12835
  const { lockDragHandle, commentInputVisible } = useUiEditorState(editor);
@@ -12840,7 +12840,7 @@ function NotionToolbarFloating({ tNotionLike, commonFns }) {
12840
12840
  });
12841
12841
  if (lockDragHandle || isMobile) return null;
12842
12842
  return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(FloatingElement, { shouldShow, children: /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(Toolbar, { variant: "floating", lOrigin: "NotionToolbarFloating", children: [
12843
- /* @__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 }) }),
12844
12844
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarSeparator, {}),
12845
12845
  /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(ToolbarGroup, { children: [
12846
12846
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(MarkButton, { type: "bold", hideWhenUnavailable: true, tNotionLike }),
@@ -12850,7 +12850,7 @@ function NotionToolbarFloating({ tNotionLike, commonFns }) {
12850
12850
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(MarkButton, { type: "code", hideWhenUnavailable: true, tNotionLike })
12851
12851
  ] }),
12852
12852
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarSeparator, {}),
12853
- /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ImageNodeFloating, { tNotionLike, commonFns }) }),
12853
+ /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ImageNodeFloating, { tNotionLike, commonHelpFns }) }),
12854
12854
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(VideoNodeFloating, { tNotionLike }) }),
12855
12855
  /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(ToolbarGroup, { children: [
12856
12856
  /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(LinkPopover, { autoOpenOnLinkActive: false, hideWhenUnavailable: true, tNotionLike }),
@@ -19370,8 +19370,9 @@ var useResizeHandles = (args) => {
19370
19370
  leftResizeHandleRef,
19371
19371
  rightResizeHandleRef,
19372
19372
  nodeId,
19373
- commonFns
19373
+ commonHelpFns
19374
19374
  } = args;
19375
+ console.log("\u{1F680} ~ useResizeHandles ~ commonHelpFns:", commonHelpFns);
19375
19376
  const resizeParamsRef = (0, import_react197.useRef)(void 0);
19376
19377
  const widthRef = (0, import_react197.useRef)(width);
19377
19378
  widthRef.current = width;
@@ -19379,7 +19380,7 @@ var useResizeHandles = (args) => {
19379
19380
  heightRef.current = height;
19380
19381
  const windowMouseMoveHandler = (0, import_react197.useCallback)(
19381
19382
  (event) => {
19382
- commonFns.stopEventPropagation(event);
19383
+ commonHelpFns.stopEventPropagation(event);
19383
19384
  const { current: resizeParamsFromRef } = resizeParamsRef;
19384
19385
  if (!resizeParamsFromRef || !editor || !isMountedRef.current) {
19385
19386
  return;
@@ -19537,12 +19538,12 @@ var import_jsx_runtime134 = require("react/jsx-runtime");
19537
19538
  function ImageNodeView(props) {
19538
19539
  const { editor, node, updateAttributes, getPos } = props;
19539
19540
  const hasContent = node.content.size > 0;
19540
- const { commonFns } = (0, import_react198.useContext)(import_react199.EditorContext);
19541
- console.log("\u{1F680} ~ ImageNodeView ~ commonFns:", commonFns);
19542
- if (!commonFns) {
19543
- 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 !!!!");
19544
19545
  }
19545
- const { getFileUrl } = commonFns || {};
19546
+ const { getFileUrl } = commonHelpFns || {};
19546
19547
  return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
19547
19548
  ResizableImage,
19548
19549
  {
@@ -19568,7 +19569,7 @@ function ImageNodeView(props) {
19568
19569
  },
19569
19570
  onUpdateAttributes: updateAttributes,
19570
19571
  getPos,
19571
- commonFns
19572
+ commonHelpFns
19572
19573
  }
19573
19574
  );
19574
19575
  }
@@ -19588,8 +19589,9 @@ var ResizableImage = ({
19588
19589
  onImageResize,
19589
19590
  onUpdateAttributes,
19590
19591
  getPos,
19591
- commonFns
19592
+ commonHelpFns
19592
19593
  }) => {
19594
+ console.log("\u{1F680} ~ ResizableImage ~ commonHelpFns:", commonHelpFns);
19593
19595
  const [width, setWidth] = (0, import_react198.useState)(initialWidth);
19594
19596
  const [height, setHeight] = (0, import_react198.useState)(initialHeight);
19595
19597
  const [showHandles, setShowHandles] = (0, import_react198.useState)(false);
@@ -19629,7 +19631,7 @@ var ResizableImage = ({
19629
19631
  leftResizeHandleRef,
19630
19632
  rightResizeHandleRef,
19631
19633
  nodeId: id,
19632
- commonFns
19634
+ commonHelpFns
19633
19635
  });
19634
19636
  (0, import_react198.useEffect)(() => {
19635
19637
  if (!editor || !showCaption) return;
@@ -19680,8 +19682,8 @@ var ResizableImage = ({
19680
19682
  className: "tiptap-image-container",
19681
19683
  style: { width: width ? `${width}px` : "fit-content" },
19682
19684
  onDoubleClick: (e) => {
19683
- commonFns.ExpandImgIconClickHAndler(e, id);
19684
- commonFns.stopEventPropagation(e);
19685
+ commonHelpFns.ExpandImgIconClickHAndler(e, id);
19686
+ commonHelpFns.stopEventPropagation(e);
19685
19687
  },
19686
19688
  children: [
19687
19689
  /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "tiptap-image-content", children: [
@@ -20472,8 +20474,8 @@ var ImageUploadNode = (props) => {
20472
20474
  onSuccess: extension.options.onSuccess,
20473
20475
  onError: extension.options.onError
20474
20476
  };
20475
- const { commonFns } = (0, import_react202.useContext)(import_react203.EditorContext);
20476
- 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);
20477
20479
  const { fileItems, uploadFiles, removeFileItem, clearAllFiles } = useFileUpload(uploadOptions);
20478
20480
  const handleUpload = async (files) => {
20479
20481
  const imgsInfos = await uploadFiles(files);
@@ -20856,7 +20858,7 @@ var useNotionLikeExtensions = (args) => {
20856
20858
  setTocContent,
20857
20859
  ignore,
20858
20860
  customExtensions = [],
20859
- commonFns
20861
+ commonHelpFns
20860
20862
  } = args;
20861
20863
  const editable = Boolean(isEditable);
20862
20864
  const localHandleImageUpload = (0, import_react206.useCallback)(
@@ -20866,7 +20868,7 @@ var useNotionLikeExtensions = (args) => {
20866
20868
  }
20867
20869
  const { current: editor } = editorRef;
20868
20870
  const { view } = editor;
20869
- commonFns.uploadImageForNotion({
20871
+ commonHelpFns.uploadImageForNotion({
20870
20872
  file,
20871
20873
  view,
20872
20874
  onProgress,
@@ -20983,7 +20985,7 @@ var useNotionLikeExtensions_default = useNotionLikeExtensions;
20983
20985
  // src/components/tiptap-node/toc-node/ui/toc-sidebar/toc-sidebar.tsx
20984
20986
  var import_react207 = require("react");
20985
20987
  var import_jsx_runtime137 = require("react/jsx-runtime");
20986
- function TocSidebar({ className, maxShowCount = 20, topOffset = 0, commonFns, ...props }) {
20988
+ function TocSidebar({ className, maxShowCount = 20, topOffset = 0, commonHelpFns, ...props }) {
20987
20989
  const { tocContent, normalizeHeadingDepths: normalizeHeadingDepths2 } = useToc();
20988
20990
  const tocContainerRef = (0, import_react207.useRef)(null);
20989
20991
  const [manualActiveId, setManualActiveId] = (0, import_react207.useState)(null);
@@ -21028,14 +21030,14 @@ function TocSidebar({ className, maxShowCount = 20, topOffset = 0, commonFns, ..
21028
21030
  e.stopPropagation();
21029
21031
  if (target.closest(".toc-sidebar-item")) {
21030
21032
  const element = item.editor.view.dom.querySelector(`[data-toc-id="${item.id}"`);
21031
- commonFns.scrollToElementInsideContainerEl(tocContainerRef.current, element, true);
21033
+ commonHelpFns.scrollToElementInsideContainerEl(tocContainerRef.current, element, true);
21032
21034
  }
21033
21035
  },
21034
21036
  [topOffset]
21035
21037
  );
21036
21038
  const bpOnScrollEventHandler = (0, import_react207.useCallback)(() => {
21037
21039
  const { current: manualActiveIdFromRef } = manualActiveIdRef;
21038
- commonFns.periodicallyExecute(
21040
+ commonHelpFns.periodicallyExecute(
21039
21041
  "bpOnScrollEventHandler",
21040
21042
  function(mAId) {
21041
21043
  if (mAId !== null) {
@@ -21145,10 +21147,10 @@ function EditorProvider(props) {
21145
21147
  setAutoFocusOnPopupIsReady,
21146
21148
  ExpandImgIconClickHAndler,
21147
21149
  tNotionLike,
21148
- commonFns,
21150
+ commonHelpFns,
21149
21151
  customExtensions
21150
21152
  } = getInchangeableProps();
21151
- const { getUpdatedProseMirrorViewVars, urlToFile, ...restCommonFns } = commonFns;
21153
+ const { getUpdatedProseMirrorViewVars, urlToFile, ...restCommonFns } = commonHelpFns;
21152
21154
  const extensions = useNotionLikeExtensions_default({
21153
21155
  isEditable,
21154
21156
  withImages,
@@ -21158,7 +21160,7 @@ function EditorProvider(props) {
21158
21160
  withVideo,
21159
21161
  setTocContent,
21160
21162
  customExtensions,
21161
- commonFns: restCommonFns
21163
+ commonHelpFns: restCommonFns
21162
21164
  });
21163
21165
  const imageIndexRef = (0, import_react208.useRef)(0);
21164
21166
  const transformNode = (args) => {
@@ -21264,7 +21266,7 @@ function EditorProvider(props) {
21264
21266
  const sliceIsEmpty = slice.content.size === 0;
21265
21267
  console.log("\u{1F680} handlePaste ~ slice:", slice);
21266
21268
  console.log("\u{1F680} handlePaste ~ sliceIsEmpty:", sliceIsEmpty);
21267
- commonFns.stopEventPropagation(event);
21269
+ commonHelpFns.stopEventPropagation(event);
21268
21270
  const { schema } = editorRef.current;
21269
21271
  const { image: imageType, imageUpload: imageUploadType } = schema.nodes;
21270
21272
  const bookmark = view.state.selection.getBookmark();
@@ -21521,7 +21523,7 @@ function EditorProvider(props) {
21521
21523
  },
21522
21524
  onPaste(event, slice) {
21523
21525
  console.log("\u{1F680} onPaste ~ slice:", slice);
21524
- commonFns.stopEventPropagation(event);
21526
+ commonHelpFns.stopEventPropagation(event);
21525
21527
  return true;
21526
21528
  },
21527
21529
  editable: Boolean(isEditable)
@@ -21561,16 +21563,16 @@ function EditorProvider(props) {
21561
21563
  ...extraStyle
21562
21564
  },
21563
21565
  children: [
21564
- /* @__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: [
21565
21567
  /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
21566
21568
  EditorContentArea,
21567
21569
  {
21568
21570
  mentionListRef,
21569
21571
  tNotionLike,
21570
- commonFns: restCommonFns
21572
+ commonHelpFns: restCommonFns
21571
21573
  }
21572
21574
  ),
21573
- 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 }) : "",
21574
21576
  /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(TableExtendRowColumnButtons, {}),
21575
21577
  /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(TableHandle, { tNotionLike }),
21576
21578
  /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
@@ -21615,7 +21617,7 @@ function LoadingSpinner({ text = "Connecting..." }) {
21615
21617
  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { className: "spinner-loading-text", children: text })
21616
21618
  ] }) });
21617
21619
  }
21618
- function EditorContentArea({ mentionListRef, tNotionLike, commonFns }) {
21620
+ function EditorContentArea({ mentionListRef, tNotionLike, commonHelpFns }) {
21619
21621
  const { editor } = (0, import_react210.useContext)(import_react211.EditorContext);
21620
21622
  const { isDragging } = useUiEditorState(editor);
21621
21623
  useScrollToHash();
@@ -21632,13 +21634,13 @@ function EditorContentArea({ mentionListRef, tNotionLike, commonFns }) {
21632
21634
  cursor: isDragging ? "grabbing" : "auto"
21633
21635
  },
21634
21636
  children: [
21635
- /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(DragContextMenu, { tNotionLike, commonFns }),
21637
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(DragContextMenu, { tNotionLike, commonHelpFns }),
21636
21638
  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(EmojiDropdownMenu, {}),
21637
21639
  /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(MentionDropdownMenu, { mentionListRef }),
21638
- /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(SlashDropdownMenu, { commonFns }),
21639
- /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(NotionToolbarFloating, { tNotionLike, commonFns }),
21640
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(SlashDropdownMenu, { commonHelpFns }),
21641
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(NotionToolbarFloating, { tNotionLike, commonHelpFns }),
21640
21642
  (0, import_react_dom.createPortal)(
21641
- /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(MobileToolbar, { tNotionLike, commonFns }),
21643
+ /* @__PURE__ */ (0, import_jsx_runtime139.jsx)(MobileToolbar, { tNotionLike, commonHelpFns }),
21642
21644
  document.body
21643
21645
  )
21644
21646
  ]