rme 0.3.0-beta.7 → 0.3.0-beta.9

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.mjs CHANGED
@@ -895,6 +895,7 @@ var WysiwygThemeWrapper = styled.div.attrs((p) => ({
895
895
  height: min-content;
896
896
  display: inline-block;
897
897
  font-size: 16px;
898
+ line-height: ${(props) => props.rootLineHeight};
898
899
  animation: loading-icon-spin 1s linear infinite;
899
900
  }
900
901
 
@@ -1275,8 +1276,9 @@ var WysiwygThemeWrapper = styled.div.attrs((p) => ({
1275
1276
 
1276
1277
  & .html-image-node-view-wrapper,
1277
1278
  & .md-image-node-view-wrapper {
1278
- display: inline-block;
1279
+ display: inline-flex;
1279
1280
  padding: 0 2px;
1281
+ vertical-align: bottom;
1280
1282
  z-index: 1;
1281
1283
  }
1282
1284
 
@@ -5479,7 +5481,7 @@ var throttle = (delay, noTrailing, callback) => {
5479
5481
  };
5480
5482
  };
5481
5483
  var ResizableContainer = styled6.div`
5482
- display: inline-block;
5484
+ display: inline-flex;
5483
5485
  position: relative;
5484
5486
  max-width: 100%;
5485
5487
  user-select: none;
@@ -6596,6 +6598,8 @@ var Container2 = styled9.div`
6596
6598
  border: 1px solid ${(props) => props.theme.borderColor};
6597
6599
  border-radius: ${(props) => props.theme.smallBorderRadius};
6598
6600
  box-shadow: 0 4px 12px ${(props) => props.theme.boxShadowColor};
6601
+ font-size: ${(props) => props.theme.fontBase};
6602
+ line-height: normal;
6599
6603
  z-index: 100;
6600
6604
  `;
6601
6605
  var InputGroup = styled9.div`
@@ -6802,12 +6806,6 @@ function ImageNodeView(props) {
6802
6806
  } catch (error) {
6803
6807
  }
6804
6808
  }
6805
- if (handleViewImgSrcUrl) {
6806
- try {
6807
- src = await handleViewImgSrcUrl(src);
6808
- } catch (error) {
6809
- }
6810
- }
6811
6809
  updateAttributes({
6812
6810
  "data-rme-from-paste": null,
6813
6811
  src
@@ -6815,7 +6813,7 @@ function ImageNodeView(props) {
6815
6813
  };
6816
6814
  handlePasteEvent();
6817
6815
  }
6818
- }, [fromPaste, node.attrs.src]);
6816
+ }, [fromPaste, imageCopyHandler, node.attrs.src]);
6819
6817
  const handleStoreChange = (store) => {
6820
6818
  popoverStore.current = store;
6821
6819
  };
