@quadrats/react 0.5.6 → 0.5.10

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.
Files changed (49) hide show
  1. package/blockquote/defaultRenderBlockquoteElement.js +1 -1
  2. package/blockquote/index.cjs.js +1 -1
  3. package/divider/defaultRenderDividerElement.js +1 -1
  4. package/divider/index.cjs.js +1 -1
  5. package/embed/components/VideoIframe.d.ts +1 -1
  6. package/embed/components/VideoIframe.js +2 -2
  7. package/embed/index.cjs.js +2 -2
  8. package/embed/renderers/facebook/components/Facebook.js +1 -1
  9. package/embed/renderers/facebook/index.cjs.js +1 -1
  10. package/embed/renderers/instagram/components/Instagram.js +1 -1
  11. package/embed/renderers/instagram/index.cjs.js +1 -1
  12. package/embed/renderers/podcast-apple/components/PodcastApple.d.ts +2 -3
  13. package/embed/renderers/podcast-apple/components/PodcastApple.js +1 -1
  14. package/embed/renderers/podcast-apple/index.cjs.js +1 -1
  15. package/embed/renderers/spotify/components/Spotify.js +1 -1
  16. package/embed/renderers/spotify/index.cjs.js +1 -1
  17. package/embed/renderers/twitter/components/Twitter.js +1 -1
  18. package/embed/renderers/twitter/index.cjs.js +1 -1
  19. package/footnote/defaultRenderFootnoteElement.js +2 -2
  20. package/footnote/index.cjs.js +2 -2
  21. package/heading/defaultRenderHeadingElement.js +1 -1
  22. package/heading/index.cjs.js +1 -1
  23. package/input-block/components/InputBlock.js +1 -1
  24. package/input-block/index.cjs.js +1 -1
  25. package/line-break/defaultRenderLineBreakElement.d.ts +1 -1
  26. package/line-break/defaultRenderLineBreakElement.js +1 -2
  27. package/line-break/index.cjs.js +2 -4
  28. package/line-break/jsx-serializer/createJsxSerializeLineBreak.d.ts +5 -0
  29. package/line-break/jsx-serializer/createJsxSerializeLineBreak.js +11 -0
  30. package/line-break/jsx-serializer/defaultRenderLineBreakElement.d.ts +2 -0
  31. package/line-break/jsx-serializer/defaultRenderLineBreakElement.js +6 -0
  32. package/line-break/jsx-serializer/index.cjs.js +23 -0
  33. package/line-break/jsx-serializer/index.d.ts +3 -0
  34. package/line-break/jsx-serializer/index.js +2 -0
  35. package/line-break/jsx-serializer/package.json +7 -0
  36. package/line-break/jsx-serializer/typings.d.ts +3 -0
  37. package/line-break/renderLineBreakElementWithSymbol.d.ts +1 -1
  38. package/line-break/renderLineBreakElementWithSymbol.js +1 -2
  39. package/link/defaultRenderLinkElement.js +1 -1
  40. package/link/index.cjs.js +1 -1
  41. package/list/defaultRenderListElements.js +3 -3
  42. package/list/index.cjs.js +3 -3
  43. package/package.json +3 -3
  44. package/paragraph/defaultRenderParagraphElement.js +1 -1
  45. package/paragraph/index.cjs.js +2 -2
  46. package/paragraph/renderParagraphElementWithSymbol.js +1 -1
  47. package/toolbar/components/Toolbar.d.ts +5 -1
  48. package/toolbar/components/Toolbar.js +8 -1
  49. package/toolbar/index.cjs.js +8 -1
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
 
3
- const defaultRenderBlockquoteElement = ({ attributes, children, }) => React.createElement("blockquote", Object.assign({}, attributes), children);
3
+ const defaultRenderBlockquoteElement = ({ attributes, children, }) => React.createElement("blockquote", Object.assign({}, attributes, { className: "qdr-blockquote" }), children);
4
4
 
5
5
  export { defaultRenderBlockquoteElement };
@@ -20,7 +20,7 @@ var isHotkey__default = /*#__PURE__*/_interopDefaultLegacy(isHotkey);
20
20
  */
21
21
  const BLOCKQUOTE_HOTKEY = 'ctrl+opt+q';
22
22
 
23
- const defaultRenderBlockquoteElement = ({ attributes, children, }) => React__default.createElement("blockquote", Object.assign({}, attributes), children);
23
+ const defaultRenderBlockquoteElement = ({ attributes, children, }) => React__default.createElement("blockquote", Object.assign({}, attributes, { className: "qdr-blockquote" }), children);
24
24
 
