@atlaskit/editor-plugin-paste 4.1.7 → 4.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/pm-plugins/main.js +36 -0
  3. package/dist/es2019/pm-plugins/main.js +35 -0
  4. package/dist/esm/pm-plugins/main.js +35 -0
  5. package/dist/types/editor-actions/actions.d.ts +3 -3
  6. package/dist/types/editor-commands/commands.d.ts +1 -1
  7. package/dist/types/pastePluginType.d.ts +7 -7
  8. package/dist/types/pm-plugins/analytics.d.ts +3 -3
  9. package/dist/types/pm-plugins/main.d.ts +1 -0
  10. package/dist/types/pm-plugins/move-analytics/actions.d.ts +2 -2
  11. package/dist/types/pm-plugins/move-analytics/types.d.ts +3 -3
  12. package/dist/types/pm-plugins/util/edge-cases/handleVSCodeBlock.d.ts +2 -2
  13. package/dist/types/pm-plugins/util/edge-cases/index.d.ts +4 -4
  14. package/dist/types/pm-plugins/util/edge-cases/lists.d.ts +5 -5
  15. package/dist/types/pm-plugins/util/tinyMCE.d.ts +1 -1
  16. package/dist/types-ts4.5/editor-actions/actions.d.ts +3 -3
  17. package/dist/types-ts4.5/editor-commands/commands.d.ts +1 -1
  18. package/dist/types-ts4.5/pastePluginType.d.ts +7 -7
  19. package/dist/types-ts4.5/pm-plugins/analytics.d.ts +3 -3
  20. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -0
  21. package/dist/types-ts4.5/pm-plugins/move-analytics/actions.d.ts +2 -2
  22. package/dist/types-ts4.5/pm-plugins/move-analytics/types.d.ts +3 -3
  23. package/dist/types-ts4.5/pm-plugins/util/edge-cases/handleVSCodeBlock.d.ts +2 -2
  24. package/dist/types-ts4.5/pm-plugins/util/edge-cases/index.d.ts +4 -4
  25. package/dist/types-ts4.5/pm-plugins/util/edge-cases/lists.d.ts +5 -5
  26. package/dist/types-ts4.5/pm-plugins/util/tinyMCE.d.ts +1 -1
  27. package/package.json +9 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 4.1.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a2cd8c46a3e94`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a2cd8c46a3e94) -
8
+ EDITOR-1442 Bump adf-schema
9
+ - Updated dependencies
10
+
11
+ ## 4.1.8
12
+
13
+ ### Patch Changes
14
+
15
+ - [`265c1bf0cefa4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/265c1bf0cefa4) -
16
+ Sorted type and interface props to improve Atlaskit docs
17
+ - Updated dependencies
18
+
3
19
  ## 4.1.7
4
20
 
5
21
  ### Patch Changes
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.createPlugin = createPlugin;
8
8
  exports.isInsideBlockQuote = void 0;
9
+ exports.isSharePointUrl = isSharePointUrl;
9
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
12
  var _uuid = _interopRequireDefault(require("uuid"));
@@ -43,6 +44,27 @@ var isInsideBlockQuote = exports.isInsideBlockQuote = function isInsideBlockQuot
43
44
  return (0, _utils2.hasParentNodeOfType)(blockquote)(state.selection);
44
45
  };
45
46
  var PASTE = 'Editor Paste Plugin Paste Duration';
47
+ function isSharePointUrl(url) {
48
+ if (!url) {
49
+ return false;
50
+ }
51
+ try {
52
+ var urlObj = new URL(url);
53
+ var hostname = urlObj.hostname.toLowerCase();
54
+ var protocol = urlObj.protocol.toLowerCase();
55
+
56
+ // Only accept HTTPS URLs for security
57
+ if (protocol !== 'https:') {
58
+ return false;
59
+ }
60
+
61
+ // Check if hostname ends with the trusted domains (not just contains them)
62
+ return hostname.endsWith('sharepoint.com') || hostname.endsWith('onedrive.com') || hostname.endsWith('onedrive.live.com');
63
+ } catch (_unused) {
64
+ // If URL parsing fails, return false for safety
65
+ return false;
66
+ }
67
+ }
46
68
  function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
