@atlaskit/editor-plugin-paste 8.0.2 → 8.1.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 +19 -0
- package/dist/cjs/editor-actions/actions.js +1 -0
- package/dist/cjs/pastePlugin.js +18 -2
- package/dist/cjs/pastePluginType.js +9 -1
- package/dist/cjs/pm-plugins/main.js +4 -2
- package/dist/cjs/pm-plugins/media.js +6 -0
- package/dist/cjs/pm-plugins/reducer.js +14 -0
- package/dist/cjs/pm-plugins/util/sync-block.js +129 -0
- package/dist/cjs/ui/Flag.js +107 -0
- package/dist/es2019/editor-actions/actions.js +1 -0
- package/dist/es2019/pastePlugin.js +17 -2
- package/dist/es2019/pastePluginType.js +7 -1
- package/dist/es2019/pm-plugins/main.js +5 -3
- package/dist/es2019/pm-plugins/media.js +6 -0
- package/dist/es2019/pm-plugins/reducer.js +15 -0
- package/dist/es2019/pm-plugins/util/sync-block.js +121 -0
- package/dist/es2019/ui/Flag.js +102 -0
- package/dist/esm/editor-actions/actions.js +1 -0
- package/dist/esm/pastePlugin.js +17 -2
- package/dist/esm/pastePluginType.js +7 -1
- package/dist/esm/pm-plugins/main.js +5 -3
- package/dist/esm/pm-plugins/media.js +6 -0
- package/dist/esm/pm-plugins/reducer.js +14 -0
- package/dist/esm/pm-plugins/util/sync-block.js +122 -0
- package/dist/esm/ui/Flag.js +98 -0
- package/dist/types/editor-actions/actions.d.ts +8 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/pastePluginType.d.ts +23 -1
- package/dist/types/pm-plugins/main.d.ts +2 -2
- package/dist/types/pm-plugins/util/sync-block.d.ts +5 -0
- package/dist/types/ui/Flag.d.ts +8 -0
- package/dist/types-ts4.5/editor-actions/actions.d.ts +8 -3
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/pastePluginType.d.ts +23 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/util/sync-block.d.ts +5 -0
- package/dist/types-ts4.5/ui/Flag.d.ts +8 -0
- package/package.json +13 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { MessageDescriptor } from 'react-intl-next';
|
|
1
2
|
import type { PasteSource } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
3
|
-
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { NextEditorPlugin, OptionalPlugin, PasteWarningOptions } from '@atlaskit/editor-common/types';
|
|
4
5
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
6
|
import type { AnnotationPlugin } from '@atlaskit/editor-plugin-annotation';
|
|
6
7
|
import type { BetterTypeHistoryPlugin } from '@atlaskit/editor-plugin-better-type-history';
|
|
@@ -11,7 +12,25 @@ import type { ListPlugin } from '@atlaskit/editor-plugin-list';
|
|
|
11
12
|
import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
|
|
12
13
|
import type { MentionsPlugin } from '@atlaskit/editor-plugin-mentions';
|
|
13
14
|
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
15
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
16
|
+
export declare enum FLAG_TYPE {
|
|
17
|
+
WARNING = "warning",
|
|
18
|
+
ERROR = "error",
|
|
19
|
+
INFO = "info",
|
|
20
|
+
SUCCESS = "success"
|
|
21
|
+
}
|
|
22
|
+
type FlagConfig = {
|
|
23
|
+
description: MessageDescriptor;
|
|
24
|
+
id: string;
|
|
25
|
+
onDismissed?: (tr: Transaction) => Transaction | void;
|
|
26
|
+
title: MessageDescriptor;
|
|
27
|
+
type: FLAG_TYPE;
|
|
28
|
+
urlHref?: string;
|
|
29
|
+
urlText?: MessageDescriptor;
|
|
30
|
+
};
|
|
31
|
+
export type ActiveFlag = FlagConfig | false;
|
|
14
32
|
export interface PastePluginState {
|
|
33
|
+
activeFlag: ActiveFlag | null;
|
|
15
34
|
lastContentPasted: LastContentPasted | null;
|
|
16
35
|
/** map of pasted macro link positions that will to be mapped through incoming transactions */
|
|
17
36
|
pastedMacroPositions: {
|
|
@@ -31,6 +50,7 @@ export type LastContentPasted = {
|
|
|
31
50
|
export type PastePluginOptions = {
|
|
32
51
|
cardOptions?: CardOptions;
|
|
33
52
|
isFullPage?: boolean;
|
|
53
|
+
pasteWarningOptions?: PasteWarningOptions;
|
|
34
54
|
sanitizePrivateContent?: boolean;
|
|
35
55
|
};
|
|
36
56
|
export type PastePluginDependencies = [
|
|
@@ -48,6 +68,8 @@ export type PastePlugin = NextEditorPlugin<'paste', {
|
|
|
48
68
|
dependencies: PastePluginDependencies;
|
|
49
69
|
pluginConfiguration: PastePluginOptions;
|
|
50
70
|
sharedState: {
|
|
71
|
+
activeFlag: ActiveFlag | null;
|
|
51
72
|
lastContentPasted: LastContentPasted | null;
|
|
52
73
|
};
|
|
53
74
|
}>;
|
|
75
|
+
export {};
|
|
@@ -4,10 +4,10 @@ import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
|
4
4
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
5
5
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
-
import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
|
+
import type { ExtractInjectionAPI, FeatureFlags, PasteWarningOptions } from '@atlaskit/editor-common/types';
|
|
8
8
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
9
9
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import type { PastePlugin } from '../index';
|
|
11
11
|
export declare const isInsideBlockQuote: (state: EditorState) => boolean;
|
|
12
12
|
export declare function isSharePointUrl(url: string | undefined): boolean;
|
|
13
|
-
export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, getIntl: () => IntlShape, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory): SafePlugin<import("../pastePluginType").PastePluginState>;
|
|
13
|
+
export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, getIntl: () => IntlShape, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory, pasteWarningOptions?: PasteWarningOptions): SafePlugin<import("../pastePluginType").PastePluginState>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PasteSource } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { ExtractInjectionAPI, PasteWarningOptions } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { PastePlugin } from '../../pastePluginType';
|
|
5
|
+
export declare const handleSyncBlocksPaste: (slice: Slice, schema: Schema, pasteSource: PasteSource, rawHtml: string, pasteWarningOptions: PasteWarningOptions | undefined, api: ExtractInjectionAPI<PastePlugin> | undefined) => Slice;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { PastePlugin } from '../pastePluginType';
|
|
4
|
+
type Props = {
|
|
5
|
+
api?: ExtractInjectionAPI<PastePlugin>;
|
|
6
|
+
};
|
|
7
|
+
export declare const Flag: ({ api }: Props) => React.JSX.Element | undefined;
|
|
8
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { LastContentPasted } from '../pastePluginType';
|
|
1
|
+
import type { LastContentPasted, ActiveFlag } from '../pastePluginType';
|
|
2
2
|
export declare enum PastePluginActionTypes {
|
|
3
3
|
START_TRACKING_PASTED_MACRO_POSITIONS = "START_TRACKING_PASTED_MACRO_POSITIONS",
|
|
4
4
|
STOP_TRACKING_PASTED_MACRO_POSITIONS = "STOP_TRACKING_PASTED_MACRO_POSITIONS",
|
|
5
|
-
ON_PASTE = "ON_PASTE"
|
|
5
|
+
ON_PASTE = "ON_PASTE",
|
|
6
|
+
SET_ACTIVE_FLAG = "SET_ACTIVE_FLAG"
|
|
6
7
|
}
|
|
7
8
|
export interface StartTrackingPastedMacroPositions {
|
|
8
9
|
pastedMacroPositions: {
|
|
@@ -18,4 +19,8 @@ export interface StopTrackingPastedMacroPositions {
|
|
|
18
19
|
pastedMacroPositionKeys: string[];
|
|
19
20
|
type: PastePluginActionTypes.STOP_TRACKING_PASTED_MACRO_POSITIONS;
|
|
20
21
|
}
|
|
21
|
-
export
|
|
22
|
+
export interface SetActiveFlag {
|
|
23
|
+
activeFlag: ActiveFlag;
|
|
24
|
+
type: PastePluginActionTypes.SET_ACTIVE_FLAG;
|
|
25
|
+
}
|
|
26
|
+
export type PastePluginAction = StartTrackingPastedMacroPositions | StopTrackingPastedMacroPositions | OnPaste | SetActiveFlag;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { PastePlugin, PastePluginOptions, PastePluginState, LastContentPasted, PastePluginDependencies, } from './pastePluginType';
|
|
1
|
+
export type { PastePlugin, PastePluginOptions, PastePluginState, LastContentPasted, PastePluginDependencies, ActiveFlag, } from './pastePluginType';
|
|
2
2
|
export { pastePlugin } from './pastePlugin';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { MessageDescriptor } from 'react-intl-next';
|
|
1
2
|
import type { PasteSource } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
3
|
-
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { NextEditorPlugin, OptionalPlugin, PasteWarningOptions } from '@atlaskit/editor-common/types';
|
|
4
5
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
6
|
import type { AnnotationPlugin } from '@atlaskit/editor-plugin-annotation';
|
|
6
7
|
import type { BetterTypeHistoryPlugin } from '@atlaskit/editor-plugin-better-type-history';
|
|
@@ -11,7 +12,25 @@ import type { ListPlugin } from '@atlaskit/editor-plugin-list';
|
|
|
11
12
|
import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
|
|
12
13
|
import type { MentionsPlugin } from '@atlaskit/editor-plugin-mentions';
|
|
13
14
|
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
15
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
16
|
+
export declare enum FLAG_TYPE {
|
|
17
|
+
WARNING = "warning",
|
|
18
|
+
ERROR = "error",
|
|
19
|
+
INFO = "info",
|
|
20
|
+
SUCCESS = "success"
|
|
21
|
+
}
|
|
22
|
+
type FlagConfig = {
|
|
23
|
+
description: MessageDescriptor;
|
|
24
|
+
id: string;
|
|
25
|
+
onDismissed?: (tr: Transaction) => Transaction | void;
|
|
26
|
+
title: MessageDescriptor;
|
|
27
|
+
type: FLAG_TYPE;
|
|
28
|
+
urlHref?: string;
|
|
29
|
+
urlText?: MessageDescriptor;
|
|
30
|
+
};
|
|
31
|
+
export type ActiveFlag = FlagConfig | false;
|
|
14
32
|
export interface PastePluginState {
|
|
33
|
+
activeFlag: ActiveFlag | null;
|
|
15
34
|
lastContentPasted: LastContentPasted | null;
|
|
16
35
|
/** map of pasted macro link positions that will to be mapped through incoming transactions */
|
|
17
36
|
pastedMacroPositions: {
|
|
@@ -31,6 +50,7 @@ export type LastContentPasted = {
|
|
|
31
50
|
export type PastePluginOptions = {
|
|
32
51
|
cardOptions?: CardOptions;
|
|
33
52
|
isFullPage?: boolean;
|
|
53
|
+
pasteWarningOptions?: PasteWarningOptions;
|
|
34
54
|
sanitizePrivateContent?: boolean;
|
|
35
55
|
};
|
|
36
56
|
export type PastePluginDependencies = [
|
|
@@ -48,6 +68,8 @@ export type PastePlugin = NextEditorPlugin<'paste', {
|
|
|
48
68
|
dependencies: PastePluginDependencies;
|
|
49
69
|
pluginConfiguration: PastePluginOptions;
|
|
50
70
|
sharedState: {
|
|
71
|
+
activeFlag: ActiveFlag | null;
|
|
51
72
|
lastContentPasted: LastContentPasted | null;
|
|
52
73
|
};
|
|
53
74
|
}>;
|
|
75
|
+
export {};
|
|
@@ -4,10 +4,10 @@ import type { CardOptions } from '@atlaskit/editor-common/card';
|
|
|
4
4
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
5
5
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
-
import type { ExtractInjectionAPI, FeatureFlags } from '@atlaskit/editor-common/types';
|
|
7
|
+
import type { ExtractInjectionAPI, FeatureFlags, PasteWarningOptions } from '@atlaskit/editor-common/types';
|
|
8
8
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
9
9
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import type { PastePlugin } from '../index';
|
|
11
11
|
export declare const isInsideBlockQuote: (state: EditorState) => boolean;
|
|
12
12
|
export declare function isSharePointUrl(url: string | undefined): boolean;
|
|
13
|
-
export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, getIntl: () => IntlShape, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory): SafePlugin<import("../pastePluginType").PastePluginState>;
|
|
13
|
+
export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, getIntl: () => IntlShape, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory, pasteWarningOptions?: PasteWarningOptions): SafePlugin<import("../pastePluginType").PastePluginState>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PasteSource } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { ExtractInjectionAPI, PasteWarningOptions } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import type { PastePlugin } from '../../pastePluginType';
|
|
5
|
+
export declare const handleSyncBlocksPaste: (slice: Slice, schema: Schema, pasteSource: PasteSource, rawHtml: string, pasteWarningOptions: PasteWarningOptions | undefined, api: ExtractInjectionAPI<PastePlugin> | undefined) => Slice;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { PastePlugin } from '../pastePluginType';
|
|
4
|
+
type Props = {
|
|
5
|
+
api?: ExtractInjectionAPI<PastePlugin>;
|
|
6
|
+
};
|
|
7
|
+
export declare const Flag: ({ api }: Props) => React.JSX.Element | undefined;
|
|
8
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "Paste plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,28 +31,31 @@
|
|
|
31
31
|
"@atlaskit/code": "^17.4.0",
|
|
32
32
|
"@atlaskit/editor-markdown-transformer": "^5.20.0",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^7.0.0",
|
|
34
|
-
"@atlaskit/editor-plugin-annotation": "^7.
|
|
34
|
+
"@atlaskit/editor-plugin-annotation": "^7.1.0",
|
|
35
35
|
"@atlaskit/editor-plugin-better-type-history": "^7.0.0",
|
|
36
|
-
"@atlaskit/editor-plugin-card": "^12.
|
|
36
|
+
"@atlaskit/editor-plugin-card": "^12.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-feature-flags": "^6.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-list": "^9.0.0",
|
|
39
|
-
"@atlaskit/editor-plugin-media": "^9.
|
|
40
|
-
"@atlaskit/editor-plugin-mentions": "^9.
|
|
39
|
+
"@atlaskit/editor-plugin-media": "^9.4.0",
|
|
40
|
+
"@atlaskit/editor-plugin-mentions": "^9.1.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
42
42
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
43
|
+
"@atlaskit/flag": "^17.8.0",
|
|
44
|
+
"@atlaskit/icon": "^30.0.0",
|
|
43
45
|
"@atlaskit/insm": "^0.2.0",
|
|
44
46
|
"@atlaskit/media-client": "^35.7.0",
|
|
45
47
|
"@atlaskit/media-common": "^12.3.0",
|
|
46
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
49
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^16.32.0",
|
|
51
|
+
"@atlaskit/tokens": "^10.1.0",
|
|
49
52
|
"@babel/runtime": "^7.0.0",
|
|
50
53
|
"lodash": "^4.17.21",
|
|
51
54
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
52
55
|
"uuid": "^3.1.0"
|
|
53
56
|
},
|
|
54
57
|
"peerDependencies": {
|
|
55
|
-
"@atlaskit/editor-common": "^111.
|
|
58
|
+
"@atlaskit/editor-common": "^111.8.0",
|
|
56
59
|
"react": "^18.2.0",
|
|
57
60
|
"react-dom": "^18.2.0"
|
|
58
61
|
},
|
|
@@ -117,6 +120,9 @@
|
|
|
117
120
|
},
|
|
118
121
|
"platform_editor_date_to_text": {
|
|
119
122
|
"type": "boolean"
|
|
123
|
+
},
|
|
124
|
+
"platform_synced_block_dogfooding": {
|
|
125
|
+
"type": "boolean"
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
128
|
}
|