@atlaskit/editor-plugin-paste 5.0.0 → 5.0.1

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,13 @@
1
1
  # @atlaskit/editor-plugin-paste
2
2
 
3
+ ## 5.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9f1387a0e8ab4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9f1387a0e8ab4) -
8
+ clean up ff platform_editor_paste_code_block_do_not_escape
9
+ - Updated dependencies
10
+
3
11
  ## 5.0.0
4
12
 
5
13
  ### Patch Changes
@@ -70,41 +70,13 @@ function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFlags, pl
70
70
  var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
71
71
  var atlassianMarkDownParser = new _editorMarkdownTransformer.MarkdownTransformer(schema, _paste.md);
72
72
  function getMarkdownSlice(text, openStart, openEnd) {
73
- var escapedTextInput = (0, _platformFeatureFlags.fg)('platform_editor_paste_code_block_do_not_escape') ? (0, _util.escapeBackslashAndLinksExceptCodeBlock)(text) : (0, _util.escapeLinks)(escapeBackslashExceptCodeblock(text));
73
+ var escapedTextInput = (0, _util.escapeBackslashAndLinksExceptCodeBlock)(text);
74
74
  var doc = atlassianMarkDownParser.parse(escapedTextInput);
75
75
  if (doc && doc.content) {
76
76
  return new _model.Slice(doc.content, openStart, openEnd);
77
77
  }
78
78
  return;
79
79
  }
80
- function escapeBackslashExceptCodeblock(textInput) {
81
- var codeToken = '```';
82
- if (!textInput.includes(codeToken)) {
83
- // Ignored via go/ees005
84
- // eslint-disable-next-line require-unicode-regexp
85
- return textInput.replace(/\\/g, '\\\\');
86
- }
87
- var isInsideCodeblock = false;
88
- var textSplitByNewLine = textInput.split('\n');
89
- // In the splitted array, we traverse through every line and check if it will be parsed as a codeblock.
90
- textSplitByNewLine = textSplitByNewLine.map(function (text) {
91
- if (text === codeToken) {
92
- isInsideCodeblock = !isInsideCodeblock;
93
- } else if (text.startsWith(codeToken) && isInsideCodeblock === false) {
94
- // if there is some text after the ``` mark , it gets counted as language attribute only at the start of codeblock
95
- isInsideCodeblock = true;
96
- }
97
- if (!isInsideCodeblock) {
98
- // only escape text which is not inside a codeblock
99
- // Ignored via go/ees005
100
- // eslint-disable-next-line require-unicode-regexp
101
- text = text.replace(/\\/g, '\\\\');
102
- }
103
- return text;
104
- });
105
- textInput = textSplitByNewLine.join('\n');
106
- return textInput;
107
- }
108
80
  var extensionAutoConverter;
