@atlaskit/editor-plugin-paste 16.0.1 → 16.0.3

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,20 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 16.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`285e872c16221`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/285e872c16221) -
8
+ Fix bare URL pastes under the platform_editor_paste_as_md_use_gfm experiment so Smart Links
9
+ resolve again, gated by the platform_editor_gfm_link_paste_fix experiment.
10
+ - Updated dependencies
11
+
12
+ ## 16.0.2
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 16.0.1
4
19
 
5
20
  ### Patch Changes
@@ -27,6 +27,7 @@ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
27
27
  var _utils3 = require("@atlaskit/editor-tables/utils");
28
28
  var _insm = require("@atlaskit/insm");
29
29
  var _mediaCommon = require("@atlaskit/media-common");
30
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
30
31
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
31
32
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
32
33
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
@@ -92,7 +93,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
92
93
  var atlassianMarkDownParser = new _editorMarkdownTransformer.MarkdownTransformer(schema, _paste.md);
93
94
  function getMarkdownSlice(text, openStart, openEnd) {
94
95
  if (markdownToPmConverter && (0, _expValEquals.expValEquals)('platform_editor_paste_as_md_use_gfm', 'isEnabled', true)) {
95
- return (0, _getMarkdownSlice.getMarkdownSliceViaGfm)(text, schema, openStart, openEnd, markdownToPmConverter);
96
+ return (0, _getMarkdownSlice.getMarkdownSliceViaGfm)(text, schema, openStart, openEnd, markdownToPmConverter, (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_gfm_link_paste_fix'));
96
97
  }
97
98
  var escapedTextInput = (0, _util.escapeBackslashAndLinksExceptCodeBlock)(text);
98
99
  var doc = atlassianMarkDownParser.parse(escapedTextInput);
@@ -15,13 +15,14 @@ var _index = require("./index");
15
15
  * throws or produces an empty document — the caller will propagate `undefined`
16
16
  * without falling back to the legacy MarkdownTransformer.
17
17
  */
18
- function getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter) {
19
- // GFM parsers (e.g. markdownToAdf) natively recognise raw URLs as autolinks per
20
- // the CommonMark spec — they do not need the `<url>` angle-bracket wrapping that
21
- // the legacy MarkdownTransformer requires. Passing skipLinkEscaping: true avoids
22
- // double-processing URLs and lets the GFM parser handle them correctly.
18
+ function getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter, wrapBareUrls) {
19
+ // 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.
23
24
  var escapedTextInput = (0, _index.escapeBackslashAndLinksExceptCodeBlock)(text, {
24
- skipLinkEscaping: true
25
+ skipLinkEscaping: !wrapBareUrls
25
26
  });
26
27
  try {
27
28
  var doc = schema.nodes.doc.createAndFill({}, markdownToPmConverter({
@@ -17,6 +17,7 @@ import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/util
17
17
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
18
18
  import { insm } from '@atlaskit/insm';
19
19
  import { extractClientIdsFromHtml } from '@atlaskit/media-common';
20
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
20
21
  import { fg } from '@atlaskit/platform-feature-flags';
21
22
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
22
23
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
@@ -81,7 +82,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
81
82
  const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
82
83
  function getMarkdownSlice(text, openStart, openEnd) {
83
84
  if (markdownToPmConverter && expValEquals('platform_editor_paste_as_md_use_gfm', 'isEnabled', true)) {
84
- return getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter);
85
+ return getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter, isExperimentEnabled('platform_editor_gfm_link_paste_fix'));
85
86
  }
86
87
  const escapedTextInput = escapeBackslashAndLinksExceptCodeBlock(text);
87
88
  const doc = atlassianMarkDownParser.parse(escapedTextInput);
@@ -10,13 +10,14 @@ import { escapeBackslashAndLinksExceptCodeBlock } from './index';
10
10
  * throws or produces an empty document — the caller will propagate `undefined`
11
11
  * without falling back to the legacy MarkdownTransformer.
12
12
  */
13
- export function getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter) {
14
- // GFM parsers (e.g. markdownToAdf) natively recognise raw URLs as autolinks per
15
- // the CommonMark spec — they do not need the `<url>` angle-bracket wrapping that
16
- // the legacy MarkdownTransformer requires. Passing skipLinkEscaping: true avoids
17
- // double-processing URLs and lets the GFM parser handle them correctly.
13
+ export function getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter, wrapBareUrls) {
14
+ // 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.
18
19
  const escapedTextInput = escapeBackslashAndLinksExceptCodeBlock(text, {
19
- skipLinkEscaping: true
20
+ skipLinkEscaping: !wrapBareUrls
20
21
  });
21
22
  try {
22
23
  const doc = schema.nodes.doc.createAndFill({}, markdownToPmConverter({
@@ -22,6 +22,7 @@ import { contains, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/util
22
22
  import { handlePaste as handlePasteTable } from '@atlaskit/editor-tables/utils';
23
23
  import { insm } from '@atlaskit/insm';
24
24
  import { extractClientIdsFromHtml } from '@atlaskit/media-common';
25
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
25
26
  import { fg } from '@atlaskit/platform-feature-flags';
26
27
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
27
28
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
@@ -84,7 +85,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
84
85
  var atlassianMarkDownParser = new MarkdownTransformer(schema, md);
85
86
  function getMarkdownSlice(text, openStart, openEnd) {
86
87
  if (markdownToPmConverter && expValEquals('platform_editor_paste_as_md_use_gfm', 'isEnabled', true)) {
87
- return getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter);
88
+ return getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter, isExperimentEnabled('platform_editor_gfm_link_paste_fix'));
88
89
  }
89
90
  var escapedTextInput = escapeBackslashAndLinksExceptCodeBlock(text);
90
91
  var doc = atlassianMarkDownParser.parse(escapedTextInput);
@@ -10,13 +10,14 @@ import { escapeBackslashAndLinksExceptCodeBlock } from './index';
10
10
  * throws or produces an empty document — the caller will propagate `undefined`
11
11
  * without falling back to the legacy MarkdownTransformer.
12
12
  */
13
- export function getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter) {
14
- // GFM parsers (e.g. markdownToAdf) natively recognise raw URLs as autolinks per
15
- // the CommonMark spec — they do not need the `<url>` angle-bracket wrapping that
16
- // the legacy MarkdownTransformer requires. Passing skipLinkEscaping: true avoids
17
- // double-processing URLs and lets the GFM parser handle them correctly.
13
+ export function getMarkdownSliceViaGfm(text, schema, openStart, openEnd, markdownToPmConverter, wrapBareUrls) {
14
+ // 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.
18
19
  var escapedTextInput = escapeBackslashAndLinksExceptCodeBlock(text, {
19
- skipLinkEscaping: true
20
+ skipLinkEscaping: !wrapBareUrls
20
21
  });
21
22
  try {
22
23
  var doc = schema.nodes.doc.createAndFill({}, markdownToPmConverter({
@@ -11,4 +11,4 @@ import { Slice } from '@atlaskit/editor-prosemirror/model';
11
11
  export declare function getMarkdownSliceViaGfm(text: string, schema: Schema, openStart: number, openEnd: number, markdownToPmConverter: (params: {
12
12
  markdown: string;
13
13
  schema: Schema;
14
- }) => Fragment): Slice | undefined;
14
+ }) => Fragment, wrapBareUrls: boolean): Slice | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "16.0.1",
3
+ "version": "16.0.3",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,14 +42,14 @@
42
42
  "@atlaskit/platform-feature-experiments": "^0.3.0",
43
43
  "@atlaskit/platform-feature-flags": "^2.1.0",
44
44
  "@atlaskit/prosemirror-history": "^1.1.0",
45
- "@atlaskit/tmp-editor-statsig": "^147.1.0",
45
+ "@atlaskit/tmp-editor-statsig": "^148.0.0",
46
46
  "@atlaskit/tokens": "^16.7.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "lodash": "^4.17.21",
49
49
  "uuid": "^3.1.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "@atlaskit/editor-common": "^119.4.0",
52
+ "@atlaskit/editor-common": "^119.5.0",
53
53
  "react": "^18.2.0 || ^19.2.0",
54
54
  "react-dom": "^18.2.0 || ^19.2.0",
55
55
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"