@contentful/field-editor-rich-text 3.0.0-next.0 → 3.0.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/CHANGELOG.md +690 -0
- package/LICENSE +21 -0
- package/README.md +25 -3
- package/dist/ContentfulEditorProvider.d.ts +6 -5
- package/dist/RichTextEditor.d.ts +2 -3
- package/dist/SdkProvider.d.ts +1 -1
- package/dist/Toolbar/{EmbedEntityWidget.d.ts → components/EmbedEntityWidget.d.ts} +1 -2
- package/dist/{plugins/EmbeddedEntity/index.d.ts → Toolbar/components/EmbeddedEntityDropdownButton.d.ts} +1 -2
- package/dist/Toolbar/{StickyToolbarWrapper.d.ts → components/StickyToolbarWrapper.d.ts} +0 -0
- package/dist/Toolbar/index.d.ts +0 -1
- package/dist/dialogs/HypelinkDialog/HyperlinkDialog.d.ts +3 -3
- package/dist/dialogs/renderRichTextDialog.d.ts +0 -1
- package/dist/field-editor-rich-text.cjs.development.js +6503 -4337
- 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 +6485 -4319
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/helpers/editor.d.ts +21 -23
- package/dist/helpers/environment.d.ts +2 -1
- package/dist/helpers/extractNodes.d.ts +6 -0
- package/dist/helpers/removeInternalMarks.d.ts +1 -0
- package/dist/helpers/sanitizeIncomingSlateDoc.d.ts +6 -0
- package/dist/helpers/transformers.d.ts +8 -0
- package/dist/helpers/validations.d.ts +1 -1
- package/dist/plugins/Break/createExitBreakPlugin.d.ts +2 -0
- package/dist/plugins/Break/createResetNodePlugin.d.ts +2 -0
- package/dist/plugins/Break/createSoftBreakPlugin.d.ts +2 -0
- package/dist/plugins/Break/index.d.ts +5 -0
- package/dist/plugins/CommandPalette/components/CommandList.d.ts +7 -0
- package/dist/plugins/CommandPalette/components/CommandList.styles.d.ts +13 -0
- package/dist/plugins/CommandPalette/components/CommandPrompt.d.ts +2 -0
- package/dist/plugins/CommandPalette/constants.d.ts +1 -0
- package/dist/plugins/CommandPalette/createCommandPalettePlugin.d.ts +13 -0
- package/dist/plugins/CommandPalette/hooks/useCommandList.d.ts +4 -0
- package/dist/plugins/CommandPalette/index.d.ts +1 -0
- package/dist/plugins/CommandPalette/onKeyDown.d.ts +3 -0
- package/dist/plugins/CommandPalette/useCommands.d.ts +14 -0
- package/dist/plugins/CommandPalette/utils/createInlineEntryNode.d.ts +16 -0
- package/dist/plugins/CommandPalette/utils/fetchAssets.d.ts +8 -0
- package/dist/plugins/CommandPalette/utils/fetchEntries.d.ts +9 -0
- package/dist/plugins/CommandPalette/utils/insertBlock.d.ts +1 -0
- package/dist/plugins/CommandPalette/utils/trimLeadingSlash.d.ts +7 -0
- package/dist/plugins/DragAndDrop/index.d.ts +2 -2
- package/dist/plugins/EmbeddedEntityBlock/LinkedEntityBlock.d.ts +3 -2
- package/dist/plugins/EmbeddedEntityBlock/ToolbarIcon.d.ts +1 -4
- package/dist/plugins/EmbeddedEntityBlock/Util.d.ts +2 -1
- package/dist/plugins/EmbeddedEntityBlock/index.d.ts +3 -9
- package/dist/plugins/EmbeddedEntityInline/FetchingWrappedInlineEntryCard.d.ts +1 -0
- package/dist/plugins/EmbeddedEntityInline/index.d.ts +3 -6
- package/dist/plugins/Heading/components/Heading.d.ts +10 -0
- package/dist/plugins/Heading/components/ToolbarHeadingButton.d.ts +4 -0
- package/dist/plugins/Heading/createHeadingPlugin.d.ts +2 -0
- package/dist/plugins/Heading/index.d.ts +2 -20
- package/dist/plugins/Hr/index.d.ts +3 -5
- package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +6 -6
- 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 -12
- package/dist/plugins/Hyperlink/useEntityInfo.d.ts +16 -0
- package/dist/plugins/Hyperlink/utils.d.ts +5 -0
- package/dist/plugins/List/components/List.d.ts +3 -0
- package/dist/plugins/List/components/ListItem.d.ts +2 -0
- package/dist/plugins/List/components/ToolbarListButton.d.ts +4 -0
- package/dist/plugins/List/createListPlugin.d.ts +2 -0
- package/dist/plugins/List/index.d.ts +2 -15
- package/dist/plugins/List/insertListBreak.d.ts +2 -0
- package/dist/plugins/List/insertListFragment.d.ts +3 -0
- package/dist/plugins/List/onKeyDownList.d.ts +7 -0
- package/dist/plugins/List/transforms/deleteBackwardList.d.ts +2 -0
- package/dist/plugins/List/transforms/insertListItem.d.ts +5 -0
- package/dist/plugins/List/transforms/moveListItemDown.d.ts +11 -0
- package/dist/plugins/List/transforms/moveListItems.d.ts +10 -0
- package/dist/plugins/List/transforms/toggleList.d.ts +4 -0
- package/dist/plugins/List/transforms/unwrapList.d.ts +5 -0
- package/dist/plugins/List/utils.d.ts +15 -0
- package/dist/plugins/List/withList.d.ts +4 -0
- package/dist/plugins/Marks/Bold.d.ts +11 -0
- package/dist/plugins/Marks/Code.d.ts +11 -0
- package/dist/plugins/Marks/Italic.d.ts +11 -0
- package/dist/plugins/Marks/Underline.d.ts +11 -0
- package/dist/plugins/Marks/components/MarkToolbarButton.d.ts +13 -0
- package/dist/plugins/Marks/helpers.d.ts +4 -0
- package/dist/plugins/Marks/index.d.ts +2 -0
- package/dist/plugins/Normalizer/baseRules.d.ts +2 -0
- package/dist/plugins/Normalizer/createNormalizerPlugin.d.ts +2 -0
- package/dist/plugins/Normalizer/index.d.ts +2 -0
- package/dist/plugins/Normalizer/types.d.ts +40 -0
- package/dist/plugins/Normalizer/utils.d.ts +8 -0
- package/dist/plugins/Normalizer/withNormalizer.d.ts +2 -0
- package/dist/plugins/Paragraph/Paragraph.d.ts +2 -0
- package/dist/plugins/Paragraph/createParagraphPlugin.d.ts +2 -0
- package/dist/plugins/Paragraph/index.d.ts +1 -7
- package/dist/plugins/Paragraph/utils.d.ts +2 -0
- package/dist/plugins/PasteHTML/createPasteHTMLPlugin.d.ts +8 -0
- package/dist/plugins/PasteHTML/index.d.ts +1 -0
- package/dist/plugins/PasteHTML/utils/sanitizeHTML.d.ts +1 -0
- package/dist/plugins/PasteHTML/utils/sanitizeSheets.d.ts +4 -0
- package/dist/plugins/Quote/components/Quote.d.ts +2 -0
- package/dist/plugins/Quote/components/ToolbarQuoteButton.d.ts +4 -0
- package/dist/plugins/Quote/createQuotePlugin.d.ts +2 -0
- package/dist/plugins/Quote/index.d.ts +2 -13
- package/dist/plugins/Quote/shouldResetQuote.d.ts +8 -0
- package/dist/plugins/Quote/toggleQuote.d.ts +5 -0
- package/dist/plugins/Quote/withQuote.d.ts +3 -0
- package/dist/plugins/SelectOnBackspace/createSelectOnBackspacePlugin.d.ts +2 -0
- package/dist/plugins/SelectOnBackspace/index.d.ts +1 -0
- package/dist/plugins/Table/actions/addColumn.d.ts +3 -3
- package/dist/plugins/Table/actions/addRow.d.ts +3 -3
- package/dist/plugins/Table/actions/setHeader.d.ts +2 -2
- package/dist/plugins/Table/components/Cell.d.ts +2 -0
- package/dist/plugins/Table/components/HeaderCell.d.ts +2 -0
- package/dist/plugins/Table/components/Row.d.ts +2 -0
- package/dist/plugins/Table/components/Table.d.ts +2 -0
- package/dist/plugins/Table/components/TableActions.d.ts +4 -0
- package/dist/plugins/Table/components/ToolbarButton.d.ts +4 -0
- package/dist/plugins/Table/createTablePlugin.d.ts +2 -0
- package/dist/plugins/Table/helpers.d.ts +16 -4
- package/dist/plugins/Table/index.d.ts +2 -189
- package/dist/plugins/Table/insertTableFragment.d.ts +3 -0
- package/dist/plugins/Table/onKeyDownTable.d.ts +3 -0
- package/dist/plugins/Table/tableTracking.d.ts +4 -0
- package/dist/plugins/Text/createTextPlugin.d.ts +2 -0
- package/dist/plugins/Text/index.d.ts +1 -0
- package/dist/plugins/Tracking/createTrackingPlugin.d.ts +11 -0
- package/dist/plugins/Tracking/index.d.ts +1 -0
- package/dist/plugins/Tracking/utils.d.ts +2 -0
- package/dist/plugins/TrailingParagraph/index.d.ts +2 -1
- package/dist/plugins/Voids/createVoidsPlugin.d.ts +2 -0
- package/dist/plugins/Voids/index.d.ts +1 -0
- package/dist/plugins/Voids/transformVoid.d.ts +6 -0
- package/dist/plugins/index.d.ts +6 -0
- package/dist/plugins/links-tracking.d.ts +6 -0
- package/dist/plugins/shared/FetchingWrappedAssetCard.d.ts +1 -11
- package/dist/plugins/shared/FetchingWrappedEntryCard.d.ts +4 -4
- package/dist/plugins/shared/ToolbarButton.d.ts +0 -1
- package/dist/prepareDocument.d.ts +20 -0
- package/dist/test-utils/assertOutput.d.ts +7 -0
- package/dist/test-utils/createEditor.d.ts +13 -0
- package/dist/test-utils/index.d.ts +4 -0
- package/dist/test-utils/jsx.d.ts +28 -0
- package/dist/test-utils/mockPlugin.d.ts +2 -0
- package/dist/test-utils/randomId.d.ts +4 -0
- package/dist/test-utils/setEmptyDataAttribute.d.ts +6 -0
- package/dist/test-utils/validation.d.ts +1 -0
- package/dist/types.d.ts +34 -9
- package/dist/useOnValueChanged.d.ts +8 -0
- package/package.json +34 -29
- package/dist/TrackingProvider.d.ts +0 -11
- package/dist/helpers/deserializer.d.ts +0 -3
- package/dist/helpers/sanitizeSlateDoc.d.ts +0 -18
- package/dist/helpers/truncate.d.ts +0 -1
- package/dist/plugins/Bold/index.d.ts +0 -12
- package/dist/plugins/Code/index.d.ts +0 -12
- package/dist/plugins/CommandPalette/CommandPanel/InViewport/InViewport.d.ts +0 -37
- package/dist/plugins/Hyperlink/EntryAssetTooltip.d.ts +0 -10
- package/dist/plugins/InsertBeforeFirstVoidBlock/index.d.ts +0 -2
- package/dist/plugins/Italic/index.d.ts +0 -12
- package/dist/plugins/List/getListInsertFragment.d.ts +0 -6
- package/dist/plugins/NewLine/index.d.ts +0 -2
- package/dist/plugins/Paste/index.d.ts +0 -2
- package/dist/plugins/Paste/sanitizers/helpers.d.ts +0 -7
- package/dist/plugins/Paste/sanitizers/index.d.ts +0 -3
- package/dist/plugins/Paste/sanitizers/removeComments.d.ts +0 -2
- package/dist/plugins/Paste/sanitizers/sanitizeEntityBlocks.d.ts +0 -6
- package/dist/plugins/Paste/sanitizers/sanitizeTables.d.ts +0 -2
- package/dist/plugins/Table/TableActions.d.ts +0 -5
- package/dist/plugins/Underline/index.d.ts +0 -12
- package/dist/plugins/shared/EntityStatusIcon.d.ts +0 -8
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Contentful
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,11 +4,33 @@
|
|
|
4
4
|
npm install @contentful/field-editor-rich-text
|
|
5
5
|
```
|
|
6
6
|
|
|
7
|
-
This package contains
|
|
8
|
-
|
|
9
|
-
This editor app is built on top of [Slate](https://github.com/ianstormtaylor/slate), a third party framework for building highly customizable rich text editing solutions.
|
|
7
|
+
This package contains a React `RichTextEditor` component that is used as the default for `RichText` field type in the Contentful web application.
|
|
10
8
|
|
|
11
9
|
```js
|
|
12
10
|
import 'codemirror/lib/codemirror.css';
|
|
13
11
|
import { RichTextEditor } from '@contentful/field-editor-rich-text';
|
|
14
12
|
```
|
|
13
|
+
|
|
14
|
+
## Migrating to v2
|
|
15
|
+
|
|
16
|
+
To bring support for Rich Text Tables we rewrote most of the internals of this package to adapt the latest version of [Slate][slate]. We are releasing this change as v2.0.0.
|
|
17
|
+
|
|
18
|
+
There are two ways our users typically use the rich-text field editor:
|
|
19
|
+
|
|
20
|
+
### 1. By embedding `@contentful/field-editor-rich-text` npm package
|
|
21
|
+
|
|
22
|
+
Since the public API exposed by the package remains the same, upgrading to v2 should be seamless as it's just a matter of installing the latest version from npm. No migration is needed.
|
|
23
|
+
|
|
24
|
+
### 2. By forking the source code
|
|
25
|
+
|
|
26
|
+
You will need to adapt your fork to work with v2. Here is a highlight of the major changes:
|
|
27
|
+
|
|
28
|
+
1. Using Slate >= v0.80.0. If you're upgrading from < 0.50.x Please check the library [migration guide](https://docs.slatejs.org/concepts/xx-migrating)
|
|
29
|
+
2. Using Plate as a plugin system. Plate is a powerful plugin system to make it easy to work with Slate. All of the existing rich text plugins were rewritten to use Plate. To learn more, please check Plate's [website][plate].
|
|
30
|
+
|
|
31
|
+
## Credits
|
|
32
|
+
|
|
33
|
+
This package is based on [Slate][slate] & [Plate][plate] and also borrows some of their code. Without them, this project would not have been possible.
|
|
34
|
+
|
|
35
|
+
[slate]: https://www.slatejs.org/
|
|
36
|
+
[plate]: https://plate.udecode.io/
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
3
|
+
import { RichTextEditor } from './types';
|
|
3
4
|
export declare function getContentfulEditorId(sdk: FieldExtensionSDK): string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export declare
|
|
8
|
-
export
|
|
5
|
+
export declare const editorContext: import("react").Context<string>;
|
|
6
|
+
export declare const ContentfulEditorIdProvider: import("react").Provider<string>;
|
|
7
|
+
export declare function useContentfulEditorId(id?: string): string;
|
|
8
|
+
export declare function useContentfulEditor(id?: string): import("@udecode/plate-core").PlateEditor<RichTextEditor>;
|
|
9
|
+
export declare function useContentfulEditorRef(id?: string): import("@udecode/plate-core").PlateEditor<RichTextEditor>;
|
package/dist/RichTextEditor.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import * as Contentful from '@contentful/rich-text-types';
|
|
3
|
-
import { RichTextTrackingActionHandler } from './TrackingProvider';
|
|
4
1
|
import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
2
|
+
import * as Contentful from '@contentful/rich-text-types';
|
|
3
|
+
import { RichTextTrackingActionHandler } from './plugins/Tracking';
|
|
5
4
|
declare type ConnectedProps = {
|
|
6
5
|
sdk: FieldExtensionSDK;
|
|
7
6
|
onAction?: RichTextTrackingActionHandler;
|
package/dist/SdkProvider.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ import { FieldExtensionSDK } from '@contentful/app-sdk';
|
|
|
3
3
|
interface SdkProviderProps {
|
|
4
4
|
sdk: FieldExtensionSDK;
|
|
5
5
|
}
|
|
6
|
-
export declare const SdkProvider: React.FC<SdkProviderProps>, useSdkContext:
|
|
6
|
+
export declare const SdkProvider: React.FC<SdkProviderProps>, useSdkContext: () => FieldExtensionSDK;
|
|
7
7
|
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export interface EmbedEntityWidgetProps {
|
|
3
2
|
isDisabled?: boolean;
|
|
4
3
|
canInsertBlocks?: boolean;
|
|
5
4
|
}
|
|
6
|
-
export declare const EmbedEntityWidget: ({ isDisabled, canInsertBlocks }: EmbedEntityWidgetProps) => JSX.Element;
|
|
5
|
+
export declare const EmbedEntityWidget: ({ isDisabled, canInsertBlocks }: EmbedEntityWidgetProps) => JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
interface EmbeddedEntityDropdownButtonProps {
|
|
2
|
+
export interface EmbeddedEntityDropdownButtonProps {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
isDisabled: boolean | undefined;
|
|
5
5
|
isOpen: boolean;
|
|
@@ -7,4 +7,3 @@ interface EmbeddedEntityDropdownButtonProps {
|
|
|
7
7
|
onToggle: () => void;
|
|
8
8
|
}
|
|
9
9
|
export declare function EmbeddedEntityDropdownButton({ children, isDisabled, isOpen, onClose, onToggle, }: EmbeddedEntityDropdownButtonProps): JSX.Element;
|
|
10
|
-
export {};
|
|
File without changes
|
package/dist/Toolbar/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export namespace LINK_TYPES {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const URI: string;
|
|
3
|
+
const ENTRY: string;
|
|
4
|
+
const ASSET: string;
|
|
5
5
|
}
|
|
6
6
|
export class HyperlinkDialog extends React.Component<any, any, any> {
|
|
7
7
|
static propTypes: {
|