@@ -6841,59 +6839,84 @@ function ImageNodeView(props) {
6841
6839
  if (fromPaste) {
6842
6840
  return Loading;
6843
6841
  }
6844
- const Main = /* @__PURE__ */ jsx14(Resizable, { controlInit: (init) => initRef.current = init, onResize: handleResize, ...props, children: /* @__PURE__ */ jsx14(
6845
- ZensImage,
6842
+ const Main = /* @__PURE__ */ jsx14(
6843
+ Resizable,
6846
6844
  {
6847
- onLoad: () => initRef.current?.(),
6848
- src: node.attrs.src,
6849
- loader: Loading,
6850
- imgPromise: (src) => {
6851
- return new Promise((resolve, reject) => {
6852
- const makeImageLoad = (targetSrc) => {
6853
- const img = new Image();
6854
- img.src = targetSrc;
6855
- img.onload = () => {
6856
- resolve(targetSrc);
6857
- };
6858
- img.onerror = () => {
6859
- reject(warningFallBack);
6860
- };
6861
- };
6862
- if (handleViewImgSrcUrl) {
6863
- handleViewImgSrcUrl(node.attrs.src).then((newSrc) => {
6864
- makeImageLoad(newSrc);
6845
+ controlInit: (init) => initRef.current = init,
6846
+ onResize: handleResize,
6847
+ ...props,
6848
+ children: /* @__PURE__ */ jsx14(
6849
+ ZensImage,
6850
+ {
6851
+ onLoad: () => initRef.current?.(),
6852
+ src: node.attrs.src,
6853
+ loader: Loading,
6854
+ imgPromise: () => {
6855
+ return new Promise(async (resolve, reject) => {
6856
+ let targetSrc = node.attrs.src || "";
6857
+ if (handleViewImgSrcUrl) {
6858
+ try {
6859
+ targetSrc = await handleViewImgSrcUrl(targetSrc);
6860
+ } catch (error) {
6861
+ }
6862
+ }
6863
+ const makeImageLoad = (targetSrc2) => {
6864
+ const img = new Image();
6865
+ img.src = targetSrc2;
6866
+ img.onload = () => {
6867
+ resolve(targetSrc2);
6868
+ };
6869
+ img.onerror = () => {
6870
+ reject(warningFallBack);
6871
+ };
6872
+ };
6873
+ makeImageLoad(targetSrc);
6865
6874
  });
6866
- } else {
6867
- makeImageLoad(node.attrs.src);
6868
- }
6869
- });
6870
- },
6871
- ...node.attrs
6875
+ },
6876
+ style: {
6877
+ width: "100%",
6878
+ height: "100%"
6879
+ },
6880
+ ...node.attrs
6881
+ }
6882
+ )
6872
6883
  },
6873
6884
  `${node.attrs.src}_${node.attrs["data-rme-loading"]}`
6874
- ) });
6875
- return /* @__PURE__ */ jsx14("div", { ref: popoverRef, style: { position: "relative", zIndex: selected ? 10 : "auto" }, children: /* @__PURE__ */ jsx14(
6876
- Popover2,
6885
+ );
6886
+ return /* @__PURE__ */ jsx14(
6887
+ "div",
6877
6888
  {
6878
- customContent: /* @__PURE__ */ jsx14(
6879
- ImageToolTips,
6889
+ ref: popoverRef,
6890
+ style: { position: "relative", zIndex: selected ? 10 : "auto", lineHeight: 0 },
6891
+ children: /* @__PURE__ */ jsx14(
6892
+ Popover2,
6880
6893
  {
6881
- node,
6882
- imageHostingHandler,
6883
- updateAttributes: (...args) => {
6884
- updateAttributes(...args);
6885
- popoverStore.current?.setOpen(false);
6886
- }
6887
- },
6888
- `${node.attrs.src}`
6889
- ),
6890
- placement: "top-start",
6891
- onStoreChange: handleStoreChange,
6892
- toggleOnClick: true,
6893
- style: { zIndex: 11 },
6894
- children: Main
6894
+ customContent: /* @__PURE__ */ jsx14(
6895
+ ImageToolTips,
6896
+ {
6897
+ node,
6898
+ imageHostingHandler,
6899
+ updateAttributes: (...args) => {
6900
+ updateAttributes(...args);
6901
+ popoverStore.current?.setOpen(false);
6902
+ }
6903
+ },
6904
+ `${node.attrs.src}`
6905
+ ),
6906
+ boxProps: {
6907
+ style: {
6908
+ display: "inline-flex"
6909
+ }
6910
+ },
6911
+ placement: "top-start",
6912
+ onStoreChange: handleStoreChange,
6913
+ toggleOnClick: true,
6914
+ style: { zIndex: 11 },
6915
+ children: Main
6916
+ }
6917
+ )
6895
6918
  }
6896
- ) });
6919
+ );
6897
6920
  }
6898
6921
 
6899
6922
  // src/editor/extensions/Image/image-extension.tsx