@atlaskit/editor-plugin-paste 1.14.0 → 1.14.2

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,23 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 1.14.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#152510](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152510)
8
+ [`dcf9edde7ac7b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dcf9edde7ac7b) -
9
+ bump adf-schema to 42.0.1
10
+ - Updated dependencies
11
+
12
+ ## 1.14.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [#149098](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/149098)
17
+ [`77093dd953b01`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/77093dd953b01) -
18
+ [ux] Fix bug where bullet list content that contains numbered items could not be pasted.
19
+ - Updated dependencies
20
+
3
21
  ## 1.14.0
4
22
 
5
23
  ### Minor Changes
@@ -11,6 +11,7 @@ var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _commands = require("@atlaskit/editor-prosemirror/commands");
12
12
  var _model = require("@atlaskit/editor-prosemirror/model");
13
13
  var _state = require("@atlaskit/editor-prosemirror/state");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
15
  var _actions = require("./actions");
15
16
  var _pluginFactory = require("./pm-plugins/plugin-factory");
16
17
  /**
@@ -45,6 +46,9 @@ var stopTrackingPastedMacroPositions = exports.stopTrackingPastedMacroPositions
45
46
  // matchers for text lists
46
47
  var bullets = /^\s*[\*\-\u2022](\s+|\s+$)/;
47
48
  var numbers = /^\s*\d[\.\)](\s+|$)/;
49
+ var isListItem = function isListItem(node, schema) {
50
+ return Boolean(node && node.type === schema.nodes.listItem);
51
+ };
48
52
  var getListType = function getListType(node, schema) {
49
53
  if (!node || !node.text) {
50
54
  return null;
@@ -125,7 +129,10 @@ var extractListFromParagraph = exports.extractListFromParagraph = function extra
125
129
  }
126
130
  listMatch = getListType(line[1], schema);
127
131
  }
128
- if (!listMatch) {
132
+ if (!listMatch ||
133
+ // CONFCLOUD-79708: If we are inside a list - let's not try to upgrade list as it resolves
134
+ // to invalid content
135
+ isListItem(parent, schema) && (0, _platformFeatureFlags.fg)('platform_editor_escape_formatting_for_nested_list')) {
129
136
  // if there is not list match return as is
130
137
  paragraphParts.push(line);
131
138
  continue;
@@ -2,6 +2,7 @@ import { isListNode, mapChildren, mapSlice } from '@atlaskit/editor-common/utils
2
2
  import { autoJoin } from '@atlaskit/editor-prosemirror/commands';
3
3
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
4
4
  import { EditorState } from '@atlaskit/editor-prosemirror/state';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { PastePluginActionTypes as ActionTypes } from './actions';
6
7
  import { createCommand } from './pm-plugins/plugin-factory';
7
8
 
@@ -33,6 +34,9 @@ export const stopTrackingPastedMacroPositions = pastedMacroPositionKeys => creat
33
34
  // matchers for text lists
34
35
  const bullets = /^\s*[\*\-\u2022](\s+|\s+$)/;
35
36
  const numbers = /^\s*\d[\.\)](\s+|$)/;
37
+ const isListItem = (node, schema) => {
38
+ return Boolean(node && node.type === schema.nodes.listItem);
39
+ };
36
40
  const getListType = (node, schema) => {
37
41
  if (!node || !node.text) {
38
42
  return null;
@@ -113,7 +117,10 @@ export const extractListFromParagraph = (node, parent, schema) => {
113
117
  }
114
118
  listMatch = getListType(line[1], schema);
115
119
  }
116
- if (!listMatch) {
120
+ if (!listMatch ||
121
+ // CONFCLOUD-79708: If we are inside a list - let's not try to upgrade list as it resolves
122
+ // to invalid content
123
+ isListItem(parent, schema) && fg('platform_editor_escape_formatting_for_nested_list')) {
117
124
  // if there is not list match return as is
118
125
  paragraphParts.push(line);
119
126
  continue;
@@ -4,6 +4,7 @@ import { isListNode, mapChildren, mapSlice } from '@atlaskit/editor-common/utils
4
4
  import { autoJoin } from '@atlaskit/editor-prosemirror/commands';
5
5
  import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
6
6
  import { EditorState } from '@atlaskit/editor-prosemirror/state';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { PastePluginActionTypes as ActionTypes } from './actions';
8
9
  import { createCommand } from './pm-plugins/plugin-factory';
9
10
 
@@ -39,6 +40,9 @@ export var stopTrackingPastedMacroPositions = function stopTrackingPastedMacroPo
39
40
  // matchers for text lists
40
41
  var bullets = /^\s*[\*\-\u2022](\s+|\s+$)/;
41
42
  var numbers = /^\s*\d[\.\)](\s+|$)/;
43
+ var isListItem = function isListItem(node, schema) {
44
+ return Boolean(node && node.type === schema.nodes.listItem);
45
+ };
42
46
  var getListType = function getListType(node, schema) {
43
47
  if (!node || !node.text) {
44
48
  return null;
@@ -119,7 +123,10 @@ export var extractListFromParagraph = function extractListFromParagraph(node, pa
119
123
  }
120
124
  listMatch = getListType(line[1], schema);
121
125
  }
122
- if (!listMatch) {
126
+ if (!listMatch ||
127
+ // CONFCLOUD-79708: If we are inside a list - let's not try to upgrade list as it resolves
128
+ // to invalid content
129
+ isListItem(parent, schema) && fg('platform_editor_escape_formatting_for_nested_list')) {
123
130
  // if there is not list match return as is
124
131
  paragraphParts.push(line);
125
132
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "1.14.0",
3
+ "version": "1.14.2",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,20 +31,20 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^93.3.0",
34
+ "@atlaskit/editor-common": "^93.5.0",
35
35
  "@atlaskit/editor-markdown-transformer": "^5.13.0",
36
- "@atlaskit/editor-plugin-analytics": "^1.9.0",
37
- "@atlaskit/editor-plugin-annotation": "^1.20.0",
36
+ "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
+ "@atlaskit/editor-plugin-annotation": "^1.21.0",
38
38
  "@atlaskit/editor-plugin-better-type-history": "^1.9.0",
39
39
  "@atlaskit/editor-plugin-card": "^4.3.0",
40
40
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
41
41
  "@atlaskit/editor-plugin-list": "^3.9.0",
42
- "@atlaskit/editor-plugin-media": "^1.35.0",
43
- "@atlaskit/editor-plugin-mentions": "^2.8.0",
42
+ "@atlaskit/editor-plugin-media": "^1.36.0",
43
+ "@atlaskit/editor-plugin-mentions": "^2.9.0",
44
44
  "@atlaskit/editor-prosemirror": "6.0.0",
45
45
  "@atlaskit/editor-tables": "^2.8.0",
46
46
  "@atlaskit/media-client": "^28.0.0",
47
- "@atlaskit/media-common": "^11.5.0",
47
+ "@atlaskit/media-common": "^11.6.0",
48
48
  "@atlaskit/platform-feature-flags": "^0.3.0",
49
49
  "@atlaskit/tmp-editor-statsig": "*",
50
50
  "@babel/runtime": "^7.0.0",
@@ -56,10 +56,10 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@af/visual-regression": "*",
59
- "@atlaskit/adf-schema": "^40.9.4",
59
+ "@atlaskit/adf-schema": "^42.0.2",
60
60
  "@atlaskit/editor-plugin-block-type": "^3.16.0",
61
61
  "@atlaskit/editor-plugin-history": "^1.3.0",
62
- "@atlaskit/editor-plugin-type-ahead": "^1.9.0",
62
+ "@atlaskit/editor-plugin-type-ahead": "^1.10.0",
63
63
  "@atlaskit/ssr": "*",
64
64
  "@atlaskit/visual-regression": "*",
65
65
  "@testing-library/react": "^12.1.5",
@@ -123,6 +123,9 @@
123
123
  },
124
124
  "editor_nest_media_and_codeblock_in_quotes_jira": {
125
125
  "type": "boolean"
126
+ },
127
+ "platform_editor_escape_formatting_for_nested_list": {
128
+ "type": "boolean"
126
129
  }
127
130
  }
128
131
  }