@atlaskit/editor-plugin-paste 1.5.6 → 1.5.7

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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 1.5.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#122612](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/122612)
8
+ [`01a85ce0a88ec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/01a85ce0a88ec) -
9
+ [ux] ED-23705 Add logic to handle annotations on inline nodes when they are inserted or pasted.
10
+ Covers the following inline nodes: emoji, status, mention, date, inlineCard
11
+
3
12
  ## 1.5.6
4
13
 
5
14
  ### Patch Changes
@@ -27,6 +27,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
27
27
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
28
28
  var _utils3 = require("@atlaskit/editor-tables/utils");
29
29
  var _mediaClient = require("@atlaskit/media-client");
30
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
30
31
  function isPastedFromWord(html) {
31
32
  return !!html && html.indexOf('urn:schemas-microsoft-com:office:word') >= 0;
32
33
  }
@@ -117,6 +118,14 @@ function applyTextMarksToSlice(schema, marks) {
117
118
  }))).sort((0, _legacyRankPlugins.sortByOrderWithTypeName)('marks'));
118
119
  return false;
119
120
  }
121
+ if ((0, _platformFeatureFlags.fg)('editor_inline_comments_paste_insert_nodes')) {
122
+ if (node.isInline && ['inlineCard', 'emoji', 'status', 'date', 'mention'].includes(node.type.name) && parent && parent.isBlock) {
123
+ // @ts-ignore - [unblock prosemirror bump] assigning to readonly prop
124
+ node.marks = [].concat((0, _toConsumableArray2.default)(node.marks), (0, _toConsumableArray2.default)(parent.type.allowedMarks(marks).filter(function (mark) {
125
+ return mark.type === schema.marks.annotation;
126
+ })));
127
+ }
128
+ }
120
129
  return true;
121
130
  });
122
131
  return sliceCopy;
@@ -6,6 +6,7 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
6
6
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
7
7
  import { getSelectedTableInfo, isTableSelected } from '@atlaskit/editor-tables/utils';
8
8
  import { isMediaBlobUrl } from '@atlaskit/media-client';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
  export function isPastedFromWord(html) {
10
11
  return !!html && html.indexOf('urn:schemas-microsoft-com:office:word') >= 0;
11
12
  }
@@ -98,6 +99,12 @@ export function applyTextMarksToSlice(schema, marks) {
98
99
  ...parent.type.allowedMarks(marks).filter(mark => mark.type !== linkMark)].sort(sortByOrderWithTypeName('marks'));
99
100
  return false;
100
101
  }
102
+ if (fg('editor_inline_comments_paste_insert_nodes')) {
103
+ if (node.isInline && ['inlineCard', 'emoji', 'status', 'date', 'mention'].includes(node.type.name) && parent && parent.isBlock) {
104
+ // @ts-ignore - [unblock prosemirror bump] assigning to readonly prop
105
+ node.marks = [...node.marks, ...parent.type.allowedMarks(marks).filter(mark => mark.type === schema.marks.annotation)];
106
+ }
107
+ }
101
108
  return true;
102
109
  });
103
110
  return sliceCopy;
@@ -7,6 +7,7 @@ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state
7
7
  import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
8
8
  import { getSelectedTableInfo, isTableSelected } from '@atlaskit/editor-tables/utils';
9
9
  import { isMediaBlobUrl } from '@atlaskit/media-client';
10
+ import { fg } from '@atlaskit/platform-feature-flags';
10
11
  export function isPastedFromWord(html) {
11
12
  return !!html && html.indexOf('urn:schemas-microsoft-com:office:word') >= 0;
12
13
  }
@@ -97,6 +98,14 @@ export function applyTextMarksToSlice(schema, marks) {
97
98
  }))).sort(sortByOrderWithTypeName('marks'));
98
99
  return false;
99
100
  }
101
+ if (fg('editor_inline_comments_paste_insert_nodes')) {
102
+ if (node.isInline && ['inlineCard', 'emoji', 'status', 'date', 'mention'].includes(node.type.name) && parent && parent.isBlock) {
103
+ // @ts-ignore - [unblock prosemirror bump] assigning to readonly prop
104
+ node.marks = [].concat(_toConsumableArray(node.marks), _toConsumableArray(parent.type.allowedMarks(marks).filter(function (mark) {
105
+ return mark.type === schema.marks.annotation;
106
+ })));
107
+ }
108
+ }
100
109
  return true;
101
110
  });
102
111
  return sliceCopy;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^86.2.0",
36
+ "@atlaskit/editor-common": "^86.4.0",
37
37
  "@atlaskit/editor-markdown-transformer": "^5.8.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^1.4.0",
39
39
  "@atlaskit/editor-plugin-annotation": "^1.15.0",
@@ -130,6 +130,9 @@
130
130
  },
131
131
  "platform.editor.preserve-whitespace-clipboard-text-serialization": {
132
132
  "type": "boolean"
133
+ },
134
+ "editor_inline_comments_paste_insert_nodes": {
135
+ "type": "boolean"
133
136
  }
134
137
  }
135
138
  }