neuphlo-editor 2.0.0 → 2.0.1
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/react/index.cjs +15 -4
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +15 -4
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -2561,6 +2561,7 @@ var ImageBlockMenu = ({ editor, getPos, appendTo }) => {
|
|
|
2561
2561
|
if (!ctx.editor) return { isVisible: false, align: "center", width: 100 };
|
|
2562
2562
|
const { state } = ctx.editor;
|
|
2563
2563
|
const { selection } = state;
|
|
2564
|
+
if (!ctx.editor.isEditable) return { isVisible: false, align: "center", width: 100 };
|
|
2564
2565
|
const isNodeSel = selection instanceof import_state6.NodeSelection;
|
|
2565
2566
|
const isThisNode = isNodeSel && selection.from === getPos();
|
|
2566
2567
|
const visible = isThisNode;
|
|
@@ -2898,13 +2899,14 @@ var ImageBlockView = (props) => {
|
|
|
2898
2899
|
position: "relative"
|
|
2899
2900
|
});
|
|
2900
2901
|
if (!src || src === "") {
|
|
2902
|
+
if (!editor.isEditable) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react26.NodeViewWrapper, {});
|
|
2901
2903
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react26.NodeViewWrapper, { style: { width: "100%", marginTop: "0.5rem", marginBottom: "0.5rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: imageWrapperRef, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageUploader, { onUpload: handleUpload, editor }) }) });
|
|
2902
2904
|
}
|
|
2903
2905
|
if (loading) {
|
|
2904
2906
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react26.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: imageWrapperRef, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageBlockLoading, {}) }) });
|
|
2905
2907
|
}
|
|
2906
2908
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react26.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { contentEditable: false, ref: imageWrapperRef, style: getContentStyle(), children: [
|
|
2907
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageResizeHandle, { onResize: handleResize, currentWidth: width, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2909
|
+
editor.isEditable ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageResizeHandle, { onResize: handleResize, currentWidth: width, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2908
2910
|
"img",
|
|
2909
2911
|
{
|
|
2910
2912
|
src,
|
|
@@ -2912,8 +2914,15 @@ var ImageBlockView = (props) => {
|
|
|
2912
2914
|
onClick,
|
|
2913
2915
|
className: "nph-image-block"
|
|
2914
2916
|
}
|
|
2915
|
-
) }),
|
|
2916
|
-
|
|
2917
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2918
|
+
"img",
|
|
2919
|
+
{
|
|
2920
|
+
src,
|
|
2921
|
+
alt: alt || "",
|
|
2922
|
+
className: "nph-image-block"
|
|
2923
|
+
}
|
|
2924
|
+
),
|
|
2925
|
+
editor.isEditable && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageBlockMenu, { editor, getPos, appendTo: imageWrapperRef })
|
|
2917
2926
|
] }) });
|
|
2918
2927
|
};
|
|
2919
2928
|
|
|
@@ -2936,6 +2945,7 @@ var VideoBlockMenu = ({ editor, getPos }) => {
|
|
|
2936
2945
|
if (!ctx.editor) return { isVisible: false, align: "center", width: 100 };
|
|
2937
2946
|
const { state } = ctx.editor;
|
|
2938
2947
|
const { selection } = state;
|
|
2948
|
+
if (!ctx.editor.isEditable) return { isVisible: false, align: "center", width: 100 };
|
|
2939
2949
|
const isNodeSel = selection instanceof import_state7.NodeSelection;
|
|
2940
2950
|
const isThisNode = isNodeSel && selection.from === getPos();
|
|
2941
2951
|
let currentAlign = "center";
|
|
@@ -3105,6 +3115,7 @@ var VideoBlockView = (props) => {
|
|
|
3105
3115
|
}
|
|
3106
3116
|
};
|
|
3107
3117
|
if (!src || src === "") {
|
|
3118
|
+
if (!editor.isEditable) return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react30.NodeViewWrapper, {});
|
|
3108
3119
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react30.NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: wrapperRef, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "nph-video-input", children: [
|
|
3109
3120
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "nph-video-input__icon", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons_react10.IconVideo, { size: 24 }) }),
|
|
3110
3121
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "nph-video-input__content", children: [
|
|
@@ -3157,7 +3168,7 @@ var VideoBlockView = (props) => {
|
|
|
3157
3168
|
}
|
|
3158
3169
|
)
|
|
3159
3170
|
] }),
|
|
3160
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(VideoBlockMenu, { editor, getPos })
|
|
3171
|
+
editor.isEditable && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(VideoBlockMenu, { editor, getPos })
|
|
3161
3172
|
]
|
|
3162
3173
|
}
|
|
3163
3174
|
) });
|