@contentful/field-editor-rich-text 3.12.7 → 3.14.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/Toolbar/components/EmbedEntityWidget.js +6 -0
- package/dist/cjs/Toolbar/index.js +2 -1
- package/dist/cjs/constants/Schema.js +14 -0
- package/dist/cjs/helpers/{newEntitySelectorConfigFromRichTextField.js → config.js} +19 -5
- package/dist/cjs/helpers/editor.js +1 -0
- package/dist/cjs/plugins/DragAndDrop/index.js +4 -2
- package/dist/cjs/plugins/EmbeddedEntityInline/index.js +21 -4
- package/dist/cjs/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +102 -0
- package/dist/cjs/plugins/EmbeddedResourceInline/LinkedResourceInline.js +51 -0
- package/dist/cjs/plugins/EmbeddedResourceInline/index.js +56 -0
- package/dist/cjs/plugins/Heading/__tests__/createHeadingPlugin.test.js +2 -0
- package/dist/cjs/plugins/Hyperlink/HyperlinkModal.js +63 -8
- package/dist/cjs/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +3 -1
- package/dist/cjs/plugins/Hyperlink/components/ResourceHyperlink.js +93 -0
- package/dist/cjs/plugins/Hyperlink/createHyperlinkPlugin.js +29 -1
- package/dist/cjs/plugins/Hyperlink/useResourceEntityInfo.js +71 -0
- package/dist/cjs/plugins/Hyperlink/utils.js +5 -2
- package/dist/cjs/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +2 -0
- package/dist/cjs/plugins/Quote/__test__/createQuotePlugin.test.js +2 -0
- package/dist/cjs/plugins/index.js +2 -0
- package/dist/cjs/plugins/shared/EmbeddedBlockToolbarIcon.js +2 -4
- package/dist/cjs/plugins/shared/EmbeddedBlockUtil.js +3 -4
- package/dist/cjs/plugins/shared/EmbeddedInlineToolbarIcon.js +11 -6
- package/dist/cjs/plugins/shared/EmbeddedInlineUtil.js +66 -27
- package/dist/cjs/plugins/shared/ResourceNewBadge.js +57 -0
- package/dist/cjs/test-utils/jsx.js +11 -0
- package/dist/esm/Toolbar/components/EmbedEntityWidget.js +6 -0
- package/dist/esm/Toolbar/index.js +2 -1
- package/dist/esm/constants/Schema.js +14 -0
- package/dist/esm/helpers/{newEntitySelectorConfigFromRichTextField.js → config.js} +8 -2
- package/dist/esm/helpers/editor.js +1 -0
- package/dist/esm/plugins/DragAndDrop/index.js +4 -2
- package/dist/esm/plugins/EmbeddedEntityInline/index.js +22 -5
- package/dist/esm/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.js +53 -0
- package/dist/esm/plugins/EmbeddedResourceInline/LinkedResourceInline.js +36 -0
- package/dist/esm/plugins/EmbeddedResourceInline/index.js +46 -0
- package/dist/esm/plugins/Heading/__tests__/createHeadingPlugin.test.js +2 -0
- package/dist/esm/plugins/Hyperlink/HyperlinkModal.js +63 -8
- package/dist/esm/plugins/Hyperlink/__tests__/createHyperlinkPlugin.test.js +3 -1
- package/dist/esm/plugins/Hyperlink/components/ResourceHyperlink.js +44 -0
- package/dist/esm/plugins/Hyperlink/createHyperlinkPlugin.js +29 -1
- package/dist/esm/plugins/Hyperlink/useResourceEntityInfo.js +22 -0
- package/dist/esm/plugins/Hyperlink/utils.js +2 -2
- package/dist/esm/plugins/Paragraph/__tests__/createParagraphPlugin.test.js +2 -0
- package/dist/esm/plugins/Quote/__test__/createQuotePlugin.test.js +2 -0
- package/dist/esm/plugins/index.js +2 -0
- package/dist/esm/plugins/shared/EmbeddedBlockToolbarIcon.js +3 -5
- package/dist/esm/plugins/shared/EmbeddedBlockUtil.js +1 -2
- package/dist/esm/plugins/shared/EmbeddedInlineToolbarIcon.js +12 -7
- package/dist/esm/plugins/shared/EmbeddedInlineUtil.js +64 -25
- package/dist/esm/plugins/shared/ResourceNewBadge.js +8 -0
- package/dist/esm/test-utils/jsx.js +11 -0
- package/dist/types/constants/Schema.d.ts +10 -0
- package/dist/types/helpers/config.d.ts +33 -0
- package/dist/types/helpers/editor.d.ts +1 -1
- package/dist/types/plugins/EmbeddedResourceInline/FetchingWrappedResourceInlineCard.d.ts +13 -0
- package/dist/types/plugins/EmbeddedResourceInline/LinkedResourceInline.d.ts +13 -0
- package/dist/types/plugins/EmbeddedResourceInline/index.d.ts +3 -0
- package/dist/types/plugins/Hyperlink/HyperlinkModal.d.ts +2 -1
- package/dist/types/plugins/Hyperlink/components/ResourceHyperlink.d.ts +20 -0
- package/dist/types/plugins/Hyperlink/useResourceEntityInfo.d.ts +7 -0
- package/dist/types/plugins/Hyperlink/utils.d.ts +1 -0
- package/dist/types/plugins/shared/EmbeddedInlineToolbarIcon.d.ts +2 -1
- package/dist/types/plugins/shared/EmbeddedInlineUtil.d.ts +3 -17
- package/dist/types/plugins/shared/ResourceNewBadge.d.ts +2 -0
- package/package.json +2 -2
- package/dist/cjs/helpers/newResourceEntitySelectorConfigFromRichTextField.js +0 -21
- package/dist/esm/helpers/newResourceEntitySelectorConfigFromRichTextField.js +0 -6
- package/dist/types/helpers/newEntitySelectorConfigFromRichTextField.d.ts +0 -14
- package/dist/types/helpers/newResourceEntitySelectorConfigFromRichTextField.d.ts +0 -16
|
@@ -1,25 +1,59 @@
|
|
|
1
1
|
import { INLINES } from '@contentful/rich-text-types';
|
|
2
2
|
import isHotkey from 'is-hotkey';
|
|
3
|
+
import { newEntitySelectorConfigFromRichTextField, newResourceEntitySelectorConfigFromRichTextField } from '../../helpers/config';
|
|
3
4
|
import { focus } from '../../helpers/editor';
|
|
4
|
-
import newEntitySelectorConfigFromRichTextField from '../../helpers/newEntitySelectorConfigFromRichTextField';
|
|
5
5
|
import { watchCurrentSlide } from '../../helpers/sdkNavigatorSlideIn';
|
|
6
6
|
import { insertNodes, select } from '../../internal/transforms';
|
|
7
|
-
export function getWithEmbeddedEntryInlineEvents(sdk) {
|
|
7
|
+
export function getWithEmbeddedEntryInlineEvents(nodeType, sdk) {
|
|
8
8
|
return function withEmbeddedEntryInlineEvents(editor, { options: { hotkey } }) {
|
|
9
9
|
return function handleEvent(event) {
|
|
10
10
|
if (!editor) return;
|
|
11
11
|
if (hotkey && isHotkey(hotkey, event)) {
|
|
12
|
-
|
|
12
|
+
if (nodeType === INLINES.EMBEDDED_RESOURCE) {
|
|
13
|
+
selectResourceEntityAndInsert(editor, sdk, editor.tracking.onShortcutAction);
|
|
14
|
+
} else {
|
|
15
|
+
selectEntityAndInsert(editor, sdk, editor.tracking.onShortcutAction);
|
|
16
|
+
}
|
|
13
17
|
}
|
|
14
18
|
};
|
|
15
19
|
};
|
|
16
20
|
}
|
|
21
|
+
const getLink = (nodeType, entity)=>{
|
|
22
|
+
if (nodeType === INLINES.EMBEDDED_RESOURCE) {
|
|
23
|
+
return {
|
|
24
|
+
urn: entity.sys.urn,
|
|
25
|
+
type: 'ResourceLink',
|
|
26
|
+
linkType: 'Contentful:Entry'
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
id: entity.sys.id,
|
|
31
|
+
type: 'Link',
|
|
32
|
+
linkType: entity.sys.type
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const createInlineEntryNode = (nodeType, entity)=>{
|
|
36
|
+
return {
|
|
37
|
+
type: nodeType,
|
|
38
|
+
children: [
|
|
39
|
+
{
|
|
40
|
+
text: ''
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
data: {
|
|
44
|
+
target: {
|
|
45
|
+
sys: getLink(nodeType, entity)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
17
50
|
export async function selectEntityAndInsert(editor, sdk, logAction) {
|
|
51
|
+
const nodeType = INLINES.EMBEDDED_ENTRY;
|
|
18
52
|
logAction('openCreateEmbedDialog', {
|
|
19
|
-
nodeType
|
|
53
|
+
nodeType
|
|
20
54
|
});
|
|
21
55
|
const config = {
|
|
22
|
-
...newEntitySelectorConfigFromRichTextField(sdk.field,
|
|
56
|
+
...newEntitySelectorConfigFromRichTextField(sdk.field, nodeType),
|
|
23
57
|
withCreate: true
|
|
24
58
|
};
|
|
25
59
|
const { selection } = editor;
|
|
@@ -27,13 +61,13 @@ export async function selectEntityAndInsert(editor, sdk, logAction) {
|
|
|
27
61
|
const entry = await sdk.dialogs.selectSingleEntry(config);
|
|
28
62
|
if (!entry) {
|
|
29
63
|
logAction('cancelCreateEmbedDialog', {
|
|
30
|
-
nodeType
|
|
64
|
+
nodeType
|
|
31
65
|
});
|
|
32
66
|
} else {
|
|
33
67
|
select(editor, selection);
|
|
34
|
-
insertNodes(editor, createInlineEntryNode(entry
|
|
68
|
+
insertNodes(editor, createInlineEntryNode(nodeType, entry));
|
|
35
69
|
logAction('insert', {
|
|
36
|
-
nodeType
|
|
70
|
+
nodeType
|
|
37
71
|
});
|
|
38
72
|
}
|
|
39
73
|
rteSlide.onActive(()=>{
|
|
@@ -41,22 +75,27 @@ export async function selectEntityAndInsert(editor, sdk, logAction) {
|
|
|
41
75
|
focus(editor);
|
|
42
76
|
});
|
|
43
77
|
}
|
|
44
|
-
export function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
target: {
|
|
54
|
-
sys: {
|
|
55
|
-
id,
|
|
56
|
-
type: 'Link',
|
|
57
|
-
linkType: 'Entry'
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
78
|
+
export async function selectResourceEntityAndInsert(editor, sdk, logAction) {
|
|
79
|
+
const nodeType = INLINES.EMBEDDED_RESOURCE;
|
|
80
|
+
logAction('openCreateEmbedDialog', {
|
|
81
|
+
nodeType
|
|
82
|
+
});
|
|
83
|
+
const { dialogs , field } = sdk;
|
|
84
|
+
const config = {
|
|
85
|
+
...newResourceEntitySelectorConfigFromRichTextField(field, nodeType),
|
|
86
|
+
withCreate: true
|
|
61
87
|
};
|
|
88
|
+
const { selection } = editor;
|
|
89
|
+
const entry = await dialogs.selectSingleResourceEntry(config);
|
|
90
|
+
if (!entry) {
|
|
91
|
+
logAction('cancelCreateEmbedDialog', {
|
|
92
|
+
nodeType
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
select(editor, selection);
|
|
96
|
+
insertNodes(editor, createInlineEntryNode(nodeType, entry));
|
|
97
|
+
logAction('insert', {
|
|
98
|
+
nodeType
|
|
99
|
+
});
|
|
100
|
+
}
|
|
62
101
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Badge } from '@contentful/f36-components';
|
|
3
|
+
export const ResourceNewBadge = ()=>{
|
|
4
|
+
return React.createElement(React.Fragment, null, ' ', "(different space)", ' ', React.createElement(Badge, {
|
|
5
|
+
variant: "primary-filled",
|
|
6
|
+
size: "small"
|
|
7
|
+
}, "new"));
|
|
8
|
+
};
|
|
@@ -19,6 +19,13 @@ const createSysLink = (linkType, id)=>({
|
|
|
19
19
|
linkType
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
+
const createSysResourceLink = (urn)=>({
|
|
23
|
+
sys: {
|
|
24
|
+
urn,
|
|
25
|
+
type: 'ResourceLink',
|
|
26
|
+
linkType: 'Contentful:Entry'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
22
29
|
const createHyperlink = (_, attrs, children)=>{
|
|
23
30
|
const data = {};
|
|
24
31
|
let type = INLINES.HYPERLINK;
|
|
@@ -34,6 +41,10 @@ const createHyperlink = (_, attrs, children)=>{
|
|
|
34
41
|
type = INLINES.ENTRY_HYPERLINK;
|
|
35
42
|
data.target = createSysLink('Entry', attrs.entry);
|
|
36
43
|
}
|
|
44
|
+
if (attrs.resource) {
|
|
45
|
+
type = INLINES.RESOURCE_HYPERLINK;
|
|
46
|
+
data.target = createSysResourceLink(attrs.resource);
|
|
47
|
+
}
|
|
37
48
|
children = children.map((child)=>typeof child === 'string' ? {
|
|
38
49
|
text: child
|
|
39
50
|
} : child);
|
|
@@ -96,6 +96,13 @@ declare const _default: {
|
|
|
96
96
|
}[];
|
|
97
97
|
}[];
|
|
98
98
|
};
|
|
99
|
+
"resource-hyperlink": {
|
|
100
|
+
nodes: {
|
|
101
|
+
match: {
|
|
102
|
+
object: string;
|
|
103
|
+
}[];
|
|
104
|
+
}[];
|
|
105
|
+
};
|
|
99
106
|
"asset-hyperlink": {
|
|
100
107
|
nodes: {
|
|
101
108
|
match: {
|
|
@@ -106,6 +113,9 @@ declare const _default: {
|
|
|
106
113
|
"embedded-entry-inline": {
|
|
107
114
|
isVoid: boolean;
|
|
108
115
|
};
|
|
116
|
+
"embedded-resource-inline": {
|
|
117
|
+
isVoid: boolean;
|
|
118
|
+
};
|
|
109
119
|
};
|
|
110
120
|
};
|
|
111
121
|
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { FieldAPI } from '@contentful/app-sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a config for the entity selector based on a given rich text field and a
|
|
4
|
+
* rich text node type that the entity should be picked for. Takes the field
|
|
5
|
+
* validations for the given node type into account.
|
|
6
|
+
*
|
|
7
|
+
* @param {object} field
|
|
8
|
+
* @param {string} nodeType
|
|
9
|
+
* @returns {object}
|
|
10
|
+
*/
|
|
11
|
+
type EntitySelectorConfig = {
|
|
12
|
+
entityType: string;
|
|
13
|
+
locale: string | null;
|
|
14
|
+
contentTypes: string[];
|
|
15
|
+
};
|
|
16
|
+
export declare const newEntitySelectorConfigFromRichTextField: (field: FieldAPI, nodeType: any) => EntitySelectorConfig;
|
|
17
|
+
/**
|
|
18
|
+
* Returns a config for the entity selector based on a given rich text field and a
|
|
19
|
+
* rich text node type that the entity should be picked for. Takes the field
|
|
20
|
+
* validations for the given node type into account.
|
|
21
|
+
*
|
|
22
|
+
* @param {object} field
|
|
23
|
+
* @param {string} nodeType
|
|
24
|
+
* @returns {object}
|
|
25
|
+
*/
|
|
26
|
+
export declare const newResourceEntitySelectorConfigFromRichTextField: (field: any, nodeType: any) => {
|
|
27
|
+
allowedResources: {
|
|
28
|
+
type: "Contentful:Entry";
|
|
29
|
+
source: string;
|
|
30
|
+
contentTypes: string[];
|
|
31
|
+
}[];
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -17,7 +17,7 @@ export declare function isList(editor?: PlateEditor): boolean;
|
|
|
17
17
|
export declare function getTableSize(table: Element): Record<'numRows' | 'numColumns', number> | null;
|
|
18
18
|
interface InsertLinkOptions {
|
|
19
19
|
text: string;
|
|
20
|
-
type: INLINES.HYPERLINK | INLINES.ENTRY_HYPERLINK | INLINES.ASSET_HYPERLINK;
|
|
20
|
+
type: INLINES.HYPERLINK | INLINES.ENTRY_HYPERLINK | INLINES.RESOURCE_HYPERLINK | INLINES.ASSET_HYPERLINK;
|
|
21
21
|
url?: string;
|
|
22
22
|
target?: Link;
|
|
23
23
|
path?: Path;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ResourceLink } from '@contentful/field-editor-reference';
|
|
3
|
+
import { FieldAppSDK } from '@contentful/field-editor-shared';
|
|
4
|
+
interface FetchingWrappedResourceInlineCardProps {
|
|
5
|
+
link: ResourceLink['sys'];
|
|
6
|
+
sdk: FieldAppSDK;
|
|
7
|
+
isSelected: boolean;
|
|
8
|
+
isDisabled: boolean;
|
|
9
|
+
onRemove: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
10
|
+
onEntityFetchComplete?: VoidFunction;
|
|
11
|
+
}
|
|
12
|
+
export declare function FetchingWrappedResourceInlineCard(props: FetchingWrappedResourceInlineCardProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ResourceLink } from '@contentful/field-editor-reference';
|
|
3
|
+
import { Element, RenderElementProps } from '../../internal';
|
|
4
|
+
export type LinkedResourceInlineProps = {
|
|
5
|
+
element: Element & {
|
|
6
|
+
data: {
|
|
7
|
+
target: ResourceLink;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
attributes: Pick<RenderElementProps, 'attributes'>;
|
|
11
|
+
children: Pick<RenderElementProps, 'children'>;
|
|
12
|
+
};
|
|
13
|
+
export declare function LinkedResourceInline(props: LinkedResourceInlineProps): React.JSX.Element;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Link } from '@contentful/field-editor-reference';
|
|
3
3
|
import { FieldAppSDK } from '@contentful/field-editor-shared';
|
|
4
|
+
import { ResourceLink } from '@contentful/rich-text-types';
|
|
4
5
|
import { PlateEditor, Path } from '../../internal/types';
|
|
5
6
|
import { TrackingPluginActions } from '../../plugins/Tracking';
|
|
6
7
|
interface HyperlinkModalProps {
|
|
7
8
|
linkText?: string;
|
|
8
9
|
linkType?: string;
|
|
9
10
|
linkTarget?: string;
|
|
10
|
-
linkEntity?: Link;
|
|
11
|
+
linkEntity?: Link | ResourceLink;
|
|
11
12
|
onClose: (value: unknown) => void;
|
|
12
13
|
sdk: FieldAppSDK;
|
|
13
14
|
readonly: boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Link } from '@contentful/app-sdk';
|
|
3
|
+
import { Element, RenderElementProps } from '../../../internal/types';
|
|
4
|
+
export type ResourceHyperlinkProps = {
|
|
5
|
+
element: Element & {
|
|
6
|
+
data: {
|
|
7
|
+
target: {
|
|
8
|
+
sys: {
|
|
9
|
+
urn: string;
|
|
10
|
+
linkType: 'Contentful:Entry';
|
|
11
|
+
type: 'ResourceLink';
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
target: Link;
|
|
17
|
+
attributes: Pick<RenderElementProps, 'attributes'>;
|
|
18
|
+
children: Pick<RenderElementProps, 'children'>;
|
|
19
|
+
};
|
|
20
|
+
export declare function ResourceHyperlink(props: ResourceHyperlinkProps): React.JSX.Element | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ResourceLink } from '@contentful/rich-text-types';
|
|
2
|
+
type ResourceEntityInfoProps = {
|
|
3
|
+
target: ResourceLink;
|
|
4
|
+
onEntityFetchComplete?: VoidFunction;
|
|
5
|
+
};
|
|
6
|
+
export declare function useResourceEntityInfo({ onEntityFetchComplete, target }: ResourceEntityInfoProps): string;
|
|
7
|
+
export {};
|
|
@@ -2,4 +2,5 @@ import { NodeEntry } from '../../internal/types';
|
|
|
2
2
|
import { PlateEditor } from '../../internal/types';
|
|
3
3
|
import { FetchedEntityData } from './useEntityInfo';
|
|
4
4
|
export declare const hasText: (editor: PlateEditor, entry: NodeEntry) => boolean;
|
|
5
|
+
export declare function truncateTitle(str: string, length: number): string;
|
|
5
6
|
export declare function getEntityInfo(data?: FetchedEntityData): string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface EmbeddedInlineToolbarIconProps {
|
|
3
3
|
onClose: () => void;
|
|
4
|
+
nodeType: string;
|
|
4
5
|
isDisabled: boolean;
|
|
5
6
|
}
|
|
6
|
-
export declare function EmbeddedInlineToolbarIcon(
|
|
7
|
+
export declare function EmbeddedInlineToolbarIcon({ onClose, nodeType, isDisabled, }: EmbeddedInlineToolbarIconProps): React.JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -3,20 +3,6 @@ import { INLINES } from '@contentful/rich-text-types';
|
|
|
3
3
|
import { HotkeyPlugin } from '@udecode/plate-common';
|
|
4
4
|
import { KeyboardHandler } from '../../internal/types';
|
|
5
5
|
import { TrackingPluginActions } from '../../plugins/Tracking';
|
|
6
|
-
export declare function getWithEmbeddedEntryInlineEvents(sdk: FieldAppSDK): KeyboardHandler<HotkeyPlugin>;
|
|
7
|
-
export declare function selectEntityAndInsert(editor: any, sdk:
|
|
8
|
-
export declare function
|
|
9
|
-
type: INLINES;
|
|
10
|
-
children: {
|
|
11
|
-
text: string;
|
|
12
|
-
}[];
|
|
13
|
-
data: {
|
|
14
|
-
target: {
|
|
15
|
-
sys: {
|
|
16
|
-
id: string;
|
|
17
|
-
type: string;
|
|
18
|
-
linkType: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
};
|
|
6
|
+
export declare function getWithEmbeddedEntryInlineEvents(nodeType: INLINES.EMBEDDED_ENTRY | INLINES.EMBEDDED_RESOURCE, sdk: FieldAppSDK): KeyboardHandler<HotkeyPlugin>;
|
|
7
|
+
export declare function selectEntityAndInsert(editor: any, sdk: any, logAction: TrackingPluginActions['onShortcutAction'] | TrackingPluginActions['onToolbarAction']): Promise<void>;
|
|
8
|
+
export declare function selectResourceEntityAndInsert(editor: any, sdk: any, logAction: TrackingPluginActions['onToolbarAction'] | TrackingPluginActions['onShortcutAction']): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-rich-text",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"source": "./src/index.tsx",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"prism-react-renderer": "2.0.5",
|
|
82
82
|
"react": ">=16.14.0"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "5df6fd753ac999a99c4aaaac9fac54336f0c4974"
|
|
85
85
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return newResourceEntitySelectorConfigFromRichTextField;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _getAllowedResourcesForNodeType = _interop_require_default(require("./getAllowedResourcesForNodeType"));
|
|
12
|
-
function _interop_require_default(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
default: obj
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function newResourceEntitySelectorConfigFromRichTextField(field, nodeType) {
|
|
18
|
-
return {
|
|
19
|
-
allowedResources: (0, _getAllowedResourcesForNodeType.default)(field, nodeType)
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a config for the entity selector based on a given rich text field and a
|
|
3
|
-
* rich text node type that the entity should be picked for. Takes the field
|
|
4
|
-
* validations for the given node type into account.
|
|
5
|
-
*
|
|
6
|
-
* @param {object} field
|
|
7
|
-
* @param {string} nodeType
|
|
8
|
-
* @returns {object}
|
|
9
|
-
*/
|
|
10
|
-
export default function newEntitySelectorConfigFromRichTextField(field: any, nodeType: any): {
|
|
11
|
-
entityType: "Entry" | "Asset";
|
|
12
|
-
locale: any;
|
|
13
|
-
contentTypes: string[];
|
|
14
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a config for the entity selector based on a given rich text field and a
|
|
3
|
-
* rich text node type that the entity should be picked for. Takes the field
|
|
4
|
-
* validations for the given node type into account.
|
|
5
|
-
*
|
|
6
|
-
* @param {object} field
|
|
7
|
-
* @param {string} nodeType
|
|
8
|
-
* @returns {object}
|
|
9
|
-
*/
|
|
10
|
-
export default function newResourceEntitySelectorConfigFromRichTextField(field: any, nodeType: any): {
|
|
11
|
-
allowedResources: {
|
|
12
|
-
type: "Contentful:Entry";
|
|
13
|
-
source: string;
|
|
14
|
-
contentTypes: string[];
|
|
15
|
-
}[];
|
|
16
|
-
};
|