@contentful/field-editor-rich-text 3.12.7 → 3.13.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/constants/Schema.js +3 -0
- package/dist/cjs/helpers/{newEntitySelectorConfigFromRichTextField.js → config.js} +19 -5
- package/dist/cjs/plugins/DragAndDrop/index.js +4 -2
- package/dist/cjs/plugins/EmbeddedEntityInline/index.js +21 -4
- package/dist/cjs/plugins/{shared/FetchingWrappedResourceCard.js → EmbeddedResourceBlock/FetchingWrappedResourceBlockCard.js} +3 -3
- package/dist/cjs/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +2 -2
- 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/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/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +2 -2
- package/dist/esm/Toolbar/components/EmbedEntityWidget.js +6 -0
- package/dist/esm/constants/Schema.js +3 -0
- package/dist/esm/helpers/{newEntitySelectorConfigFromRichTextField.js → config.js} +8 -2
- package/dist/esm/plugins/DragAndDrop/index.js +4 -2
- package/dist/esm/plugins/EmbeddedEntityInline/index.js +22 -5
- package/dist/esm/plugins/{shared/FetchingWrappedResourceCard.js → EmbeddedResourceBlock/FetchingWrappedResourceBlockCard.js} +1 -1
- package/dist/esm/plugins/EmbeddedResourceBlock/LinkedResourceBlock.js +2 -2
- 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/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/plugins/shared/__tests__/FetchingWrappedResourceCard.test.js +2 -2
- package/dist/types/constants/Schema.d.ts +3 -0
- package/dist/types/helpers/config.d.ts +33 -0
- package/dist/types/plugins/{shared/FetchingWrappedResourceCard.d.ts → EmbeddedResourceBlock/FetchingWrappedResourceBlockCard.d.ts} +2 -2
- 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/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
|
@@ -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 {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { FieldAppSDK } from '@contentful/app-sdk';
|
|
3
3
|
import { ResourceLink } from '@contentful/rich-text-types';
|
|
4
|
-
interface
|
|
4
|
+
interface FetchingWrappedResourceBlockCardProps {
|
|
5
5
|
link: ResourceLink['sys'];
|
|
6
6
|
isDisabled: boolean;
|
|
7
7
|
isSelected: boolean;
|
|
@@ -10,5 +10,5 @@ interface FetchingWrappedResourceCardProps {
|
|
|
10
10
|
onEdit?: VoidFunction;
|
|
11
11
|
onRemove?: VoidFunction;
|
|
12
12
|
}
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const FetchingWrappedResourceBlockCard: (props: FetchingWrappedResourceBlockCardProps) => React.JSX.Element;
|
|
14
14
|
export {};
|
|
@@ -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,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.13.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": "8cbc98b0d9bd617de2199269659c6ce16807fbeb"
|
|
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
|
-
};
|