@atlaskit/editor-core 187.43.12 → 187.43.13
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 +7 -0
- package/dist/cjs/labs/next/presets/default.js +2 -1
- package/dist/cjs/labs/next/presets/universal.js +1 -1
- package/dist/cjs/plugins/clipboard/pm-plugins/main.js +13 -54
- package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
- package/dist/cjs/plugins/floating-toolbar/index.js +1 -2
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/selection/utils.js +29 -80
- package/dist/cjs/utils/clipboard.js +19 -127
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/default.js +2 -1
- package/dist/es2019/labs/next/presets/universal.js +2 -2
- package/dist/es2019/plugins/clipboard/pm-plugins/main.js +3 -53
- package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
- package/dist/es2019/plugins/floating-toolbar/index.js +1 -2
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/selection/utils.js +3 -74
- package/dist/es2019/utils/clipboard.js +1 -53
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/default.js +2 -1
- package/dist/esm/labs/next/presets/universal.js +2 -2
- package/dist/esm/plugins/clipboard/pm-plugins/main.js +3 -49
- package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
- package/dist/esm/plugins/floating-toolbar/index.js +1 -2
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/selection/utils.js +3 -72
- package/dist/esm/utils/clipboard.js +1 -119
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +68 -4
- package/dist/types/plugins/clipboard/pm-plugins/main.d.ts +2 -3
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/selection/utils.d.ts +2 -5
- package/dist/types/utils/clipboard.d.ts +1 -3
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +86 -0
- package/dist/types-ts4.5/plugins/clipboard/pm-plugins/main.d.ts +2 -3
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/selection/utils.d.ts +2 -5
- package/dist/types-ts4.5/utils/clipboard.d.ts +1 -3
- package/package.json +7 -7
- package/dist/cjs/plugins/copy-button/commands.js +0 -171
- package/dist/cjs/plugins/copy-button/index.js +0 -23
- package/dist/cjs/plugins/copy-button/pm-plugins/main.js +0 -104
- package/dist/cjs/plugins/copy-button/pm-plugins/plugin-key.js +0 -9
- package/dist/cjs/plugins/copy-button/toolbar.js +0 -99
- package/dist/cjs/plugins/copy-button/utils.js +0 -22
- package/dist/es2019/plugins/copy-button/commands.js +0 -157
- package/dist/es2019/plugins/copy-button/index.js +0 -11
- package/dist/es2019/plugins/copy-button/pm-plugins/main.js +0 -97
- package/dist/es2019/plugins/copy-button/pm-plugins/plugin-key.js +0 -2
- package/dist/es2019/plugins/copy-button/toolbar.js +0 -82
- package/dist/es2019/plugins/copy-button/utils.js +0 -15
- package/dist/esm/plugins/copy-button/commands.js +0 -159
- package/dist/esm/plugins/copy-button/index.js +0 -15
- package/dist/esm/plugins/copy-button/pm-plugins/main.js +0 -96
- package/dist/esm/plugins/copy-button/pm-plugins/plugin-key.js +0 -2
- package/dist/esm/plugins/copy-button/toolbar.js +0 -89
- package/dist/esm/plugins/copy-button/utils.js +0 -14
- package/dist/types/plugins/copy-button/commands.d.ts +0 -9
- package/dist/types/plugins/copy-button/index.d.ts +0 -3
- package/dist/types/plugins/copy-button/pm-plugins/main.d.ts +0 -4
- package/dist/types/plugins/copy-button/pm-plugins/plugin-key.d.ts +0 -2
- package/dist/types/plugins/copy-button/toolbar.d.ts +0 -13
- package/dist/types/plugins/copy-button/utils.d.ts +0 -8
- package/dist/types-ts4.5/plugins/copy-button/commands.d.ts +0 -9
- package/dist/types-ts4.5/plugins/copy-button/index.d.ts +0 -3
- package/dist/types-ts4.5/plugins/copy-button/pm-plugins/main.d.ts +0 -4
- package/dist/types-ts4.5/plugins/copy-button/pm-plugins/plugin-key.d.ts +0 -2
- package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +0 -13
- package/dist/types-ts4.5/plugins/copy-button/utils.d.ts +0 -8
|
@@ -34,7 +34,7 @@ export type DefaultPresetPluginOptions = {
|
|
|
34
34
|
* Note: The order that presets are added determines
|
|
35
35
|
* their placement in the editor toolbar
|
|
36
36
|
*/
|
|
37
|
-
export declare function createDefaultPreset(options: EditorPresetProps & DefaultPresetPluginOptions): EditorPresetBuilder<[...string[], "hyperlink", "textFormatting", "width", "quickInsert", "typeAhead", "placeholder", "unsupportedContent", "editorDisabled", "submitEditor", "fakeTextCursor", "floatingToolbar", "selection", "codeBlock"], [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"codeBlock", {
|
|
37
|
+
export declare function createDefaultPreset(options: EditorPresetProps & DefaultPresetPluginOptions): EditorPresetBuilder<[...string[], "hyperlink", "textFormatting", "width", "quickInsert", "typeAhead", "placeholder", "unsupportedContent", "editorDisabled", "submitEditor", "fakeTextCursor", "copyButton", "floatingToolbar", "selection", "codeBlock"], [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"codeBlock", {
|
|
38
38
|
pluginConfiguration: CodeBlockOptions;
|
|
39
39
|
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"decorations", {
|
|
40
40
|
sharedState: import("@atlaskit/editor-plugin-decorations").DecorationState;
|
|
@@ -99,7 +99,23 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
99
99
|
actions: {
|
|
100
100
|
api: () => import("@atlaskit/editor-common/extensions").ExtensionAPI<import("@atlaskit/editor-common/extensions").Parameters>;
|
|
101
101
|
};
|
|
102
|
-
}, import("@atlaskit/editor-plugin-extension").ExtensionPluginOptions | undefined>>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"
|
|
102
|
+
}, import("@atlaskit/editor-plugin-extension").ExtensionPluginOptions | undefined>>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"copyButton", {
|
|
103
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
104
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
105
|
+
sharedState: {
|
|
106
|
+
createAnalyticsEvent: CreateUIAnalyticsEvent | null;
|
|
107
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
108
|
+
};
|
|
109
|
+
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
110
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
111
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
112
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>];
|
|
113
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
114
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
|
|
115
|
+
actions: {
|
|
116
|
+
processCopyButtonItems: (state: import("prosemirror-state").EditorState) => (items: import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[], hoverDecoration: ((nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command) | undefined) => import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[];
|
|
117
|
+
};
|
|
118
|
+
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
|
|
103
119
|
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
104
120
|
}, undefined>];
|
|
105
121
|
actions: {
|
|
@@ -109,6 +125,22 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
109
125
|
configWithNodeInfo: import("@atlaskit/editor-plugin-floating-toolbar").ConfigWithNodeInfo | undefined;
|
|
110
126
|
floatingToolbarData: import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData | undefined;
|
|
111
127
|
} | undefined;
|
|
128
|
+
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"copyButton", {
|
|
129
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
130
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
131
|
+
sharedState: {
|
|
132
|
+
createAnalyticsEvent: CreateUIAnalyticsEvent | null;
|
|
133
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
134
|
+
};
|
|
135
|
+
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
136
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
137
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
138
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>];
|
|
139
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
140
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
|
|
141
|
+
actions: {
|
|
142
|
+
processCopyButtonItems: (state: import("prosemirror-state").EditorState) => (items: import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[], hoverDecoration: ((nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command) | undefined) => import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[];
|
|
143
|
+
};
|
|
112
144
|
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"fakeTextCursor", {}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"submitEditor", {
|
|
113
145
|
pluginConfiguration: ((editorView: import("prosemirror-view").EditorView) => void) | undefined;
|
|
114
146
|
}, ((editorView: import("prosemirror-view").EditorView) => void) | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
|
|
@@ -210,7 +242,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
210
242
|
};
|
|
211
243
|
sharedState: import("@atlaskit/editor-common/link").HyperlinkState | undefined;
|
|
212
244
|
}, HyperlinkPluginOptions | undefined>, ...import("@atlaskit/editor-common/types").AllEditorPresetPluginTypes[]]>;
|
|
213
|
-
export declare function useDefaultPreset(props: EditorPresetProps & DefaultPresetPluginOptions): EditorPresetBuilder<[...string[], "hyperlink", "textFormatting", "width", "quickInsert", "typeAhead", "placeholder", "unsupportedContent", "editorDisabled", "submitEditor", "fakeTextCursor", "floatingToolbar", "selection", "codeBlock"], [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"codeBlock", {
|
|
245
|
+
export declare function useDefaultPreset(props: EditorPresetProps & DefaultPresetPluginOptions): EditorPresetBuilder<[...string[], "hyperlink", "textFormatting", "width", "quickInsert", "typeAhead", "placeholder", "unsupportedContent", "editorDisabled", "submitEditor", "fakeTextCursor", "copyButton", "floatingToolbar", "selection", "codeBlock"], [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"codeBlock", {
|
|
214
246
|
pluginConfiguration: CodeBlockOptions;
|
|
215
247
|
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"decorations", {
|
|
216
248
|
sharedState: import("@atlaskit/editor-plugin-decorations").DecorationState;
|
|
@@ -275,7 +307,23 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
275
307
|
actions: {
|
|
276
308
|
api: () => import("@atlaskit/editor-common/extensions").ExtensionAPI<import("@atlaskit/editor-common/extensions").Parameters>;
|
|
277
309
|
};
|
|
278
|
-
}, import("@atlaskit/editor-plugin-extension").ExtensionPluginOptions | undefined>>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"
|
|
310
|
+
}, import("@atlaskit/editor-plugin-extension").ExtensionPluginOptions | undefined>>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"copyButton", {
|
|
311
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
312
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
313
|
+
sharedState: {
|
|
314
|
+
createAnalyticsEvent: CreateUIAnalyticsEvent | null;
|
|
315
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
316
|
+
};
|
|
317
|
+
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
318
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
319
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
320
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>];
|
|
321
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
322
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
|
|
323
|
+
actions: {
|
|
324
|
+
processCopyButtonItems: (state: import("prosemirror-state").EditorState) => (items: import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[], hoverDecoration: ((nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command) | undefined) => import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[];
|
|
325
|
+
};
|
|
326
|
+
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
|
|
279
327
|
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
280
328
|
}, undefined>];
|
|
281
329
|
actions: {
|
|
@@ -285,6 +333,22 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
285
333
|
configWithNodeInfo: import("@atlaskit/editor-plugin-floating-toolbar").ConfigWithNodeInfo | undefined;
|
|
286
334
|
floatingToolbarData: import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData | undefined;
|
|
287
335
|
} | undefined;
|
|
336
|
+
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"copyButton", {
|
|
337
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
338
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
339
|
+
sharedState: {
|
|
340
|
+
createAnalyticsEvent: CreateUIAnalyticsEvent | null;
|
|
341
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
342
|
+
};
|
|
343
|
+
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
344
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
345
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
346
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>];
|
|
347
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
348
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
|
|
349
|
+
actions: {
|
|
350
|
+
processCopyButtonItems: (state: import("prosemirror-state").EditorState) => (items: import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[], hoverDecoration: ((nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command) | undefined) => import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[];
|
|
351
|
+
};
|
|
288
352
|
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"fakeTextCursor", {}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"submitEditor", {
|
|
289
353
|
pluginConfiguration: ((editorView: import("prosemirror-view").EditorView) => void) | undefined;
|
|
290
354
|
}, ((editorView: import("prosemirror-view").EditorView) => void) | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
3
|
import type { PMPluginFactoryParams } from '../../../types';
|
|
5
4
|
import type { DispatchAnalyticsEvent } from '../../analytics/types/dispatch-analytics-event';
|
|
6
|
-
import type { AnalyticsEventPayload } from '../../../plugins/analytics';
|
|
7
5
|
import { ACTION } from '../../analytics/types/enums';
|
|
8
6
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
9
7
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
+
import { getAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
|
|
10
9
|
export declare const createPlugin: ({ dispatchAnalyticsEvent, schema, }: PMPluginFactoryParams) => SafePlugin<any>;
|
|
11
10
|
/**
|
|
12
11
|
* Overrides Prosemirror's default clipboardSerializer, in order to fix table row copy/paste bug raised in ED-13003.
|
|
@@ -16,4 +15,4 @@ export declare const createPlugin: ({ dispatchAnalyticsEvent, schema, }: PMPlugi
|
|
|
16
15
|
*/
|
|
17
16
|
export declare const createClipboardSerializer: (schema: Schema, getEditorView: () => EditorView) => DOMSerializer;
|
|
18
17
|
export declare const sendClipboardAnalytics: (view: EditorView, dispatchAnalyticsEvent: DispatchAnalyticsEvent, action: ACTION.CUT | ACTION.COPIED) => boolean;
|
|
19
|
-
export
|
|
18
|
+
export { getAnalyticsPayload };
|
|
@@ -48,5 +48,4 @@ export { default as avatarGroupPlugin } from './avatar-group';
|
|
|
48
48
|
export { default as viewUpdateSubscriptionPlugin } from './view-update-subscription';
|
|
49
49
|
export { default as beforePrimaryToolbarPlugin } from './before-primaryToolbar';
|
|
50
50
|
export { default as codeBidiWarningPlugin } from './code-bidi-warning';
|
|
51
|
-
export { default as copyButtonPlugin } from './copy-button';
|
|
52
51
|
export { default as borderPlugin } from './border';
|
|
@@ -4,15 +4,12 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
4
4
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { Node as PmNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { ContentNodeWithPos, NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
-
import
|
|
7
|
+
import { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload } from '@atlaskit/editor-common/selection';
|
|
8
8
|
export declare function createSelectionClickHandler(nodes: string[], isValidTarget: (target: HTMLElement) => boolean, options: {
|
|
9
9
|
useLongPressSelection: boolean;
|
|
10
10
|
getNodeSelectionPos?: (state: EditorState, nodePos: number) => number;
|
|
11
11
|
}): (view: EditorView, pos: number, node: PmNode, nodePos: number, event: MouseEvent, direct: boolean) => boolean;
|
|
12
12
|
export declare const getDecorations: (tr: Transaction | ReadonlyTransaction) => DecorationSet;
|
|
13
|
-
export declare function getNodeSelectionAnalyticsPayload(selection: Selection): AnalyticsEventPayload | undefined;
|
|
14
|
-
export declare function getAllSelectionAnalyticsPayload(selection: Selection): AnalyticsEventPayload | undefined;
|
|
15
|
-
export declare function getCellSelectionAnalyticsPayload(state: EditorState): AnalyticsEventPayload | undefined;
|
|
16
13
|
/**
|
|
17
14
|
* Use `getNodesToDecorateFromSelection` to collect and return
|
|
18
15
|
* a list of nodes within the Selection that should have Selection
|
|
@@ -25,7 +22,6 @@ export declare const getNodesToDecorateFromSelection: (selection: Selection, doc
|
|
|
25
22
|
node: PmNode;
|
|
26
23
|
pos: number;
|
|
27
24
|
}[];
|
|
28
|
-
export declare function getRangeSelectionAnalyticsPayload(selection: Selection, doc: PmNode): AnalyticsEventPayload | undefined;
|
|
29
25
|
export declare function shouldRecalcDecorations({ oldEditorState, newEditorState, }: {
|
|
30
26
|
oldEditorState: EditorState;
|
|
31
27
|
newEditorState: EditorState;
|
|
@@ -64,3 +60,4 @@ export declare const findFirstChildNodeToSelect: (parent: PmNode) => NodeWithPos
|
|
|
64
60
|
export declare const findLastChildNodeToSelect: (parent: PmNode) => NodeWithPos | undefined;
|
|
65
61
|
export declare const isSelectionAtStartOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
66
62
|
export declare const isSelectionAtEndOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
63
|
+
export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, };
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const copyHTMLToClipboard: (elementToCopy: HTMLElement, plainTextToCopy?: string) => Promise<void>;
|
|
3
|
-
export declare const copyHTMLToClipboardPolyfill: (elementToCopy: HTMLElement, plainTextToCopy?: string) => void;
|
|
1
|
+
export { copyToClipboard, copyHTMLToClipboard, copyHTMLToClipboardPolyfill, } from '@atlaskit/editor-common/clipboard';
|
|
@@ -46,6 +46,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
46
46
|
"editorDisabled",
|
|
47
47
|
"submitEditor",
|
|
48
48
|
"fakeTextCursor",
|
|
49
|
+
"copyButton",
|
|
49
50
|
"floatingToolbar",
|
|
50
51
|
"selection",
|
|
51
52
|
"codeBlock"
|
|
@@ -133,6 +134,27 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
133
134
|
api: () => import("@atlaskit/editor-common/extensions").ExtensionAPI<import("@atlaskit/editor-common/extensions").Parameters>;
|
|
134
135
|
};
|
|
135
136
|
}, import("@atlaskit/editor-plugin-extension").ExtensionPluginOptions | undefined>>,
|
|
137
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"copyButton", {
|
|
138
|
+
dependencies: [
|
|
139
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
140
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
141
|
+
sharedState: {
|
|
142
|
+
createAnalyticsEvent: CreateUIAnalyticsEvent | null;
|
|
143
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
144
|
+
};
|
|
145
|
+
dependencies: [
|
|
146
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
147
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
148
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
149
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>
|
|
150
|
+
];
|
|
151
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
152
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>
|
|
153
|
+
];
|
|
154
|
+
actions: {
|
|
155
|
+
processCopyButtonItems: (state: import("prosemirror-state").EditorState) => (items: import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[], hoverDecoration: ((nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command) | undefined) => import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[];
|
|
156
|
+
};
|
|
157
|
+
}, undefined>,
|
|
136
158
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
|
|
137
159
|
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
138
160
|
}, undefined>
|
|
@@ -145,6 +167,27 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
145
167
|
floatingToolbarData: import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData | undefined;
|
|
146
168
|
} | undefined;
|
|
147
169
|
}, undefined>,
|
|
170
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"copyButton", {
|
|
171
|
+
dependencies: [
|
|
172
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
173
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
174
|
+
sharedState: {
|
|
175
|
+
createAnalyticsEvent: CreateUIAnalyticsEvent | null;
|
|
176
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
177
|
+
};
|
|
178
|
+
dependencies: [
|
|
179
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
180
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
181
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
182
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>
|
|
183
|
+
];
|
|
184
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
185
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>
|
|
186
|
+
];
|
|
187
|
+
actions: {
|
|
188
|
+
processCopyButtonItems: (state: import("prosemirror-state").EditorState) => (items: import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[], hoverDecoration: ((nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command) | undefined) => import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[];
|
|
189
|
+
};
|
|
190
|
+
}, undefined>,
|
|
148
191
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"fakeTextCursor", {}, undefined>,
|
|
149
192
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"submitEditor", {
|
|
150
193
|
pluginConfiguration: ((editorView: import("prosemirror-view").EditorView) => void) | undefined;
|
|
@@ -282,6 +325,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
282
325
|
"editorDisabled",
|
|
283
326
|
"submitEditor",
|
|
284
327
|
"fakeTextCursor",
|
|
328
|
+
"copyButton",
|
|
285
329
|
"floatingToolbar",
|
|
286
330
|
"selection",
|
|
287
331
|
"codeBlock"
|
|
@@ -369,6 +413,27 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
369
413
|
api: () => import("@atlaskit/editor-common/extensions").ExtensionAPI<import("@atlaskit/editor-common/extensions").Parameters>;
|
|
370
414
|
};
|
|
371
415
|
}, import("@atlaskit/editor-plugin-extension").ExtensionPluginOptions | undefined>>,
|
|
416
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"copyButton", {
|
|
417
|
+
dependencies: [
|
|
418
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
419
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
420
|
+
sharedState: {
|
|
421
|
+
createAnalyticsEvent: CreateUIAnalyticsEvent | null;
|
|
422
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
423
|
+
};
|
|
424
|
+
dependencies: [
|
|
425
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
426
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
427
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
428
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>
|
|
429
|
+
];
|
|
430
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
431
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>
|
|
432
|
+
];
|
|
433
|
+
actions: {
|
|
434
|
+
processCopyButtonItems: (state: import("prosemirror-state").EditorState) => (items: import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[], hoverDecoration: ((nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command) | undefined) => import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[];
|
|
435
|
+
};
|
|
436
|
+
}, undefined>,
|
|
372
437
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
|
|
373
438
|
sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
|
|
374
439
|
}, undefined>
|
|
@@ -381,6 +446,27 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
381
446
|
floatingToolbarData: import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData | undefined;
|
|
382
447
|
} | undefined;
|
|
383
448
|
}, undefined>,
|
|
449
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"copyButton", {
|
|
450
|
+
dependencies: [
|
|
451
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
452
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
453
|
+
sharedState: {
|
|
454
|
+
createAnalyticsEvent: CreateUIAnalyticsEvent | null;
|
|
455
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
456
|
+
};
|
|
457
|
+
dependencies: [
|
|
458
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
459
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
460
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
461
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>
|
|
462
|
+
];
|
|
463
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
464
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>
|
|
465
|
+
];
|
|
466
|
+
actions: {
|
|
467
|
+
processCopyButtonItems: (state: import("prosemirror-state").EditorState) => (items: import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[], hoverDecoration: ((nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command) | undefined) => import("@atlaskit/editor-common/types").FloatingToolbarItem<import("@atlaskit/editor-common/types").Command>[];
|
|
468
|
+
};
|
|
469
|
+
}, undefined>,
|
|
384
470
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"fakeTextCursor", {}, undefined>,
|
|
385
471
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"submitEditor", {
|
|
386
472
|
pluginConfiguration: ((editorView: import("prosemirror-view").EditorView) => void) | undefined;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
3
|
import type { PMPluginFactoryParams } from '../../../types';
|
|
5
4
|
import type { DispatchAnalyticsEvent } from '../../analytics/types/dispatch-analytics-event';
|
|
6
|
-
import type { AnalyticsEventPayload } from '../../../plugins/analytics';
|
|
7
5
|
import { ACTION } from '../../analytics/types/enums';
|
|
8
6
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
9
7
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
+
import { getAnalyticsPayload } from '@atlaskit/editor-common/clipboard';
|
|
10
9
|
export declare const createPlugin: ({ dispatchAnalyticsEvent, schema, }: PMPluginFactoryParams) => SafePlugin<any>;
|
|
11
10
|
/**
|
|
12
11
|
* Overrides Prosemirror's default clipboardSerializer, in order to fix table row copy/paste bug raised in ED-13003.
|
|
@@ -16,4 +15,4 @@ export declare const createPlugin: ({ dispatchAnalyticsEvent, schema, }: PMPlugi
|
|
|
16
15
|
*/
|
|
17
16
|
export declare const createClipboardSerializer: (schema: Schema, getEditorView: () => EditorView) => DOMSerializer;
|
|
18
17
|
export declare const sendClipboardAnalytics: (view: EditorView, dispatchAnalyticsEvent: DispatchAnalyticsEvent, action: ACTION.CUT | ACTION.COPIED) => boolean;
|
|
19
|
-
export
|
|
18
|
+
export { getAnalyticsPayload };
|
|
@@ -48,5 +48,4 @@ export { default as avatarGroupPlugin } from './avatar-group';
|
|
|
48
48
|
export { default as viewUpdateSubscriptionPlugin } from './view-update-subscription';
|
|
49
49
|
export { default as beforePrimaryToolbarPlugin } from './before-primaryToolbar';
|
|
50
50
|
export { default as codeBidiWarningPlugin } from './code-bidi-warning';
|
|
51
|
-
export { default as copyButtonPlugin } from './copy-button';
|
|
52
51
|
export { default as borderPlugin } from './border';
|
|
@@ -4,15 +4,12 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
4
4
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
import type { Node as PmNode, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { ContentNodeWithPos, NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
-
import
|
|
7
|
+
import { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload } from '@atlaskit/editor-common/selection';
|
|
8
8
|
export declare function createSelectionClickHandler(nodes: string[], isValidTarget: (target: HTMLElement) => boolean, options: {
|
|
9
9
|
useLongPressSelection: boolean;
|
|
10
10
|
getNodeSelectionPos?: (state: EditorState, nodePos: number) => number;
|
|
11
11
|
}): (view: EditorView, pos: number, node: PmNode, nodePos: number, event: MouseEvent, direct: boolean) => boolean;
|
|
12
12
|
export declare const getDecorations: (tr: Transaction | ReadonlyTransaction) => DecorationSet;
|
|
13
|
-
export declare function getNodeSelectionAnalyticsPayload(selection: Selection): AnalyticsEventPayload | undefined;
|
|
14
|
-
export declare function getAllSelectionAnalyticsPayload(selection: Selection): AnalyticsEventPayload | undefined;
|
|
15
|
-
export declare function getCellSelectionAnalyticsPayload(state: EditorState): AnalyticsEventPayload | undefined;
|
|
16
13
|
/**
|
|
17
14
|
* Use `getNodesToDecorateFromSelection` to collect and return
|
|
18
15
|
* a list of nodes within the Selection that should have Selection
|
|
@@ -25,7 +22,6 @@ export declare const getNodesToDecorateFromSelection: (selection: Selection, doc
|
|
|
25
22
|
node: PmNode;
|
|
26
23
|
pos: number;
|
|
27
24
|
}[];
|
|
28
|
-
export declare function getRangeSelectionAnalyticsPayload(selection: Selection, doc: PmNode): AnalyticsEventPayload | undefined;
|
|
29
25
|
export declare function shouldRecalcDecorations({ oldEditorState, newEditorState, }: {
|
|
30
26
|
oldEditorState: EditorState;
|
|
31
27
|
newEditorState: EditorState;
|
|
@@ -64,3 +60,4 @@ export declare const findFirstChildNodeToSelect: (parent: PmNode) => NodeWithPos
|
|
|
64
60
|
export declare const findLastChildNodeToSelect: (parent: PmNode) => NodeWithPos | undefined;
|
|
65
61
|
export declare const isSelectionAtStartOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
66
62
|
export declare const isSelectionAtEndOfParentNode: ($pos: ResolvedPos, selection: Selection) => boolean;
|
|
63
|
+
export { getNodeSelectionAnalyticsPayload, getAllSelectionAnalyticsPayload, getRangeSelectionAnalyticsPayload, getCellSelectionAnalyticsPayload, };
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare const copyHTMLToClipboard: (elementToCopy: HTMLElement, plainTextToCopy?: string) => Promise<void>;
|
|
3
|
-
export declare const copyHTMLToClipboardPolyfill: (elementToCopy: HTMLElement, plainTextToCopy?: string) => void;
|
|
1
|
+
export { copyToClipboard, copyHTMLToClipboard, copyHTMLToClipboardPolyfill, } from '@atlaskit/editor-common/clipboard';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.43.
|
|
3
|
+
"version": "187.43.13",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/code": "^14.6.0",
|
|
56
56
|
"@atlaskit/date": "^0.10.0",
|
|
57
57
|
"@atlaskit/datetime-picker": "^12.10.0",
|
|
58
|
-
"@atlaskit/editor-common": "^75.
|
|
58
|
+
"@atlaskit/editor-common": "^75.2.0",
|
|
59
59
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
60
60
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
61
61
|
"@atlaskit/editor-palette": "1.5.1",
|
|
@@ -65,13 +65,13 @@
|
|
|
65
65
|
"@atlaskit/editor-plugin-composition": "^0.1.0",
|
|
66
66
|
"@atlaskit/editor-plugin-content-insertion": "^0.1.0",
|
|
67
67
|
"@atlaskit/editor-plugin-context-panel": "^0.2.0",
|
|
68
|
-
"@atlaskit/editor-plugin-copy-button": "^0.
|
|
68
|
+
"@atlaskit/editor-plugin-copy-button": "^0.2.0",
|
|
69
69
|
"@atlaskit/editor-plugin-decorations": "^0.2.0",
|
|
70
70
|
"@atlaskit/editor-plugin-editor-disabled": "^0.2.0",
|
|
71
71
|
"@atlaskit/editor-plugin-emoji": "^0.3.0",
|
|
72
72
|
"@atlaskit/editor-plugin-extension": "^0.2.0",
|
|
73
73
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.0",
|
|
74
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^0.
|
|
74
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^0.5.0",
|
|
75
75
|
"@atlaskit/editor-plugin-focus": "^0.2.0",
|
|
76
76
|
"@atlaskit/editor-plugin-grid": "^0.2.0",
|
|
77
77
|
"@atlaskit/editor-plugin-guideline": "^0.5.0",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"@atlaskit/radio": "^5.6.0",
|
|
112
112
|
"@atlaskit/section-message": "^6.4.0",
|
|
113
113
|
"@atlaskit/select": "^16.7.0",
|
|
114
|
-
"@atlaskit/smart-card": "^26.
|
|
114
|
+
"@atlaskit/smart-card": "^26.27.0",
|
|
115
115
|
"@atlaskit/smart-user-picker": "^6.3.0",
|
|
116
116
|
"@atlaskit/spinner": "^15.5.0",
|
|
117
117
|
"@atlaskit/status": "^1.3.0",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"@atlaskit/textfield": "^5.6.0",
|
|
122
122
|
"@atlaskit/theme": "^12.6.0",
|
|
123
123
|
"@atlaskit/toggle": "^12.6.0",
|
|
124
|
-
"@atlaskit/tokens": "^1.
|
|
124
|
+
"@atlaskit/tokens": "^1.23.0",
|
|
125
125
|
"@atlaskit/tooltip": "^17.8.0",
|
|
126
126
|
"@atlaskit/width-detector": "^4.1.0",
|
|
127
127
|
"@babel/runtime": "^7.0.0",
|
|
@@ -129,7 +129,6 @@
|
|
|
129
129
|
"@types/react-loadable": "^5.4.1",
|
|
130
130
|
"@types/react-virtualized": "^9.18.12",
|
|
131
131
|
"classnames": "^2.2.5",
|
|
132
|
-
"clipboard-polyfill": "2.4.3",
|
|
133
132
|
"date-fns": "^2.17.0",
|
|
134
133
|
"is-number": "^7.0.0",
|
|
135
134
|
"lodash": "^4.17.21",
|
|
@@ -199,6 +198,7 @@
|
|
|
199
198
|
"@types/raf-schd": "^4.0.1",
|
|
200
199
|
"@types/rison": "^0.0.6",
|
|
201
200
|
"async-retry": "^1.2.3",
|
|
201
|
+
"clipboard-polyfill": "2.4.3",
|
|
202
202
|
"diff": "^4.0.1",
|
|
203
203
|
"enzyme": "^3.10.0",
|
|
204
204
|
"eslint-import-resolver-typescript": "^3.5.1",
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createToolbarCopyCommandForMark = createToolbarCopyCommandForMark;
|
|
7
|
-
exports.createToolbarCopyCommandForNode = void 0;
|
|
8
|
-
exports.getProvideMarkVisualFeedbackForCopyButtonCommand = getProvideMarkVisualFeedbackForCopyButtonCommand;
|
|
9
|
-
exports.removeMarkVisualFeedbackForCopyButtonCommand = removeMarkVisualFeedbackForCopyButtonCommand;
|
|
10
|
-
exports.resetCopiedState = void 0;
|
|
11
|
-
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
12
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
|
-
var _clipboard = require("../../utils/clipboard");
|
|
14
|
-
var _utils = require("./utils");
|
|
15
|
-
var _analytics = require("../analytics");
|
|
16
|
-
var _main = require("../clipboard/pm-plugins/main");
|
|
17
|
-
var _utils2 = require("@atlaskit/editor-common/utils");
|
|
18
|
-
function createToolbarCopyCommandForMark(markType) {
|
|
19
|
-
function command(state, dispatch) {
|
|
20
|
-
var textNode = state.tr.selection.$head.parent.maybeChild(state.tr.selection.$head.index());
|
|
21
|
-
if (!textNode) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
if (dispatch) {
|
|
25
|
-
// As calling copyHTMLToClipboard causes side effects -- we only run this when
|
|
26
|
-
// dispatch is provided -- as otherwise the consumer is only testing to see if
|
|
27
|
-
// the action is availble.
|
|
28
|
-
var domNode = (0, _utils.toDOM)(textNode, state.schema);
|
|
29
|
-
if (domNode) {
|
|
30
|
-
var div = document.createElement('div');
|
|
31
|
-
var p = document.createElement('p');
|
|
32
|
-
div.appendChild(p);
|
|
33
|
-
p.appendChild(domNode);
|
|
34
|
-
// The "1 1" refers to the start and end depth of the slice
|
|
35
|
-
// since we're copying the text inside a paragraph, it will always be 1 1
|
|
36
|
-
// https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
|
|
37
|
-
div.firstChild.setAttribute('data-pm-slice', '1 1 []');
|
|
38
|
-
|
|
39
|
-
// If we're copying a hyperlink, we'd copy the url as the fallback plain text
|
|
40
|
-
var linkUrl = domNode.getAttribute('href');
|
|
41
|
-
(0, _clipboard.copyHTMLToClipboard)(div, markType.name === 'link' && linkUrl ? linkUrl : undefined);
|
|
42
|
-
}
|
|
43
|
-
var copyToClipboardTr = state.tr;
|
|
44
|
-
copyToClipboardTr.setMeta(_pluginKey.copyButtonPluginKey, {
|
|
45
|
-
copied: true
|
|
46
|
-
});
|
|
47
|
-
var analyticsPayload = (0, _main.getAnalyticsPayload)(state, _analytics.ACTION.COPIED);
|
|
48
|
-
if (analyticsPayload) {
|
|
49
|
-
analyticsPayload.attributes.inputMethod = _analytics.INPUT_METHOD.FLOATING_TB;
|
|
50
|
-
analyticsPayload.attributes.markType = markType.name;
|
|
51
|
-
(0, _analytics.addAnalytics)(state, copyToClipboardTr, analyticsPayload);
|
|
52
|
-
}
|
|
53
|
-
dispatch(copyToClipboardTr);
|
|
54
|
-
}
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
return command;
|
|
58
|
-
}
|
|
59
|
-
function getProvideMarkVisualFeedbackForCopyButtonCommand(markType) {
|
|
60
|
-
function provideMarkVisualFeedbackForCopyButtonCommand(state, dispatch) {
|
|
61
|
-
var tr = state.tr;
|
|
62
|
-
tr.setMeta(_pluginKey.copyButtonPluginKey, {
|
|
63
|
-
showSelection: true,
|
|
64
|
-
markType: markType
|
|
65
|
-
});
|
|
66
|
-
if (dispatch) {
|
|
67
|
-
dispatch(tr);
|
|
68
|
-
}
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
return provideMarkVisualFeedbackForCopyButtonCommand;
|
|
72
|
-
}
|
|
73
|
-
function removeMarkVisualFeedbackForCopyButtonCommand(state, dispatch) {
|
|
74
|
-
var tr = state.tr;
|
|
75
|
-
tr.setMeta(_pluginKey.copyButtonPluginKey, {
|
|
76
|
-
removeSelection: true
|
|
77
|
-
});
|
|
78
|
-
var copyButtonState = _pluginKey.copyButtonPluginKey.getState(state);
|
|
79
|
-
if (copyButtonState !== null && copyButtonState !== void 0 && copyButtonState.copied) {
|
|
80
|
-
tr.setMeta(_pluginKey.copyButtonPluginKey, {
|
|
81
|
-
copied: false
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
if (dispatch) {
|
|
85
|
-
dispatch(tr);
|
|
86
|
-
}
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
var createToolbarCopyCommandForNode = function createToolbarCopyCommandForNode(nodeType) {
|
|
90
|
-
return function (state, dispatch) {
|
|
91
|
-
var tr = state.tr,
|
|
92
|
-
schema = state.schema;
|
|
93
|
-
|
|
94
|
-
// This command should only be triggered by the Copy button in the floating toolbar
|
|
95
|
-
// which is only visible when selection is inside the target node
|
|
96
|
-
var contentNodeWithPos = (0, _utils.getSelectedNodeOrNodeParentByNodeType)({
|
|
97
|
-
nodeType: nodeType,
|
|
98
|
-
selection: tr.selection
|
|
99
|
-
});
|
|
100
|
-
if (!contentNodeWithPos) {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
var copyToClipboardTr = tr;
|
|
104
|
-
copyToClipboardTr.setMeta(_pluginKey.copyButtonPluginKey, {
|
|
105
|
-
copied: true
|
|
106
|
-
});
|
|
107
|
-
var analyticsPayload = (0, _main.getAnalyticsPayload)(state, _analytics.ACTION.COPIED);
|
|
108
|
-
if (analyticsPayload) {
|
|
109
|
-
analyticsPayload.attributes.inputMethod = _analytics.INPUT_METHOD.FLOATING_TB;
|
|
110
|
-
analyticsPayload.attributes.nodeType = contentNodeWithPos.node.type.name;
|
|
111
|
-
(0, _analytics.addAnalytics)(state, copyToClipboardTr, analyticsPayload);
|
|
112
|
-
}
|
|
113
|
-
if (dispatch) {
|
|
114
|
-
// As calling copyHTMLToClipboard causes side effects -- we only run this when
|
|
115
|
-
// dispatch is provided -- as otherwise the consumer is only testing to see if
|
|
116
|
-
// the action is availble.
|
|
117
|
-
var domNode = (0, _utils.toDOM)(contentNodeWithPos.node, schema);
|
|
118
|
-
if (domNode) {
|
|
119
|
-
var div = document.createElement('div');
|
|
120
|
-
div.appendChild(domNode);
|
|
121
|
-
|
|
122
|
-
// if copying inline content
|
|
123
|
-
if (contentNodeWithPos.node.type.inlineContent) {
|
|
124
|
-
// The "1 1" refers to the start and end depth of the slice
|
|
125
|
-
// since we're copying the text inside a paragraph, it will always be 1 1
|
|
126
|
-
// https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
|
|
127
|
-
div.firstChild.setAttribute('data-pm-slice', '1 1 []');
|
|
128
|
-
} else {
|
|
129
|
-
// The "0 0" refers to the start and end depth of the slice
|
|
130
|
-
// since we're copying the block node only, it will always be 0 0
|
|
131
|
-
// https://github.com/ProseMirror/prosemirror-view/blob/master/src/clipboard.ts#L32
|
|
132
|
-
div.firstChild.setAttribute('data-pm-slice', '0 0 []');
|
|
133
|
-
}
|
|
134
|
-
// ED-17083 safari seems have bugs for extension copy because exntension do not have a child text(innerText) and it will not recognized as html in clipboard, this could be merge into one if this extension fixed children issue or safari fix the copy bug
|
|
135
|
-
// MEX-2528 safari has a bug related to the mediaSingle node with border or link. The image tag within the clipboard is not recognized as HTML when using the ClipboardItem API. To address this, we have to switch to ClipboardPolyfill
|
|
136
|
-
if (_utils2.browser.safari && state.selection instanceof _state.NodeSelection && (state.selection.node.type === state.schema.nodes.extension || state.selection.node.type === state.schema.nodes.mediaSingle)) {
|
|
137
|
-
(0, _clipboard.copyHTMLToClipboardPolyfill)(div);
|
|
138
|
-
} else {
|
|
139
|
-
(0, _clipboard.copyHTMLToClipboard)(div);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
copyToClipboardTr.setMeta('scrollIntoView', false);
|
|
143
|
-
dispatch(copyToClipboardTr);
|
|
144
|
-
}
|
|
145
|
-
return true;
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
exports.createToolbarCopyCommandForNode = createToolbarCopyCommandForNode;
|
|
149
|
-
var resetCopiedState = function resetCopiedState(nodeType, hoverDecoration, onMouseLeave) {
|
|
150
|
-
return function (state, dispatch) {
|
|
151
|
-
var customTr = state.tr;
|
|
152
|
-
|
|
153
|
-
// Avoid multipe dispatch
|
|
154
|
-
// https://product-fabric.atlassian.net/wiki/spaces/E/pages/2241659456/All+about+dispatch+and+why+there+shouldn+t+be+multiple#How-do-I-avoid-them%3F
|
|
155
|
-
var customDispatch = function customDispatch(tr) {
|
|
156
|
-
customTr = tr;
|
|
157
|
-
};
|
|
158
|
-
onMouseLeave ? onMouseLeave(state, customDispatch) : hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false)(state, customDispatch);
|
|
159
|
-
var copyButtonState = _pluginKey.copyButtonPluginKey.getState(state);
|
|
160
|
-
if (copyButtonState !== null && copyButtonState !== void 0 && copyButtonState.copied) {
|
|
161
|
-
customTr.setMeta(_pluginKey.copyButtonPluginKey, {
|
|
162
|
-
copied: false
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
if (dispatch) {
|
|
166
|
-
dispatch(customTr);
|
|
167
|
-
}
|
|
168
|
-
return true;
|
|
169
|
-
};
|
|
170
|
-
};
|
|
171
|
-
exports.resetCopiedState = resetCopiedState;
|