25
25
  function createReactBlockquote(options = {}) {
26
26
  const core = blockquote.createBlockquote(options);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- const defaultRenderDividerElement = ({ attributes, children }) => (React.createElement("div", Object.assign({}, attributes, { contentEditable: false }),
3
+ const defaultRenderDividerElement = ({ attributes, children }) => (React.createElement("div", Object.assign({}, attributes, { className: "qdr-divider", contentEditable: false }),
4
4
  React.createElement("hr", null),
5
5
  children));
6
6
 
@@ -10,7 +10,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
10
10
 
11
11
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
12
 
13
- const defaultRenderDividerElement = ({ attributes, children }) => (React__default.createElement("div", Object.assign({}, attributes, { contentEditable: false }),
13
+ const defaultRenderDividerElement = ({ attributes, children }) => (React__default.createElement("div", Object.assign({}, attributes, { className: "qdr-divider", contentEditable: false }),
14
14
  React__default.createElement("hr", null),
15
15
  children));
16
16
 
@@ -7,5 +7,5 @@ export interface VideoIframeProps<E extends EmbedElement> {
7
7
  data: string;
8
8
  element: E;
9
9
  }
10
- declare function VideoIframe<E extends EmbedElement>({ attributes, children, data: src }: VideoIframeProps<E>): JSX.Element;
10
+ declare function VideoIframe<E extends EmbedElement>({ attributes, children, data: src, }: VideoIframeProps<E>): JSX.Element;
11
11
  export default VideoIframe;
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import { composeRefs } from '@quadrats/react/utils';
3
3
  import { useVideoIframeSize } from '../hooks/useVideoIframeSize.js';
4
4
 
5
- function VideoIframe({ attributes, children, data: src }) {
5
+ function VideoIframe({ attributes, children, data: src, }) {
6
6
  const { ref } = attributes || {};
7
7
  const { ref: containerRef, size } = useVideoIframeSize();
8
8
  const composedRef = ref ? composeRefs([ref, containerRef]) : containerRef;
9
- return (React.createElement("div", Object.assign({}, attributes, { ref: composedRef, contentEditable: false }),
9
+ return (React.createElement("div", Object.assign({}, attributes, { ref: composedRef, className: "qdr-embed-video", contentEditable: false }),
10
10
  React.createElement("div", { style: size },
11
11
  React.createElement("iframe", { title: src, src: src, frameBorder: "0", width: "100%", height: "100%" })),
12
12
  attributes ? children : undefined));
@@ -32,11 +32,11 @@ function useVideoIframeSize() {
32
32
  };
33
33
  }
34
34
 
35
- function VideoIframe({ attributes, children, data: src }) {
35
+ function VideoIframe({ attributes, children, data: src, }) {
36
36
  const { ref } = attributes || {};
37
37
  const { ref: containerRef, size } = useVideoIframeSize();
38
38
  const composedRef = ref ? utils.composeRefs([ref, containerRef]) : containerRef;
39
- return (React__default.createElement("div", Object.assign({}, attributes, { ref: composedRef, contentEditable: false }),
39
+ return (React__default.createElement("div", Object.assign({}, attributes, { ref: composedRef, className: "qdr-embed-video", contentEditable: false }),
40
40
  React__default.createElement("div", { style: size },
41
41
  React__default.createElement("iframe", { title: src, src: src, frameBorder: "0", width: "100%", height: "100%" })),
42
42
  attributes ? children : undefined));
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  function Facebook({ attributes, children, data: { url, width, height } }) {
4
- return (React.createElement("div", Object.assign({}, attributes, { contentEditable: false }),
4
+ return (React.createElement("div", Object.assign({}, attributes, { className: "qdr-embed-facebook", contentEditable: false }),
5
5
  React.createElement("iframe", { title: url, src: url, width: width, height: height, style: {
6
6
  border: 0,
7
7
  overflow: 'hidden',
@@ -9,7 +9,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
9
9
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
10
10
 
11
11
  function Facebook({ attributes, children, data: { url, width, height } }) {
12
- return (React__default.createElement("div", Object.assign({}, attributes, { contentEditable: false }),
12
+ return (React__default.createElement("div", Object.assign({}, attributes, { className: "qdr-embed-facebook", contentEditable: false }),
13
13
  React__default.createElement("iframe", { title: url, src: url, width: width, height: height, style: {
14
14
  border: 0,
15
15
  overflow: 'hidden',
@@ -3,7 +3,7 @@ import { useLoadInstagramEmbedApi } from '../hooks/useLoadInstagramEmbedApi.js';
3
3
 
4
4
  function Instagram({ attributes, children, data: permalink }) {
5
5
  useLoadInstagramEmbedApi(permalink);
6
- return (React.createElement("div", Object.assign({}, attributes, { contentEditable: false, style: {
6
+ return (React.createElement("div", Object.assign({}, attributes, { className: "qdr-embed-instagram", contentEditable: false, style: {
7
7
  display: 'flex',
8
8
  marginBottom: -12,
9
9
  } }),
@@ -34,7 +34,7 @@ function useLoadInstagramEmbedApi(permalink) {
34
34
 
35
35
  function Instagram({ attributes, children, data: permalink }) {
36
36
  useLoadInstagramEmbedApi(permalink);
37
- return (React__default.createElement("div", Object.assign({}, attributes, { contentEditable: false, style: {
37
+ return (React__default.createElement("div", Object.assign({}, attributes, { className: "qdr-embed-instagram", contentEditable: false, style: {
38
38
  display: 'flex',
39
39
  marginBottom: -12,
40
40
  } }),
@@ -1,11 +1,10 @@
1
- /// <reference types="react" />
1
+ import { PropsWithChildren } from 'react';
2
2
  import { PodcastAppleEmbedElement } from '@quadrats/common/embed/strategies/podcast-apple';
3
3
  import { RenderElementProps } from '@quadrats/react';
4
4
  export interface PodcastAppleProps {
5
5
  attributes?: RenderElementProps['attributes'];
6
- children?: any;
7
6
  data: string;
8
7
  element: PodcastAppleEmbedElement;
9
8
  }
10
- declare function PodcastApple({ attributes, children, data: src }: PodcastAppleProps): JSX.Element;
9
+ declare function PodcastApple({ attributes, children, data: src }: PropsWithChildren<PodcastAppleProps>): JSX.Element;
11
10
  export default PodcastApple;
@@ -4,7 +4,7 @@ import { composeRefs } from '@quadrats/react/utils';
4
4
  function PodcastApple({ attributes, children, data: src }) {
5
5
  const containerRef = useRef(null);
6
6
  const composedRef = composeRefs([attributes === null || attributes === void 0 ? void 0 : attributes.ref, containerRef]);
7
- return (React.createElement("div", Object.assign({}, attributes, { ref: composedRef, contentEditable: false }),
7
+ return (React.createElement("div", Object.assign({}, attributes, { className: "qdr-embed-podcast-apple", ref: composedRef, contentEditable: false }),
8
8
  React.createElement("iframe", { title: src, src: src, frameBorder: "0", width: "100%", height: "450px" }),
9
9
  attributes ? children : undefined));
10
10
  }
@@ -12,7 +12,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
12
  function PodcastApple({ attributes, children, data: src }) {
13
13
  const containerRef = React.useRef(null);
14
14
  const composedRef = utils.composeRefs([attributes === null || attributes === void 0 ? void 0 : attributes.ref, containerRef]);
15
- return (React__default.createElement("div", Object.assign({}, attributes, { ref: composedRef, contentEditable: false }),
15
+ return (React__default.createElement("div", Object.assign({}, attributes, { className: "qdr-embed-podcast-apple", ref: composedRef, contentEditable: false }),
16
16
  React__default.createElement("iframe", { title: src, src: src, frameBorder: "0", width: "100%", height: "450px" }),
17
17
  attributes ? children : undefined));
18
18
  }
@@ -5,7 +5,7 @@ function Spotify({ attributes, children, data: src }) {
5
5
  const containerRef = useRef(null);
6
6
  const composedRef = composeRefs([attributes === null || attributes === void 0 ? void 0 : attributes.ref, containerRef]);
7
7
  const higher = useMemo(() => (!!src.match(/\/playlist/)), [src]);
8
- return (React.createElement("div", Object.assign({}, attributes, { ref: composedRef, contentEditable: false }),
8
+ return (React.createElement("div", Object.assign({}, attributes, { ref: composedRef, className: "qdr-embed-spotify", contentEditable: false }),
9
9
  React.createElement("iframe", { title: src, src: src, frameBorder: "0", width: "100%", allow: "autoplay", "clipboard-write": "true", "encrypted-media": "true", "picture-in-picture": "true", height: higher ? '400px' : '152px', style: {
10
10
  maxHeight: '100%',
11
11
  height: higher ? '400px' : '152px',
@@ -13,7 +13,7 @@ function Spotify({ attributes, children, data: src }) {
13
13
  const containerRef = React.useRef(null);
14
14
  const composedRef = utils.composeRefs([attributes === null || attributes === void 0 ? void 0 : attributes.ref, containerRef]);
15
15
  const higher = React.useMemo(() => (!!src.match(/\/playlist/)), [src]);
16
- return (React__default.createElement("div", Object.assign({}, attributes, { ref: composedRef, contentEditable: false }),
16
+ return (React__default.createElement("div", Object.assign({}, attributes, { ref: composedRef, className: "qdr-embed-spotify", contentEditable: false }),
17
17
  React__default.createElement("iframe", { title: src, src: src, frameBorder: "0", width: "100%", allow: "autoplay", "clipboard-write": "true", "encrypted-media": "true", "picture-in-picture": "true", height: higher ? '400px' : '152px', style: {
18
18
  maxHeight: '100%',
19
19
  height: higher ? '400px' : '152px',
@@ -6,7 +6,7 @@ function Twitter({ attributes, children, data: tweetId }) {
6
6
  const tweetContainerRef = useRef(null);
7
7
  const composedRef = composeRefs([attributes === null || attributes === void 0 ? void 0 : attributes.ref, tweetContainerRef]);
8
8
  useLoadTwitterEmbedApi(tweetId, tweetContainerRef);
9
- return (React.createElement("div", Object.assign({}, attributes, { ref: composedRef, contentEditable: false }), attributes ? children : undefined));
9
+ return (React.createElement("div", Object.assign({}, attributes, { ref: composedRef, className: "qdr-embed-twitter", contentEditable: false }), attributes ? children : undefined));
10
10
  }
11
11
 
12
12
  export { Twitter as default };
@@ -43,7 +43,7 @@ function Twitter({ attributes, children, data: tweetId }) {
43
43
  const tweetContainerRef = React.useRef(null);
44
44
  const composedRef = utils.composeRefs([attributes === null || attributes === void 0 ? void 0 : attributes.ref, tweetContainerRef]);
45
45
  useLoadTwitterEmbedApi(tweetId, tweetContainerRef);
46
- return (React__default.createElement("div", Object.assign({}, attributes, { ref: composedRef, contentEditable: false }), attributes ? children : undefined));
46
+ return (React__default.createElement("div", Object.assign({}, attributes, { ref: composedRef, className: "qdr-embed-twitter", contentEditable: false }), attributes ? children : undefined));
47
47
  }
48
48
 
49
49
  const defaultRenderTwitterEmbedElement = (props) => React__default.createElement(Twitter, Object.assign({}, props));
@@ -8,8 +8,8 @@ const defaultRenderFootnoteElement = ({ attributes, children, element, placement
8
8
  const { footnote, index } = element;
9
9
  return (React.createElement(React.Fragment, null,
10
10
  React.createElement(Tooltip, { placement: placement, popup: footnote },
11
- React.createElement("span", Object.assign({ style: { textDecoration: 'underline' } }, attributes), children)),
12
- React.createElement("sup", Object.assign({}, attributes, { style: { color: 'var(--qdr-sup)', userSelect: 'none' }, contentEditable: false }), `[${index !== null && index !== void 0 ? index : 1}]`)));
11
+ React.createElement("span", Object.assign({ style: { textDecoration: 'underline' } }, attributes, { className: "qdr-footnote-text" }), children)),
12
+ React.createElement("sup", Object.assign({}, attributes, { className: "qdr-footnote-sup", style: { color: 'var(--qdr-sup)', userSelect: 'none' }, contentEditable: false }), `[${index !== null && index !== void 0 ? index : 1}]`)));
13
13
  };
14
14
 
15
15
  export { defaultRenderFootnoteElement };
@@ -19,8 +19,8 @@ const defaultRenderFootnoteElement = ({ attributes, children, element, placement
19
19
  const { footnote, index } = element;
20
20
  return (React__default.createElement(React__default.Fragment, null,
21
21
  React__default.createElement(components.Tooltip, { placement: placement, popup: footnote },
22
- React__default.createElement("span", Object.assign({ style: { textDecoration: 'underline' } }, attributes), children)),
23
- React__default.createElement("sup", Object.assign({}, attributes, { style: { color: 'var(--qdr-sup)', userSelect: 'none' }, contentEditable: false }), `[${index !== null && index !== void 0 ? index : 1}]`)));
22
+ React__default.createElement("span", Object.assign({ style: { textDecoration: 'underline' } }, attributes, { className: "qdr-footnote-text" }), children)),
23
+ React__default.createElement("sup", Object.assign({}, attributes, { className: "qdr-footnote-sup", style: { color: 'var(--qdr-sup)', userSelect: 'none' }, contentEditable: false }), `[${index !== null && index !== void 0 ? index : 1}]`)));
24
24
  };
25
25
 
26
26
  function createReactFootnote(options = {}) {
@@ -13,7 +13,7 @@ const defaultRenderHeadingElement = ({ attributes, children, element, }) => {
13
13
  if (!Component) {
14
14
  return null;
15
15
  }
16
- return React.createElement(Component, Object.assign({}, attributes), children);
16
+ return React.createElement(Component, Object.assign({}, attributes, { className: `qdr-${Component}` }), children);
17
17
  };
18
18
 
19
19
  export { HEADING_COMPONENTS, defaultRenderHeadingElement };
@@ -36,7 +36,7 @@ const defaultRenderHeadingElement = ({ attributes, children, element, }) => {
36
36
  if (!Component) {
37
37
  return null;
38
38
  }
39
- return React__default.createElement(Component, Object.assign({}, attributes), children);
39
+ return React__default.createElement(Component, Object.assign({}, attributes, { className: `qdr-${Component}` }), children);
40
40
  };
41
41
 
42
42
  function createReactHeading(options = {}) {
@@ -6,7 +6,7 @@ function InputBlock(props) {
6
6
  const { inputRef, onBlur, onKeyDown, placeholder, } = useInputBlock(props);
7
7
  return (React.createElement("div", Object.assign({}, attributes, { contentEditable: false, style: {
8
8
  display: 'flex',
9
- } }),
9
+ }, className: "qdr-input-block" }),
10
10
  React.createElement("input", { ref: inputRef, onBlur: onBlur, onKeyDown: onKeyDown, placeholder: placeholder, style: {
11
11
  display: 'block',
12
12
  color: 'currentColor',
@@ -60,7 +60,7 @@ function InputBlock(props) {
60
60
  const { inputRef, onBlur, onKeyDown, placeholder, } = useInputBlock(props);
61
61
  return (React__default.createElement("div", Object.assign({}, attributes, { contentEditable: false, style: {
62
62
  display: 'flex',
63
- } }),
63
+ }, className: "qdr-input-block" }),
64
64
  React__default.createElement("input", { ref: inputRef, onBlur: onBlur, onKeyDown: onKeyDown, placeholder: placeholder, style: {
65
65
  display: 'block',
66
66
  color: 'currentColor',
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { RenderLineBreakElementProps } from './typings';
3
- export declare const defaultRenderLineBreakElement: ({ attributes }: RenderLineBreakElementProps) => JSX.Element;
3
+ export declare const defaultRenderLineBreakElement: ({ attributes, children }: RenderLineBreakElementProps) => JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
 
3
- const defaultRenderLineBreakElement = ({ attributes }) => (React.createElement("span", Object.assign({}, attributes, { style: { userSelect: 'none' }, contentEditable: false }),
4
- React.createElement("br", null)));
3
+ const defaultRenderLineBreakElement = ({ attributes, children }) => (React.createElement("span", Object.assign({}, attributes, { className: "qdr-line-break" }), children));
5
4
 
6
5
  export { defaultRenderLineBreakElement };
@@ -84,8 +84,7 @@ const COMMON_ON_KEY_DOWN_BREAK = createOnKeyDownBreak({
84
84
  },
85
85
  });
86
86
 
87
- const defaultRenderLineBreakElement = ({ attributes }) => (React__default.createElement("span", Object.assign({}, attributes, { style: { userSelect: 'none' }, contentEditable: false }),
88
- React__default.createElement("br", null)));
87
+ const defaultRenderLineBreakElement = ({ attributes, children }) => (React__default.createElement("span", Object.assign({}, attributes, { className: "qdr-line-break" }), children));
89
88
 
90
89
  function createReactLineBreak(options = {}) {
91
90
  const core$1 = core.createLineBreak(options);
@@ -95,8 +94,7 @@ function createReactLineBreak(options = {}) {
95
94
  }), createRenderElement: ({ render = defaultRenderLineBreakElement } = {}) => react.createRenderElement({ type, render }) });
96
95
  }
97
96
 
98
- const renderLineBreakElementWithSymbol = ({ attributes }) => (React__default.createElement("span", Object.assign({}, attributes, { style: { userSelect: 'none' }, className: "qdr-line-break__with-symbol", contentEditable: false }),
99
- React__default.createElement("br", null)));
97
+ const renderLineBreakElementWithSymbol = ({ attributes, children }) => (React__default.createElement("span", Object.assign({}, attributes, { className: "qdr-line-break qdr-line-break__with-symbol" }), children));
100
98
 
101
99
  exports.COMMON_EXIT_BREAK_ON_AFTER_HOTKEY = COMMON_EXIT_BREAK_ON_AFTER_HOTKEY;
102
100
  exports.COMMON_EXIT_BREAK_ON_AFTER_RULE = COMMON_EXIT_BREAK_ON_AFTER_RULE;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { CreateJsxSerializeElementOptions } from '@quadrats/react/jsx-serializer';
3
+ import { JsxSerializeLineBreakElementProps } from './typings';
4
+ export declare type CreateJsxSerializeLineBreakOptions = Partial<CreateJsxSerializeElementOptions<JsxSerializeLineBreakElementProps>>;
5
+ export declare function createJsxSerializeLineBreak(options?: CreateJsxSerializeLineBreakOptions): (props: import("@quadrats/react/jsx-serializer").JsxSerializeElementProps<import("@quadrats/core").QuadratsElement>) => JSX.Element | null | undefined;
@@ -0,0 +1,11 @@
1
+ import { createJsxSerializeElement } from '@quadrats/react/jsx-serializer';
2
+ import { defaultRenderLineBreakElement } from './defaultRenderLineBreakElement.js';
3
+ import { LINE_BREAK_TYPE } from '@quadrats/core';
4
+
5
+ /* eslint-disable max-len */
6
+ function createJsxSerializeLineBreak(options = {}) {
7
+ const { type = LINE_BREAK_TYPE, render = defaultRenderLineBreakElement } = options;
8
+ return createJsxSerializeElement({ type, render });
9
+ }
10
+
11
+ export { createJsxSerializeLineBreak };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const defaultRenderLineBreakElement: () => JSX.Element;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+
3
+ const defaultRenderLineBreakElement = () => (React.createElement("span", { style: { userSelect: 'none' }, contentEditable: false },
4
+ React.createElement("br", null)));
5
+
6
+ export { defaultRenderLineBreakElement };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var jsxSerializer = require('@quadrats/react/jsx-serializer');
7
+ var core = require('@quadrats/core');
8
+
9
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
10
+
11
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
+
13
+ const defaultRenderLineBreakElement = () => (React__default.createElement("span", { style: { userSelect: 'none' }, contentEditable: false },
14
+ React__default.createElement("br", null)));
15
+
16
+ /* eslint-disable max-len */
17
+ function createJsxSerializeLineBreak(options = {}) {
18
+ const { type = core.LINE_BREAK_TYPE, render = defaultRenderLineBreakElement } = options;
19
+ return jsxSerializer.createJsxSerializeElement({ type, render });
20
+ }
21
+
22
+ exports.createJsxSerializeLineBreak = createJsxSerializeLineBreak;
23
+ exports.defaultRenderLineBreakElement = defaultRenderLineBreakElement;
@@ -0,0 +1,3 @@
1
+ export * from './typings';
2
+ export { defaultRenderLineBreakElement } from './defaultRenderLineBreakElement';
3
+ export { CreateJsxSerializeLineBreakOptions, createJsxSerializeLineBreak } from './createJsxSerializeLineBreak';
@@ -0,0 +1,2 @@
1
+ export { defaultRenderLineBreakElement } from './defaultRenderLineBreakElement.js';
2
+ export { createJsxSerializeLineBreak } from './createJsxSerializeLineBreak.js';
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@quadrats/react/line-break/jsx-serializer",
3
+ "sideEffects": false,
4
+ "main": "./index.cjs.js",
5
+ "module": "./index.js",
6
+ "typings": "./index.d.ts"
7
+ }
@@ -0,0 +1,3 @@
1
+ import { LineBreakElement } from '@quadrats/core';
2
+ import { JsxSerializeElementProps } from '@quadrats/react/jsx-serializer';
3
+ export declare type JsxSerializeLineBreakElementProps = JsxSerializeElementProps<LineBreakElement>;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { RenderLineBreakElementProps } from './typings';
3
- export declare const renderLineBreakElementWithSymbol: ({ attributes }: RenderLineBreakElementProps) => JSX.Element;
3
+ export declare const renderLineBreakElementWithSymbol: ({ attributes, children }: RenderLineBreakElementProps) => JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
 
3
- const renderLineBreakElementWithSymbol = ({ attributes }) => (React.createElement("span", Object.assign({}, attributes, { style: { userSelect: 'none' }, className: "qdr-line-break__with-symbol", contentEditable: false }),
4
- React.createElement("br", null)));
3
+ const renderLineBreakElementWithSymbol = ({ attributes, children }) => (React.createElement("span", Object.assign({}, attributes, { className: "qdr-line-break qdr-line-break__with-symbol" }), children));
5
4
 
6
5
  export { renderLineBreakElementWithSymbol };
@@ -7,7 +7,7 @@ import { Tooltip } from '@quadrats/react/components';
7
7
  const defaultRenderLinkElement = ({ attributes, children, element, placement = 'bottom', target = '_blank', }) => {
8
8
  const { url } = element;
9
9
  return (React.createElement(Tooltip, { placement: placement, popup: url },
10
- React.createElement("a", Object.assign({}, attributes, { href: url, target: target }), children)));
10
+ React.createElement("a", Object.assign({}, attributes, { className: "qdr-link", href: url, target: target }), children)));
11
11
  };
12
12
 
13
13
  export { defaultRenderLinkElement };
package/link/index.cjs.js CHANGED
@@ -17,7 +17,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
17
17
  const defaultRenderLinkElement = ({ attributes, children, element, placement = 'bottom', target = '_blank', }) => {
18
18
  const { url } = element;
19
19
  return (React__default.createElement(components.Tooltip, { placement: placement, popup: url },
20
- React__default.createElement("a", Object.assign({}, attributes, { href: url, target: target }), children)));
20
+ React__default.createElement("a", Object.assign({}, attributes, { className: "qdr-link", href: url, target: target }), children)));
21
21
  };
22
22
 
23
23
  function createReactLink(options = {}) {
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
 
3
3
  const defaultRenderListElements = {
4
- ol: ({ attributes, children }) => React.createElement("ol", Object.assign({}, attributes), children),
5
- ul: ({ attributes, children }) => React.createElement("ul", Object.assign({}, attributes), children),
6
- li: ({ attributes, children }) => React.createElement("li", Object.assign({}, attributes), children),
4
+ ol: ({ attributes, children }) => React.createElement("ol", Object.assign({}, attributes, { className: "qdr-ol" }), children),
5
+ ul: ({ attributes, children }) => React.createElement("ul", Object.assign({}, attributes, { className: "qdr-ul" }), children),
6
+ li: ({ attributes, children }) => React.createElement("li", Object.assign({}, attributes, { className: "qdr-li" }), children),
7
7
  };
8
8
 
9
9
  export { defaultRenderListElements };
package/list/index.cjs.js CHANGED
@@ -11,9 +11,9 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
11
11
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
12
 
13
13
  const defaultRenderListElements = {
14
- ol: ({ attributes, children }) => React__default.createElement("ol", Object.assign({}, attributes), children),
15
- ul: ({ attributes, children }) => React__default.createElement("ul", Object.assign({}, attributes), children),
16
- li: ({ attributes, children }) => React__default.createElement("li", Object.assign({}, attributes), children),
14
+ ol: ({ attributes, children }) => React__default.createElement("ol", Object.assign({}, attributes, { className: "qdr-ol" }), children),
15
+ ul: ({ attributes, children }) => React__default.createElement("ul", Object.assign({}, attributes, { className: "qdr-ul" }), children),
16
+ li: ({ attributes, children }) => React__default.createElement("li", Object.assign({}, attributes, { className: "qdr-li" }), children),
17
17
  };
18
18
 
19
19
  function createReactList(options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quadrats/react",
3
- "version": "0.5.6",
3
+ "version": "0.5.10",
4
4
  "description": "",
5
5
  "author": "Rytass",
6
6
  "homepage": "https://github.com/Quadrats/quadrats#readme",
@@ -20,8 +20,8 @@
20
20
  "url": "https://github.com/Quadrats/quadrats/issues"
21
21
  },
22
22
  "dependencies": {
23
- "@quadrats/common": "^0.5.3",
24
- "@quadrats/core": "^0.5.2",
23
+ "@quadrats/common": "^0.5.10",
24
+ "@quadrats/core": "^0.5.9",
25
25
  "@quadrats/icons": "^0.5.0",
26
26
  "@quadrats/locales": "^0.5.0",
27
27
  "@quadrats/theme": "^0.5.0",
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
 
3
- const defaultRenderParagraphElement = ({ attributes, children, }) => (React.createElement("p", Object.assign({}, attributes), children));
3
+ const defaultRenderParagraphElement = ({ attributes, children, }) => (React.createElement("p", Object.assign({}, attributes, { className: "qdr-paragraph" }), children));
4
4
 
5
5
  export { defaultRenderParagraphElement };
@@ -10,14 +10,14 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
10
10
 
11
11
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
12
12
 
13
- const defaultRenderParagraphElement = ({ attributes, children, }) => (React__default.createElement("p", Object.assign({}, attributes), children));
13
+ const defaultRenderParagraphElement = ({ attributes, children, }) => (React__default.createElement("p", Object.assign({}, attributes, { className: "qdr-paragraph" }), children));
14
14
 
15
15
  function createRenderParagraphElement(options = {}) {
16
16
  const { render = defaultRenderParagraphElement } = options;
17
17
  return react.createRenderElement({ type: core.PARAGRAPH_TYPE, render });
18
18
  }
19
19
 
20
- const renderParagraphElementWithSymbol = ({ attributes, children, }) => (React__default.createElement("p", Object.assign({}, attributes, { className: "qdr-paragraph__with-line-break-symbol" }), children));
20
+ const renderParagraphElementWithSymbol = ({ attributes, children, }) => (React__default.createElement("p", Object.assign({}, attributes, { className: "qdr-paragraph qdr-paragraph__with-line-break-symbol" }), children));
21
21
 
22
22
  exports.createRenderParagraphElement = createRenderParagraphElement;
23
23
  exports.defaultRenderParagraphElement = defaultRenderParagraphElement;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
 
3
- const renderParagraphElementWithSymbol = ({ attributes, children, }) => (React.createElement("p", Object.assign({}, attributes, { className: "qdr-paragraph__with-line-break-symbol" }), children));
3
+ const renderParagraphElementWithSymbol = ({ attributes, children, }) => (React.createElement("p", Object.assign({}, attributes, { className: "qdr-paragraph qdr-paragraph__with-line-break-symbol" }), children));
4
4
 
5
5
  export { renderParagraphElementWithSymbol };
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  export interface ToolbarProps {
3
3
  /**
4
4
  * If there are any nodes which type match it, toolbar will hide.
@@ -8,6 +8,10 @@ export interface ToolbarProps {
8
8
  * A render props which provide a flag `expanded` which useful for rendering different things between collapsed and expanded.
9
9
  */
10
10
  children: (expanded: boolean) => JSX.Element | null | undefined;
11
+ /**
12
+ * Toolbar container
13
+ */
14
+ containerRef?: React.MutableRefObject<HTMLElement | undefined>;
11
15
  }
12
16
  declare function Toolbar(props: ToolbarProps): JSX.Element | null;
13
17
  export default Toolbar;
@@ -80,6 +80,13 @@ function Toolbar(props) {
80
80
  }
81
81
  });
82
82
  });
83
+ const getPortalContainer = useCallback(() => {
84
+ var _a;
85
+ if ((_a = props.containerRef) === null || _a === void 0 ? void 0 : _a.current) {
86
+ return props.containerRef.current;
87
+ }
88
+ return document.body;
89
+ }, [props.containerRef]);
83
90
  if (!shouldRender || (disabledElementTypes && isNodesTypeIn(editor, disabledElementTypes, { mode: 'all' }))) {
84
91
  return null;
85
92
  }
@@ -88,7 +95,7 @@ function Toolbar(props) {
88
95
  if (!tools) {
89
96
  return null;
90
97
  }
91
- return (React.createElement(Portal, null,
98
+ return (React.createElement(Portal, { getContainer: getPortalContainer },
92
99
  React.createElement("div", { ref: toolbarRef, className: clsx('qdr-toolbar__wrapper', { 'qdr-toolbar__wrapper--inputting': toolInput }, themeProps.className), style: themeProps.style },
93
100
  React.createElement("div", { className: "qdr-toolbar__arrow" }),
94
101
  React.createElement("div", { className: "qdr-toolbar" },
@@ -120,6 +120,13 @@ function Toolbar(props) {
120
120
  }
121
121
  });
122
122
  });
123
+ const getPortalContainer = React.useCallback(() => {
124
+ var _a;
125
+ if ((_a = props.containerRef) === null || _a === void 0 ? void 0 : _a.current) {
126
+ return props.containerRef.current;
127
+ }
128
+ return document.body;
129
+ }, [props.containerRef]);
123
130
  if (!shouldRender || (disabledElementTypes && core.isNodesTypeIn(editor, disabledElementTypes, { mode: 'all' }))) {
124
131
  return null;
125
132
  }
@@ -128,7 +135,7 @@ function Toolbar(props) {
128
135
  if (!tools) {
129
136
  return null;
130
137
  }
131
- return (React__default.createElement(components.Portal, null,
138
+ return (React__default.createElement(components.Portal, { getContainer: getPortalContainer },
132
139
  React__default.createElement("div", { ref: toolbarRef, className: clsx__default('qdr-toolbar__wrapper', { 'qdr-toolbar__wrapper--inputting': toolInput }, themeProps.className), style: themeProps.style },
133
140
  React__default.createElement("div", { className: "qdr-toolbar__arrow" }),
134
141
  React__default.createElement("div", { className: "qdr-toolbar" },