@atlaskit/editor-plugin-paste 16.0.2 → 16.0.4

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,38 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 16.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`76e9f6152bf16`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/76e9f6152bf16) -
8
+ Enable launched synced block integrations and remove obsolete experiment scaffolding.
9
+
10
+ BREAKING: `@atlaskit/tmp-editor-statsig` no longer defines the `platform_synced_block` editor
11
+ experiment. Consumers that use `editorExperiment('platform_synced_block', ...)` to conditionally
12
+ enable synced-block integrations will no longer be able to look up that experiment; synced-block
13
+ integrations are now enabled by default. Remove each lookup and its conditional branch:
14
+
15
+ ```ts
16
+ // Before
17
+ if (editorExperiment('platform_synced_block', true)) {
18
+ enableSyncedBlocks();
19
+ }
20
+
21
+ // After
22
+ enableSyncedBlocks();
23
+ ```
24
+
25
+ - Updated dependencies
26
+
27
+ ## 16.0.3
28
+
29
+ ### Patch Changes
30
+
31
+ - [`285e872c16221`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/285e872c16221) -
32
+ Fix bare URL pastes under the platform_editor_paste_as_md_use_gfm experiment so Smart Links
33
+ resolve again, gated by the platform_editor_gfm_link_paste_fix experiment.
34
+ - Updated dependencies
35
+
3
36
  ## 16.0.2
4
37
 
5
38
  ### 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);
@@ -663,7 +664,7 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
663
664
 
664
665
  // Remove breakout marks HTML around sync block renderer nodes
665
666
  // so the breakout mark doesn't get applied to the wrong nodes
666
- if (html.indexOf(_syncBlock.SyncBlockRendererDataAttributeName) >= 0 && (0, _experiments.editorExperiment)('platform_synced_block', true)) {
667
+ if (html.indexOf(_syncBlock.SyncBlockRendererDataAttributeName) >= 0) {
667
668
  html = (0, _transforms.removeBreakoutFromRendererSyncBlockHTML)(html);
668
669
  }
669
670
 
@@ -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);
@@ -622,7 +623,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
622
623
 
623
624
  // Remove breakout marks HTML around sync block renderer nodes
624
625
  // so the breakout mark doesn't get applied to the wrong nodes
625
- if (html.indexOf(SyncBlockRendererDataAttributeName) >= 0 && editorExperiment('platform_synced_block', true)) {
626
+ if (html.indexOf(SyncBlockRendererDataAttributeName) >= 0) {
626
627
  html = removeBreakoutFromRendererSyncBlockHTML(html);
627
628
  }
628
629
 
@@ -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);
@@ -655,7 +656,7 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
655
656
 
656
657
  // Remove breakout marks HTML around sync block renderer nodes
657
658
  // so the breakout mark doesn't get applied to the wrong nodes
658
- if (html.indexOf(SyncBlockRendererDataAttributeName) >= 0 && editorExperiment('platform_synced_block', true)) {
659
+ if (html.indexOf(SyncBlockRendererDataAttributeName) >= 0) {
659
660
  html = removeBreakoutFromRendererSyncBlockHTML(html);
660
661
  }
661
662
 
@@ -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.2",
3
+ "version": "16.0.4",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -41,15 +41,15 @@
41
41
  "@atlaskit/media-common": "^14.4.0",
42
42
  "@atlaskit/platform-feature-experiments": "^0.3.0",
43
43
  "@atlaskit/platform-feature-flags": "^2.1.0",
44
- "@atlaskit/prosemirror-history": "^1.1.0",
45
- "@atlaskit/tmp-editor-statsig": "^148.0.0",
44
+ "@atlaskit/prosemirror-history": "^1.2.0",
45
+ "@atlaskit/tmp-editor-statsig": "^149.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.5.0",
52
+ "@atlaskit/editor-common": "^119.7.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"