@contentful/field-editor-rich-text 2.0.3 → 2.1.1

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/field-editor-rich-text.cjs.development.js +1117 -585
  3. package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
  4. package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
  5. package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
  6. package/dist/field-editor-rich-text.esm.js +1097 -565
  7. package/dist/field-editor-rich-text.esm.js.map +1 -1
  8. package/dist/helpers/removeInternalMarks.d.ts +1 -0
  9. package/dist/plugins/CommandPalette/components/CommandList.d.ts +6 -0
  10. package/dist/plugins/CommandPalette/components/CommandList.styles.d.ts +13 -0
  11. package/dist/plugins/CommandPalette/components/CommandPrompt.d.ts +2 -0
  12. package/dist/plugins/CommandPalette/constants.d.ts +1 -0
  13. package/dist/plugins/CommandPalette/createCommandPalettePlugin.d.ts +13 -0
  14. package/dist/plugins/CommandPalette/hooks/useCommandList.d.ts +3 -0
  15. package/dist/plugins/CommandPalette/index.d.ts +1 -0
  16. package/dist/plugins/CommandPalette/onKeyDown.d.ts +3 -0
  17. package/dist/plugins/CommandPalette/useCommands.d.ts +14 -0
  18. package/dist/plugins/CommandPalette/utils/createInlineEntryNode.d.ts +16 -0
  19. package/dist/plugins/CommandPalette/utils/fetchAssets.d.ts +8 -0
  20. package/dist/plugins/CommandPalette/utils/fetchEntries.d.ts +9 -0
  21. package/dist/plugins/CommandPalette/utils/insertBlock.d.ts +1 -0
  22. package/dist/plugins/CommandPalette/utils/trimLeadingSlash.d.ts +7 -0
  23. package/package.json +3 -3
  24. package/dist/plugins/SlashCommands/SlashCommandsPalette.d.ts +0 -5
  25. package/dist/plugins/SlashCommands/createSlashCommandsPlugin.d.ts +0 -2
  26. package/dist/plugins/SlashCommands/helpers.d.ts +0 -6
  27. package/dist/plugins/SlashCommands/index.d.ts +0 -2
