@quadrats/react 1.1.3 → 1.1.4

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.
@@ -6,14 +6,14 @@ import { InlineToolbar } from '@quadrats/react/toolbar';
6
6
 
7
7
  // import { useImageResizer } from '../hooks/useImageResizer';
8
8
  function Image(props) {
9
- const { attributes, children, element,
9
+ const { attributes, children, element, parentType,
10
10
  // resizeImage,
11
11
  src, } = props;
12
12
  const editor = useSlateStatic();
13
13
  const path = ReactEditor.findPath(editor, element);
14
14
  const parentEntry = Editor.above(editor, {
15
15
  at: path,
16
- match: (node) => Element.isElement(node) && node.type === element.figureType,
16
+ match: (node) => Element.isElement(node) && node.type === parentType,
17
17
  mode: 'lowest',
18
18
  });
19
19
  const parentNode = parentEntry === null || parentEntry === void 0 ? void 0 : parentEntry[0];
@@ -54,7 +54,7 @@ function createReactImage(options = {}, getUploadOptions) {
54
54
  const { attributes, children, element } = props;
55
55
  return renderImage(Object.assign(Object.assign({}, getImageElementCommonProps(element, core.hostingResolvers)), { attributes,
56
56
  element,
57
- children, resizeImage: core.resizeImage }));
57
+ children, parentType: core.types.figure, resizeImage: core.resizeImage }));
58
58
  },
59
59
  },
60
60
  {
@@ -25,14 +25,14 @@ function ImageFigure(props) {
25
25
 
26
26
  // import { useImageResizer } from '../hooks/useImageResizer';
27
27
  function Image(props) {
28
- const { attributes, children, element,
28
+ const { attributes, children, element, parentType,
29
29
  // resizeImage,
30
30
  src, } = props;
31
31
  const editor = react.useSlateStatic();
32
32
  const path = react.ReactEditor.findPath(editor, element);
33
33
  const parentEntry = core.Editor.above(editor, {
34
34
  at: path,
35
- match: (node) => core.Element.isElement(node) && node.type === element.figureType,
35
+ match: (node) => core.Element.isElement(node) && node.type === parentType,
36
36
  mode: 'lowest',
37
37
  });
38
38
  const parentNode = parentEntry === null || parentEntry === void 0 ? void 0 : parentEntry[0];
@@ -251,7 +251,7 @@ function createReactImage(options = {}, getUploadOptions) {
251
251
  const { attributes, children, element } = props;
252
252
  return renderImage(Object.assign(Object.assign({}, image.getImageElementCommonProps(element, core$1.hostingResolvers)), { attributes,
253
253
  element,
254
- children, resizeImage: core$1.resizeImage }));
254
+ children, parentType: core$1.types.figure, resizeImage: core$1.resizeImage }));
255
255
  },
256
256
  },
257
257
  {
@@ -10,6 +10,7 @@ export interface RenderImageFigureElementProps extends RenderElementProps<ImageF
10
10
  }
11
11
  export interface RenderImageElementProps extends RenderElementProps<ImageElement> {
12
12
  resizeImage: ReactImage<any>['resizeImage'];
13
+ parentType: string;
13
14
  src: string;
14
15
  }
15
16
  export type RenderImageCaptionElementProps = RenderElementProps<ImageCaptionElement>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quadrats/react",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "",
5
5
  "author": "Rytass",
6
6
  "homepage": "https://github.com/Quadrats/quadrats#readme",
@@ -20,7 +20,7 @@
20
20
  "url": "https://github.com/Quadrats/quadrats/issues"
21
21
  },
22
22
  "dependencies": {
23
- "@quadrats/common": "^1.1.1",
23
+ "@quadrats/common": "^1.1.4",
24
24
  "@quadrats/core": "^1.1.0",
25
25
  "@quadrats/icons": "^1.1.1",
26
26
  "@quadrats/locales": "^1.0.0",