109
81
  function setExtensionAutoConverter(_x, _x2) {
110
82
  return _setExtensionAutoConverter.apply(this, arguments);
@@ -21,7 +21,7 @@ import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformS
21
21
  import { createPasteMeasurePayload, getContentNodeTypes, handleCodeBlockWithAnalytics, handleExpandWithAnalytics, handleMarkdownWithAnalytics, handleMediaSingleWithAnalytics, handleNestedTablePasteWithAnalytics, handlePasteAsPlainTextWithAnalytics, handlePasteIntoCaptionWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePastePreservingMarksWithAnalytics, handleRichTextWithAnalytics, handleSelectedTableWithAnalytics, sendPasteAnalyticsEvent } from './analytics';
22
22
  import { clipboardTextSerializer } from './clipboard-text-serializer';
23
23
  import { createPluginState, pluginKey as stateKey } from './plugin-factory';
24
- import { escapeBackslashAndLinksExceptCodeBlock, escapeLinks, getPasteSource, htmlContainsSingleFile, htmlHasInvalidLinkTags, isPastedFromExcel, isPastedFromWord, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from './util';
24
+ import { escapeBackslashAndLinksExceptCodeBlock, getPasteSource, htmlContainsSingleFile, htmlHasInvalidLinkTags, isPastedFromExcel, isPastedFromWord, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from './util';
25
25
  import { handleVSCodeBlock } from './util/edge-cases/handleVSCodeBlock';
26
26
  import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks, handleTableContentPasteInBodiedExtension } from './util/handlers';
27
27
  import { htmlHasIncompleteTable, isPastedFromTinyMCEConfluence, tryRebuildCompleteTableHtml } from './util/tinyMCE';
@@ -58,41 +58,13 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
58
58
  const editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
59
59
  const atlassianMarkDownParser = new MarkdownTransformer(schema, md);
60
60
  function getMarkdownSlice(text, openStart, openEnd) {
61
- const escapedTextInput = fg('platform_editor_paste_code_block_do_not_escape') ? escapeBackslashAndLinksExceptCodeBlock(text) : escapeLinks(escapeBackslashExceptCodeblock(text));
61
+ const escapedTextInput = escapeBackslashAndLinksExceptCodeBlock(text);
62
62
  const doc = atlassianMarkDownParser.parse(escapedTextInput);
63
63
  if (doc && doc.content) {
64
64
  return new Slice(doc.content, openStart, openEnd);
65
65
  }
66
66
  return;
67
67
  }
68
- function escapeBackslashExceptCodeblock(textInput) {
69
- const codeToken = '```';
70
- if (!textInput.includes(codeToken)) {
71
- // Ignored via go/ees005
72
- // eslint-disable-next-line require-unicode-regexp
73
- return textInput.replace(/\\/g, '\\\\');
74
- }
75
- let isInsideCodeblock = false;
76
- let textSplitByNewLine = textInput.split('\n');
77
- // In the splitted array, we traverse through every line and check if it will be parsed as a codeblock.
78
- textSplitByNewLine = textSplitByNewLine.map(text => {
79
- if (text === codeToken) {
80
- isInsideCodeblock = !isInsideCodeblock;
81
- } else if (text.startsWith(codeToken) && isInsideCodeblock === false) {
82
- // if there is some text after the ``` mark , it gets counted as language attribute only at the start of codeblock
83
- isInsideCodeblock = true;
84
- }
85
- if (!isInsideCodeblock) {
86
- // only escape text which is not inside a codeblock
87
- // Ignored via go/ees005
88
- // eslint-disable-next-line require-unicode-regexp
89
- text = text.replace(/\\/g, '\\\\');
90
- }
91
- return text;
92
- });
93
- textInput = textSplitByNewLine.join('\n');
94
- return textInput;
95
- }
96
68
  let extensionAutoConverter;
97
69
  async function setExtensionAutoConverter(name, extensionProviderPromise) {
98
70
  if (name !== 'extensionProvider' || !extensionProviderPromise) {
@@ -26,7 +26,7 @@ import { transformSliceForMedia, transformSliceToCorrectMediaWrapper, transformS
26
26
  import { createPasteMeasurePayload, getContentNodeTypes, handleCodeBlockWithAnalytics, handleExpandWithAnalytics, handleMarkdownWithAnalytics, handleMediaSingleWithAnalytics, handleNestedTablePasteWithAnalytics, handlePasteAsPlainTextWithAnalytics, handlePasteIntoCaptionWithAnalytics, handlePasteIntoTaskAndDecisionWithAnalytics, handlePasteLinkOnSelectedTextWithAnalytics, handlePasteNonNestableBlockNodesIntoListWithAnalytics, handlePastePanelOrDecisionIntoListWithAnalytics, handlePastePreservingMarksWithAnalytics, handleRichTextWithAnalytics, handleSelectedTableWithAnalytics, sendPasteAnalyticsEvent } from './analytics';
27
27
  import { clipboardTextSerializer } from './clipboard-text-serializer';
28
28
  import { createPluginState, pluginKey as stateKey } from './plugin-factory';
29
- import { escapeBackslashAndLinksExceptCodeBlock, escapeLinks, getPasteSource, htmlContainsSingleFile, htmlHasInvalidLinkTags, isPastedFromExcel, isPastedFromWord, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from './util';
29
+ import { escapeBackslashAndLinksExceptCodeBlock, getPasteSource, htmlContainsSingleFile, htmlHasInvalidLinkTags, isPastedFromExcel, isPastedFromWord, removeDuplicateInvalidLinks, transformUnsupportedBlockCardToInline } from './util';
30
30
  import { handleVSCodeBlock } from './util/edge-cases/handleVSCodeBlock';
31
31
  import { handleMacroAutoConvert, handleMention, handleParagraphBlockMarks, handleTableContentPasteInBodiedExtension } from './util/handlers';
32
32
  import { htmlHasIncompleteTable, isPastedFromTinyMCEConfluence, tryRebuildCompleteTableHtml } from './util/tinyMCE';
@@ -61,41 +61,13 @@ export function createPlugin(schema, dispatchAnalyticsEvent, dispatch, featureFl
61
61
  var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
62
62
  var atlassianMarkDownParser = new MarkdownTransformer(schema, md);
63
63
  function getMarkdownSlice(text, openStart, openEnd) {
64
- var escapedTextInput = fg('platform_editor_paste_code_block_do_not_escape') ? escapeBackslashAndLinksExceptCodeBlock(text) : escapeLinks(escapeBackslashExceptCodeblock(text));
64
+ var escapedTextInput = escapeBackslashAndLinksExceptCodeBlock(text);
65
65
  var doc = atlassianMarkDownParser.parse(escapedTextInput);
66
66
  if (doc && doc.content) {
67
67
  return new Slice(doc.content, openStart, openEnd);
68
68
  }
69
69
  return;
70
70
  }
71
- function escapeBackslashExceptCodeblock(textInput) {
72
- var codeToken = '```';
73
- if (!textInput.includes(codeToken)) {
74
- // Ignored via go/ees005
75
- // eslint-disable-next-line require-unicode-regexp
76
- return textInput.replace(/\\/g, '\\\\');
77
- }
78
- var isInsideCodeblock = false;
79
- var textSplitByNewLine = textInput.split('\n');
80
- // In the splitted array, we traverse through every line and check if it will be parsed as a codeblock.
81
- textSplitByNewLine = textSplitByNewLine.map(function (text) {
82
- if (text === codeToken) {
83
- isInsideCodeblock = !isInsideCodeblock;
84
- } else if (text.startsWith(codeToken) && isInsideCodeblock === false) {
85
- // if there is some text after the ``` mark , it gets counted as language attribute only at the start of codeblock
86
- isInsideCodeblock = true;
87
- }
88
- if (!isInsideCodeblock) {
89
- // only escape text which is not inside a codeblock
90
- // Ignored via go/ees005
91
- // eslint-disable-next-line require-unicode-regexp
92
- text = text.replace(/\\/g, '\\\\');
93
- }
94
- return text;
95
- });
96
- textInput = textSplitByNewLine.join('\n');
97
- return textInput;
98
- }
99
71
  var extensionAutoConverter;
100
72
  function setExtensionAutoConverter(_x, _x2) {
101
73
  return _setExtensionAutoConverter.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-paste",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "Paste plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,7 +43,7 @@
43
43
  "@atlaskit/media-client": "^35.3.0",
44
44
  "@atlaskit/media-common": "^12.3.0",
45
45
  "@atlaskit/platform-feature-flags": "^1.1.0",
46
- "@atlaskit/tmp-editor-statsig": "^12.0.0",
46
+ "@atlaskit/tmp-editor-statsig": "^12.1.0",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "lodash": "^4.17.21",
49
49
  "uuid": "^3.1.0"
@@ -114,9 +114,6 @@
114
114
  "platform_editor_track_node_types": {
115
115
  "type": "boolean"
116
116
  },
117
- "platform_editor_paste_code_block_do_not_escape": {
118
- "type": "boolean"
119
- },
120
117
  "platform_editor_sharepoint_url_smart_card_fallback": {
121
118
  "type": "boolean"
122
119
  }