@tn-pulse-suivi/notion-ui-comps 1.0.6 → 1.0.8
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 +74 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +80 -103
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1698,7 +1698,6 @@ AvatarGroup.displayName = "AvatarGroup";
|
|
|
1698
1698
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1699
1699
|
var MentionDropdownMenu = (props) => {
|
|
1700
1700
|
const handleItemSelect = (props2) => {
|
|
1701
|
-
console.log("\u{1F680} ~ handleItemSelect ~ props:", props2);
|
|
1702
1701
|
if (!props2.editor || !props2.range || !props2.context) return;
|
|
1703
1702
|
props2.editor.chain().focus().insertContentAt(props2.range, [
|
|
1704
1703
|
{
|
|
@@ -2625,7 +2624,7 @@ var getSlashMenuItemsTexts = (tNL) => ({
|
|
|
2625
2624
|
group: "Upload"
|
|
2626
2625
|
}
|
|
2627
2626
|
});
|
|
2628
|
-
var getItemImplementations = (
|
|
2627
|
+
var getItemImplementations = (commonHelpFns) => {
|
|
2629
2628
|
return {
|
|
2630
2629
|
// Style
|
|
2631
2630
|
text: {
|
|
@@ -2686,7 +2685,7 @@ var getItemImplementations = (commonFns) => {
|
|
|
2686
2685
|
status: {
|
|
2687
2686
|
check: (editor) => isNodeInSchema("statusNode", editor),
|
|
2688
2687
|
action: ({ editor }) => {
|
|
2689
|
-
const { getSnackCont, t } =
|
|
2688
|
+
const { getSnackCont, t } = commonHelpFns;
|
|
2690
2689
|
const { view, schema } = editor;
|
|
2691
2690
|
const { state, dispatch } = view;
|
|
2692
2691
|
const { nodes } = schema;
|
|
@@ -2695,12 +2694,12 @@ var getItemImplementations = (commonFns) => {
|
|
|
2695
2694
|
const { pos } = $from;
|
|
2696
2695
|
const selectedNode = doc.cut(pos, $to.pos);
|
|
2697
2696
|
const { domAtPos } = view;
|
|
2698
|
-
const statusNodeDomNode =
|
|
2697
|
+
const statusNodeDomNode = commonHelpFns.findDomRefAtPos(pos, domAtPos.bind(view));
|
|
2699
2698
|
if (statusNodeDomNode.tagName === "STATUS-NODE") {
|
|
2700
2699
|
const statusNodeDomNodeText = statusNodeDomNode.getAttribute("text");
|
|
2701
2700
|
const emptyStatusPopupInputPlaceholder = t("emptyStatusPopupInputPlaceholder");
|
|
2702
2701
|
const nodeAtPos = doc.nodeAt(pos);
|
|
2703
|
-
if (
|
|
2702
|
+
if (commonHelpFns.equalNodeType(nodes.statusNode, nodeAtPos)) {
|
|
2704
2703
|
if (statusNodeDomNodeText === emptyStatusPopupInputPlaceholder) {
|
|
2705
2704
|
dispatch(tr.delete(pos, pos + 1));
|
|
2706
2705
|
} else {
|
|
@@ -2708,7 +2707,7 @@ var getItemImplementations = (commonFns) => {
|
|
|
2708
2707
|
}
|
|
2709
2708
|
}
|
|
2710
2709
|
} else {
|
|
2711
|
-
const textNodes =
|
|
2710
|
+
const textNodes = commonHelpFns.findTextNodes(selectedNode);
|
|
2712
2711
|
const selectedText = textNodes.reduce(function(accumulateur, nodeData) {
|
|
2713
2712
|
return accumulateur + " " + nodeData.node.text;
|
|
2714
2713
|
}, "").trim();
|
|
@@ -2719,7 +2718,7 @@ var getItemImplementations = (commonFns) => {
|
|
|
2719
2718
|
console.error("MenuBar : [statusNode::tr.replaceSelectionWith(newStatusNode)] : error : ", error);
|
|
2720
2719
|
}
|
|
2721
2720
|
try {
|
|
2722
|
-
|
|
2721
|
+
commonHelpFns.openStatusPopup(
|
|
2723
2722
|
selectedText,
|
|
2724
2723
|
null,
|
|
2725
2724
|
pos,
|
|
@@ -2739,14 +2738,12 @@ var getItemImplementations = (commonFns) => {
|
|
|
2739
2738
|
video: {
|
|
2740
2739
|
check: (editor) => isNodeInSchema("videoNode", editor),
|
|
2741
2740
|
action: ({ editor }) => {
|
|
2742
|
-
const { setVideoUrlDialogData } =
|
|
2743
|
-
console.log("\u{1F680} ~ getItemImplementations video action ~ FN ? :", Boolean(setVideoUrlDialogData));
|
|
2741
|
+
const { setVideoUrlDialogData } = commonHelpFns;
|
|
2744
2742
|
setVideoUrlDialogData({
|
|
2745
2743
|
onCancel: () => {
|
|
2746
2744
|
setVideoUrlDialogData({});
|
|
2747
2745
|
},
|
|
2748
2746
|
onValidate: (videoUrl) => {
|
|
2749
|
-
console.log("\u{1F680} ~ getItemImplementations video action onValidate ~ videoUrl:", videoUrl);
|
|
2750
2747
|
setVideoUrlDialogData({});
|
|
2751
2748
|
if (videoUrl) {
|
|
2752
2749
|
try {
|
|
@@ -2811,12 +2808,12 @@ function organizeItemsByGroups(items, showGroups) {
|
|
|
2811
2808
|
function useSlashDropdownMenu(config) {
|
|
2812
2809
|
const { t: tNotionLike } = (0, import_react_i18next.useTranslation)("notionLike" /* notionLike */);
|
|
2813
2810
|
const getSlashMenuItems = (0, import_react38.useCallback)(
|
|
2814
|
-
(editor,
|
|
2811
|
+
(editor, commonHelpFns) => {
|
|
2815
2812
|
const items = [];
|
|
2816
2813
|
const texts = getSlashMenuItemsTexts(tNotionLike);
|
|
2817
2814
|
const enabledItems = config?.enabledItems || Object.keys(texts);
|
|
2818
2815
|
const showGroups = config?.showGroups !== false;
|
|
2819
|
-
const itemImplementations = getItemImplementations(
|
|
2816
|
+
const itemImplementations = getItemImplementations(commonHelpFns);
|
|
2820
2817
|
enabledItems.forEach((itemType) => {
|
|
2821
2818
|
const itemImpl = itemImplementations[itemType];
|
|
2822
2819
|
const itemText = texts[itemType];
|
|
@@ -2873,7 +2870,7 @@ Separator.displayName = "Separator";
|
|
|
2873
2870
|
var import_i18next = __toESM(require("i18next"), 1);
|
|
2874
2871
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2875
2872
|
var SlashDropdownMenu = (props) => {
|
|
2876
|
-
const { config,
|
|
2873
|
+
const { config, commonHelpFns, ...restProps } = props;
|
|
2877
2874
|
const { getSlashMenuItems } = useSlashDropdownMenu(config);
|
|
2878
2875
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_material3.Portal, { container: () => document.body, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2879
2876
|
SuggestionMenu,
|
|
@@ -2883,7 +2880,7 @@ var SlashDropdownMenu = (props) => {
|
|
|
2883
2880
|
decorationClass: "tiptap-slash-decoration " + import_i18next.default.language,
|
|
2884
2881
|
decorationContent: "Filter...",
|
|
2885
2882
|
selector: "tiptap-slash-dropdown-menu",
|
|
2886
|
-
items: ({ query, editor }) => filterSuggestionItems(getSlashMenuItems(editor,
|
|
2883
|
+
items: ({ query, editor }) => filterSuggestionItems(getSlashMenuItems(editor, commonHelpFns), query),
|
|
2887
2884
|
...restProps,
|
|
2888
2885
|
children: (props2) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(List, { ...props2, config })
|
|
2889
2886
|
}
|
|
@@ -9067,7 +9064,7 @@ var SubMenuTrigger = ({ icon: Icon, label, children }) => /* @__PURE__ */ (0, im
|
|
|
9067
9064
|
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(MenuContent, { portal: true, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ComboboxList2, { children }) })
|
|
9068
9065
|
}
|
|
9069
9066
|
);
|
|
9070
|
-
var TransformActionGroup = ({ tNotionLike,
|
|
9067
|
+
var TransformActionGroup = ({ tNotionLike, commonHelpFns }) => {
|
|
9071
9068
|
const actions = useNodeTransformActions(tNotionLike);
|
|
9072
9069
|
const { canReset, handleResetFormatting, label, Icon } = useResetAllFormatting({
|
|
9073
9070
|
hideWhenUnavailable: true,
|
|
@@ -9077,7 +9074,7 @@ var TransformActionGroup = ({ tNotionLike, commonFns }) => {
|
|
|
9077
9074
|
if (!actions && !canReset) return null;
|
|
9078
9075
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
9079
9076
|
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:
|
|
9077
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(MenuGroupLabel, { children: commonHelpFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()) }),
|
|
9081
9078
|
actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(BaseMenuItem, { ...action }, action.label))
|
|
9082
9079
|
] }) }),
|
|
9083
9080
|
canReset && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(BaseMenuItem, { icon: Icon, label, disabled: !canReset, onClick: handleResetFormatting }),
|
|
@@ -9183,7 +9180,7 @@ var DragContextMenu = ({
|
|
|
9183
9180
|
withSlashCommandTrigger = true,
|
|
9184
9181
|
mobileBreakpoint = 768,
|
|
9185
9182
|
tNotionLike,
|
|
9186
|
-
|
|
9183
|
+
commonHelpFns,
|
|
9187
9184
|
...props
|
|
9188
9185
|
}) => {
|
|
9189
9186
|
const { editor } = useTiptapEditor(providedEditor);
|
|
@@ -9303,10 +9300,10 @@ var DragContextMenu = ({
|
|
|
9303
9300
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ColorMenu, { tNotionLike }),
|
|
9304
9301
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TableAlignMenu, { tNotionLike }),
|
|
9305
9302
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TableFitToWidth, { tNotionLike }),
|
|
9306
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TransformActionGroup, { tNotionLike,
|
|
9303
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(TransformActionGroup, { tNotionLike, commonHelpFns }),
|
|
9307
9304
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ImageActionGroup, {})
|
|
9308
9305
|
] }),
|
|
9309
|
-
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(CoreActionGroup, { tNotionLike,
|
|
9306
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(CoreActionGroup, { tNotionLike, commonHelpFns }),
|
|
9310
9307
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DeleteActionGroup, { tNotionLike })
|
|
9311
9308
|
] })
|
|
9312
9309
|
] })
|
|
@@ -10939,7 +10936,7 @@ var TurnIntoDropdownContent = ({
|
|
|
10939
10936
|
blockTypes,
|
|
10940
10937
|
useCardLayout = true,
|
|
10941
10938
|
tNotionLike,
|
|
10942
|
-
|
|
10939
|
+
commonHelpFns
|
|
10943
10940
|
}) => {
|
|
10944
10941
|
const filteredOptions = getFilteredBlockTypeOptions(tNotionLike, blockTypes);
|
|
10945
10942
|
const renderButtons = () => /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ButtonGroup, { children: filteredOptions.map(
|
|
@@ -10947,7 +10944,7 @@ var TurnIntoDropdownContent = ({
|
|
|
10947
10944
|
) });
|
|
10948
10945
|
if (!useCardLayout) return renderButtons();
|
|
10949
10946
|
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:
|
|
10947
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(CardGroupLabel, { children: commonHelpFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()) }),
|
|
10951
10948
|
renderButtons()
|
|
10952
10949
|
] }) }) });
|
|
10953
10950
|
};
|
|
@@ -10983,7 +10980,7 @@ var TurnIntoDropdown = (0, import_react138.forwardRef)(
|
|
|
10983
10980
|
onOpenChange,
|
|
10984
10981
|
children,
|
|
10985
10982
|
tNotionLike,
|
|
10986
|
-
|
|
10983
|
+
commonHelpFns,
|
|
10987
10984
|
...buttonProps
|
|
10988
10985
|
}, ref) => {
|
|
10989
10986
|
const { editor } = useTiptapEditor(providedEditor);
|
|
@@ -10993,7 +10990,7 @@ var TurnIntoDropdown = (0, import_react138.forwardRef)(
|
|
|
10993
10990
|
blockTypes,
|
|
10994
10991
|
onOpenChange,
|
|
10995
10992
|
tNotionLike,
|
|
10996
|
-
|
|
10993
|
+
commonHelpFns
|
|
10997
10994
|
});
|
|
10998
10995
|
if (!isVisible) {
|
|
10999
10996
|
return null;
|
|
@@ -11009,7 +11006,7 @@ var TurnIntoDropdown = (0, import_react138.forwardRef)(
|
|
|
11009
11006
|
role: "button",
|
|
11010
11007
|
tabIndex: -1,
|
|
11011
11008
|
"aria-label": label,
|
|
11012
|
-
tooltip:
|
|
11009
|
+
tooltip: commonHelpFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()),
|
|
11013
11010
|
...buttonProps,
|
|
11014
11011
|
ref,
|
|
11015
11012
|
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(import_jsx_runtime95.Fragment, { children: [
|
|
@@ -11018,7 +11015,7 @@ var TurnIntoDropdown = (0, import_react138.forwardRef)(
|
|
|
11018
11015
|
] })
|
|
11019
11016
|
}
|
|
11020
11017
|
) }),
|
|
11021
|
-
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(DropdownMenuContent, { align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(TurnIntoDropdownContent, { blockTypes, useCardLayout, tNotionLike,
|
|
11018
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(DropdownMenuContent, { align: "start", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(TurnIntoDropdownContent, { blockTypes, useCardLayout, tNotionLike, commonHelpFns }) })
|
|
11022
11019
|
] });
|
|
11023
11020
|
}
|
|
11024
11021
|
);
|
|
@@ -11122,7 +11119,7 @@ function shouldShowTurnInto(params) {
|
|
|
11122
11119
|
return true;
|
|
11123
11120
|
}
|
|
11124
11121
|
function useTurnIntoDropdown(config) {
|
|
11125
|
-
const { editor: providedEditor, hideWhenUnavailable = false, blockTypes, onOpenChange, tNotionLike,
|
|
11122
|
+
const { editor: providedEditor, hideWhenUnavailable = false, blockTypes, onOpenChange, tNotionLike, commonHelpFns } = config || {};
|
|
11126
11123
|
const { editor } = useTiptapEditor(providedEditor);
|
|
11127
11124
|
const [isOpen, setIsOpen] = (0, import_react139.useState)(false);
|
|
11128
11125
|
const [isVisible, setIsVisible] = (0, import_react139.useState)(true);
|
|
@@ -11161,7 +11158,7 @@ function useTurnIntoDropdown(config) {
|
|
|
11161
11158
|
activeBlockType,
|
|
11162
11159
|
handleOpenChange,
|
|
11163
11160
|
filteredOptions: getFilteredBlockTypeOptions(tNotionLike, blockTypes),
|
|
11164
|
-
label:
|
|
11161
|
+
label: commonHelpFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()) + ` (current: ${activeBlockType?.label || tNotionLike("Text")})`,
|
|
11165
11162
|
Icon: ChevronDownIcon
|
|
11166
11163
|
};
|
|
11167
11164
|
}
|
|
@@ -11643,7 +11640,7 @@ var import_react_i18next3 = require("react-i18next");
|
|
|
11643
11640
|
var import_react_fontawesome = require("@fortawesome/react-fontawesome");
|
|
11644
11641
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
11645
11642
|
function ImageExpandButton(props) {
|
|
11646
|
-
const {
|
|
11643
|
+
const { commonHelpFns } = props;
|
|
11647
11644
|
const { t } = (0, import_react_i18next3.useTranslation)("richText" /* richText */);
|
|
11648
11645
|
const { currentSelectedImgId } = window;
|
|
11649
11646
|
return currentSelectedImgId ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
@@ -11657,10 +11654,10 @@ function ImageExpandButton(props) {
|
|
|
11657
11654
|
"aria-label": "Preview",
|
|
11658
11655
|
tooltip: t("Preview"),
|
|
11659
11656
|
onClick: (e) => {
|
|
11660
|
-
|
|
11661
|
-
|
|
11657
|
+
commonHelpFns.ExpandImgIconClickHAndler(e, currentSelectedImgId);
|
|
11658
|
+
commonHelpFns.stopEventPropagation(e);
|
|
11662
11659
|
},
|
|
11663
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react_fontawesome.FontAwesomeIcon, { id: "ImageExpandBtnIcon", icon:
|
|
11660
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react_fontawesome.FontAwesomeIcon, { id: "ImageExpandBtnIcon", icon: commonHelpFns.customIcons.faExpand, style: { height: 20, width: "auto" } })
|
|
11664
11661
|
}
|
|
11665
11662
|
) : "";
|
|
11666
11663
|
}
|
|
@@ -12226,7 +12223,7 @@ var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
|
12226
12223
|
function ImageNodeFloating({
|
|
12227
12224
|
editor: providedEditor,
|
|
12228
12225
|
tNotionLike,
|
|
12229
|
-
|
|
12226
|
+
commonHelpFns
|
|
12230
12227
|
}) {
|
|
12231
12228
|
const { editor } = useTiptapEditor(providedEditor);
|
|
12232
12229
|
const visible = isNodeTypeSelected(editor, ["image"]);
|
|
@@ -12234,7 +12231,7 @@ function ImageNodeFloating({
|
|
|
12234
12231
|
return null;
|
|
12235
12232
|
}
|
|
12236
12233
|
return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(import_jsx_runtime108.Fragment, { children: [
|
|
12237
|
-
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(image_expand_button_default, {
|
|
12234
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(image_expand_button_default, { commonHelpFns }),
|
|
12238
12235
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ImageAlignButton, { align: "left" }),
|
|
12239
12236
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ImageAlignButton, { align: "center" }),
|
|
12240
12237
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(ImageAlignButton, { align: "right" }),
|
|
@@ -12415,25 +12412,25 @@ function ColorActionGroup({ tNotionLike }) {
|
|
|
12415
12412
|
] }) }) }) })
|
|
12416
12413
|
] });
|
|
12417
12414
|
}
|
|
12418
|
-
function TransformActionGroup2({ tNotionLike,
|
|
12415
|
+
function TransformActionGroup2({ tNotionLike, commonHelpFns }) {
|
|
12419
12416
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(DropdownMenuSub, { children: [
|
|
12420
12417
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuSubTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(Button, { "data-style": "ghost", children: [
|
|
12421
12418
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Repeat2Icon, { className: "tiptap-button-icon" }),
|
|
12422
|
-
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "tiptap-button-text", children:
|
|
12419
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("span", { className: "tiptap-button-text", children: commonHelpFns.capitalizeFirstLetter(tNotionLike("TurnInto").toLowerCase()) }),
|
|
12423
12420
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Spacer, {}),
|
|
12424
12421
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ChevronRightIcon, { className: "tiptap-button-icon" })
|
|
12425
12422
|
] }) }),
|
|
12426
|
-
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuSubContent, { children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(TurnIntoDropdownContent, { tNotionLike,
|
|
12423
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuSubContent, { children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(TurnIntoDropdownContent, { tNotionLike, commonHelpFns }) })
|
|
12427
12424
|
] });
|
|
12428
12425
|
}
|
|
12429
|
-
function DropdownMenuActions({ editor, tNotionLike,
|
|
12426
|
+
function DropdownMenuActions({ editor, tNotionLike, commonHelpFns }) {
|
|
12430
12427
|
const isMobile = useIsBreakpoint();
|
|
12431
12428
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(CardBody, { children: [
|
|
12432
12429
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(CardItemGroup, { children: [
|
|
12433
12430
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(CardGroupLabel, { children: getNodeDisplayName(editor, tNotionLike) }),
|
|
12434
12431
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(ButtonGroup, { children: [
|
|
12435
12432
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ColorActionGroup, { tNotionLike }),
|
|
12436
|
-
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(TransformActionGroup2, { tNotionLike,
|
|
12433
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(TransformActionGroup2, { tNotionLike, commonHelpFns }),
|
|
12437
12434
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuItem, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ResetAllFormattingButton, { text: tNotionLike("ResetFormatting"), tNotionLike }) })
|
|
12438
12435
|
] })
|
|
12439
12436
|
] }),
|
|
@@ -12461,10 +12458,10 @@ function DropdownMenuActions({ editor, tNotionLike, commonFns }) {
|
|
|
12461
12458
|
/* @__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
12459
|
] }) });
|
|
12463
12460
|
}
|
|
12464
|
-
function MoreActionsDropdown({ editor, tNotionLike,
|
|
12461
|
+
function MoreActionsDropdown({ editor, tNotionLike, commonHelpFns }) {
|
|
12465
12462
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(DropdownMenu, { modal: true, children: [
|
|
12466
12463
|
/* @__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,
|
|
12464
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuContent, { portal: true, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(DropdownMenuActions, { editor, tNotionLike, commonHelpFns }) })
|
|
12468
12465
|
] });
|
|
12469
12466
|
}
|
|
12470
12467
|
function ToolbarViewButton({ view, isMobile, onViewChange }) {
|
|
@@ -12493,14 +12490,14 @@ function MainToolbarContent({
|
|
|
12493
12490
|
toolbarViews,
|
|
12494
12491
|
onViewChange,
|
|
12495
12492
|
tNotionLike,
|
|
12496
|
-
|
|
12493
|
+
commonHelpFns
|
|
12497
12494
|
}) {
|
|
12498
12495
|
const hasSelection = hasTextSelection(editor);
|
|
12499
12496
|
const hasContent = (editor?.getText().length ?? 0) > 0;
|
|
12500
12497
|
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
|
|
12501
12498
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(ToolbarGroup, { children: [
|
|
12502
12499
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(SlashCommandTriggerButton, { tNotionLike }),
|
|
12503
|
-
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(MoreActionsDropdown, { editor, tNotionLike,
|
|
12500
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(MoreActionsDropdown, { editor, tNotionLike, commonHelpFns }),
|
|
12504
12501
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ToolbarSeparator, {})
|
|
12505
12502
|
] }),
|
|
12506
12503
|
(hasSelection || hasContent) && /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
|
|
@@ -12514,7 +12511,7 @@ function MainToolbarContent({
|
|
|
12514
12511
|
editor
|
|
12515
12512
|
}
|
|
12516
12513
|
),
|
|
12517
|
-
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ImageNodeFloating, { tNotionLike,
|
|
12514
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ImageNodeFloating, { tNotionLike, commonHelpFns }),
|
|
12518
12515
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(ScriptGroup, { tNotionLike }),
|
|
12519
12516
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(AlignmentGroup, { tNotionLike }),
|
|
12520
12517
|
/* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(ToolbarGroup, { children: [
|
|
@@ -12538,7 +12535,7 @@ function SpecializedToolbarContent({ view, onBack }) {
|
|
|
12538
12535
|
view.content
|
|
12539
12536
|
] });
|
|
12540
12537
|
}
|
|
12541
|
-
function MobileToolbar({ editor: providedEditor, tNotionLike,
|
|
12538
|
+
function MobileToolbar({ editor: providedEditor, tNotionLike, commonHelpFns }) {
|
|
12542
12539
|
const { editor } = useTiptapEditor(providedEditor);
|
|
12543
12540
|
const isMobile = useIsBreakpoint("max", 480);
|
|
12544
12541
|
const toolbarRef = (0, import_react155.useRef)(null);
|
|
@@ -12571,7 +12568,7 @@ function MobileToolbar({ editor: providedEditor, tNotionLike, commonFns }) {
|
|
|
12571
12568
|
toolbarViews,
|
|
12572
12569
|
onViewChange: toolbarState.showView,
|
|
12573
12570
|
tNotionLike,
|
|
12574
|
-
|
|
12571
|
+
commonHelpFns
|
|
12575
12572
|
}
|
|
12576
12573
|
) : currentView && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(SpecializedToolbarContent, { view: currentView, onBack: toolbarState.showMainView })
|
|
12577
12574
|
}
|
|
@@ -12829,7 +12826,7 @@ var isElementWithinEditor = (editor, element) => {
|
|
|
12829
12826
|
|
|
12830
12827
|
// src/components/tiptap-templates/notion-like/notion-like-editor-toolbar-floating.tsx
|
|
12831
12828
|
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
12832
|
-
function NotionToolbarFloating({ tNotionLike,
|
|
12829
|
+
function NotionToolbarFloating({ tNotionLike, commonHelpFns }) {
|
|
12833
12830
|
const { editor } = useTiptapEditor();
|
|
12834
12831
|
const isMobile = useIsBreakpoint("max", 480);
|
|
12835
12832
|
const { lockDragHandle, commentInputVisible } = useUiEditorState(editor);
|
|
@@ -12840,7 +12837,7 @@ function NotionToolbarFloating({ tNotionLike, commonFns }) {
|
|
|
12840
12837
|
});
|
|
12841
12838
|
if (lockDragHandle || isMobile) return null;
|
|
12842
12839
|
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,
|
|
12840
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(TurnIntoDropdown, { hideWhenUnavailable: true, tNotionLike, commonHelpFns }) }),
|
|
12844
12841
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarSeparator, {}),
|
|
12845
12842
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(ToolbarGroup, { children: [
|
|
12846
12843
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(MarkButton, { type: "bold", hideWhenUnavailable: true, tNotionLike }),
|
|
@@ -12850,7 +12847,7 @@ function NotionToolbarFloating({ tNotionLike, commonFns }) {
|
|
|
12850
12847
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(MarkButton, { type: "code", hideWhenUnavailable: true, tNotionLike })
|
|
12851
12848
|
] }),
|
|
12852
12849
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarSeparator, {}),
|
|
12853
|
-
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ImageNodeFloating, { tNotionLike,
|
|
12850
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ImageNodeFloating, { tNotionLike, commonHelpFns }) }),
|
|
12854
12851
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(VideoNodeFloating, { tNotionLike }) }),
|
|
12855
12852
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsxs)(ToolbarGroup, { children: [
|
|
12856
12853
|
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(LinkPopover, { autoOpenOnLinkActive: false, hideWhenUnavailable: true, tNotionLike }),
|
|
@@ -16224,7 +16221,6 @@ function tableMoveRowColumn({
|
|
|
16224
16221
|
};
|
|
16225
16222
|
const to = from + delta[direction];
|
|
16226
16223
|
const moveOperation = finalOrientation === "row" ? import_tables7.moveTableRow : import_tables7.moveTableColumn;
|
|
16227
|
-
console.log({ from, to, finalOrientation, direction });
|
|
16228
16224
|
const dispatch = (tr) => editor.view.dispatch(tr);
|
|
16229
16225
|
if (editor.state.selection instanceof import_tables7.CellSelection) {
|
|
16230
16226
|
return moveOperation({ from, to, select: true, pos: table.start })(editor.state, dispatch);
|
|
@@ -17109,7 +17105,6 @@ function tableSortRowColumn({
|
|
|
17109
17105
|
});
|
|
17110
17106
|
const dataItems = allItems.filter((item) => !item.isHeader);
|
|
17111
17107
|
if (dataItems.length < 2) {
|
|
17112
|
-
console.log("No sortable data cells found (excluding headers)");
|
|
17113
17108
|
return false;
|
|
17114
17109
|
}
|
|
17115
17110
|
dataItems.sort((a, b) => {
|
|
@@ -19062,8 +19057,6 @@ var getHierarchicalIndexes = (headline, previousHeadlines, currentLevel) => {
|
|
|
19062
19057
|
// src/Custom-Extensions/extension-customToC/tableOfContents.ts
|
|
19063
19058
|
var getUuidv4 = () => {
|
|
19064
19059
|
const newGenId = (0, import_ulid2.ulid)();
|
|
19065
|
-
console.log("getUuidv4 :: WILL GEN ID !!!! newGenId : ", newGenId);
|
|
19066
|
-
debugger;
|
|
19067
19060
|
return newGenId;
|
|
19068
19061
|
};
|
|
19069
19062
|
var getTocId = (attrs) => attrs["data-toc-id"] || attrs["data-id"] || attrs.id;
|
|
@@ -19370,7 +19363,7 @@ var useResizeHandles = (args) => {
|
|
|
19370
19363
|
leftResizeHandleRef,
|
|
19371
19364
|
rightResizeHandleRef,
|
|
19372
19365
|
nodeId,
|
|
19373
|
-
|
|
19366
|
+
commonHelpFns
|
|
19374
19367
|
} = args;
|
|
19375
19368
|
const resizeParamsRef = (0, import_react197.useRef)(void 0);
|
|
19376
19369
|
const widthRef = (0, import_react197.useRef)(width);
|
|
@@ -19379,7 +19372,7 @@ var useResizeHandles = (args) => {
|
|
|
19379
19372
|
heightRef.current = height;
|
|
19380
19373
|
const windowMouseMoveHandler = (0, import_react197.useCallback)(
|
|
19381
19374
|
(event) => {
|
|
19382
|
-
|
|
19375
|
+
commonHelpFns.stopEventPropagation(event);
|
|
19383
19376
|
const { current: resizeParamsFromRef } = resizeParamsRef;
|
|
19384
19377
|
if (!resizeParamsFromRef || !editor || !isMountedRef.current) {
|
|
19385
19378
|
return;
|
|
@@ -19537,12 +19530,11 @@ var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
|
19537
19530
|
function ImageNodeView(props) {
|
|
19538
19531
|
const { editor, node, updateAttributes, getPos } = props;
|
|
19539
19532
|
const hasContent = node.content.size > 0;
|
|
19540
|
-
const {
|
|
19541
|
-
|
|
19542
|
-
|
|
19543
|
-
console.error("ImageNodeView :: commonFns NOT PROVIDED !!!!");
|
|
19533
|
+
const { commonHelpFns } = (0, import_react198.useContext)(import_react199.EditorContext);
|
|
19534
|
+
if (!commonHelpFns) {
|
|
19535
|
+
console.error("ImageNodeView :: commonHelpFns NOT PROVIDED !!!!");
|
|
19544
19536
|
}
|
|
19545
|
-
const { getFileUrl } =
|
|
19537
|
+
const { getFileUrl } = commonHelpFns || {};
|
|
19546
19538
|
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
19547
19539
|
ResizableImage,
|
|
19548
19540
|
{
|
|
@@ -19557,10 +19549,8 @@ function ImageNodeView(props) {
|
|
|
19557
19549
|
hasContent,
|
|
19558
19550
|
nodeSize: node.nodeSize,
|
|
19559
19551
|
onImageResize: (width, height) => {
|
|
19560
|
-
console.log("\n\n \u{1F680} onImageResize >>>>> width:" + width + " :: height : ", height);
|
|
19561
19552
|
if (getFileUrl) {
|
|
19562
19553
|
const src = getFileUrl(node.attrs.id, width, height);
|
|
19563
|
-
console.log("\u{1F680} onImageResize >>>>> src:", src);
|
|
19564
19554
|
return updateAttributes({ width, src, height });
|
|
19565
19555
|
} else {
|
|
19566
19556
|
console.error("onImageResize ERROR :: getFileUrl NOT PROVIDED !!!!");
|
|
@@ -19568,7 +19558,7 @@ function ImageNodeView(props) {
|
|
|
19568
19558
|
},
|
|
19569
19559
|
onUpdateAttributes: updateAttributes,
|
|
19570
19560
|
getPos,
|
|
19571
|
-
|
|
19561
|
+
commonHelpFns
|
|
19572
19562
|
}
|
|
19573
19563
|
);
|
|
19574
19564
|
}
|
|
@@ -19588,7 +19578,7 @@ var ResizableImage = ({
|
|
|
19588
19578
|
onImageResize,
|
|
19589
19579
|
onUpdateAttributes,
|
|
19590
19580
|
getPos,
|
|
19591
|
-
|
|
19581
|
+
commonHelpFns
|
|
19592
19582
|
}) => {
|
|
19593
19583
|
const [width, setWidth] = (0, import_react198.useState)(initialWidth);
|
|
19594
19584
|
const [height, setHeight] = (0, import_react198.useState)(initialHeight);
|
|
@@ -19629,7 +19619,7 @@ var ResizableImage = ({
|
|
|
19629
19619
|
leftResizeHandleRef,
|
|
19630
19620
|
rightResizeHandleRef,
|
|
19631
19621
|
nodeId: id,
|
|
19632
|
-
|
|
19622
|
+
commonHelpFns
|
|
19633
19623
|
});
|
|
19634
19624
|
(0, import_react198.useEffect)(() => {
|
|
19635
19625
|
if (!editor || !showCaption) return;
|
|
@@ -19680,8 +19670,8 @@ var ResizableImage = ({
|
|
|
19680
19670
|
className: "tiptap-image-container",
|
|
19681
19671
|
style: { width: width ? `${width}px` : "fit-content" },
|
|
19682
19672
|
onDoubleClick: (e) => {
|
|
19683
|
-
|
|
19684
|
-
|
|
19673
|
+
commonHelpFns.ExpandImgIconClickHAndler(e, id);
|
|
19674
|
+
commonHelpFns.stopEventPropagation(e);
|
|
19685
19675
|
},
|
|
19686
19676
|
children: [
|
|
19687
19677
|
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "tiptap-image-content", children: [
|
|
@@ -20472,8 +20462,6 @@ var ImageUploadNode = (props) => {
|
|
|
20472
20462
|
onSuccess: extension.options.onSuccess,
|
|
20473
20463
|
onError: extension.options.onError
|
|
20474
20464
|
};
|
|
20475
|
-
const { commonFns } = (0, import_react202.useContext)(import_react203.EditorContext);
|
|
20476
|
-
console.log("\u{1F680} ~ ImageUploadNode ~ commonFns:", commonFns);
|
|
20477
20465
|
const { fileItems, uploadFiles, removeFileItem, clearAllFiles } = useFileUpload(uploadOptions);
|
|
20478
20466
|
const handleUpload = async (files) => {
|
|
20479
20467
|
const imgsInfos = await uploadFiles(files);
|
|
@@ -20856,7 +20844,7 @@ var useNotionLikeExtensions = (args) => {
|
|
|
20856
20844
|
setTocContent,
|
|
20857
20845
|
ignore,
|
|
20858
20846
|
customExtensions = [],
|
|
20859
|
-
|
|
20847
|
+
commonHelpFns
|
|
20860
20848
|
} = args;
|
|
20861
20849
|
const editable = Boolean(isEditable);
|
|
20862
20850
|
const localHandleImageUpload = (0, import_react206.useCallback)(
|
|
@@ -20866,7 +20854,7 @@ var useNotionLikeExtensions = (args) => {
|
|
|
20866
20854
|
}
|
|
20867
20855
|
const { current: editor } = editorRef;
|
|
20868
20856
|
const { view } = editor;
|
|
20869
|
-
|
|
20857
|
+
commonHelpFns.uploadImageForNotion({
|
|
20870
20858
|
file,
|
|
20871
20859
|
view,
|
|
20872
20860
|
onProgress,
|
|
@@ -20983,7 +20971,7 @@ var useNotionLikeExtensions_default = useNotionLikeExtensions;
|
|
|
20983
20971
|
// src/components/tiptap-node/toc-node/ui/toc-sidebar/toc-sidebar.tsx
|
|
20984
20972
|
var import_react207 = require("react");
|
|
20985
20973
|
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
20986
|
-
function TocSidebar({ className, maxShowCount = 20, topOffset = 0,
|
|
20974
|
+
function TocSidebar({ className, maxShowCount = 20, topOffset = 0, commonHelpFns, ...props }) {
|
|
20987
20975
|
const { tocContent, normalizeHeadingDepths: normalizeHeadingDepths2 } = useToc();
|
|
20988
20976
|
const tocContainerRef = (0, import_react207.useRef)(null);
|
|
20989
20977
|
const [manualActiveId, setManualActiveId] = (0, import_react207.useState)(null);
|
|
@@ -21028,14 +21016,14 @@ function TocSidebar({ className, maxShowCount = 20, topOffset = 0, commonFns, ..
|
|
|
21028
21016
|
e.stopPropagation();
|
|
21029
21017
|
if (target.closest(".toc-sidebar-item")) {
|
|
21030
21018
|
const element = item.editor.view.dom.querySelector(`[data-toc-id="${item.id}"`);
|
|
21031
|
-
|
|
21019
|
+
commonHelpFns.scrollToElementInsideContainerEl(tocContainerRef.current, element, true);
|
|
21032
21020
|
}
|
|
21033
21021
|
},
|
|
21034
21022
|
[topOffset]
|
|
21035
21023
|
);
|
|
21036
21024
|
const bpOnScrollEventHandler = (0, import_react207.useCallback)(() => {
|
|
21037
21025
|
const { current: manualActiveIdFromRef } = manualActiveIdRef;
|
|
21038
|
-
|
|
21026
|
+
commonHelpFns.periodicallyExecute(
|
|
21039
21027
|
"bpOnScrollEventHandler",
|
|
21040
21028
|
function(mAId) {
|
|
21041
21029
|
if (mAId !== null) {
|
|
@@ -21145,10 +21133,10 @@ function EditorProvider(props) {
|
|
|
21145
21133
|
setAutoFocusOnPopupIsReady,
|
|
21146
21134
|
ExpandImgIconClickHAndler,
|
|
21147
21135
|
tNotionLike,
|
|
21148
|
-
|
|
21136
|
+
commonHelpFns,
|
|
21149
21137
|
customExtensions
|
|
21150
21138
|
} = getInchangeableProps();
|
|
21151
|
-
const { getUpdatedProseMirrorViewVars, urlToFile, ...restCommonFns } =
|
|
21139
|
+
const { getUpdatedProseMirrorViewVars, urlToFile, ...restCommonFns } = commonHelpFns;
|
|
21152
21140
|
const extensions = useNotionLikeExtensions_default({
|
|
21153
21141
|
isEditable,
|
|
21154
21142
|
withImages,
|
|
@@ -21158,7 +21146,7 @@ function EditorProvider(props) {
|
|
|
21158
21146
|
withVideo,
|
|
21159
21147
|
setTocContent,
|
|
21160
21148
|
customExtensions,
|
|
21161
|
-
|
|
21149
|
+
commonHelpFns: restCommonFns
|
|
21162
21150
|
});
|
|
21163
21151
|
const imageIndexRef = (0, import_react208.useRef)(0);
|
|
21164
21152
|
const transformNode = (args) => {
|
|
@@ -21191,7 +21179,6 @@ function EditorProvider(props) {
|
|
|
21191
21179
|
)
|
|
21192
21180
|
);
|
|
21193
21181
|
const newSlice = new Slice2(newContent, slice.openStart, slice.openEnd);
|
|
21194
|
-
console.log("\u{1F680} handlePaste ~ 000000 >>> newSlice:", newSlice);
|
|
21195
21182
|
imageIndexRef2.current = 0;
|
|
21196
21183
|
insertSliceAtBookmark(view, bookmark, newSlice);
|
|
21197
21184
|
};
|
|
@@ -21261,10 +21248,7 @@ function EditorProvider(props) {
|
|
|
21261
21248
|
class: "notion-like-editor noouter"
|
|
21262
21249
|
},
|
|
21263
21250
|
handlePaste(view, event, slice) {
|
|
21264
|
-
|
|
21265
|
-
console.log("\u{1F680} handlePaste ~ slice:", slice);
|
|
21266
|
-
console.log("\u{1F680} handlePaste ~ sliceIsEmpty:", sliceIsEmpty);
|
|
21267
|
-
commonFns.stopEventPropagation(event);
|
|
21251
|
+
commonHelpFns.stopEventPropagation(event);
|
|
21268
21252
|
const { schema } = editorRef.current;
|
|
21269
21253
|
const { image: imageType, imageUpload: imageUploadType } = schema.nodes;
|
|
21270
21254
|
const bookmark = view.state.selection.getBookmark();
|
|
@@ -21279,7 +21263,6 @@ function EditorProvider(props) {
|
|
|
21279
21263
|
}
|
|
21280
21264
|
}
|
|
21281
21265
|
}
|
|
21282
|
-
console.log("\u{1F680} ~ handlePaste ~ fileImages:", fileImages);
|
|
21283
21266
|
if (slice.content.size === 0 && fileImages.length) {
|
|
21284
21267
|
setTimeout(
|
|
21285
21268
|
(blobs) => {
|
|
@@ -21314,12 +21297,9 @@ function EditorProvider(props) {
|
|
|
21314
21297
|
if (htmlItem) {
|
|
21315
21298
|
htmlItem.getAsString((html) => {
|
|
21316
21299
|
const htmlImages = extractImagesFromHtml(html);
|
|
21317
|
-
console.log("AAA :: FILE images:", fileImages);
|
|
21318
|
-
console.log("AAA :: HTML images:", htmlImages);
|
|
21319
21300
|
if (htmlImages.length) {
|
|
21320
21301
|
const htmlImagesFiles = [];
|
|
21321
21302
|
htmlImages.forEach((htmImg, hiIndex) => {
|
|
21322
|
-
console.log("htmImg :: ", htmImg);
|
|
21323
21303
|
const isFile = htmImg instanceof File;
|
|
21324
21304
|
if (!isFile) {
|
|
21325
21305
|
const { src } = htmImg;
|
|
@@ -21327,7 +21307,6 @@ function EditorProvider(props) {
|
|
|
21327
21307
|
if (err) {
|
|
21328
21308
|
console.error("handlePaste.urlToFile.cb ~ err : ", err);
|
|
21329
21309
|
} else {
|
|
21330
|
-
console.log("file :: ", imf);
|
|
21331
21310
|
htmlImagesFiles.push(imf);
|
|
21332
21311
|
if (htmlImagesFiles.length === htmlImages.length) {
|
|
21333
21312
|
transformNodesAndinsertSliceAtBmark({
|
|
@@ -21359,7 +21338,6 @@ function EditorProvider(props) {
|
|
|
21359
21338
|
}
|
|
21360
21339
|
});
|
|
21361
21340
|
} else {
|
|
21362
|
-
console.log("BBB :: FILE images:", fileImages);
|
|
21363
21341
|
transformNodesAndinsertSliceAtBmark({
|
|
21364
21342
|
Fragment: Fragment31,
|
|
21365
21343
|
imageType,
|
|
@@ -21520,8 +21498,7 @@ function EditorProvider(props) {
|
|
|
21520
21498
|
}
|
|
21521
21499
|
},
|
|
21522
21500
|
onPaste(event, slice) {
|
|
21523
|
-
|
|
21524
|
-
commonFns.stopEventPropagation(event);
|
|
21501
|
+
commonHelpFns.stopEventPropagation(event);
|
|
21525
21502
|
return true;
|
|
21526
21503
|
},
|
|
21527
21504
|
editable: Boolean(isEditable)
|
|
@@ -21561,16 +21538,16 @@ function EditorProvider(props) {
|
|
|
21561
21538
|
...extraStyle
|
|
21562
21539
|
},
|
|
21563
21540
|
children: [
|
|
21564
|
-
/* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_react209.EditorContext.Provider, { value: { editor,
|
|
21541
|
+
/* @__PURE__ */ (0, import_jsx_runtime138.jsxs)(import_react209.EditorContext.Provider, { value: { editor, commonHelpFns: { ...restCommonFns, getFileUrl, ExpandImgIconClickHAndler } }, children: [
|
|
21565
21542
|
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
21566
21543
|
EditorContentArea,
|
|
21567
21544
|
{
|
|
21568
21545
|
mentionListRef,
|
|
21569
21546
|
tNotionLike,
|
|
21570
|
-
|
|
21547
|
+
commonHelpFns: restCommonFns
|
|
21571
21548
|
}
|
|
21572
21549
|
),
|
|
21573
|
-
withToc && showToCInBookPages ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(TocSidebar, { topOffset: 48,
|
|
21550
|
+
withToc && showToCInBookPages ? /* @__PURE__ */ (0, import_jsx_runtime138.jsx)(TocSidebar, { topOffset: 48, commonHelpFns: restCommonFns }) : "",
|
|
21574
21551
|
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(TableExtendRowColumnButtons, {}),
|
|
21575
21552
|
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(TableHandle, { tNotionLike }),
|
|
21576
21553
|
/* @__PURE__ */ (0, import_jsx_runtime138.jsx)(
|
|
@@ -21615,7 +21592,7 @@ function LoadingSpinner({ text = "Connecting..." }) {
|
|
|
21615
21592
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)("div", { className: "spinner-loading-text", children: text })
|
|
21616
21593
|
] }) });
|
|
21617
21594
|
}
|
|
21618
|
-
function EditorContentArea({ mentionListRef, tNotionLike,
|
|
21595
|
+
function EditorContentArea({ mentionListRef, tNotionLike, commonHelpFns }) {
|
|
21619
21596
|
const { editor } = (0, import_react210.useContext)(import_react211.EditorContext);
|
|
21620
21597
|
const { isDragging } = useUiEditorState(editor);
|
|
21621
21598
|
useScrollToHash();
|
|
@@ -21632,13 +21609,13 @@ function EditorContentArea({ mentionListRef, tNotionLike, commonFns }) {
|
|
|
21632
21609
|
cursor: isDragging ? "grabbing" : "auto"
|
|
21633
21610
|
},
|
|
21634
21611
|
children: [
|
|
21635
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(DragContextMenu, { tNotionLike,
|
|
21612
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(DragContextMenu, { tNotionLike, commonHelpFns }),
|
|
21636
21613
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(EmojiDropdownMenu, {}),
|
|
21637
21614
|
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(MentionDropdownMenu, { mentionListRef }),
|
|
21638
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(SlashDropdownMenu, {
|
|
21639
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(NotionToolbarFloating, { tNotionLike,
|
|
21615
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(SlashDropdownMenu, { commonHelpFns }),
|
|
21616
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(NotionToolbarFloating, { tNotionLike, commonHelpFns }),
|
|
21640
21617
|
(0, import_react_dom.createPortal)(
|
|
21641
|
-
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(MobileToolbar, { tNotionLike,
|
|
21618
|
+
/* @__PURE__ */ (0, import_jsx_runtime139.jsx)(MobileToolbar, { tNotionLike, commonHelpFns }),
|
|
21642
21619
|
document.body
|
|
21643
21620
|
)
|
|
21644
21621
|
]
|