@contentful/field-editor-rich-text 4.20.14 → 5.0.0
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/cjs/CharConstraints.js +4 -4
- package/dist/cjs/RichTextEditor.js +3 -3
- package/dist/cjs/RichTextEditor.styles.js +8 -8
- package/dist/cjs/Toolbar/components/StickyToolbarWrapper.js +2 -2
- package/dist/cjs/Toolbar/index.js +6 -6
- package/dist/cjs/dialogs/HypelinkDialog/HyperlinkDialog.js +3 -3
- package/dist/cjs/plugins/CommandPalette/components/CommandList.js +4 -6
- package/dist/cjs/plugins/CommandPalette/components/CommandList.styles.js +12 -12
- package/dist/cjs/plugins/CommandPalette/components/CommandPrompt.js +2 -2
- package/dist/cjs/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +2 -2
- package/dist/cjs/plugins/Heading/components/Heading.js +17 -17
- package/dist/cjs/plugins/Heading/components/ToolbarHeadingButton.js +11 -11
- package/dist/cjs/plugins/Hr/index.js +5 -5
- package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +2 -2
- package/dist/cjs/plugins/Hyperlink/components/styles.js +6 -6
- package/dist/cjs/plugins/List/components/List.js +5 -5
- package/dist/cjs/plugins/List/components/ListItem.js +2 -2
- package/dist/cjs/plugins/Marks/Bold.js +2 -2
- package/dist/cjs/plugins/Marks/Code.js +2 -2
- package/dist/cjs/plugins/Marks/Italic.js +2 -2
- package/dist/cjs/plugins/Marks/Strikethrough.js +2 -2
- package/dist/cjs/plugins/Marks/Subscript.js +5 -3
- package/dist/cjs/plugins/Marks/Superscript.js +2 -2
- package/dist/cjs/plugins/Marks/components/MarkToolbarButton.js +3 -3
- package/dist/cjs/plugins/Paragraph/Paragraph.js +2 -2
- package/dist/cjs/plugins/Quote/components/Quote.js +2 -2
- package/dist/cjs/plugins/Table/components/Cell.js +2 -2
- package/dist/cjs/plugins/Table/components/HeaderCell.js +2 -2
- package/dist/cjs/plugins/Table/components/Row.js +2 -2
- package/dist/cjs/plugins/Table/components/Table.js +2 -2
- package/dist/cjs/plugins/Table/components/TableActions.js +2 -2
- package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +2 -2
- package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +3 -3
- package/dist/cjs/plugins/shared/LinkedBlockWrapper.js +3 -3
- package/dist/cjs/plugins/shared/LinkedInlineWrapper.js +3 -3
- package/dist/cjs/plugins/shared/ToolbarButton.js +37 -17
- package/dist/esm/CharConstraints.js +1 -1
- package/dist/esm/RichTextEditor.js +1 -1
- package/dist/esm/RichTextEditor.styles.js +1 -1
- package/dist/esm/Toolbar/components/StickyToolbarWrapper.js +1 -1
- package/dist/esm/Toolbar/index.js +1 -1
- package/dist/esm/dialogs/HypelinkDialog/HyperlinkDialog.js +1 -1
- package/dist/esm/plugins/CommandPalette/components/CommandList.js +1 -3
- package/dist/esm/plugins/CommandPalette/components/CommandList.styles.js +1 -1
- package/dist/esm/plugins/CommandPalette/components/CommandPrompt.js +1 -1
- package/dist/esm/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.js +1 -1
- package/dist/esm/plugins/Heading/components/Heading.js +1 -1
- package/dist/esm/plugins/Heading/components/ToolbarHeadingButton.js +1 -1
- package/dist/esm/plugins/Hr/index.js +1 -1
- package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +1 -1
- package/dist/esm/plugins/Hyperlink/components/styles.js +1 -1
- package/dist/esm/plugins/List/components/List.js +1 -1
- package/dist/esm/plugins/List/components/ListItem.js +1 -1
- package/dist/esm/plugins/Marks/Bold.js +1 -1
- package/dist/esm/plugins/Marks/Code.js +1 -1
- package/dist/esm/plugins/Marks/Italic.js +1 -1
- package/dist/esm/plugins/Marks/Strikethrough.js +1 -1
- package/dist/esm/plugins/Marks/Subscript.js +4 -2
- package/dist/esm/plugins/Marks/Superscript.js +1 -1
- package/dist/esm/plugins/Marks/components/MarkToolbarButton.js +1 -1
- package/dist/esm/plugins/Paragraph/Paragraph.js +1 -1
- package/dist/esm/plugins/Quote/components/Quote.js +1 -1
- package/dist/esm/plugins/Table/components/Cell.js +1 -1
- package/dist/esm/plugins/Table/components/HeaderCell.js +1 -1
- package/dist/esm/plugins/Table/components/Row.js +1 -1
- package/dist/esm/plugins/Table/components/Table.js +1 -1
- package/dist/esm/plugins/Table/components/TableActions.js +1 -1
- package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +1 -1
- package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +1 -1
- package/dist/esm/plugins/shared/LinkedBlockWrapper.js +1 -1
- package/dist/esm/plugins/shared/LinkedInlineWrapper.js +1 -1
- package/dist/esm/plugins/shared/ToolbarButton.js +35 -15
- package/dist/types/plugins/Hyperlink/components/LinkPopover.d.ts +1 -1
- package/dist/types/plugins/shared/ToolbarButton.d.ts +1 -1
- package/package.json +12 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import tokens from '@contentful/f36-tokens';
|
|
3
3
|
import { BLOCKS } from '@contentful/rich-text-types';
|
|
4
|
-
import { css, cx } from 'emotion';
|
|
4
|
+
import { css, cx } from '@emotion/css';
|
|
5
5
|
const baseStyle = css`
|
|
6
6
|
padding: 0;
|
|
7
7
|
margin: 0 0 1.25rem 1.25rem;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TextBIcon } from '@contentful/f36-icons';
|
|
3
3
|
import { MARKS } from '@contentful/rich-text-types';
|
|
4
|
+
import { css } from '@emotion/css';
|
|
4
5
|
import { createBoldPlugin as createDefaultBoldPlugin } from '@udecode/plate-basic-marks';
|
|
5
|
-
import { css } from 'emotion';
|
|
6
6
|
import { someHtmlElement } from '../../internal/queries';
|
|
7
7
|
import { createMarkToolbarButton } from './components/MarkToolbarButton';
|
|
8
8
|
import { buildMarkEventHandler } from './helpers';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { CodeSimpleIcon } from '@contentful/f36-icons';
|
|
3
3
|
import { MARKS } from '@contentful/rich-text-types';
|
|
4
|
+
import { css } from '@emotion/css';
|
|
4
5
|
import { createCodePlugin as createDefaultCodePlugin } from '@udecode/plate-basic-marks';
|
|
5
|
-
import { css } from 'emotion';
|
|
6
6
|
import { createMarkToolbarButton } from './components/MarkToolbarButton';
|
|
7
7
|
import { buildMarkEventHandler } from './helpers';
|
|
8
8
|
export const ToolbarCodeButton = createMarkToolbarButton({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TextItalicIcon } from '@contentful/f36-icons';
|
|
3
3
|
import { MARKS } from '@contentful/rich-text-types';
|
|
4
|
+
import { css } from '@emotion/css';
|
|
4
5
|
import { createItalicPlugin as createDefaultItalicPlugin } from '@udecode/plate-basic-marks';
|
|
5
|
-
import { css } from 'emotion';
|
|
6
6
|
import { someHtmlElement } from '../../internal/queries';
|
|
7
7
|
import { createMarkToolbarButton } from './components/MarkToolbarButton';
|
|
8
8
|
import { buildMarkEventHandler } from './helpers';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TextStrikethroughIcon } from '@contentful/f36-icons';
|
|
3
3
|
import { MARKS } from '@contentful/rich-text-types';
|
|
4
|
+
import { css } from '@emotion/css';
|
|
4
5
|
import { createStrikethroughPlugin as createDefaultStrikethroughPlugin } from '@udecode/plate-basic-marks';
|
|
5
|
-
import { css } from 'emotion';
|
|
6
6
|
import { createMarkToolbarButton } from './components/MarkToolbarButton';
|
|
7
7
|
import { buildMarkEventHandler } from './helpers';
|
|
8
8
|
const styles = {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { Icon } from '@contentful/f36-icon';
|
|
2
3
|
import { TextSubscriptIcon } from '@contentful/f36-icons';
|
|
3
4
|
import { MARKS } from '@contentful/rich-text-types';
|
|
5
|
+
import { css } from '@emotion/css';
|
|
4
6
|
import { createSubscriptPlugin as createDefaultSubscriptPlugin } from '@udecode/plate-basic-marks';
|
|
5
|
-
import { css } from 'emotion';
|
|
6
7
|
import { createMarkToolbarButton } from './components/MarkToolbarButton';
|
|
7
8
|
import { buildMarkEventHandler } from './helpers';
|
|
8
9
|
const styles = {
|
|
@@ -14,7 +15,8 @@ const styles = {
|
|
|
14
15
|
export const ToolbarSubscriptButton = createMarkToolbarButton({
|
|
15
16
|
title: 'Subscript',
|
|
16
17
|
mark: MARKS.SUBSCRIPT,
|
|
17
|
-
icon: /*#__PURE__*/ React.createElement(
|
|
18
|
+
icon: /*#__PURE__*/ React.createElement(Icon, {
|
|
19
|
+
as: TextSubscriptIcon,
|
|
18
20
|
viewBox: "0 0 23 18"
|
|
19
21
|
})
|
|
20
22
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TextSuperscriptIcon } from '@contentful/f36-icons';
|
|
3
3
|
import { MARKS } from '@contentful/rich-text-types';
|
|
4
|
+
import { css } from '@emotion/css';
|
|
4
5
|
import { createSuperscriptPlugin as createDefaultSuperscriptPlugin } from '@udecode/plate-basic-marks';
|
|
5
|
-
import { css } from 'emotion';
|
|
6
6
|
import { createMarkToolbarButton } from './components/MarkToolbarButton';
|
|
7
7
|
import { buildMarkEventHandler } from './helpers';
|
|
8
8
|
const styles = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Menu } from '@contentful/f36-components';
|
|
3
3
|
import tokens from '@contentful/f36-tokens';
|
|
4
|
-
import { css, cx } from 'emotion';
|
|
4
|
+
import { css, cx } from '@emotion/css';
|
|
5
5
|
import { useContentfulEditor } from '../../../ContentfulEditorProvider';
|
|
6
6
|
import { focus } from '../../../helpers/editor';
|
|
7
7
|
import { isMarkActive } from '../../../internal/queries';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import tokens from '@contentful/f36-tokens';
|
|
3
3
|
import { BLOCKS } from '@contentful/rich-text-types';
|
|
4
|
-
import { css } from 'emotion';
|
|
4
|
+
import { css } from '@emotion/css';
|
|
5
5
|
const styles = {
|
|
6
6
|
[BLOCKS.PARAGRAPH]: css`
|
|
7
7
|
line-height: ${tokens.lineHeightDefault};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import tokens from '@contentful/f36-tokens';
|
|
3
3
|
import { BLOCKS } from '@contentful/rich-text-types';
|
|
4
|
-
import { css } from 'emotion';
|
|
4
|
+
import { css } from '@emotion/css';
|
|
5
5
|
const style = css`
|
|
6
6
|
margin-bottom: 1.5em;
|
|
7
7
|
border-collapse: collapse;
|
|
@@ -2,8 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import { IconButton, Menu } from '@contentful/f36-components';
|
|
3
3
|
import { CaretDownIcon } from '@contentful/f36-icons';
|
|
4
4
|
import { BLOCKS } from '@contentful/rich-text-types';
|
|
5
|
+
import { css } from '@emotion/css';
|
|
5
6
|
import { deleteColumn, deleteRow, deleteTable } from '@udecode/plate-table';
|
|
6
|
-
import { css } from 'emotion';
|
|
7
7
|
import { useContentfulEditor } from '../../../ContentfulEditorProvider';
|
|
8
8
|
import { getNodeEntryFromSelection, getTableSize } from '../../../helpers/editor';
|
|
9
9
|
import { withoutNormalizing } from '../../../internal';
|
|
@@ -4,7 +4,7 @@ import { Icon } from '@contentful/f36-components';
|
|
|
4
4
|
import { ImageSquareIcon, EmbeddedBlockIcon } from '@contentful/f36-icons';
|
|
5
5
|
import tokens from '@contentful/f36-tokens';
|
|
6
6
|
import { BLOCKS } from '@contentful/rich-text-types';
|
|
7
|
-
import { css } from 'emotion';
|
|
7
|
+
import { css } from '@emotion/css';
|
|
8
8
|
import { useContentfulEditor } from '../../ContentfulEditorProvider';
|
|
9
9
|
import { useSdkContext } from '../../SdkProvider';
|
|
10
10
|
import { selectEntityAndInsert, selectResourceEntityAndInsert } from '../shared/EmbeddedBlockUtil';
|
|
@@ -3,7 +3,7 @@ import { Menu, Flex } from '@contentful/f36-components';
|
|
|
3
3
|
import { EmbeddedLineIcon } from '@contentful/f36-icons';
|
|
4
4
|
import tokens from '@contentful/f36-tokens';
|
|
5
5
|
import { INLINES } from '@contentful/rich-text-types';
|
|
6
|
-
import { css } from 'emotion';
|
|
6
|
+
import { css } from '@emotion/css';
|
|
7
7
|
import { useContentfulEditor } from '../../ContentfulEditorProvider';
|
|
8
8
|
import { moveToTheNextChar } from '../../helpers/editor';
|
|
9
9
|
import { useSdkContext } from '../../SdkProvider';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import tokens from '@contentful/f36-tokens';
|
|
3
|
-
import { css } from 'emotion';
|
|
3
|
+
import { css } from '@emotion/css';
|
|
4
4
|
import { IS_CHROME } from '../../helpers/environment';
|
|
5
5
|
import { getLinkEntityId } from './utils';
|
|
6
6
|
const styles = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { IconButton } from '@contentful/f36-components';
|
|
3
3
|
import tokens from '@contentful/f36-tokens';
|
|
4
|
-
import { css, cx } from 'emotion';
|
|
4
|
+
import { css, cx } from '@emotion/css';
|
|
5
5
|
const styles = {
|
|
6
6
|
button: css({
|
|
7
7
|
height: '30px',
|
|
@@ -10,30 +10,50 @@ const styles = {
|
|
|
10
10
|
marginRight: tokens.spacing2Xs
|
|
11
11
|
}),
|
|
12
12
|
tooltip: css({
|
|
13
|
-
zIndex: Number(tokens.zIndexTooltip)
|
|
13
|
+
zIndex: Number(tokens.zIndexTooltip),
|
|
14
|
+
pointerEvents: 'none'
|
|
14
15
|
})
|
|
15
16
|
};
|
|
16
17
|
export function ToolbarButton(props) {
|
|
17
18
|
const { title, testId, isActive, children, className, isDisabled = false } = props;
|
|
18
|
-
const
|
|
19
|
+
const pointerTriggeredRef = React.useRef(false);
|
|
20
|
+
const handlePointerDown = React.useCallback((event)=>{
|
|
21
|
+
if (isDisabled || event.button !== 0) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
19
24
|
event.preventDefault();
|
|
25
|
+
pointerTriggeredRef.current = true;
|
|
20
26
|
props.onClick();
|
|
21
|
-
}
|
|
22
|
-
|
|
27
|
+
}, [
|
|
28
|
+
isDisabled,
|
|
29
|
+
props
|
|
30
|
+
]);
|
|
31
|
+
const handleClick = React.useCallback((event)=>{
|
|
32
|
+
if (pointerTriggeredRef.current) {
|
|
33
|
+
pointerTriggeredRef.current = false;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
props.onClick();
|
|
38
|
+
}, [
|
|
39
|
+
props
|
|
40
|
+
]);
|
|
41
|
+
return /*#__PURE__*/ React.createElement(IconButton, {
|
|
23
42
|
className: cx(styles.button, className),
|
|
24
43
|
isDisabled: isDisabled,
|
|
25
|
-
|
|
44
|
+
onMouseDown: handlePointerDown,
|
|
26
45
|
onClick: handleClick,
|
|
27
46
|
testId: testId,
|
|
28
47
|
variant: isActive ? 'secondary' : 'transparent',
|
|
29
|
-
size: "small"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
48
|
+
size: "small",
|
|
49
|
+
icon: children,
|
|
50
|
+
"aria-label": title,
|
|
51
|
+
withTooltip: !!title,
|
|
52
|
+
tooltipProps: {
|
|
33
53
|
className: styles.tooltip,
|
|
34
|
-
|
|
54
|
+
usePortal: true,
|
|
55
|
+
placement: 'bottom',
|
|
35
56
|
content: title
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return button;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
39
59
|
}
|
|
@@ -4,7 +4,7 @@ type LinkPopoverProps = {
|
|
|
4
4
|
popoverText: React.ReactNode | ((closePopover: () => void) => React.ReactNode);
|
|
5
5
|
handleEditLink: () => void;
|
|
6
6
|
handleRemoveLink: () => void;
|
|
7
|
-
children: React.
|
|
7
|
+
children: React.ReactElement;
|
|
8
8
|
handleCopyLink?: () => void;
|
|
9
9
|
isEditorFocused: boolean;
|
|
10
10
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-rich-text",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"source": "./src/index.tsx",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -40,14 +40,16 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@contentful/app-sdk": "^4.42.0",
|
|
42
42
|
"@contentful/contentful-slatejs-adapter": "^16.1.6",
|
|
43
|
-
"@contentful/f36-components": "^
|
|
44
|
-
"@contentful/f36-
|
|
45
|
-
"@contentful/f36-
|
|
46
|
-
"@contentful/f36-
|
|
47
|
-
"@contentful/
|
|
48
|
-
"@contentful/field-editor-
|
|
43
|
+
"@contentful/f36-components": "^6.7.1",
|
|
44
|
+
"@contentful/f36-icon": "^6.7.1",
|
|
45
|
+
"@contentful/f36-icons": "^6.7.1",
|
|
46
|
+
"@contentful/f36-tokens": "^6.1.2",
|
|
47
|
+
"@contentful/f36-utils": "^6.1.0",
|
|
48
|
+
"@contentful/field-editor-reference": "^7.0.0",
|
|
49
|
+
"@contentful/field-editor-shared": "^3.0.0",
|
|
49
50
|
"@contentful/rich-text-plain-text-renderer": "^17.0.0",
|
|
50
51
|
"@contentful/rich-text-types": "^17.2.5",
|
|
52
|
+
"@emotion/css": "^11.13.5",
|
|
51
53
|
"@popperjs/core": "^2.11.5",
|
|
52
54
|
"@udecode/plate-basic-marks": "36.0.0",
|
|
53
55
|
"@udecode/plate-break": "36.0.0",
|
|
@@ -77,8 +79,8 @@
|
|
|
77
79
|
"peerDependencies": {
|
|
78
80
|
"@lingui/core": "^5.3.0",
|
|
79
81
|
"@tanstack/react-query": "^4.3.9",
|
|
80
|
-
"react": ">=
|
|
81
|
-
"react-dom": ">=
|
|
82
|
+
"react": ">=18.3.1",
|
|
83
|
+
"react-dom": ">=18.3.1"
|
|
82
84
|
},
|
|
83
85
|
"devDependencies": {
|
|
84
86
|
"@contentful/field-editor-test-utils": "^2.0.0",
|
|
@@ -92,5 +94,5 @@
|
|
|
92
94
|
"publishConfig": {
|
|
93
95
|
"registry": "https://npm.pkg.github.com/"
|
|
94
96
|
},
|
|
95
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "4e13dec4455366c7012c2b1c88f47a269a20b5b4"
|
|
96
98
|
}
|