47
69
  var _pluginInjectionApi$a;
48
70
  var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
@@ -478,6 +500,20 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
478
500
  return true;
479
501
  }
480
502
 
503
+ // Special handling for SharePoint URLs generated from Share button
504
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
505
+ if ((0, _platformFeatureFlags.fg)('platform_editor_sharepoint_url_smart_card_fallback') && isSharePointUrl(text)) {
506
+ // Create an inline card directly for SharePoint URLs to show the "Connect" button
507
+ var inlineCardNode = schema.nodes.inlineCard.create({
508
+ url: text
509
+ });
510
+ var cardSlice = new _model.Slice(_model.Fragment.from(inlineCardNode), 0, 0);
511
+ if (dispatch) {
512
+ dispatch(state.tr.replaceSelection(cardSlice));
513
+ }
514
+ return true;
515
+ }
516
+
481
517
  // handle the case when copy content from a table cell inside bodied extension
482
518
  if ((0, _handlers.handleTableContentPasteInBodiedExtension)(slice)(state, dispatch)) {
483
519
  return true;
@@ -32,6 +32,27 @@ export const isInsideBlockQuote = state => {
32
32
  return hasParentNodeOfType(blockquote)(state.selection);
33
33
  };
34
34
  const PASTE = 'Editor Paste Plugin Paste Duration';
35
+ export function isSharePointUrl(url) {
36
+ if (!url) {
37
+ return false;
38
+ }
39
+ try {
40
+ const urlObj = new URL(url);
41
+ const hostname = urlObj.hostname.toLowerCase();
42
+ const protocol = urlObj.protocol.toLowerCase();
43
+
44
+ // Only accept HTTPS URLs for security
45
+ if (protocol !== 'https:') {
46
+ return false;
47
+ }
48
+
49
+ // Check if hostname ends with the trusted domains (not just contains them)
50
+ return hostname.endsWith('sharepoint.com') || hostname.endsWith('onedrive.com') || hostname.endsWith('onedrive.live.com');
51
+ } catch {
52
+ // If URL parsing fails, return false for safety
53
+ return false;
54
+ }
55
+ }
35
56
  export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
36
57
  var _pluginInjectionApi$a;
37
58
  const editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
@@ -442,6 +463,20 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
442
463
  return true;
443
464
  }
444
465
 
466
+ // Special handling for SharePoint URLs generated from Share button
467
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
468
+ if (fg('platform_editor_sharepoint_url_smart_card_fallback') && isSharePointUrl(text)) {
469
+ // Create an inline card directly for SharePoint URLs to show the "Connect" button
470
+ const inlineCardNode = schema.nodes.inlineCard.create({
471
+ url: text
472
+ });
473
+ const cardSlice = new Slice(Fragment.from(inlineCardNode), 0, 0);
474
+ if (dispatch) {
475
+ dispatch(state.tr.replaceSelection(cardSlice));
476
+ }
477
+ return true;
478
+ }
479
+
445
480
  // handle the case when copy content from a table cell inside bodied extension
446
481
  if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
447
482
  return true;
@@ -35,6 +35,27 @@ export var isInsideBlockQuote = function isInsideBlockQuote(state) {
35
35
  return hasParentNodeOfType(blockquote)(state.selection);
36
36
  };
37
37
  var PASTE = 'Editor Paste Plugin Paste Duration';
38
+ export function isSharePointUrl(url) {
39
+ if (!url) {
40
+ return false;
41
+ }
42
+ try {
43
+ var urlObj = new URL(url);
44
+ var hostname = urlObj.hostname.toLowerCase();
45
+ var protocol = urlObj.protocol.toLowerCase();
46
+
47
+ // Only accept HTTPS URLs for security
48
+ if (protocol !== 'https:') {
49
+ return false;
50
+ }
51
+
52
+ // Check if hostname ends with the trusted domains (not just contains them)
53
+ return hostname.endsWith('sharepoint.com') || hostname.endsWith('onedrive.com') || hostname.endsWith('onedrive.live.com');
54
+ } catch (_unused) {
55
+ // If URL parsing fails, return false for safety
56
+ return false;
57
+ }
58
+ }
38
59
  export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pluginInjectionApi, cardOptions, sanitizePrivateContent, providerFactory) {
39
60
  var _pluginInjectionApi$a;
40
61
  var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
@@ -470,6 +491,20 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
470
491
  return true;
471
492
  }
