@contentful/field-editor-rich-text 2.0.0-next.19 → 2.0.0-next.21
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/field-editor-rich-text.cjs.development.js +1058 -971
- package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
- package/dist/field-editor-rich-text.esm.js +1060 -973
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/editor.d.ts +2 -2
- package/dist/plugins/Break/createResetNodePlugin.d.ts +2 -0
- package/dist/plugins/Break/index.d.ts +2 -0
- package/dist/plugins/Hyperlink/components/EntityHyperlink.d.ts +9 -0
- package/dist/plugins/Hyperlink/components/ToolbarHyperlinkButton.d.ts +5 -0
- package/dist/plugins/Hyperlink/components/UrlHyperlink.d.ts +9 -0
- package/dist/plugins/Hyperlink/components/styles.d.ts +4 -0
- package/dist/plugins/Hyperlink/createHyperlinkPlugin.d.ts +3 -0
- package/dist/plugins/Hyperlink/index.d.ts +2 -8
- package/dist/plugins/Hyperlink/useEntityInfo.d.ts +16 -0
- package/dist/plugins/Hyperlink/utils.d.ts +2 -0
- package/dist/plugins/List/transforms/deleteBackwardList.d.ts +2 -0
- package/dist/plugins/List/transforms/unwrapList.d.ts +5 -0
- package/dist/plugins/Quote/shouldResetQuote.d.ts +8 -0
- package/dist/plugins/Quote/toggleQuote.d.ts +2 -2
- package/dist/plugins/Quote/withQuote.d.ts +3 -0
- package/dist/types.d.ts +5 -1
- package/package.json +2 -1
- package/dist/plugins/Hyperlink/EntryAssetTooltip.d.ts +0 -9
- package/dist/plugins/Hyperlink/truncate.d.ts +0 -1
package/dist/helpers/editor.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Link } from '@contentful/field-editor-reference/dist/types';
|
|
2
2
|
import { BLOCKS, INLINES } from '@contentful/rich-text-types';
|
|
3
|
-
import { EditorNodesOptions, ToggleNodeTypeOptions } from '@udecode/plate-core';
|
|
3
|
+
import { EditorNodesOptions, PlateEditor, ToggleNodeTypeOptions } from '@udecode/plate-core';
|
|
4
4
|
import { Path, Node } from 'slate';
|
|
5
5
|
import { CustomElement, RichTextEditor } from '../types';
|
|
6
6
|
export declare const LINK_TYPES: INLINES[];
|
|
7
|
-
export declare function isBlockSelected(editor:
|
|
7
|
+
export declare function isBlockSelected(editor: PlateEditor, type: string): boolean;
|
|
8
8
|
export declare function isRootLevel(path: Path): boolean;
|
|
9
9
|
declare type NodeEntry = [CustomElement, Path];
|
|
10
10
|
declare type NodeType = BLOCKS | INLINES;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export type { SoftBreakRule, ExitBreakRule } from '@udecode/plate-break';
|
|
2
|
+
export type { ResetNodePluginRule } from '@udecode/plate-reset-node';
|
|
2
3
|
export * from './createSoftBreakPlugin';
|
|
3
4
|
export * from './createExitBreakPlugin';
|
|
5
|
+
export * from './createResetNodePlugin';
|
|
@@ -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,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 {};
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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,8 @@
|
|
|
1
|
+
import { PlateEditor } from '@udecode/plate-core';
|
|
2
|
+
/**
|
|
3
|
+
* Returns true if we are:
|
|
4
|
+
* 1) Inside a blockquote
|
|
5
|
+
* 2) With no only one child paragraph/heading and
|
|
6
|
+
* 3) that child is empty
|
|
7
|
+
*/
|
|
8
|
+
export declare const shouldResetQuoteOnBackspace: (editor: PlateEditor) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HotkeyPlugin, KeyboardHandler } from '@udecode/plate-core';
|
|
1
|
+
import { HotkeyPlugin, KeyboardHandler, PlateEditor } from '@udecode/plate-core';
|
|
2
2
|
import { TrackingPluginActions } from '../../plugins/Tracking';
|
|
3
3
|
import { RichTextEditor } from '../../types';
|
|
4
|
-
export declare function toggleQuote(editor:
|
|
4
|
+
export declare function toggleQuote(editor: PlateEditor, logAction?: TrackingPluginActions['onShortcutAction'] | TrackingPluginActions['onToolbarAction']): void;
|
|
5
5
|
export declare const onKeyDownToggleQuote: KeyboardHandler<RichTextEditor, HotkeyPlugin>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MARKS } from '@contentful/rich-text-types';
|
|
2
2
|
import { PlateEditor, PlatePlugin } from '@udecode/plate-core';
|
|
3
3
|
import { RenderElementProps } from 'slate-react';
|
|
4
|
-
import type { SoftBreakRule, ExitBreakRule } from './plugins/Break';
|
|
4
|
+
import type { SoftBreakRule, ExitBreakRule, ResetNodePluginRule } from './plugins/Break';
|
|
5
5
|
import type { NormalizerRule } from './plugins/Normalizer';
|
|
6
6
|
import { TrackingPluginActions } from './plugins/Tracking';
|
|
7
7
|
export declare type CustomText = {
|
|
@@ -36,6 +36,10 @@ export interface RichTextPlugin extends PlatePlugin<RichTextEditor> {
|
|
|
36
36
|
* @see createExitBreakPlugin
|
|
37
37
|
*/
|
|
38
38
|
exitBreak?: ExitBreakRule[];
|
|
39
|
+
/**
|
|
40
|
+
* @see createResetNodePlugin
|
|
41
|
+
*/
|
|
42
|
+
resetNode?: ResetNodePluginRule[];
|
|
39
43
|
/**
|
|
40
44
|
* @see createNormalizerPlugin
|
|
41
45
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-rich-text",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.21",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"tag": "next"
|
|
6
6
|
},
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@udecode/plate-core": "^9.2.1",
|
|
41
41
|
"@udecode/plate-list": "^9.2.1",
|
|
42
42
|
"@udecode/plate-paragraph": "^9.2.1",
|
|
43
|
+
"@udecode/plate-reset-node": "^9.2.1",
|
|
43
44
|
"@udecode/plate-select": "^9.2.1",
|
|
44
45
|
"@udecode/plate-serializer-docx": "^9.2.1",
|
|
45
46
|
"@udecode/plate-table": "^9.2.1",
|
|
@@ -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;
|