@contentful/field-editor-rich-text 2.0.0-next.20 → 2.0.0-next.23

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.
@@ -0,0 +1,9 @@
1
+ import { Link } from '@contentful/app-sdk';
2
+ import { CustomRenderElementProps } from '../../../types';
3
+ declare type HyperlinkElementProps = CustomRenderElementProps<{
4
+ uri?: string;
5
+ target?: Link;
6
+ onEntityFetchComplete?: VoidFunction;
7
+ }>;
8
+ export declare function EntityHyperlink(props: HyperlinkElementProps): JSX.Element | null;
9
+ export {};
@@ -0,0 +1,5 @@
1
+ interface ToolbarHyperlinkButtonProps {
2
+ isDisabled: boolean | undefined;
3
+ }
4
+ export declare function ToolbarHyperlinkButton(props: ToolbarHyperlinkButtonProps): JSX.Element | null;
5
+ export {};
@@ -0,0 +1,9 @@
1
+ import { Link } from '@contentful/app-sdk';
2
+ import { CustomRenderElementProps } from '../../../types';
3
+ declare type HyperlinkElementProps = CustomRenderElementProps<{
4
+ uri?: string;
5
+ target?: Link;
6
+ onEntityFetchComplete?: VoidFunction;
7
+ }>;
8
+ export declare function UrlHyperlink(props: HyperlinkElementProps): JSX.Element;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const styles: {
2
+ hyperlinkWrapper: string;
3
+ hyperlink: string;
4
+ };
@@ -0,0 +1,3 @@
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ import { RichTextPlugin } from '../../types';
3
+ export declare const createHyperlinkPlugin: (sdk: FieldExtensionSDK) => RichTextPlugin;
@@ -1,8 +1,2 @@
1
- import { FieldExtensionSDK } from '@contentful/app-sdk';
2
- import { RichTextPlugin } from '../../types';
3
- interface ToolbarHyperlinkButtonProps {
4
- isDisabled: boolean | undefined;
5
- }
6
- export declare function ToolbarHyperlinkButton(props: ToolbarHyperlinkButtonProps): JSX.Element | null;
7
- export declare const createHyperlinkPlugin: (sdk: FieldExtensionSDK) => RichTextPlugin;
8
- export {};
1
+ export { ToolbarHyperlinkButton } from './components/ToolbarHyperlinkButton';
2
+ export { createHyperlinkPlugin } from './createHyperlinkPlugin';
@@ -0,0 +1,16 @@
1
+ import { FieldExtensionSDK, Link, Entry, Asset, ScheduledAction } from '@contentful/app-sdk';
2
+ import { entityHelpers } from '@contentful/field-editor-shared';
3
+ export declare type FetchedEntityData = {
4
+ jobs: ScheduledAction[];
5
+ entity: Entry | Asset;
6
+ entityTitle: string;
7
+ entityDescription: string;
8
+ entityStatus: ReturnType<typeof entityHelpers.getEntryStatus>;
9
+ contentTypeName: string;
10
+ };
11
+ export declare type EntityInfoProps = {
12
+ target: Link;
13
+ sdk: FieldExtensionSDK;
14
+ onEntityFetchComplete?: VoidFunction;
15
+ };
16
+ export declare function useEntityInfo(props: EntityInfoProps): string;
@@ -1,3 +1,5 @@
1
1
  import { NodeEntry, Node } from 'slate';
2
2
  import { RichTextEditor } from '../../types';
3
+ import { FetchedEntityData } from './useEntityInfo';
3
4
  export declare const hasText: (editor: RichTextEditor, entry: NodeEntry<Node>) => boolean;
5
+ export declare function getEntityInfo(data?: FetchedEntityData): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Credit: Modified version of Plate's list plugin
3
+ * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4
+ */
5
+ import { HotkeyPlugin, KeyboardHandler } from '@udecode/plate-core';
6
+ import { RichTextEditor } from '../../types';
7
+ export declare const onKeyDownList: KeyboardHandler<RichTextEditor, HotkeyPlugin>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Credit: Modified version of Plate's list plugin
3
+ * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4
+ */
5
+ import { PlateEditor, TElement } from '@udecode/plate-core';
6
+ import { NodeEntry } from 'slate';
7
+ export interface MoveListItemDownOptions {
8
+ list: NodeEntry<TElement>;
9
+ listItem: NodeEntry<TElement>;
10
+ }
11
+ export declare const moveListItemDown: (editor: PlateEditor, { list, listItem }: MoveListItemDownOptions) => void;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Credit: Modified version of Plate's list plugin
3
+ * See: https://github.com/udecode/plate/blob/main/packages/nodes/list
4
+ */
5
+ import { EditorNodesOptions, PlateEditor } from '@udecode/plate-core';
6
+ export declare type MoveListItemsOptions = {
7
+ increase?: boolean;
8
+ at?: EditorNodesOptions['at'];
9
+ };
10
+ export declare const moveListItems: (editor: PlateEditor, { increase, at }?: MoveListItemsOptions) => void;
@@ -0,0 +1,20 @@
1
+ import { Document } from '@contentful/rich-text-types';
2
+ import { CreatePlateEditorOptions } from '@udecode/plate-core';
3
+ import { Descendant, Editor, Node } from 'slate';
4
+ import { RichTextEditor } from 'types';
5
+ /**
6
+ * For legacy reasons, a document may not have any content at all
7
+ * e.g:
8
+ *
9
+ * {nodeType: document, data: {}, content: []}
10
+ *
11
+ * Rendering such document will break the Slate editor
12
+ */
13
+ export declare const hasContent: (doc?: Document | undefined) => boolean;
14
+ export declare const setEditorContent: (editor: Editor, nodes?: Node[] | undefined) => void;
15
+ /**
16
+ * Converts a contenful rich text document to the corresponding slate editor
17
+ * value
18
+ */
19
+ export declare const documentToEditorValue: (doc: any) => any;
20
+ export declare const normalizeEditorValue: (value: Descendant[], options?: Pick<CreatePlateEditorOptions<RichTextEditor>, "plugins" | "disableCorePlugins" | "components" | "overrideByKey"> | undefined) => Descendant[] & any[];
@@ -1,7 +1,8 @@
1
1
  import { Document } from '@contentful/rich-text-types';