472
493
 
494
+ // Special handling for SharePoint URLs generated from Share button
495
+ // eslint-disable-next-line @atlaskit/platform/no-preconditioning
496
+ if (fg('platform_editor_sharepoint_url_smart_card_fallback') && isSharePointUrl(text)) {
497
+ // Create an inline card directly for SharePoint URLs to show the "Connect" button
498
+ var inlineCardNode = schema.nodes.inlineCard.create({
499
+ url: text
500
+ });
501
+ var cardSlice = new Slice(Fragment.from(inlineCardNode), 0, 0);
502
+ if (dispatch) {
503
+ dispatch(state.tr.replaceSelection(cardSlice));
504
+ }
505
+ return true;
506
+ }
507
+
473
508
  // handle the case when copy content from a table cell inside bodied extension
474
509
  if (handleTableContentPasteInBodiedExtension(slice)(state, dispatch)) {
475
510
  return true;
@@ -5,17 +5,17 @@ export declare enum PastePluginActionTypes {
5
5
  ON_PASTE = "ON_PASTE"
6
6
  }
7
7
  export interface StartTrackingPastedMacroPositions {
8
- type: PastePluginActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS;
9
8
  pastedMacroPositions: {
10
9
  [key: string]: number;
11
10
  };
11
+ type: PastePluginActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS;
12
12
  }
13
13
  export interface OnPaste {
14
- type: PastePluginActionTypes.ON_PASTE;
15
14
  contentPasted: LastContentPasted;
15
+ type: PastePluginActionTypes.ON_PASTE;
16
16
  }
17
17
  export interface StopTrackingPastedMacroPositions {
18
- type: PastePluginActionTypes.STOP_TRACKING_PASTED_MACRO_POSITIONS;
19
18
  pastedMacroPositionKeys: string[];
19
+ type: PastePluginActionTypes.STOP_TRACKING_PASTED_MACRO_POSITIONS;
20
20
  }
21
21
  export type PastePluginAction = StartTrackingPastedMacroPositions | StopTrackingPastedMacroPositions | OnPaste;
@@ -25,7 +25,7 @@ export declare const splitParagraphs: (slice: Slice, schema: Schema) => Slice;
25
25
  * Returns the original paragraph node (as a fragment), or a fragment containing multiple nodes.
26
26
  */
27
27
  export declare const splitIntoParagraphs: ({ fragment, blockMarks, schema, }: {
28
- fragment: Fragment;
29
28
  blockMarks?: readonly Mark[];
29
+ fragment: Fragment;
30
30
  schema: Schema;
31
31
  }) => Fragment;
@@ -12,26 +12,26 @@ import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
12
12
  import type { MentionsPlugin } from '@atlaskit/editor-plugin-mentions';
13
13
  import type { Slice } from '@atlaskit/editor-prosemirror/model';
14
14
  export interface PastePluginState {
15
+ lastContentPasted: LastContentPasted | null;
15
16
  /** map of pasted macro link positions that will to be mapped through incoming transactions */
16
17
  pastedMacroPositions: {
17
18
  [key: string]: number;
18
19
  };
19
- lastContentPasted: LastContentPasted | null;
20
20
  }
21
21
  export type LastContentPasted = {
22
22
  isPlainText: boolean;
23
- text?: string;
24
23
  isShiftPressed: boolean;
25
- pasteStartPos: number;
26
- pasteEndPos: number;
27
- pastedSlice: Slice;
28
24
  pastedAt: number;
25
+ pastedSlice: Slice;
26
+ pasteEndPos: number;
29
27
  pasteSource: PasteSource;
28
+ pasteStartPos: number;
29
+ text?: string;
30
30
  };
31
31
  export type PastePluginOptions = {
32
32
  cardOptions?: CardOptions;
33
- sanitizePrivateContent?: boolean;
34
33
  isFullPage?: boolean;
34
+ sanitizePrivateContent?: boolean;
35
35
  };
36
36
  export type PastePluginDependencies = [
37
37
  OptionalPlugin<FeatureFlagsPlugin>,
@@ -45,8 +45,8 @@ export type PastePluginDependencies = [
45
45
  OptionalPlugin<MentionsPlugin>
46
46
  ];
47
47
  export type PastePlugin = NextEditorPlugin<'paste', {
48
- pluginConfiguration: PastePluginOptions;
49
48
  dependencies: PastePluginDependencies;
49
+ pluginConfiguration: PastePluginOptions;
50
50
  sharedState: {
51
51
  lastContentPasted: LastContentPasted | null;
52
52
  };
@@ -6,12 +6,12 @@ import type { Fragment, Schema, Slice } from '@atlaskit/editor-prosemirror/model
6
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
7
  import type { PastePlugin } from '../index';
8
8
  type PasteContext = {
9
- type: PasteType;
10
9
  asPlain?: boolean;
11
10
  /** Has the hyperlink been pasted while text is selected, making the text into a link? */
12
11
  hyperlinkPasteOnText?: boolean;
13
12
  /** Did this paste action split a list in half? */
14
13
  pasteSplitList?: boolean;
14
+ type: PasteType;
15
15
  };
16
16
  type GetContentProps = {
17
17
  schema: Schema;
@@ -36,10 +36,10 @@ export declare const handleNestedTablePasteWithAnalytics: (editorAnalyticsAPI: E
36
36
  export declare const handleSelectedTableWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
37
37
  export declare const handlePasteLinkOnSelectedTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType) => Command;
38
38
  export declare const createPasteMeasurePayload: ({ view, duration, content, distortedDuration, }: {
39
- view: EditorView;
40
- duration: number;
41
39
  content: Array<string>;
42
40
  distortedDuration: boolean;
41
+ duration: number;
42
+ view: EditorView;
43
43
  }) => AnalyticsEventPayload;
44
44
  export declare const getContentNodeTypes: (content: Fragment) => string[];
45
45
  export {};
@@ -8,4 +8,5 @@ import type { Schema } from '@atlaskit/editor-prosemirror/model';
8
8
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
9
9
  import type { PastePlugin } from '../index';
10
10
  export declare const isInsideBlockQuote: (state: EditorState) => boolean;
11
+ export declare function isSharePointUrl(url: string | undefined): boolean;
11
12
  export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory): SafePlugin<import("../pastePluginType").PastePluginState>;
@@ -4,11 +4,11 @@ export declare enum MoveAnalyticPluginTypes {
4
4
  RemoveMovedAction = 1
5
5
  }
6
6
  export type UpdateMovedAction = {
7
- type: MoveAnalyticPluginTypes.UpdateMovedAction;
8
7
  data: ContentMoved;
8
+ type: MoveAnalyticPluginTypes.UpdateMovedAction;
9
9
  };
10
10
  export type RemoveMovedAction = {
11
- type: MoveAnalyticPluginTypes.RemoveMovedAction;
12
11
  data: undefined;
12
+ type: MoveAnalyticPluginTypes.RemoveMovedAction;
13
13
  };
14
14
  export type MoveAnalyticsPluginAction = UpdateMovedAction | RemoveMovedAction;
@@ -1,12 +1,12 @@
1
1
  export type ActionType = 'contentCut' | 'contentPasted';
2
2
  export type NodeName = string;
3
3
  export type ContentMoved = {
4
- nodeName?: NodeName;
5
- size?: number;
6
4
  currentActions: Array<ActionType>;
5
+ hasSelectedMultipleNodes?: boolean;
7
6
  nodeDepth?: number;
7
+ nodeName?: NodeName;
8
8
  nodeTypes?: string;
9
- hasSelectedMultipleNodes?: boolean;
9
+ size?: number;
10
10
  };
11
11
  export type MoveAnalyticsPluginState = {
12
12
  contentMoved: ContentMoved;
@@ -1,10 +1,10 @@
1
1
  import { type Slice } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
3
  interface VSCodeBlockParams {
4
- state: EditorState;
4
+ event: ClipboardEvent;
5
5
  slice: Slice;
6
+ state: EditorState;
6
7
  text: string;
7
- event: ClipboardEvent;
8
8
  }
9
9
  export declare function handleVSCodeBlock({ state, slice, text, event }: VSCodeBlockParams): Slice;
10
10
  export {};
@@ -1,18 +1,18 @@
1
1
  import type { Slice as PMSlice, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
3
  export declare function insertSliceForLists({ tr, slice, schema, }: {
4
- tr: Transaction;
5
- slice: PMSlice;
6
4
  schema: Schema;
5
+ slice: PMSlice;
6
+ tr: Transaction;
7
7
  }): void | Transaction;
8
8
  export declare function insertSliceInsideBlockquote({ tr, slice }: {
9
- tr: Transaction;
10
9
  slice: PMSlice;
10
+ tr: Transaction;
11
11
  }): void;
12
12
  export declare function updateSelectionAfterReplace({ tr }: {
13
13
  tr: Transaction;
14
14
  }): Transaction | undefined;
15
15
  export declare function insertSliceForTaskInsideList({ tr, slice }: {
16
- tr: Transaction;
17
16
  slice: PMSlice;
17
+ tr: Transaction;
18
18
  }): void;
@@ -1,19 +1,19 @@
1
1
  import type { Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
3
  export declare function insertSliceIntoEmptyNode({ tr, slice }: {
4
- tr: Transaction;
5
4
  slice: Slice;
5
+ tr: Transaction;
6
6
  }): void;
7
7
  export declare function insertSliceAtNodeEdge({ tr, slice }: {
8
- tr: Transaction;
9
8
  slice: Slice;
9
+ tr: Transaction;
10
10
  }): void;
11
11
  export declare function insertSliceIntoRangeSelectionInsideList({ tr, slice, }: {
12
- tr: Transaction;
13
12
  slice: Slice;
13
+ tr: Transaction;
14
14
  }): Transaction | undefined;
15
15
  export declare function insertSliceInsideOfPanelNodeSelected(panelNode: PMNode): ({ tr, slice, schema }: {
16
- tr: Transaction;
17
- slice: Slice;
18
16
  schema?: Schema;
17
+ slice: Slice;
18
+ tr: Transaction;
19
19
  }) => void;
@@ -5,8 +5,8 @@ export declare const isPastedFromTinyMCEConfluence: (pasteEvent: ClipboardEvent,
5
5
  * instances.
6
6
  */
7
7
  export declare const wrapWithTable: (html: string) => {
8
- tableWrappedDoc: Document;
9
8
  nonTableWrappedDoc: Document;
9
+ tableWrappedDoc: Document;
10
10
  };
11
11
  /**
12
12
  * Given a DOM document, it will try to rebuild table rows by using the
@@ -5,17 +5,17 @@ export declare enum PastePluginActionTypes {
5
5
  ON_PASTE = "ON_PASTE"
6
6
  }
7
7
  export interface StartTrackingPastedMacroPositions {
8
- type: PastePluginActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS;
9
8
  pastedMacroPositions: {
10
9
  [key: string]: number;
11
10
  };
11
+ type: PastePluginActionTypes.START_TRACKING_PASTED_MACRO_POSITIONS;
12
12
  }
13
13
  export interface OnPaste {
14
- type: PastePluginActionTypes.ON_PASTE;
15
14
  contentPasted: LastContentPasted;
15
+ type: PastePluginActionTypes.ON_PASTE;
16
16
  }
17
17
  export interface StopTrackingPastedMacroPositions {
18
- type: PastePluginActionTypes.STOP_TRACKING_PASTED_MACRO_POSITIONS;
19
18
  pastedMacroPositionKeys: string[];
19
+ type: PastePluginActionTypes.STOP_TRACKING_PASTED_MACRO_POSITIONS;
20
20
  }
21
21
  export type PastePluginAction = StartTrackingPastedMacroPositions | StopTrackingPastedMacroPositions | OnPaste;
@@ -25,7 +25,7 @@ export declare const splitParagraphs: (slice: Slice, schema: Schema) => Slice;
25
25
  * Returns the original paragraph node (as a fragment), or a fragment containing multiple nodes.
26
26
  */
27
27
  export declare const splitIntoParagraphs: ({ fragment, blockMarks, schema, }: {
28
- fragment: Fragment;
29
28
  blockMarks?: readonly Mark[];
29
+ fragment: Fragment;
30
30
  schema: Schema;
31
31
  }) => Fragment;
@@ -12,26 +12,26 @@ import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
12
12
  import type { MentionsPlugin } from '@atlaskit/editor-plugin-mentions';
13
13
  import type { Slice } from '@atlaskit/editor-prosemirror/model';
14
14
  export interface PastePluginState {
15
+ lastContentPasted: LastContentPasted | null;
15
16
  /** map of pasted macro link positions that will to be mapped through incoming transactions */
16
17
  pastedMacroPositions: {
17
18
  [key: string]: number;
18
19
  };
19
- lastContentPasted: LastContentPasted | null;
20
20
  }
21
21
  export type LastContentPasted = {
22
22
  isPlainText: boolean;
23
- text?: string;
24
23
  isShiftPressed: boolean;
25
- pasteStartPos: number;
26
- pasteEndPos: number;
27
- pastedSlice: Slice;
28
24
  pastedAt: number;
25
+ pastedSlice: Slice;
26
+ pasteEndPos: number;
29
27
  pasteSource: PasteSource;
28
+ pasteStartPos: number;
29
+ text?: string;
30
30
  };
31
31
  export type PastePluginOptions = {
32
32
  cardOptions?: CardOptions;
33
- sanitizePrivateContent?: boolean;
34
33
  isFullPage?: boolean;
34
+ sanitizePrivateContent?: boolean;
35
35
  };
36
36
  export type PastePluginDependencies = [
37
37
  OptionalPlugin<FeatureFlagsPlugin>,
@@ -45,8 +45,8 @@ export type PastePluginDependencies = [
45
45
  OptionalPlugin<MentionsPlugin>
46
46
  ];
47
47
  export type PastePlugin = NextEditorPlugin<'paste', {
48
- pluginConfiguration: PastePluginOptions;
49
48
  dependencies: PastePluginDependencies;
49
+ pluginConfiguration: PastePluginOptions;
50
50
  sharedState: {
51
51
  lastContentPasted: LastContentPasted | null;
52
52
  };
@@ -6,12 +6,12 @@ import type { Fragment, Schema, Slice } from '@atlaskit/editor-prosemirror/model
6
6
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
7
7
  import type { PastePlugin } from '../index';
8
8
  type PasteContext = {
9
- type: PasteType;
10
9
  asPlain?: boolean;
11
10
  /** Has the hyperlink been pasted while text is selected, making the text into a link? */
12
11
  hyperlinkPasteOnText?: boolean;
13
12
  /** Did this paste action split a list in half? */
14
13
  pasteSplitList?: boolean;
14
+ type: PasteType;
15
15
  };
16
16
  type GetContentProps = {
17
17
  schema: Schema;
@@ -36,10 +36,10 @@ export declare const handleNestedTablePasteWithAnalytics: (editorAnalyticsAPI: E
36
36
  export declare const handleSelectedTableWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice) => Command;
37
37
  export declare const handlePasteLinkOnSelectedTextWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, event: ClipboardEvent, slice: Slice, type: PasteType) => Command;
38
38
  export declare const createPasteMeasurePayload: ({ view, duration, content, distortedDuration, }: {
39
- view: EditorView;
40
- duration: number;
41
39
  content: Array<string>;
42
40
  distortedDuration: boolean;
41
+ duration: number;
42
+ view: EditorView;
43
43
  }) => AnalyticsEventPayload;
44
44
  export declare const getContentNodeTypes: (content: Fragment) => string[];
45
45
  export {};
@@ -8,4 +8,5 @@ import type { Schema } from '@atlaskit/editor-prosemirror/model';
8
8
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
9
9
  import type { PastePlugin } from '../index';
10
10
  export declare const isInsideBlockQuote: (state: EditorState) => boolean;
11
+ export declare function isSharePointUrl(url: string | undefined): boolean;
11
12
  export declare function createPlugin(schema: Schema, dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, featureFlags: FeatureFlags, pluginInjectionApi: ExtractInjectionAPI<PastePlugin> | undefined, cardOptions?: CardOptions, sanitizePrivateContent?: boolean, providerFactory?: ProviderFactory): SafePlugin<import("../pastePluginType").PastePluginState>;
@@ -4,11 +4,11 @@ export declare enum MoveAnalyticPluginTypes {
4
4
  RemoveMovedAction = 1
5
5
  }
6
6
  export type UpdateMovedAction = {
7
- type: MoveAnalyticPluginTypes.UpdateMovedAction;
8
7
  data: ContentMoved;
8
+ type: MoveAnalyticPluginTypes.UpdateMovedAction;
9
9
  };
10
10
  export type RemoveMovedAction = {
11
- type: MoveAnalyticPluginTypes.RemoveMovedAction;
12
11
  data: undefined;
12
+ type: MoveAnalyticPluginTypes.RemoveMovedAction;
13
13
  };
14
14
  export type MoveAnalyticsPluginAction = UpdateMovedAction | RemoveMovedAction;
@@ -1,12 +1,12 @@
1
1
  export type ActionType = 'contentCut' | 'contentPasted';
2
2
  export type NodeName = string;
3
3
  export type ContentMoved = {
4
- nodeName?: NodeName;
5
- size?: number;
6
4
  currentActions: Array<ActionType>;
5
+ hasSelectedMultipleNodes?: boolean;
7
6
  nodeDepth?: number;
7
+ nodeName?: NodeName;
8
8
  nodeTypes?: string;
9
- hasSelectedMultipleNodes?: boolean;
9
+ size?: number;
10
10
  };
11
11
  export type MoveAnalyticsPluginState = {
12
12
  contentMoved: ContentMoved;
@@ -1,10 +1,10 @@
1
1
  import { type Slice } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
3
  interface VSCodeBlockParams {
4
- state: EditorState;
4
+ event: ClipboardEvent;
5
5
  slice: Slice;
6
+ state: EditorState;
6
7
  text: string;
7
- event: ClipboardEvent;
8
8
  }
9
9
  export declare function handleVSCodeBlock({ state, slice, text, event }: VSCodeBlockParams): Slice;
10
10
  export {};
@@ -1,18 +1,18 @@
1
1
  import type { Slice as PMSlice, Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
3
  export declare function insertSliceForLists({ tr, slice, schema, }: {
4
- tr: Transaction;
5
- slice: PMSlice;
6
4
  schema: Schema;
5
+ slice: PMSlice;
6
+ tr: Transaction;
7
7
  }): void | Transaction;
8
8
  export declare function insertSliceInsideBlockquote({ tr, slice }: {
9
- tr: Transaction;
10
9
  slice: PMSlice;
10
+ tr: Transaction;
11
11
  }): void;
12
12
  export declare function updateSelectionAfterReplace({ tr }: {
13
13
  tr: Transaction;
14
14
  }): Transaction | undefined;
15
15
  export declare function insertSliceForTaskInsideList({ tr, slice }: {
16
- tr: Transaction;
17
16
  slice: PMSlice;
17
+ tr: Transaction;
18
18
  }): void;
@@ -1,19 +1,19 @@
1
1
  import type { Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
3
  export declare function insertSliceIntoEmptyNode({ tr, slice }: {
4
- tr: Transaction;
5
4
  slice: Slice;
5
+ tr: Transaction;
6
6
  }): void;
7
7
  export declare function insertSliceAtNodeEdge({ tr, slice }: {
8
- tr: Transaction;
9
8
  slice: Slice;
9
+ tr: Transaction;
10
10
  }): void;
11
11
  export declare function insertSliceIntoRangeSelectionInsideList({ tr, slice, }: {
12
- tr: Transaction;
13
12
  slice: Slice;
13
+ tr: Transaction;
14
14
  }): Transaction | undefined;
15
15
  export declare function insertSliceInsideOfPanelNodeSelected(panelNode: PMNode): ({ tr, slice, schema }: {
16
- tr: Transaction;
17
- slice: Slice;
18
16
  schema?: Schema;
17
+ slice: Slice;
18
+ tr: Transaction;
19
19
  }) => void;
@@ -5,8 +5,8 @@ export declare const isPastedFromTinyMCEConfluence: (pasteEvent: ClipboardEvent,
5
5
  * instances.
6
6
  */
7
7
  export declare const wrapWithTable: (html: string) => {
8
- tableWrappedDoc: Document;
9
8
  nonTableWrappedDoc: Document;
9
+ tableWrappedDoc: Document;
10
10
  };
11
11
  /**
12
12
  * Given a DOM document, it will try to rebuild table rows by using the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "4.1.7",
3
+ "version": "4.1.9",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -26,33 +26,30 @@
26
26
  },
27
27
  "sideEffects": false,
28
28
  "atlaskit:src": "src/index.ts",
29
- "af:exports": {
30
- ".": "./src/index.ts"
31
- },
32
29
  "dependencies": {
33
- "@atlaskit/adf-schema": "^50.2.1",
30
+ "@atlaskit/adf-schema": "^50.2.3",
34
31
  "@atlaskit/code": "^17.2.0",
35
32
  "@atlaskit/editor-markdown-transformer": "^5.16.0",
36
33
  "@atlaskit/editor-plugin-analytics": "^3.0.0",
37
34
  "@atlaskit/editor-plugin-annotation": "^3.3.0",
38
35
  "@atlaskit/editor-plugin-better-type-history": "^3.0.0",
39
- "@atlaskit/editor-plugin-card": "^7.4.0",
36
+ "@atlaskit/editor-plugin-card": "^7.6.0",
40
37
  "@atlaskit/editor-plugin-feature-flags": "^2.0.0",
41
38
  "@atlaskit/editor-plugin-list": "^5.1.0",
42
- "@atlaskit/editor-plugin-media": "^5.2.0",
39
+ "@atlaskit/editor-plugin-media": "^5.4.0",
43
40
  "@atlaskit/editor-plugin-mentions": "^5.2.0",
44
41
  "@atlaskit/editor-prosemirror": "7.0.0",
45
42
  "@atlaskit/editor-tables": "^2.9.0",
46
43
  "@atlaskit/media-client": "^35.3.0",
47
44
  "@atlaskit/media-common": "^12.3.0",
48
45
  "@atlaskit/platform-feature-flags": "^1.1.0",
49
- "@atlaskit/tmp-editor-statsig": "^11.3.0",
46
+ "@atlaskit/tmp-editor-statsig": "^11.9.0",
50
47
  "@babel/runtime": "^7.0.0",
51
48
  "lodash": "^4.17.21",
52
49
  "uuid": "^3.1.0"
53
50
  },
54
51
  "peerDependencies": {
55
- "@atlaskit/editor-common": "^107.26.0",
52
+ "@atlaskit/editor-common": "^107.33.0",
56
53
  "react": "^18.2.0",
57
54
  "react-dom": "^18.2.0"
58
55
  },
@@ -62,7 +59,6 @@
62
59
  "@atlaskit/editor-plugin-history": "^3.1.0",
63
60
  "@atlaskit/editor-plugin-type-ahead": "^3.1.0",
64
61
  "@atlaskit/ssr": "workspace:^",
65
- "@atlaskit/visual-regression": "workspace:^",
66
62
  "@testing-library/react": "^13.4.0",
67
63
  "wait-for-expect": "^1.2.0"
68
64
  },
@@ -120,6 +116,9 @@
120
116
  },
121
117
  "platform_editor_paste_code_block_do_not_escape": {
122
118
  "type": "boolean"
119
+ },
120
+ "platform_editor_sharepoint_url_smart_card_fallback": {
121
+ "type": "boolean"
123
122
  }
124
123
  }
125
124
  }