@atlaskit/editor-core 184.0.4 → 185.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 +38 -0
- package/dist/cjs/create-editor/feature-flags-from-props.js +1 -2
- package/dist/cjs/editor-next/index.js +41 -34
- package/dist/cjs/editor.js +30 -269
- package/dist/cjs/i18n/en_ZZ.js +32 -6
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/labs/next/presets/default.js +2 -1
- package/dist/cjs/plugins/base/index.js +0 -12
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +7 -0
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +7 -0
- package/dist/cjs/plugins/card/nodeviews/inlineCard.js +5 -1
- package/dist/cjs/plugins/card/pm-plugins/doc.js +1 -2
- package/dist/cjs/plugins/card/toolbar.js +11 -9
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +4 -4
- package/dist/cjs/plugins/code-block/index.js +7 -5
- package/dist/cjs/plugins/code-block/toolbar.js +5 -5
- package/dist/cjs/plugins/copy-button/commands.js +2 -3
- package/dist/cjs/plugins/copy-button/toolbar.js +7 -8
- package/dist/cjs/plugins/expand/index.js +1 -1
- package/dist/cjs/plugins/expand/toolbar.js +40 -39
- package/dist/cjs/plugins/extension/index.js +1 -1
- package/dist/cjs/plugins/extension/toolbar.js +5 -5
- package/dist/cjs/plugins/floating-toolbar/index.js +3 -2
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -4
- package/dist/cjs/plugins/layout/index.js +8 -4
- package/dist/cjs/plugins/layout/toolbar.js +5 -6
- package/dist/cjs/plugins/media/toolbar/index.js +31 -24
- package/dist/cjs/plugins/panel/index.js +2 -1
- package/dist/cjs/plugins/panel/toolbar.js +7 -7
- package/dist/cjs/plugins/placeholder-text/index.js +7 -5
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
- package/dist/cjs/ui/CollapsedEditor/index.js +1 -2
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/feature-flags-from-props.js +1 -2
- package/dist/es2019/editor-next/index.js +39 -30
- package/dist/es2019/editor.js +29 -232
- package/dist/es2019/i18n/en_ZZ.js +32 -6
- package/dist/es2019/index.js +1 -2
- package/dist/es2019/labs/next/presets/default.js +2 -1
- package/dist/es2019/plugins/base/index.js +0 -7
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +8 -0
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +8 -0
- package/dist/es2019/plugins/card/nodeviews/inlineCard.js +5 -1
- package/dist/es2019/plugins/card/pm-plugins/doc.js +1 -2
- package/dist/es2019/plugins/card/toolbar.js +8 -6
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +2 -2
- package/dist/es2019/plugins/code-block/index.js +7 -5
- package/dist/es2019/plugins/code-block/toolbar.js +5 -6
- package/dist/es2019/plugins/copy-button/commands.js +2 -3
- package/dist/es2019/plugins/copy-button/toolbar.js +7 -8
- package/dist/es2019/plugins/expand/index.js +1 -1
- package/dist/es2019/plugins/expand/toolbar.js +5 -6
- package/dist/es2019/plugins/extension/index.js +1 -1
- package/dist/es2019/plugins/extension/toolbar.js +5 -6
- package/dist/es2019/plugins/floating-toolbar/index.js +3 -2
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +2 -4
- package/dist/es2019/plugins/layout/index.js +8 -5
- package/dist/es2019/plugins/layout/toolbar.js +5 -6
- package/dist/es2019/plugins/media/toolbar/index.js +35 -24
- package/dist/es2019/plugins/panel/index.js +2 -2
- package/dist/es2019/plugins/panel/toolbar.js +7 -8
- package/dist/es2019/plugins/placeholder-text/index.js +7 -5
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +21 -0
- package/dist/es2019/ui/CollapsedEditor/index.js +1 -2
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/feature-flags-from-props.js +1 -2
- package/dist/esm/editor-next/index.js +42 -33
- package/dist/esm/editor.js +29 -270
- package/dist/esm/i18n/en_ZZ.js +32 -6
- package/dist/esm/index.js +1 -2
- package/dist/esm/labs/next/presets/default.js +2 -1
- package/dist/esm/plugins/base/index.js +0 -9
- package/dist/esm/plugins/card/nodeviews/blockCard.js +7 -0
- package/dist/esm/plugins/card/nodeviews/embedCard.js +7 -0
- package/dist/esm/plugins/card/nodeviews/inlineCard.js +5 -1
- package/dist/esm/plugins/card/pm-plugins/doc.js +1 -2
- package/dist/esm/plugins/card/toolbar.js +7 -6
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +2 -2
- package/dist/esm/plugins/code-block/index.js +7 -5
- package/dist/esm/plugins/code-block/toolbar.js +5 -5
- package/dist/esm/plugins/copy-button/commands.js +2 -3
- package/dist/esm/plugins/copy-button/toolbar.js +7 -8
- package/dist/esm/plugins/expand/index.js +1 -1
- package/dist/esm/plugins/expand/toolbar.js +40 -39
- package/dist/esm/plugins/extension/index.js +1 -1
- package/dist/esm/plugins/extension/toolbar.js +5 -5
- package/dist/esm/plugins/floating-toolbar/index.js +3 -2
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +2 -4
- package/dist/esm/plugins/layout/index.js +8 -4
- package/dist/esm/plugins/layout/toolbar.js +5 -6
- package/dist/esm/plugins/media/toolbar/index.js +31 -24
- package/dist/esm/plugins/panel/index.js +2 -1
- package/dist/esm/plugins/panel/toolbar.js +7 -7
- package/dist/esm/plugins/placeholder-text/index.js +7 -5
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
- package/dist/esm/ui/CollapsedEditor/index.js +1 -2
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/editor-next/index.d.ts +0 -6
- package/dist/types/editor.d.ts +1 -137
- package/dist/types/i18n/en_ZZ.d.ts +28 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/labs/next/presets/cxhtml.d.ts +106 -0
- package/dist/types/labs/next/presets/default.d.ts +212 -0
- package/dist/types/labs/next/presets/mobile.d.ts +106 -0
- package/dist/types/plugins/base/index.d.ts +0 -4
- package/dist/types/plugins/card/index.d.ts +2 -2
- package/dist/types/plugins/card/nodeviews/blockCard.d.ts +3 -0
- package/dist/types/plugins/card/nodeviews/embedCard.d.ts +3 -0
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/main.d.ts +1 -2
- package/dist/types/plugins/card/toolbar.d.ts +1 -2
- package/dist/types/plugins/card/types.d.ts +1 -1
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
- package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
- package/dist/types/plugins/card/ui/types.d.ts +1 -1
- package/dist/types/plugins/code-block/index.d.ts +7 -1
- package/dist/types/plugins/code-block/toolbar.d.ts +2 -1
- package/dist/types/plugins/copy-button/commands.d.ts +2 -1
- package/dist/types/plugins/copy-button/toolbar.d.ts +3 -2
- package/dist/types/plugins/expand/index.d.ts +2 -1
- package/dist/types/plugins/expand/toolbar.d.ts +2 -1
- package/dist/types/plugins/extension/index.d.ts +7 -2
- package/dist/types/plugins/extension/toolbar.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/index.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
- package/dist/types/plugins/layout/index.d.ts +7 -1
- package/dist/types/plugins/layout/toolbar.d.ts +2 -1
- package/dist/types/plugins/media/index.d.ts +3 -1
- package/dist/types/plugins/panel/index.d.ts +2 -0
- package/dist/types/plugins/panel/toolbar.d.ts +3 -2
- package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
- package/dist/types/ui/CollapsedEditor/index.d.ts +1 -2
- package/dist/types-ts4.5/editor-next/index.d.ts +0 -6
- package/dist/types-ts4.5/editor.d.ts +1 -137
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +28 -2
- package/dist/types-ts4.5/index.d.ts +0 -1
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +122 -0
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +244 -0
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +122 -0
- package/dist/types-ts4.5/plugins/base/index.d.ts +0 -4
- package/dist/types-ts4.5/plugins/card/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +3 -0
- package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +3 -0
- package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +1 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +1 -2
- package/dist/types-ts4.5/plugins/card/toolbar.d.ts +1 -2
- package/dist/types-ts4.5/plugins/card/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
- package/dist/types-ts4.5/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/code-block/index.d.ts +7 -1
- package/dist/types-ts4.5/plugins/code-block/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/copy-button/commands.d.ts +2 -1
- package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +3 -2
- package/dist/types-ts4.5/plugins/expand/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/expand/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
- package/dist/types-ts4.5/plugins/layout/index.d.ts +7 -1
- package/dist/types-ts4.5/plugins/layout/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/panel/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +3 -2
- package/dist/types-ts4.5/plugins/placeholder-text/index.d.ts +5 -1
- package/dist/types-ts4.5/ui/CollapsedEditor/index.d.ts +1 -2
- package/package.json +13 -8
- package/report.api.md +5 -93
- package/dist/cjs/editor-next/editor-migration-component.js +0 -54
- package/dist/cjs/plugins/base/pm-plugins/decoration.js +0 -122
- package/dist/es2019/editor-next/editor-migration-component.js +0 -30
- package/dist/es2019/plugins/base/pm-plugins/decoration.js +0 -111
- package/dist/esm/editor-next/editor-migration-component.js +0 -47
- package/dist/esm/plugins/base/pm-plugins/decoration.js +0 -113
- package/dist/types/editor-next/editor-migration-component.d.ts +0 -6
- package/dist/types/plugins/base/pm-plugins/decoration.d.ts +0 -24
- package/dist/types-ts4.5/editor-next/editor-migration-component.d.ts +0 -6
- package/dist/types-ts4.5/plugins/base/pm-plugins/decoration.d.ts +0 -24
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Command, CommandDispatch } from '../../types';
|
|
2
2
|
import { MarkType, NodeType } from 'prosemirror-model';
|
|
3
3
|
import { EditorState } from 'prosemirror-state';
|
|
4
|
+
import { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
4
5
|
export declare function createToolbarCopyCommandForMark(markType: MarkType): Command;
|
|
5
6
|
export declare function getProvideMarkVisualFeedbackForCopyButtonCommand(markType: MarkType): (state: EditorState, dispatch: CommandDispatch | undefined) => boolean;
|
|
6
7
|
export declare function removeMarkVisualFeedbackForCopyButtonCommand(state: EditorState, dispatch: CommandDispatch | undefined): boolean;
|
|
7
8
|
export declare const createToolbarCopyCommandForNode: (nodeType: NodeType | Array<NodeType>) => Command;
|
|
8
|
-
export declare const resetCopiedState: (nodeType: NodeType | Array<NodeType>, onMouseLeave?: Command) => Command;
|
|
9
|
+
export declare const resetCopiedState: (nodeType: NodeType | Array<NodeType>, hoverDecoration: HoverDecorationHandler | undefined, onMouseLeave?: Command) => Command;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { EditorState } from 'prosemirror-state';
|
|
2
2
|
import { Command } from '../../../src/types';
|
|
3
3
|
import { FloatingToolbarButton, FloatingToolbarItem, MarkOptions, NodeOptions } from '../floating-toolbar/types';
|
|
4
|
-
|
|
4
|
+
import { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
5
|
+
export declare function getCopyButtonConfig(options: MarkOptions | NodeOptions, hoverDecoration: HoverDecorationHandler | undefined): FloatingToolbarButton<Command>;
|
|
5
6
|
export declare const showCopyButton: (state?: EditorState) => import("prosemirror-state").Plugin<any, any> | undefined;
|
|
6
7
|
/**
|
|
7
8
|
* Process floatingToolbar items for copyButton
|
|
@@ -9,4 +10,4 @@ export declare const showCopyButton: (state?: EditorState) => import("prosemirro
|
|
|
9
10
|
* If copy button plugin not enabled, remove copy button item from toolbar items
|
|
10
11
|
* else process copy button to standard floatingtoobarbutton
|
|
11
12
|
*/
|
|
12
|
-
export declare function processCopyButtonItems(state: EditorState): (items: Array<FloatingToolbarItem<Command
|
|
13
|
+
export declare function processCopyButtonItems(state: EditorState): (items: Array<FloatingToolbarItem<Command>>, hoverDecoration: HoverDecorationHandler | undefined) => Array<FloatingToolbarItem<Command>>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NextEditorPlugin, EditorProps } from '../../types';
|
|
2
2
|
import { LongPressSelectionPluginOptions } from '../selection/types';
|
|
3
3
|
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
4
|
+
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
4
5
|
interface ExpandPluginOptions extends LongPressSelectionPluginOptions {
|
|
5
6
|
allowInsertion?: boolean;
|
|
6
7
|
appearance?: EditorProps['appearance'];
|
|
@@ -8,7 +9,8 @@ interface ExpandPluginOptions extends LongPressSelectionPluginOptions {
|
|
|
8
9
|
declare const expandPlugin: NextEditorPlugin<'expand', {
|
|
9
10
|
pluginConfiguration: ExpandPluginOptions | undefined;
|
|
10
11
|
dependencies: [
|
|
11
|
-
typeof featureFlagsPlugin
|
|
12
|
+
typeof featureFlagsPlugin,
|
|
13
|
+
typeof decorationsPlugin
|
|
12
14
|
];
|
|
13
15
|
}>;
|
|
14
16
|
interface ExpandEditorProps {
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { FloatingToolbarHandler } from '../floating-toolbar/types';
|
|
2
|
-
|
|
2
|
+
import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
3
|
+
export declare const getToolbarConfig: (hoverDecoration: HoverDecorationHandler | undefined) => FloatingToolbarHandler;
|
|
@@ -2,7 +2,8 @@ import { ExtensionHandlers } from '@atlaskit/editor-common/extensions';
|
|
|
2
2
|
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
3
3
|
import { NextEditorPlugin, EditorAppearance } from '../../types';
|
|
4
4
|
import { LongPressSelectionPluginOptions } from '../selection/types';
|
|
5
|
-
import { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
5
|
+
import type { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
6
|
+
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
6
7
|
interface ExtensionPluginOptions extends LongPressSelectionPluginOptions {
|
|
7
8
|
allowAutoSave?: boolean;
|
|
8
9
|
breakoutEnabled?: boolean;
|
|
@@ -13,7 +14,8 @@ declare const extensionPlugin: NextEditorPlugin<'extension', {
|
|
|
13
14
|
pluginConfiguration: ExtensionPluginOptions | undefined;
|
|
14
15
|
dependencies: [
|
|
15
16
|
typeof featureFlagsPlugin,
|
|
16
|
-
typeof widthPlugin
|
|
17
|
+
typeof widthPlugin,
|
|
18
|
+
typeof decorationsPlugin
|
|
17
19
|
];
|
|
18
20
|
}>;
|
|
19
21
|
export default extensionPlugin;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FloatingToolbarHandler } from '../floating-toolbar/types';
|
|
2
|
+
import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
2
3
|
export declare const messages: {
|
|
3
4
|
edit: {
|
|
4
5
|
id: string;
|
|
@@ -31,4 +32,4 @@ export declare const messages: {
|
|
|
31
32
|
description: string;
|
|
32
33
|
};
|
|
33
34
|
};
|
|
34
|
-
export declare const getToolbarConfig: (breakoutEnabled
|
|
35
|
+
export declare const getToolbarConfig: (breakoutEnabled: boolean | undefined, hoverDecoration: HoverDecorationHandler | undefined) => FloatingToolbarHandler;
|
|
@@ -3,6 +3,7 @@ import { Node } from 'prosemirror-model';
|
|
|
3
3
|
import { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { FloatingToolbarConfig } from './types';
|
|
5
5
|
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
6
|
+
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
6
7
|
export type FloatingToolbarPluginState = Record<'getConfigWithNodeInfo', (state: EditorState) => ConfigWithNodeInfo | null | undefined>;
|
|
7
8
|
export type ConfigWithNodeInfo = {
|
|
8
9
|
config: FloatingToolbarConfig | undefined;
|
|
@@ -12,7 +13,8 @@ export type ConfigWithNodeInfo = {
|
|
|
12
13
|
export declare const getRelevantConfig: (selection: Selection<any>, configs: Array<FloatingToolbarConfig>) => ConfigWithNodeInfo | undefined;
|
|
13
14
|
declare const floatingToolbarPlugin: NextEditorPlugin<'floatingToolbar', {
|
|
14
15
|
dependencies: [
|
|
15
|
-
typeof featureFlagsPlugin
|
|
16
|
+
typeof featureFlagsPlugin,
|
|
17
|
+
typeof decorationsPlugin
|
|
16
18
|
];
|
|
17
19
|
}>;
|
|
18
20
|
export default floatingToolbarPlugin;
|
|
@@ -7,7 +7,8 @@ import { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
|
7
7
|
import { DispatchAnalyticsEvent } from '../../analytics';
|
|
8
8
|
import { FloatingToolbarItem } from '../types';
|
|
9
9
|
import { WrappedComponentProps } from 'react-intl-next';
|
|
10
|
-
import { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
10
|
+
import { FeatureFlags, PluginInjectionAPIWithDependency } from '@atlaskit/editor-common/types';
|
|
11
|
+
import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
11
12
|
export type Item = FloatingToolbarItem<Function>;
|
|
12
13
|
export interface Props {
|
|
13
14
|
items: Array<Item>;
|
|
@@ -25,6 +26,7 @@ export interface Props {
|
|
|
25
26
|
extensionsProvider?: ExtensionProvider;
|
|
26
27
|
scrollable?: boolean;
|
|
27
28
|
featureFlags: FeatureFlags;
|
|
29
|
+
api: PluginInjectionAPIWithDependency<typeof decorationsPlugin> | undefined;
|
|
28
30
|
}
|
|
29
31
|
export declare const isSameItem: (leftItem: Item, rightItem: Item) => boolean;
|
|
30
32
|
export declare const areSameItems: (leftArr?: Array<Item>, rightArr?: Array<Item>) => boolean;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
3
3
|
import { LayoutPluginOptions } from './types';
|
|
4
|
+
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
5
|
+
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
6
|
export { pluginKey };
|
|
5
7
|
declare const layoutPlugin: NextEditorPlugin<'layout', {
|
|
6
8
|
pluginConfiguration: LayoutPluginOptions | undefined;
|
|
9
|
+
dependencies: [
|
|
10
|
+
typeof decorationsPlugin,
|
|
11
|
+
OptionalPlugin<typeof analyticsPlugin>
|
|
12
|
+
];
|
|
7
13
|
}>;
|
|
8
14
|
export default layoutPlugin;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IntlShape } from 'react-intl-next';
|
|
2
2
|
import { EditorState } from 'prosemirror-state';
|
|
3
3
|
import { FloatingToolbarConfig } from '../../plugins/floating-toolbar/types';
|
|
4
|
+
import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
4
5
|
export declare const layoutToolbarTitle = "Layout floating controls";
|
|
5
|
-
export declare const buildToolbar: (state: EditorState, intl: IntlShape, pos: number, _allowBreakout: boolean, addSidebarLayouts: boolean, allowSingleColumnLayout: boolean) => FloatingToolbarConfig | undefined;
|
|
6
|
+
export declare const buildToolbar: (state: EditorState, intl: IntlShape, pos: number, _allowBreakout: boolean, addSidebarLayouts: boolean, allowSingleColumnLayout: boolean, hoverDecoration: HoverDecorationHandler | undefined) => FloatingToolbarConfig | undefined;
|
|
@@ -7,6 +7,7 @@ import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
7
7
|
import type featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
|
|
8
8
|
import type { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
9
9
|
import type { widthPlugin } from '@atlaskit/editor-plugin-width';
|
|
10
|
+
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
10
11
|
import { MediaPluginState } from './pm-plugins/types';
|
|
11
12
|
export type { MediaState, MediaProvider, CustomMediaPicker };
|
|
12
13
|
export { insertMediaSingleNode } from './utils/media-single';
|
|
@@ -16,7 +17,8 @@ declare const mediaPlugin: NextEditorPlugin<'media', {
|
|
|
16
17
|
typeof featureFlagsPlugin,
|
|
17
18
|
OptionalPlugin<typeof analyticsPlugin>,
|
|
18
19
|
typeof gridPlugin,
|
|
19
|
-
typeof widthPlugin
|
|
20
|
+
typeof widthPlugin,
|
|
21
|
+
typeof decorationsPlugin
|
|
20
22
|
];
|
|
21
23
|
sharedState: MediaPluginState | null;
|
|
22
24
|
}>;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { PanelPluginOptions } from './types';
|
|
3
|
+
import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
3
4
|
declare const panelPlugin: NextEditorPlugin<'panel', {
|
|
4
5
|
pluginConfiguration: PanelPluginOptions | undefined;
|
|
6
|
+
dependencies: [
|
|
7
|
+
typeof decorationsPlugin
|
|
8
|
+
];
|
|
5
9
|
}>;
|
|
6
10
|
export default panelPlugin;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FloatingToolbarConfig, FloatingToolbarItem } from './../floating-toolbar/types';
|
|
2
2
|
import { EmojiInfo, PanelPluginOptions } from './types';
|
|
3
3
|
import { IntlShape } from 'react-intl-next';
|
|
4
|
+
import type { HoverDecorationHandler } from '@atlaskit/editor-plugin-decorations';
|
|
4
5
|
import { EditorState } from 'prosemirror-state';
|
|
5
6
|
import { NodeType } from 'prosemirror-model';
|
|
6
7
|
import { Command } from '../../types';
|
|
@@ -9,5 +10,5 @@ import { PanelType } from '@atlaskit/adf-schema';
|
|
|
9
10
|
export declare const panelIconMap: {
|
|
10
11
|
[key in Exclude<PanelType, PanelType.CUSTOM>]: EmojiInfo;
|
|
11
12
|
};
|
|
12
|
-
export declare const getToolbarItems: (formatMessage: IntlShape['formatMessage'], panelNodeType: NodeType, isCustomPanelEnabled: boolean, isCustomPanelEditable: boolean, providerFactory: ProviderFactory, activePanelType?: string, activePanelColor?: string, activePanelIcon?: string, state?: EditorState) => FloatingToolbarItem<Command>[];
|
|
13
|
-
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape, options: PanelPluginOptions | undefined, providerFactory: ProviderFactory) => FloatingToolbarConfig | undefined;
|
|
13
|
+
export declare const getToolbarItems: (formatMessage: IntlShape['formatMessage'], panelNodeType: NodeType, isCustomPanelEnabled: boolean, isCustomPanelEditable: boolean, providerFactory: ProviderFactory, hoverDecoration: HoverDecorationHandler | undefined, activePanelType?: string, activePanelColor?: string, activePanelIcon?: string, state?: EditorState) => FloatingToolbarItem<Command>[];
|
|
14
|
+
export declare const getToolbarConfig: (state: EditorState, intl: IntlShape, options: PanelPluginOptions | undefined, providerFactory: ProviderFactory, hoverDecoration: HoverDecorationHandler | undefined) => FloatingToolbarConfig | undefined;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
3
|
import { Dispatch } from '../../event-dispatcher';
|
|
4
4
|
import { PlaceholderTextOptions, PluginState } from './types';
|
|
5
|
+
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
6
|
export declare function createPlugin(dispatch: Dispatch<PluginState>, options: PlaceholderTextOptions): SafePlugin | undefined;
|
|
6
7
|
declare const placeholderTextPlugin: NextEditorPlugin<'placeholderText', {
|
|
8
|
+
dependencies: [
|
|
9
|
+
OptionalPlugin<typeof analyticsPlugin>
|
|
10
|
+
];
|
|
7
11
|
pluginConfiguration: PlaceholderTextOptions;
|
|
8
12
|
}>;
|
|
9
13
|
export default placeholderTextPlugin;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Editor from '../../editor';
|
|
3
3
|
import EditorNext from '../../editor-next';
|
|
4
|
-
import EditorMigrationComponent from '../../editor-next/editor-migration-component';
|
|
5
4
|
export interface Props {
|
|
6
5
|
placeholder?: string;
|
|
7
6
|
children?: any;
|
|
@@ -12,7 +11,7 @@ export interface Props {
|
|
|
12
11
|
export interface State {
|
|
13
12
|
}
|
|
14
13
|
export default class CollapsedEditor extends React.Component<Props, State> {
|
|
15
|
-
editorComponent?: Editor | EditorNext
|
|
14
|
+
editorComponent?: Editor | EditorNext;
|
|
16
15
|
previouslyExpanded?: boolean;
|
|
17
16
|
componentDidUpdate(): void;
|
|
18
17
|
handleEditorRef: (editorRef?: Editor, editorRefCallback?: any) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "185.0.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -48,13 +48,14 @@
|
|
|
48
48
|
"@atlaskit/checkbox": "^12.6.0",
|
|
49
49
|
"@atlaskit/code": "^14.6.0",
|
|
50
50
|
"@atlaskit/date": "^0.10.0",
|
|
51
|
-
"@atlaskit/datetime-picker": "^12.
|
|
52
|
-
"@atlaskit/editor-common": "^74.
|
|
51
|
+
"@atlaskit/datetime-picker": "^12.7.0",
|
|
52
|
+
"@atlaskit/editor-common": "^74.3.0",
|
|
53
53
|
"@atlaskit/editor-json-transformer": "^8.9.0",
|
|
54
54
|
"@atlaskit/editor-markdown-transformer": "^5.2.0",
|
|
55
55
|
"@atlaskit/editor-palette": "1.4.2",
|
|
56
56
|
"@atlaskit/editor-plugin-analytics": "^0.0.1",
|
|
57
57
|
"@atlaskit/editor-plugin-content-insertion": "^0.0.1",
|
|
58
|
+
"@atlaskit/editor-plugin-decorations": "^0.1.0",
|
|
58
59
|
"@atlaskit/editor-plugin-feature-flags": "^0.1.0",
|
|
59
60
|
"@atlaskit/editor-plugin-grid": "^0.1.0",
|
|
60
61
|
"@atlaskit/editor-plugin-table": "^1.5.0",
|
|
@@ -85,8 +86,8 @@
|
|
|
85
86
|
"@atlaskit/prosemirror-input-rules": "^2.2.0",
|
|
86
87
|
"@atlaskit/radio": "^5.6.0",
|
|
87
88
|
"@atlaskit/section-message": "^6.4.0",
|
|
88
|
-
"@atlaskit/select": "^16.
|
|
89
|
-
"@atlaskit/smart-card": "^26.
|
|
89
|
+
"@atlaskit/select": "^16.5.0",
|
|
90
|
+
"@atlaskit/smart-card": "^26.5.0",
|
|
90
91
|
"@atlaskit/smart-user-picker": "^6.1.0",
|
|
91
92
|
"@atlaskit/spinner": "^15.5.0",
|
|
92
93
|
"@atlaskit/status": "^1.3.0",
|
|
@@ -96,7 +97,7 @@
|
|
|
96
97
|
"@atlaskit/textfield": "^5.5.0",
|
|
97
98
|
"@atlaskit/theme": "^12.5.0",
|
|
98
99
|
"@atlaskit/toggle": "^12.6.0",
|
|
99
|
-
"@atlaskit/tokens": "^1.
|
|
100
|
+
"@atlaskit/tokens": "^1.5.0",
|
|
100
101
|
"@atlaskit/tooltip": "^17.8.0",
|
|
101
102
|
"@atlaskit/width-detector": "^4.1.0",
|
|
102
103
|
"@babel/runtime": "^7.0.0",
|
|
@@ -148,7 +149,7 @@
|
|
|
148
149
|
"@atlaskit/atlassian-navigation": "^2.6.0",
|
|
149
150
|
"@atlaskit/breadcrumbs": "11.10.3",
|
|
150
151
|
"@atlaskit/code": "^14.6.0",
|
|
151
|
-
"@atlaskit/collab-provider": "9.0.
|
|
152
|
+
"@atlaskit/collab-provider": "9.0.1",
|
|
152
153
|
"@atlaskit/docs": "*",
|
|
153
154
|
"@atlaskit/drawer": "^7.5.0",
|
|
154
155
|
"@atlaskit/dropdown-menu": "^11.9.0",
|
|
@@ -163,7 +164,7 @@
|
|
|
163
164
|
"@atlaskit/link-test-helpers": "^4.0.0",
|
|
164
165
|
"@atlaskit/lozenge": "^11.4.0",
|
|
165
166
|
"@atlaskit/media-core": "^34.1.0",
|
|
166
|
-
"@atlaskit/media-integration-test-helpers": "^
|
|
167
|
+
"@atlaskit/media-integration-test-helpers": "^3.0.0",
|
|
167
168
|
"@atlaskit/media-test-helpers": "^33.0.0",
|
|
168
169
|
"@atlaskit/menu": "^1.7.0",
|
|
169
170
|
"@atlaskit/page-layout": "^1.6.0",
|
|
@@ -241,6 +242,10 @@
|
|
|
241
242
|
"platform-feature-flags": {
|
|
242
243
|
"platform.editor.sentry-error-monitoring_6bksu": {
|
|
243
244
|
"type": "boolean"
|
|
245
|
+
},
|
|
246
|
+
"platform.editor.custom-table-width": {
|
|
247
|
+
"type": "boolean",
|
|
248
|
+
"referenceOnly": "true"
|
|
244
249
|
}
|
|
245
250
|
}
|
|
246
251
|
}
|
package/report.api.md
CHANGED
|
@@ -41,6 +41,7 @@ import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
|
41
41
|
import { CreateUIAnalyticsEvent as CreateUIAnalyticsEvent_2 } from '@atlaskit/analytics-next/types';
|
|
42
42
|
import { darkModeStatusColorPalette } from '@atlaskit/editor-common/ui-color';
|
|
43
43
|
import { DecorationSet } from 'prosemirror-view';
|
|
44
|
+
import type { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
44
45
|
import { DEFAULT_BORDER_COLOR } from '@atlaskit/editor-common/ui-color';
|
|
45
46
|
import { DirectEditorProps } from 'prosemirror-view';
|
|
46
47
|
import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
@@ -380,7 +381,7 @@ export class CollapsedEditor extends React_2.Component<Props, State> {
|
|
|
380
381
|
// (undocumented)
|
|
381
382
|
componentDidUpdate(): void;
|
|
382
383
|
// (undocumented)
|
|
383
|
-
editorComponent?: Editor |
|
|
384
|
+
editorComponent?: Editor | EditorNext;
|
|
384
385
|
// (undocumented)
|
|
385
386
|
handleEditorRef: (editorRef?: Editor, editorRefCallback?: any) => void;
|
|
386
387
|
// (undocumented)
|
|
@@ -588,83 +589,11 @@ type EditInsertedState = {
|
|
|
588
589
|
};
|
|
589
590
|
|
|
590
591
|
// @public (undocumented)
|
|
591
|
-
export class Editor extends React_2.Component<
|
|
592
|
-
EditorProps,
|
|
593
|
-
ProviderFactoryState & PresetState
|
|
594
|
-
> {
|
|
595
|
-
constructor(props: EditorProps, context: Context);
|
|
596
|
-
componentDidMount(): void;
|
|
597
|
-
componentDidUpdate(prevProps: EditorProps): void;
|
|
598
|
-
componentWillUnmount(): void;
|
|
592
|
+
export class Editor extends React_2.Component<EditorProps> {
|
|
599
593
|
// (undocumented)
|
|
600
|
-
static contextTypes: {
|
|
601
|
-
editorActions: PropTypes.Requireable<object>;
|
|
602
|
-
};
|
|
603
594
|
static defaultProps: EditorProps;
|
|
604
|
-
// @deprecated (undocumented)
|
|
605
|
-
handleAnalyticsEvent: FireAnalyticsCallback;
|
|
606
|
-
// @deprecated (undocumented)
|
|
607
|
-
handleSave: (view: EditorView) => void;
|
|
608
|
-
// @deprecated (undocumented)
|
|
609
|
-
onEditorCreated(instance: {
|
|
610
|
-
view: EditorView;
|
|
611
|
-
eventDispatcher: EventDispatcher;
|
|
612
|
-
transformer?: Transformer_2<string>;
|
|
613
|
-
}): void;
|
|
614
|
-
// @deprecated (undocumented)
|
|
615
|
-
onEditorDestroyed(_instance: {
|
|
616
|
-
view: EditorView;
|
|
617
|
-
transformer?: Transformer_2<string>;
|
|
618
|
-
}): void;
|
|
619
|
-
// @deprecated (undocumented)
|
|
620
|
-
prepareExtensionProvider: (
|
|
621
|
-
extensionProviders?: ExtensionProvidersProp | undefined,
|
|
622
|
-
) => ExtensionProvider<any> | undefined;
|
|
623
|
-
// @deprecated (undocumented)
|
|
624
|
-
prepareQuickInsertProvider: (
|
|
625
|
-
extensionProvider?: ExtensionProvider,
|
|
626
|
-
quickInsert?: QuickInsertOptions,
|
|
627
|
-
) => Promise<QuickInsertProvider> | undefined;
|
|
628
|
-
// (undocumented)
|
|
629
|
-
static propTypes: {
|
|
630
|
-
minHeight: ({
|
|
631
|
-
appearance,
|
|
632
|
-
minHeight,
|
|
633
|
-
}: Pick<EditorProps, 'appearance' | 'minHeight'>) => Error | null;
|
|
634
|
-
};
|
|
635
|
-
// @deprecated (undocumented)
|
|
636
|
-
registerEditorForActions(
|
|
637
|
-
editorView: EditorView,
|
|
638
|
-
eventDispatcher: EventDispatcher,
|
|
639
|
-
contentTransformer?: Transformer_2<string>,
|
|
640
|
-
): void;
|
|
641
595
|
// (undocumented)
|
|
642
596
|
render(): jsx.JSX.Element;
|
|
643
|
-
// @deprecated (undocumented)
|
|
644
|
-
trackEditorActions(
|
|
645
|
-
editorActions: EditorActions & {
|
|
646
|
-
_contentRetrievalTracking?: {
|
|
647
|
-
getValueTracked: boolean;
|
|
648
|
-
samplingCounters: {
|
|
649
|
-
success: number;
|
|
650
|
-
failure: number;
|
|
651
|
-
};
|
|
652
|
-
};
|
|
653
|
-
},
|
|
654
|
-
props: EditorProps,
|
|
655
|
-
): EditorActions<any> & {
|
|
656
|
-
_contentRetrievalTracking?:
|
|
657
|
-
| undefined
|
|
658
|
-
| {
|
|
659
|
-
getValueTracked: boolean;
|
|
660
|
-
samplingCounters: {
|
|
661
|
-
success: number;
|
|
662
|
-
failure: number;
|
|
663
|
-
};
|
|
664
|
-
};
|
|
665
|
-
};
|
|
666
|
-
// @deprecated (undocumented)
|
|
667
|
-
unregisterEditorFromActions(): void;
|
|
668
597
|
}
|
|
669
598
|
|
|
670
599
|
// @public (undocumented)
|
|
@@ -868,14 +797,6 @@ export interface EditorInstance {
|
|
|
868
797
|
secondaryToolbarComponents: UIComponentFactory[];
|
|
869
798
|
}
|
|
870
799
|
|
|
871
|
-
// @public (undocumented)
|
|
872
|
-
export class EditorMigrationComponent extends React_2.Component<EditorProps> {
|
|
873
|
-
// (undocumented)
|
|
874
|
-
static defaultProps: EditorProps;
|
|
875
|
-
// (undocumented)
|
|
876
|
-
render(): JSX.Element;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
800
|
// @public (undocumented)
|
|
880
801
|
class EditorNext extends React_2.Component<EditorNextProps> {
|
|
881
802
|
constructor(props: EditorNextProps, context: Context);
|
|
@@ -883,6 +804,7 @@ class EditorNext extends React_2.Component<EditorNextProps> {
|
|
|
883
804
|
static contextTypes: {
|
|
884
805
|
editorActions: PropTypes.Requireable<object>;
|
|
885
806
|
};
|
|
807
|
+
// (undocumented)
|
|
886
808
|
static defaultProps: EditorProps;
|
|
887
809
|
// (undocumented)
|
|
888
810
|
static propTypes: {
|
|
@@ -1658,6 +1580,7 @@ export const mediaPlugin: NextEditorPlugin<
|
|
|
1658
1580
|
OptionalPlugin<typeof analyticsPlugin>,
|
|
1659
1581
|
typeof gridPlugin,
|
|
1660
1582
|
typeof widthPlugin,
|
|
1583
|
+
typeof decorationsPlugin,
|
|
1661
1584
|
];
|
|
1662
1585
|
sharedState: MediaPluginState | null;
|
|
1663
1586
|
}
|
|
@@ -2097,11 +2020,6 @@ export { PresenceProvider };
|
|
|
2097
2020
|
|
|
2098
2021
|
export { PresenceResource };
|
|
2099
2022
|
|
|
2100
|
-
// @public (undocumented)
|
|
2101
|
-
type PresetState = {
|
|
2102
|
-
preset: EditorPresetBuilder<string[], AllEditorPresetPluginTypes[]>;
|
|
2103
|
-
};
|
|
2104
|
-
|
|
2105
2023
|
// @public (undocumented)
|
|
2106
2024
|
type PrimaryToolbarComponents =
|
|
2107
2025
|
| BeforeAndAfterToolbarComponents
|
|
@@ -2172,12 +2090,6 @@ type Props_5 = {
|
|
|
2172
2090
|
// @public (undocumented)
|
|
2173
2091
|
type ProsemirrorGetPosHandler = () => number;
|
|
2174
2092
|
|
|
2175
|
-
// @public (undocumented)
|
|
2176
|
-
type ProviderFactoryState = {
|
|
2177
|
-
extensionProvider?: ExtensionProvider;
|
|
2178
|
-
quickInsertProvider?: Promise<QuickInsertProvider>;
|
|
2179
|
-
};
|
|
2180
|
-
|
|
2181
2093
|
export { QuickInsertActionInsert };
|
|
2182
2094
|
|
|
2183
2095
|
// @public (undocumented)
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
-
var _react = _interopRequireDefault(require("react"));
|
|
16
|
-
var _featureFlagsFromProps = require("../create-editor/feature-flags-from-props");
|
|
17
|
-
var _editor = _interopRequireDefault(require("../editor"));
|
|
18
|
-
var _index = _interopRequireDefault(require("./index"));
|
|
19
|
-
var _editorPropTypes = require("./utils/editorPropTypes");
|
|
20
|
-
var _useUniversalPreset = _interopRequireDefault(require("../labs/next/presets/useUniversalPreset"));
|
|
21
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
22
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
23
|
-
var EditorNextWrapper = function EditorNextWrapper(_ref) {
|
|
24
|
-
var props = _ref.props;
|
|
25
|
-
var preset = (0, _useUniversalPreset.default)({
|
|
26
|
-
props: props
|
|
27
|
-
});
|
|
28
|
-
return /*#__PURE__*/_react.default.createElement(_index.default, (0, _extends2.default)({
|
|
29
|
-
preset: preset
|
|
30
|
-
}, props));
|
|
31
|
-
};
|
|
32
|
-
var EditorMigrationComponent = /*#__PURE__*/function (_React$Component) {
|
|
33
|
-
(0, _inherits2.default)(EditorMigrationComponent, _React$Component);
|
|
34
|
-
var _super = _createSuper(EditorMigrationComponent);
|
|
35
|
-
function EditorMigrationComponent() {
|
|
36
|
-
(0, _classCallCheck2.default)(this, EditorMigrationComponent);
|
|
37
|
-
return _super.apply(this, arguments);
|
|
38
|
-
}
|
|
39
|
-
(0, _createClass2.default)(EditorMigrationComponent, [{
|
|
40
|
-
key: "render",
|
|
41
|
-
value: function render() {
|
|
42
|
-
var featureFlags = (0, _featureFlagsFromProps.createFeatureFlagsFromProps)(this.props);
|
|
43
|
-
if (!featureFlags.useEditorNext) {
|
|
44
|
-
return /*#__PURE__*/_react.default.createElement(_editor.default, this.props);
|
|
45
|
-
}
|
|
46
|
-
return /*#__PURE__*/_react.default.createElement(EditorNextWrapper, {
|
|
47
|
-
props: this.props
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}]);
|
|
51
|
-
return EditorMigrationComponent;
|
|
52
|
-
}(_react.default.Component);
|
|
53
|
-
exports.default = EditorMigrationComponent;
|
|
54
|
-
(0, _defineProperty2.default)(EditorMigrationComponent, "defaultProps", _editorPropTypes.defaultProps);
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.hoverDecoration = exports.default = exports.decorationStateKey = exports.ACTIONS = void 0;
|
|
7
|
-
var _prosemirrorView = require("prosemirror-view");
|
|
8
|
-
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
|
-
var _prosemirrorState = require("prosemirror-state");
|
|
10
|
-
var _prosemirrorUtils = require("prosemirror-utils");
|
|
11
|
-
var decorationStateKey = new _prosemirrorState.PluginKey('decorationPlugin');
|
|
12
|
-
exports.decorationStateKey = decorationStateKey;
|
|
13
|
-
var ACTIONS = /*#__PURE__*/function (ACTIONS) {
|
|
14
|
-
ACTIONS[ACTIONS["DECORATION_ADD"] = 0] = "DECORATION_ADD";
|
|
15
|
-
ACTIONS[ACTIONS["DECORATION_REMOVE"] = 1] = "DECORATION_REMOVE";
|
|
16
|
-
return ACTIONS;
|
|
17
|
-
}({});
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @private
|
|
21
|
-
* @deprecated
|
|
22
|
-
*
|
|
23
|
-
* Please use the actions of the base plugin rather than this function
|
|
24
|
-
* directly
|
|
25
|
-
*/
|
|
26
|
-
exports.ACTIONS = ACTIONS;
|
|
27
|
-
var hoverDecoration = function hoverDecoration(nodeType, add) {
|
|
28
|
-
var className = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'danger';
|
|
29
|
-
return function (state, dispatch) {
|
|
30
|
-
var from;
|
|
31
|
-
var parentNode;
|
|
32
|
-
if (state.selection instanceof _prosemirrorState.NodeSelection) {
|
|
33
|
-
var selectedNode = state.selection.node;
|
|
34
|
-
var nodeTypes = Array.isArray(nodeType) ? nodeType : [nodeType];
|
|
35
|
-
var isNodeTypeMatching = nodeTypes.indexOf(selectedNode.type) > -1;
|
|
36
|
-
// This adds danger styling if the selected node is the one that requires
|
|
37
|
-
// the decoration to be added, e.g. if a layout is selected and the user
|
|
38
|
-
// hovers over the layout's delete button.
|
|
39
|
-
if (isNodeTypeMatching) {
|
|
40
|
-
from = state.selection.from;
|
|
41
|
-
parentNode = selectedNode;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// This adds danger styling if the selection is not a node selection, OR if
|
|
46
|
-
// the selected node is a child of the one that requires the decoration to
|
|
47
|
-
// be added, e.g. if a decision item is selected inside a layout and the
|
|
48
|
-
// user hovers over the layout's delete button.
|
|
49
|
-
var foundParentNode = (0, _prosemirrorUtils.findParentNodeOfType)(nodeType)(state.selection);
|
|
50
|
-
if (from === undefined && foundParentNode) {
|
|
51
|
-
from = foundParentNode.pos;
|
|
52
|
-
parentNode = foundParentNode.node;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Note: can't use !from as from could be 0, which is falsy but valid
|
|
56
|
-
if (from === undefined || parentNode === undefined) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
if (dispatch) {
|
|
60
|
-
dispatch(state.tr.setMeta(decorationStateKey, {
|
|
61
|
-
action: add ? ACTIONS.DECORATION_ADD : ACTIONS.DECORATION_REMOVE,
|
|
62
|
-
data: _prosemirrorView.Decoration.node(from, from + parentNode.nodeSize, {
|
|
63
|
-
class: className
|
|
64
|
-
}, {
|
|
65
|
-
key: 'decorationNode'
|
|
66
|
-
})
|
|
67
|
-
}).setMeta('addToHistory', false));
|
|
68
|
-
}
|
|
69
|
-
return true;
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
exports.hoverDecoration = hoverDecoration;
|
|
73
|
-
var _default = function _default() {
|
|
74
|
-
return new _safePlugin.SafePlugin({
|
|
75
|
-
key: decorationStateKey,
|
|
76
|
-
state: {
|
|
77
|
-
init: function init() {
|
|
78
|
-
return {
|
|
79
|
-
decoration: undefined
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
apply: function apply(tr, pluginState) {
|
|
83
|
-
if (pluginState.decoration) {
|
|
84
|
-
var mapResult = tr.mapping.mapResult(pluginState.decoration.from);
|
|
85
|
-
if (mapResult.deleted) {
|
|
86
|
-
pluginState = {
|
|
87
|
-
decoration: undefined
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
var meta = tr.getMeta(decorationStateKey);
|
|
92
|
-
if (!meta) {
|
|
93
|
-
return pluginState;
|
|
94
|
-
}
|
|
95
|
-
switch (meta.action) {
|
|
96
|
-
case ACTIONS.DECORATION_ADD:
|
|
97
|
-
return {
|
|
98
|
-
decoration: meta.data
|
|
99
|
-
};
|
|
100
|
-
case ACTIONS.DECORATION_REMOVE:
|
|
101
|
-
return {
|
|
102
|
-
decoration: undefined
|
|
103
|
-
};
|
|
104
|
-
default:
|
|
105
|
-
return pluginState;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
props: {
|
|
110
|
-
decorations: function decorations(state) {
|
|
111
|
-
var doc = state.doc;
|
|
112
|
-
var _ref = decorationStateKey.getState(state),
|
|
113
|
-
decoration = _ref.decoration;
|
|
114
|
-
if (decoration) {
|
|
115
|
-
return _prosemirrorView.DecorationSet.create(doc, [decoration]);
|
|
116
|
-
}
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
exports.default = _default;
|