@atlaskit/editor-plugin-paste 30.0.4 → 31.0.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 31.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [`c135881c26871`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c135881c26871) -
8
+ Clean up experiment `platform_editor_paste_as_md_use_gfm`
9
+ - Updated dependencies
10
+
11
+ ## 30.0.5
12
+
13
+ ### Patch Changes
14
+
15
+ - [`ca7b9d268d51a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ca7b9d268d51a) -
16
+ Clean up platform_editor_gfm_link_paste_fix, retaining bare URL link detection during GFM markdown
17
+ paste.
18
+
3
19
  ## 30.0.4
4
20
 
5
21
  ### Patch Changes
@@ -36,7 +36,6 @@ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
36
36
  var _handlePaste = require("@atlaskit/editor-tables/utils/handle-paste");
37
37
  var _api = require("@atlaskit/insm/api");
38
38
  var _clientIdCache = require("@atlaskit/media-common/clientIdCache");
39
- var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
40
39
  var _fg = require("@atlaskit/platform-feature-flags/fg");
41
40
  var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
42
41
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
@@ -101,8 +100,8 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
101
100
  var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
102
101
  var atlassianMarkDownParser = new _editorMarkdownTransformer.MarkdownTransformer(schema, _md.md);
103
102
  function getMarkdownSlice(text, openStart, openEnd) {
104
- if (markdownToPmConverter && (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_paste_as_md_use_gfm')) {
105
- return (0, _getMarkdownSlice.getMarkdownSliceViaGfm)(text, schema, openStart, openEnd, markdownToPmConverter, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_gfm_link_paste_fix'));
103
+ if (markdownToPmConverter) {
104
+ return (0, _getMarkdownSlice.getMarkdownSliceViaGfm)(text, schema, openStart, openEnd, markdownToPmConverter);
106
105
  }
107
106
  var escapedTextInput = (0, _util.escapeBackslashAndLinksExceptCodeBlock)(text);
108
107
  var doc = atlassianMarkDownParser.parse(escapedTextInput);
@@ -10,20 +10,16 @@ var _index = require("./index");
10
10
  /**
11
11
  * Convert plain-text markdown to a ProseMirror Slice using the GFM converter.
12
12
  *
13
- * Only called when `platform_editor_paste_as_md_use_gfm` is enabled AND a
14
- * `markdownToPmConverter` is provided. Returns `undefined` if the converter
13
+ * Only called when a `markdownToPmConverter` is provided. Returns `undefined` if the converter
15
14
  * throws or produces an empty document — the caller will propagate `undefined`
16
15
  * without falling back to the legacy MarkdownTransformer.
17
16
  */
18
- function getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter, wrapBareUrls) {
17
+ function getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter) {
19
18
  // The injected GFM converter enables tables, task lists, and strikethrough
20
- // individually, but does not enable the GFM autolink-literal extension. In
21
- // the treatment, wrap bare URLs in CommonMark autolink syntax so the card
22
- // plugin receives a link mark to resolve. Preserve the current behavior in
23
- // control while the fix rolls out.
24
- var escapedTextInput = (0, _index.escapeBackslashAndLinksExceptCodeBlock)(text, {
25
- skipLinkEscaping: !wrapBareUrls
26
- });
19
+ // individually, but does not enable the GFM autolink-literal extension.
20
+ // Wrap bare URLs in CommonMark autolink syntax so the card plugin receives
21
+ // a link mark to resolve.
22
+ var escapedTextInput = (0, _index.escapeBackslashAndLinksExceptCodeBlock)(text);
27
23
  try {
28
24
  var doc = schema.nodes.doc.createAndFill({}, markdownToPmConverter({
29
25
  markdown: escapedTextInput,
@@ -26,7 +26,6 @@ import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/util
26
26
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils/handle-paste';
27
27
  import { insm } from '@atlaskit/insm/api';
28
28
  import { extractClientIdsFromHtml } from '@atlaskit/media-common/clientIdCache';
29
- import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
30
29
  import { fg } from '@atlaskit/platform-feature-flags/fg';
31
30
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
32
31
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -90,8 +89,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
90
89
  const editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
91
90
  const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
92
91
  function getMarkdownSlice(text, openStart, openEnd) {
93
- if (markdownToPmConverter && isExperimentEnabled('platform_editor_paste_as_md_use_gfm')) {
94
- return getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter, isExperimentEnabled('platform_editor_gfm_link_paste_fix'));
92
+ if (markdownToPmConverter) {
93
+ return getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter);
95
94
  }
96
95
  const escapedTextInput = escapeBackslashAndLinksExceptCodeBlock(text);
97
96
  const doc = atlassianMarkDownParser.parse(escapedTextInput);
@@ -5,20 +5,16 @@ import { escapeBackslashAndLinksExceptCodeBlock } from './index';
5
5
  /**
6
6
  * Convert plain-text markdown to a ProseMirror Slice using the GFM converter.
7
7
  *
8
- * Only called when `platform_editor_paste_as_md_use_gfm` is enabled AND a
9
- * `markdownToPmConverter` is provided. Returns `undefined` if the converter
8
+ * Only called when a `markdownToPmConverter` is provided. Returns `undefined` if the converter
10
9
  * throws or produces an empty document — the caller will propagate `undefined`
11
10
  * without falling back to the legacy MarkdownTransformer.
12
11
  */
13
- export function getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter, wrapBareUrls) {
12
+ export function getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter) {
14
13
  // The injected GFM converter enables tables, task lists, and strikethrough
15
- // individually, but does not enable the GFM autolink-literal extension. In
16
- // the treatment, wrap bare URLs in CommonMark autolink syntax so the card
17
- // plugin receives a link mark to resolve. Preserve the current behavior in
18
- // control while the fix rolls out.
19
- const escapedTextInput = escapeBackslashAndLinksExceptCodeBlock(text, {
20
- skipLinkEscaping: !wrapBareUrls
21
- });
14
+ // individually, but does not enable the GFM autolink-literal extension.
15
+ // Wrap bare URLs in CommonMark autolink syntax so the card plugin receives
16
+ // a link mark to resolve.
17
+ const escapedTextInput = escapeBackslashAndLinksExceptCodeBlock(text);
22
18
  try {
23
19
  const doc = schema.nodes.doc.createAndFill({}, markdownToPmConverter({
24
20
  markdown: escapedTextInput,
@@ -31,7 +31,6 @@ import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/util
31
31
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils/handle-paste';
32
32
  import { insm } from '@atlaskit/insm/api';
33
33
  import { extractClientIdsFromHtml } from '@atlaskit/media-common/clientIdCache';
34
- import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
35
34
  import { fg } from '@atlaskit/platform-feature-flags/fg';
36
35
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
37
36
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
@@ -93,8 +92,8 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
93
92
  var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
94
93
  var atlassianMarkDownParser = new MarkdownTransformer(schema, md);
95
94
  function getMarkdownSlice(text, openStart, openEnd) {
96
- if (markdownToPmConverter && isExperimentEnabled('platform_editor_paste_as_md_use_gfm')) {
97
- return getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter, isExperimentEnabled('platform_editor_gfm_link_paste_fix'));
95
+ if (markdownToPmConverter) {
96
+ return getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter);
98
97
  }
99
98
  var escapedTextInput = escapeBackslashAndLinksExceptCodeBlock(text);
100
99
  var doc = atlassianMarkDownParser.parse(escapedTextInput);
@@ -5,20 +5,16 @@ import { escapeBackslashAndLinksExceptCodeBlock } from './index';
5
5
  /**
6
6
  * Convert plain-text markdown to a ProseMirror Slice using the GFM converter.
7
7
  *
8
- * Only called when `platform_editor_paste_as_md_use_gfm` is enabled AND a
9
- * `markdownToPmConverter` is provided. Returns `undefined` if the converter
8
+ * Only called when a `markdownToPmConverter` is provided. Returns `undefined` if the converter
10
9
  * throws or produces an empty document — the caller will propagate `undefined`
11
10
  * without falling back to the legacy MarkdownTransformer.
12
11
  */
13
- export function getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter, wrapBareUrls) {
12
+ export function getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter) {
14
13
  // The injected GFM converter enables tables, task lists, and strikethrough
15
- // individually, but does not enable the GFM autolink-literal extension. In
16
- // the treatment, wrap bare URLs in CommonMark autolink syntax so the card
17
- // plugin receives a link mark to resolve. Preserve the current behavior in
18
- // control while the fix rolls out.
19
- var escapedTextInput = escapeBackslashAndLinksExceptCodeBlock(text, {
20
- skipLinkEscaping: !wrapBareUrls
21
- });
14
+ // individually, but does not enable the GFM autolink-literal extension.
15
+ // Wrap bare URLs in CommonMark autolink syntax so the card plugin receives
16
+ // a link mark to resolve.
17
+ var escapedTextInput = escapeBackslashAndLinksExceptCodeBlock(text);
22
18
  try {
23
19
  var doc = schema.nodes.doc.createAndFill({}, markdownToPmConverter({
24
20
  markdown: escapedTextInput,
@@ -72,8 +72,7 @@ export type PastePluginOptions = {
72
72
  isFullPage?: boolean;
73
73
  /**
74
74
  * Optional markdown → ProseMirror fragment converter used for plain-text
75
- * Cmd+V paste when `platform_editor_paste_as_md_use_gfm` is enabled.
76
- * When omitted or the experiment is off, the legacy MarkdownTransformer is used.
75
+ * Cmd+V paste. When omitted, the legacy MarkdownTransformer is used.
77
76
  */
78
77
  markdownToPmConverter?: MarkdownToPmConverter;
79
78
  pasteWarningOptions?: PasteWarningOptions;
@@ -3,12 +3,11 @@ import { Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  /**
4
4
  * Convert plain-text markdown to a ProseMirror Slice using the GFM converter.
5
5
  *
6
- * Only called when `platform_editor_paste_as_md_use_gfm` is enabled AND a
7
- * `markdownToPmConverter` is provided. Returns `undefined` if the converter
6
+ * Only called when a `markdownToPmConverter` is provided. Returns `undefined` if the converter
8
7
  * throws or produces an empty document — the caller will propagate `undefined`
9
8
  * without falling back to the legacy MarkdownTransformer.
10
9
  */
11
10
  export declare function getMarkdownSliceViaGfm(text: string, schema: Schema, openStart: number, openEnd: number, markdownToPmConverter: (params: {
12
11
  markdown: string;
13
12
  schema: Schema;
14
- }) => Fragment, wrapBareUrls: boolean): Slice | undefined;
13
+ }) => Fragment): Slice | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "30.0.4",
3
+ "version": "31.0.0",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -23,35 +23,35 @@
23
23
  "@atlaskit/adf-utils": "^20.9.0",
24
24
  "@atlaskit/code": "^20.0.0",
25
25
  "@atlaskit/editor-markdown-transformer": "^6.3.0",
26
- "@atlaskit/editor-plugin-analytics": "^29.0.0",
27
- "@atlaskit/editor-plugin-annotation": "^29.0.0",
28
- "@atlaskit/editor-plugin-better-type-history": "^29.0.0",
29
- "@atlaskit/editor-plugin-card": "^35.1.0",
30
- "@atlaskit/editor-plugin-expand": "^30.0.0",
31
- "@atlaskit/editor-plugin-extension": "^32.0.0",
32
- "@atlaskit/editor-plugin-feature-flags": "^28.0.0",
33
- "@atlaskit/editor-plugin-list": "^31.0.0",
34
- "@atlaskit/editor-plugin-media": "^31.0.0",
35
- "@atlaskit/editor-plugin-mentions": "^31.0.0",
26
+ "@atlaskit/editor-plugin-analytics": "^30.0.0",
27
+ "@atlaskit/editor-plugin-annotation": "^30.0.0",
28
+ "@atlaskit/editor-plugin-better-type-history": "^30.0.0",
29
+ "@atlaskit/editor-plugin-card": "^36.0.0",
30
+ "@atlaskit/editor-plugin-expand": "^31.0.0",
31
+ "@atlaskit/editor-plugin-extension": "^33.0.0",
32
+ "@atlaskit/editor-plugin-feature-flags": "^29.0.0",
33
+ "@atlaskit/editor-plugin-list": "^32.0.0",
34
+ "@atlaskit/editor-plugin-media": "^32.0.0",
35
+ "@atlaskit/editor-plugin-mentions": "^32.0.0",
36
36
  "@atlaskit/editor-prosemirror": "^9.0.0",
37
37
  "@atlaskit/editor-tables": "^3.2.0",
38
38
  "@atlaskit/flag": "^19.0.0",
39
39
  "@atlaskit/icon": "^38.0.0",
40
40
  "@atlaskit/insm": "^3.0.0",
41
41
  "@atlaskit/linking-common": "^13.0.0",
42
- "@atlaskit/media-client": "^39.2.0",
42
+ "@atlaskit/media-client": "^39.3.0",
43
43
  "@atlaskit/media-common": "^14.7.0",
44
44
  "@atlaskit/platform-feature-experiments": "^0.3.0",
45
45
  "@atlaskit/platform-feature-flags": "^2.2.0",
46
46
  "@atlaskit/prosemirror-history": "^1.3.0",
47
- "@atlaskit/tmp-editor-statsig": "^246.0.0",
48
- "@atlaskit/tokens": "^20.7.0",
47
+ "@atlaskit/tmp-editor-statsig": "^246.1.0",
48
+ "@atlaskit/tokens": "^20.8.0",
49
49
  "@babel/runtime": "^7.0.0",
50
50
  "lodash": "^4.17.21",
51
51
  "uuid": "^11.1.1"
52
52
  },
53
53
  "peerDependencies": {
54
- "@atlaskit/editor-common": "^133.6.0",
54
+ "@atlaskit/editor-common": "^134.0.0",
55
55
  "react": "^18.2.0 || ^19.2.0",
56
56
  "react-dom": "^18.2.0 || ^19.2.0",
57
57
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"