@@ -0,0 +1 @@
1
+ export declare const removeInternalMarks: (document: Record<string, unknown>) => any;
@@ -0,0 +1,6 @@
1
+ import { PlateEditor } from '@udecode/plate-core';
2
+ export interface CommandListProps {
3
+ query: string;
4
+ editor: PlateEditor;
5
+ }
6
+ export declare const CommandList: ({ query, editor }: CommandListProps) => JSX.Element | null;
@@ -0,0 +1,13 @@
1
+ declare const styles: {
2
+ container: string;
3
+ menuContent: string;
4
+ menuList: string;
5
+ menuItem: string;
6
+ menuItemSelected: string;
7
+ menuDivider: string;
8
+ menuHeader: string;
9
+ menuFooter: string;
10
+ footerList: string;
11
+ thumbnail: string;
12
+ };
13
+ export default styles;
@@ -0,0 +1,2 @@
1
+ import { PlateRenderLeafProps } from '@udecode/plate-core';
2
+ export declare const CommandPrompt: (props: PlateRenderLeafProps) => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const COMMAND_PROMPT = "command-prompt";
@@ -0,0 +1,13 @@
1
+ import { RichTextPlugin } from '../../types';
2
+ /**
3
+ * A command palette plugin (aka slash commands)
4
+ *
5
+ * How does it work?
6
+ * * When the user presses the slash key, the editor will show a command palette
7
+ * * When the user presses a key, the command palette will show the command suggestions
8
+ * * When the user presses enter, the command palette will execute the command
9
+ * * When the user presses escape, the command palette will hide
10
+ * * When the user presses a letter, number, or space, the command palette will show the command suggestions
11
+ * * When the user presses backspace, the command palette will remove the last character from the command string
12
+ */
13
+ export declare const createCommandPalettePlugin: () => RichTextPlugin;
@@ -0,0 +1,3 @@
1
+ export declare const useCommandList: (commandItems: any, container: any) => {
2
+ selectedItem: string;
3
+ };
@@ -0,0 +1 @@
1
+ export { createCommandPalettePlugin } from './createCommandPalettePlugin';
@@ -0,0 +1,3 @@
1
+ import { KeyboardHandler } from '@udecode/plate-core';
2
+ import { RichTextEditor } from '../../types';
3
+ export declare const createOnKeyDown: () => KeyboardHandler<RichTextEditor>;
@@ -0,0 +1,14 @@
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ import { PlateEditor } from '@udecode/plate-core';
3
+ export interface Command {
4
+ id: string;
5
+ thumbnail?: string;
6
+ label: string;
7
+ callback?: () => void;
8
+ }
9
+ export interface CommandGroup {
10
+ group: string;
11
+ commands: Command[];
12
+ }
13
+ export declare type CommandList = (Command | CommandGroup)[];
14
+ export declare const useCommands: (sdk: FieldExtensionSDK, query: string, editor: PlateEditor) => CommandList;
@@ -0,0 +1,16 @@
1
+ import { INLINES } from '@contentful/rich-text-types';
2
+ export declare function createInlineEntryNode(id: string): {
3
+ type: INLINES;
4
+ children: {
5
+ text: string;
6
+ }[];
7
+ data: {
8
+ target: {
9
+ sys: {
10
+ id: string;
11
+ type: string;
12
+ linkType: string;
13
+ };
14
+ };
15
+ };
16
+ };
@@ -0,0 +1,8 @@
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ export declare function fetchAssets(sdk: FieldExtensionSDK, query: string): Promise<{
3
+ contentTypeName: string;
4
+ displayTitle: string;
5
+ id: string;
6
+ entity: import("@contentful/app-sdk").Asset;
7
+ thumbnail: string;
8
+ }[]>;
@@ -0,0 +1,9 @@
1
+ import { FieldExtensionSDK } from '@contentful/app-sdk';
2
+ import { ContentTypeProps } from 'contentful-management/types';
3
+ export declare function fetchEntries(sdk: FieldExtensionSDK, contentType: ContentTypeProps, query: string): Promise<{
4
+ contentTypeName: string;
5
+ displayTitle: string;
6
+ id: string;
7
+ description: string;
8
+ entry: import("@contentful/app-sdk").Entry<unknown>;
9
+ }[]>;
@@ -0,0 +1 @@
1
+ export declare function insertBlock(editor: any, nodeType: any, entity: any): void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Trim leading slash character if found. Bails otherwise.
3
+ *
4
+ * @example
5
+ * trimLeadingSlash("/my query") // --> "my query"
6
+ */
7
+ export declare function trimLeadingSlash(text: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-rich-text",
3
- "version": "2.0.3",
3
+ "version": "2.1.1",
4
4
  "source": "./src/index.tsx",
5
5
  "main": "./dist/index.js",
6
6
  "module": "dist/field-editor-rich-text.esm.js",
@@ -29,7 +29,7 @@
29
29
  "@contentful/f36-components": "^4.0.33",
30
30
  "@contentful/f36-icons": "^4.1.1",
31
31
  "@contentful/f36-tokens": "^4.0.0",
32
- "@contentful/field-editor-reference": "^4.3.10",
32
+ "@contentful/field-editor-reference": "^4.3.11",
33
33
  "@contentful/field-editor-shared": "^1.1.3",
34
34
  "@contentful/rich-text-plain-text-renderer": "^15.12.1",
35
35
  "@contentful/rich-text-types": "^15.12.1",
@@ -70,5 +70,5 @@
70
70
  "@udecode/plate-test-utils": "^3.2.0",
71
71
  "react": ">=16.14.0"
72
72
  },
73
- "gitHead": "bcef64253dbfe924784dcf5aa22ccc6aec988890"
73
+ "gitHead": "1a0de55209f3ea05919a154eab948865653dfa9d"
74
74
  }
@@ -1,5 +0,0 @@
1
- interface SlashCommandsPaletteProps {
2
- editorId: string;
3
- }
4
- export declare function SlashCommandsPalette({ editorId }: SlashCommandsPaletteProps): JSX.Element | null;
5
- export {};
@@ -1,2 +0,0 @@
1
- import { RichTextPlugin } from '../../types';
2
- export declare function createSlashCommandsPlugin(): RichTextPlugin;
@@ -1,6 +0,0 @@
1
- export declare function getCaretTopPoint(): {
2
- left: any;
3
- top: any;
4
- } | undefined;
5
- export declare function closePanel(editorId: string): void;
6
- export declare function openPanel(editorId: string): void;
@@ -1,2 +0,0 @@
1
- export * from './createSlashCommandsPlugin';
2
- export * from './SlashCommandsPalette';