2
- import { PlateEditor } from '@udecode/plate-core';
3
2
  export declare type OnValueChangedProps = {
4
- editor: PlateEditor;
3
+ editorId: string;
5
4
  handler?: (value: Document) => unknown;
5
+ skip?: boolean;
6
+ onSkip?: VoidFunction;
6
7
  };
7
- export declare const useOnValueChanged: ({ editor, handler }: OnValueChangedProps) => (value: unknown) => void;
8
+ export declare const useOnValueChanged: ({ editorId, handler, skip, onSkip }: OnValueChangedProps) => (value: unknown) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-rich-text",
3
- "version": "2.0.0-next.20",
3
+ "version": "2.0.0-next.23",
4
4
  "publishConfig": {
5
5
  "tag": "next"
6
6
  },
@@ -35,23 +35,23 @@
35
35
  "@contentful/field-editor-shared": "^1.0.3",
36
36
  "@contentful/rich-text-plain-text-renderer": "^15.11.1",
37
37
  "@contentful/rich-text-types": "^15.11.1",
38
- "@udecode/plate-basic-marks": "^9.2.1",
39
- "@udecode/plate-break": "^9.2.1",
40
- "@udecode/plate-core": "^9.2.1",
41
- "@udecode/plate-list": "^9.2.1",
42
- "@udecode/plate-paragraph": "^9.2.1",
43
- "@udecode/plate-reset-node": "^9.2.1",
44
- "@udecode/plate-select": "^9.2.1",
45
- "@udecode/plate-serializer-docx": "^9.2.1",
46
- "@udecode/plate-table": "^9.2.1",
47
- "@udecode/plate-trailing-block": "^9.2.1",
38
+ "@udecode/plate-basic-marks": "^10.4.0",
39
+ "@udecode/plate-break": "^10.4.0",
40
+ "@udecode/plate-core": "^10.4.0",
41
+ "@udecode/plate-list": "^10.4.0",
42
+ "@udecode/plate-paragraph": "^10.4.0",
43
+ "@udecode/plate-reset-node": "^10.4.0",
44
+ "@udecode/plate-select": "^10.4.0",
45
+ "@udecode/plate-serializer-docx": "^10.4.0",
46
+ "@udecode/plate-table": "^10.4.0",
47
+ "@udecode/plate-trailing-block": "^10.4.0",
48
48
  "fast-deep-equal": "^3.1.3",
49
49
  "is-hotkey": "^0.2.0",
50
50
  "is-plain-obj": "^3.0.0",
51
- "slate": "^0.72.3",
51
+ "slate": "^0.72.8",
52
52
  "slate-history": "^0.66.0",
53
53
  "slate-hyperscript": "^0.67.0",
54
- "slate-react": "^0.72.6"
54
+ "slate-react": "^0.72.9"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "react": ">=16.14.0",
@@ -1,9 +0,0 @@
1
- import { ContentEntityType as EntityType } from '@contentful/field-editor-reference/dist/types';
2
- import { FieldExtensionSDK } from '@contentful/field-editor-shared';
3
- interface EntryAssetTooltipProps {
4
- id: string;
5
- type: EntityType;
6
- sdk: FieldExtensionSDK;
7
- }
8
- export declare function EntryAssetTooltip({ id, type, sdk }: EntryAssetTooltipProps): JSX.Element;
9
- export {};
@@ -1 +0,0 @@
1
- export declare function truncate(str: string, length: number): string;
@@ -1,7 +0,0 @@
1
- import { RichTextPlugin } from './types';
2
- export declare type NormalizedSlateValueProps = {
3
- id: string;
4
- incomingDoc: any;
5
- plugins: RichTextPlugin[];
6
- };
7
- export declare const useNormalizedSlateValue: ({ id, incomingDoc, plugins, }: NormalizedSlateValueProps) => import("slate").Descendant[] & any[];