@crashbytes/contentful-richtext-editor 1.0.8 → 1.0.9
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/README.md +433 -204
- package/dist/components/ContentfulEditor.d.ts +8 -3
- package/dist/components/ContentfulEmbedded.d.ts +12 -0
- package/dist/components/Toolbar.d.ts +2 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.esm.js +410 -79
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +415 -77
- package/dist/index.js.map +1 -1
- package/dist/utils/configParser.d.ts +37 -0
- package/dist/utils/contentfulTransform.d.ts +20 -0
- package/dist/utils/types.d.ts +113 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Document } from '@contentful/rich-text-types';
|
|
3
|
+
import type { ContentfulFieldConfiguration } from '../utils/configParser';
|
|
3
4
|
import '../styles/editor.css';
|
|
4
5
|
export interface ContentfulRichTextEditorProps {
|
|
5
6
|
/** Initial Contentful rich text document */
|
|
@@ -10,19 +11,23 @@ export interface ContentfulRichTextEditorProps {
|
|
|
10
11
|
onEmbedEntry?: () => Promise<any> | void;
|
|
11
12
|
/** Callback for handling embedded assets */
|
|
12
13
|
onEmbedAsset?: () => Promise<any> | void;
|
|
14
|
+
/** Callback for handling inline entries */
|
|
15
|
+
onEmbedInlineEntry?: () => Promise<any> | void;
|
|
13
16
|
/** Custom CSS classes */
|
|
14
17
|
className?: string;
|
|
15
18
|
/** Whether the editor is read-only */
|
|
16
19
|
readonly?: boolean;
|
|
17
20
|
/** Placeholder text */
|
|
18
21
|
placeholder?: string;
|
|
19
|
-
/**
|
|
22
|
+
/** Contentful field configuration - takes precedence over manual settings */
|
|
23
|
+
fieldConfiguration?: ContentfulFieldConfiguration;
|
|
24
|
+
/** Manual disable features (fallback if no fieldConfiguration provided) */
|
|
20
25
|
disabledFeatures?: Array<'bold' | 'italic' | 'underline' | 'link' | 'lists' | 'headings' | 'quote' | 'table' | 'embed'>;
|
|
21
26
|
/** Custom styling options */
|
|
22
27
|
theme?: 'default' | 'minimal' | 'contentful';
|
|
23
|
-
/**
|
|
28
|
+
/** Manual heading levels (fallback if no fieldConfiguration provided) */
|
|
24
29
|
availableHeadings?: Array<1 | 2 | 3 | 4 | 5 | 6>;
|
|
25
|
-
/**
|
|
30
|
+
/** Manual text marks (fallback if no fieldConfiguration provided) */
|
|
26
31
|
availableMarks?: Array<'bold' | 'italic' | 'underline'>;
|
|
27
32
|
}
|
|
28
33
|
export declare const ContentfulRichTextEditor: React.FC<ContentfulRichTextEditorProps>;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
1
|
import { Node } from '@tiptap/core';
|
|
2
2
|
export declare const EmbeddedEntry: Node<any, any>;
|
|
3
|
+
export declare const InlineEmbeddedEntry: Node<any, any>;
|
|
3
4
|
export declare const EmbeddedAsset: Node<any, any>;
|
|
5
|
+
export declare const createEmbeddedEntryFromContentful: (entry: any) => {
|
|
6
|
+
entryId: any;
|
|
7
|
+
contentType: any;
|
|
8
|
+
title: any;
|
|
9
|
+
};
|
|
10
|
+
export declare const createEmbeddedAssetFromContentful: (asset: any) => {
|
|
11
|
+
assetId: any;
|
|
12
|
+
title: any;
|
|
13
|
+
url: any;
|
|
14
|
+
mimeType: any;
|
|
15
|
+
};
|
|
@@ -4,9 +4,11 @@ interface ToolbarProps {
|
|
|
4
4
|
editor: Editor;
|
|
5
5
|
onEmbedEntry?: () => void;
|
|
6
6
|
onEmbedAsset?: () => void;
|
|
7
|
+
onEmbedInlineEntry?: () => void;
|
|
7
8
|
disabledFeatures?: Array<string>;
|
|
8
9
|
availableHeadings?: Array<1 | 2 | 3 | 4 | 5 | 6>;
|
|
9
10
|
availableMarks?: Array<'bold' | 'italic' | 'underline'>;
|
|
11
|
+
allowHyperlinks?: boolean;
|
|
10
12
|
}
|
|
11
13
|
export declare const ContentfulToolbar: React.FC<ToolbarProps>;
|
|
12
14
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export { ContentfulRichTextEditor } from './components/ContentfulEditor';
|
|
2
2
|
export type { ContentfulRichTextEditorProps } from './components/ContentfulEditor';
|
|
3
3
|
export { ContentfulToolbar } from './components/Toolbar';
|
|
4
|
-
export { contentfulToTiptap, tiptapToContentful, validateContentfulDocument, createEmptyDocument } from './utils/contentfulTransform';
|
|
5
|
-
export
|
|
4
|
+
export { contentfulToTiptap, tiptapToContentful, validateContentfulDocument, createEmptyDocument, sanitizeContentfulDocument, extractPlainText, countWords, findEmbeddedContent } from './utils/contentfulTransform';
|
|
5
|
+
export { parseContentfulFieldConfig, fetchContentfulFieldConfig, createMockFieldConfig, } from './utils/configParser';
|
|
6
|
+
export type { ContentfulEditorTheme, EmbeddedEntry, EmbeddedAsset, ContentfulFieldValidation, ContentfulFieldConfiguration, ParsedEditorConfig, EditorFeatureConfig, ContentfulNode, ContentfulText, ContentfulDocument, TiptapNode, TiptapDocument, EditorState, OnChangeCallback, OnEmbedCallback, ThemeConfig, ValidationRule, FieldValidationConfig, LocalizationConfig, A11yConfig, AdvancedEditorConfig, PluginConfig, DeepPartial, RequiredFields, OptionalFields, } from './utils/types';
|
|
7
|
+
export type { Document, Block, Inline, Text } from '@contentful/rich-text-types';
|
|
8
|
+
export { BLOCKS, MARKS, INLINES } from '@contentful/rich-text-types';
|