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.
@@ -1349,6 +1349,7 @@ var ImageBlockMenu = ({ editor, getPos, appendTo }) => {
1349
1349
  if (!ctx.editor) return { isVisible: false, align: "center", width: 100 };
1350
1350
  const { state } = ctx.editor;
1351
1351
  const { selection } = state;
1352
+ if (!ctx.editor.isEditable) return { isVisible: false, align: "center", width: 100 };
1352
1353
  const isNodeSel = selection instanceof NodeSelection3;
1353
1354
  const isThisNode = isNodeSel && selection.from === getPos();
1354
1355
  const visible = isThisNode;
@@ -1686,13 +1687,14 @@ var ImageBlockView = (props) => {
1686
1687
  position: "relative"
1687
1688
  });
1688
1689
  if (!src || src === "") {
1690
+ if (!editor.isEditable) return /* @__PURE__ */ jsx11(NodeViewWrapper, {});
1689
1691
  return /* @__PURE__ */ jsx11(NodeViewWrapper, { style: { width: "100%", marginTop: "0.5rem", marginBottom: "0.5rem" }, children: /* @__PURE__ */ jsx11("div", { ref: imageWrapperRef, children: /* @__PURE__ */ jsx11(ImageUploader, { onUpload: handleUpload, editor }) }) });
1690
1692
  }
1691
1693
  if (loading) {
1692
1694
  return /* @__PURE__ */ jsx11(NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ jsx11("div", { ref: imageWrapperRef, children: /* @__PURE__ */ jsx11(ImageBlockLoading, {}) }) });
1693
1695
  }
1694
1696
  return /* @__PURE__ */ jsx11(NodeViewWrapper, { style: getWrapperStyle(), children: /* @__PURE__ */ jsxs11("div", { contentEditable: false, ref: imageWrapperRef, style: getContentStyle(), children: [
1695
- /* @__PURE__ */ jsx11(ImageResizeHandle, { onResize: handleResize, currentWidth: width, children: /* @__PURE__ */ jsx11(
1697
+ editor.isEditable ? /* @__PURE__ */ jsx11(ImageResizeHandle, { onResize: handleResize, currentWidth: width, children: /* @__PURE__ */ jsx11(
1696
1698
  "img",
1697
1699
  {
1698
1700
  src,
@@ -1700,8 +1702,15 @@ var ImageBlockView = (props) => {
1700
1702
  onClick,
1701
1703
  className: "nph-image-block"
1702
1704
  }
1703
- ) }),
1704
- /* @__PURE__ */ jsx11(ImageBlockMenu, { editor, getPos, appendTo: imageWrapperRef })
1705
+ ) }) : /* @__PURE__ */ jsx11(
1706
+ "img",
1707
+ {
1708
+ src,
1709
+ alt: alt || "",
1710
+ className: "nph-image-block"
1711
+ }
1712
+ ),
1713
+ editor.isEditable && /* @__PURE__ */ jsx11(ImageBlockMenu, { editor, getPos, appendTo: imageWrapperRef })
1705
1714
  ] }) });
1706
1715
  };
1707
1716
 
@@ -1729,6 +1738,7 @@ var VideoBlockMenu = ({ editor, getPos }) => {
1729
1738
  if (!ctx.editor) return { isVisible: false, align: "center", width: 100 };
1730
1739
  const { state } = ctx.editor;
1731
1740
  const { selection } = state;
1741
+ if (!ctx.editor.isEditable) return { isVisible: false, align: "center", width: 100 };
1732
1742
  const isNodeSel = selection instanceof NodeSelection4;
1733
1743
  const isThisNode = isNodeSel && selection.from === getPos();
1734
1744
  let currentAlign = "center";
@@ -1898,6 +1908,7 @@ var VideoBlockView = (props) => {
1898
1908
  }
1899
1909
  };
1900
1910
  if (!src || src === "") {
1911
+ if (!editor.isEditable) return /* @__PURE__ */ jsx13(NodeViewWrapper2, {});
1901
1912
  return /* @__PURE__ */ jsx13(NodeViewWrapper2, { style: getWrapperStyle(), children: /* @__PURE__ */ jsx13("div", { ref: wrapperRef, children: /* @__PURE__ */ jsxs13("div", { className: "nph-video-input", children: [
1902
1913
  /* @__PURE__ */ jsx13("div", { className: "nph-video-input__icon", children: /* @__PURE__ */ jsx13(IconVideo2, { size: 24 }) }),
1903
1914
  /* @__PURE__ */ jsxs13("div", { className: "nph-video-input__content", children: [
@@ -1950,7 +1961,7 @@ var VideoBlockView = (props) => {
1950
1961
  }
1951
1962
  )
1952
1963
  ] }),
1953
- /* @__PURE__ */ jsx13(VideoBlockMenu, { editor, getPos })
1964
+ editor.isEditable && /* @__PURE__ */ jsx13(VideoBlockMenu, { editor, getPos })
1954
1965
  ]
1955
1966
  }
1956
1967
  ) });