@atlaskit/editor-plugin-code-block 3.6.0 → 3.6.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/codeBlockPlugin.js +3 -7
  3. package/dist/cjs/editor-commands/index.js +5 -13
  4. package/dist/cjs/nodeviews/code-block.js +1 -6
  5. package/dist/cjs/pm-plugins/codeBlockCopySelectionPlugin.js +0 -2
  6. package/dist/cjs/pm-plugins/ide-ux.js +0 -2
  7. package/dist/cjs/pm-plugins/input-rule.js +6 -10
  8. package/dist/cjs/pm-plugins/main.js +0 -2
  9. package/dist/cjs/pm-plugins/transform-to-code-block.js +1 -14
  10. package/dist/cjs/pm-plugins/utils.js +0 -3
  11. package/dist/es2019/codeBlockPlugin.js +3 -7
  12. package/dist/es2019/editor-commands/index.js +5 -12
  13. package/dist/es2019/nodeviews/code-block.js +1 -6
  14. package/dist/es2019/pm-plugins/codeBlockCopySelectionPlugin.js +0 -2
  15. package/dist/es2019/pm-plugins/ide-ux.js +0 -2
  16. package/dist/es2019/pm-plugins/input-rule.js +6 -10
  17. package/dist/es2019/pm-plugins/main.js +0 -2
  18. package/dist/es2019/pm-plugins/transform-to-code-block.js +1 -15
  19. package/dist/es2019/pm-plugins/utils.js +0 -3
  20. package/dist/esm/codeBlockPlugin.js +3 -7
  21. package/dist/esm/editor-commands/index.js +5 -13
  22. package/dist/esm/nodeviews/code-block.js +1 -6
  23. package/dist/esm/pm-plugins/codeBlockCopySelectionPlugin.js +0 -2
  24. package/dist/esm/pm-plugins/ide-ux.js +0 -2
  25. package/dist/esm/pm-plugins/input-rule.js +6 -10
  26. package/dist/esm/pm-plugins/main.js +0 -2
  27. package/dist/esm/pm-plugins/transform-to-code-block.js +1 -15
  28. package/dist/esm/pm-plugins/utils.js +0 -3
  29. package/dist/types/editor-commands/index.d.ts +2 -3
  30. package/dist/types/pm-plugins/input-rule.d.ts +1 -1
  31. package/dist/types/pm-plugins/transform-to-code-block.d.ts +1 -1
  32. package/dist/types/ui/icons/WrapIcon.d.ts +2 -2
  33. package/dist/types-ts4.5/editor-commands/index.d.ts +2 -3
  34. package/dist/types-ts4.5/pm-plugins/input-rule.d.ts +1 -1
  35. package/dist/types-ts4.5/pm-plugins/transform-to-code-block.d.ts +1 -1
  36. package/dist/types-ts4.5/ui/icons/WrapIcon.d.ts +2 -2
  37. package/package.json +7 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-code-block
2
2
 
3
+ ## 3.6.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#107782](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107782)
8
+ [`bc422d0adbbb5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bc422d0adbbb5) -
9
+ [ux] ED-26378 remove editor_nest_media_and_codeblock_in_quotes_jira
10
+ - [#107782](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107782)
11
+ [`cccc7a8347929`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cccc7a8347929) -
12
+ [ux] ED-26378 Remove editor_nest_media_and_codeblock_in_quotes_jira and
13
+ nestMediaAndCodeblockInQuote
14
+
15
+ ## 3.6.1
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 3.6.0
4
22
 
5
23
  ### Minor Changes
@@ -11,7 +11,6 @@ var _adfSchema = require("@atlaskit/adf-schema");
11
11
  var _analytics = require("@atlaskit/editor-common/analytics");
12
12
  var _messages = require("@atlaskit/editor-common/messages");
13
13
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
14
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
14
  var _editorCommands = require("./editor-commands");
16
15
  var _codeBlockAutoFullStopTransformPlugin = require("./pm-plugins/codeBlockAutoFullStopTransformPlugin");
17
16
  var _codeBlockCopySelectionPlugin = require("./pm-plugins/codeBlockCopySelectionPlugin");
@@ -24,10 +23,8 @@ var _toolbar = require("./pm-plugins/toolbar");
24
23
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
24
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
25
  var codeBlockPlugin = function codeBlockPlugin(_ref) {
27
- var _api$featureFlags;
28
26
  var options = _ref.config,
29
27
  api = _ref.api;
30
- var isNestingInQuoteSupported = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 || (_api$featureFlags = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.nestMediaAndCodeblockInQuote) || (0, _platformFeatureFlags.fg)('editor_nest_media_and_codeblock_in_quotes_jira');
31
28
  return {
32
29
  name: 'codeBlock',
33
30
  nodes: function nodes() {
@@ -59,7 +56,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
59
56
  plugin: function plugin(_ref3) {
60
57
  var _api$analytics;
61
58
  var schema = _ref3.schema;
62
- return (0, _inputRule.createCodeBlockInputRule)(schema, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isNestingInQuoteSupported);
59
+ return (0, _inputRule.createCodeBlockInputRule)(schema, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
63
60
  }
64
61
  }, {
65
62
  name: 'codeBlockIDEKeyBindings',
@@ -95,7 +92,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
95
92
  */
96
93
  insertCodeBlock: function insertCodeBlock(inputMethod) {
97
94
  var _api$analytics2;
98
- return (0, _editorCommands.insertCodeBlockWithAnalytics)(inputMethod, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, isNestingInQuoteSupported);
95
+ return (0, _editorCommands.insertCodeBlockWithAnalytics)(inputMethod, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
99
96
  }
100
97
  },
101
98
  pluginsOptions: {
@@ -114,8 +111,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
114
111
  action: function action(_insert, state) {
115
112
  var _api$analytics3;
116
113
  var tr = (0, _editorCommands.createInsertCodeBlockTransaction)({
117
- state: state,
118
- isNestingInQuoteSupported: isNestingInQuoteSupported
114
+ state: state
119
115
  });
120
116
  api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || _api$analytics3.actions.attachAnalyticsEvent({
121
117
  action: _analytics.ACTION.INSERTED,
@@ -138,12 +138,9 @@ var resetShouldIgnoreFollowingMutations = exports.resetShouldIgnoreFollowingMuta
138
138
  * append the codeblock to the end of the document.
139
139
  */
140
140
  function createInsertCodeBlockTransaction(_ref) {
141
- var state = _ref.state,
142
- isNestingInQuoteSupported = _ref.isNestingInQuoteSupported;
141
+ var state = _ref.state;
143
142
  var tr = state.tr;
144
- var _state$selection = state.selection,
145
- from = _state$selection.from,
146
- $from = _state$selection.$from;
143
+ var from = state.selection.from;
147
144
  var codeBlock = state.schema.nodes.codeBlock;
148
145
  var grandParentNode = state.selection.$from.node(-1);
149
146
  var grandParentNodeType = grandParentNode === null || grandParentNode === void 0 ? void 0 : grandParentNode.type;
@@ -160,17 +157,13 @@ function createInsertCodeBlockTransaction(_ref) {
160
157
  content: codeBlock.createAndFill()
161
158
  }) && (0, _insert.contentAllowedInCodeBlock)(state);
162
159
  if (canInsertCodeBlock) {
163
- tr = (0, _transformToCodeBlock.transformToCodeBlockAction)(state, from, undefined, isNestingInQuoteSupported);
164
- } else if (!isNestingInQuoteSupported && (grandParentNodeType === null || grandParentNodeType === void 0 ? void 0 : grandParentNodeType.name) === 'blockquote') {
165
- /** we only allow the insertion of a codeblock inside a blockquote if nesting in quotes is supported */
166
- var grandparentEndPos = $from.start(-1) + grandParentNode.nodeSize - 1;
167
- (0, _utils.safeInsert)(codeBlock.createAndFill(), grandparentEndPos)(tr).scrollIntoView();
160
+ tr = (0, _transformToCodeBlock.transformToCodeBlockAction)(state, from, undefined);
168
161
  } else {
169
162
  (0, _utils.safeInsert)(codeBlock.createAndFill())(tr).scrollIntoView();
170
163
  }
171
164
  return tr;
172
165
  }
173
- function insertCodeBlockWithAnalytics(inputMethod, analyticsAPI, isNestingInQuoteSupported) {
166
+ function insertCodeBlockWithAnalytics(inputMethod, analyticsAPI) {
174
167
  return (0, _editorAnalytics.withAnalytics)(analyticsAPI, {
175
168
  action: _analytics.ACTION.INSERTED,
176
169
  actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
@@ -181,8 +174,7 @@ function insertCodeBlockWithAnalytics(inputMethod, analyticsAPI, isNestingInQuot
181
174
  eventType: _analytics.EVENT_TYPE.TRACK
182
175
  })(function (state, dispatch) {
183
176
  var tr = createInsertCodeBlockTransaction({
184
- state: state,
185
- isNestingInQuoteSupported: isNestingInQuoteSupported
177
+ state: state
186
178
  });
187
179
  if (dispatch) {
188
180
  dispatch(tr);
@@ -42,8 +42,6 @@ var toDOM = function toDOM(node, contentEditable, formattedAriaLabel) {
42
42
  }]];
43
43
  };
44
44
  var CodeBlockView = exports.CodeBlockView = /*#__PURE__*/function () {
45
- // Ignored via go/ees005
46
- // eslint-disable-next-line @typescript-eslint/max-params
47
45
  function CodeBlockView(_node, view, getPos, formattedAriaLabel, api, cleanupEditorDisabledListener) {
48
46
  var _this = this,
49
47
  _api$editorDisabled;
@@ -197,9 +195,6 @@ var CodeBlockView = exports.CodeBlockView = /*#__PURE__*/function () {
197
195
  }
198
196
  }]);
199
197
  }();
200
- var codeBlockNodeView = exports.codeBlockNodeView = function codeBlockNodeView(node, view, getPos, formattedAriaLabel, api
201
- // Ignored via go/ees005
202
- // eslint-disable-next-line @typescript-eslint/max-params
203
- ) {
198
+ var codeBlockNodeView = exports.codeBlockNodeView = function codeBlockNodeView(node, view, getPos, formattedAriaLabel, api) {
204
199
  return new CodeBlockView(node, view, getPos, formattedAriaLabel, api);
205
200
  };
@@ -42,8 +42,6 @@ function codeBlockCopySelectionPlugin() {
42
42
  decorationStartAndEnd: undefined
43
43
  };
44
44
  },
45
- // Ignored via go/ees005
46
- // eslint-disable-next-line @typescript-eslint/max-params
47
45
  apply: function apply(transaction, currentCodeBlockCopySelectionPluginState, _oldState, newState) {
48
46
  switch (transaction.getMeta(copySelectionPluginKey)) {
49
47
  case 'show-selection':
@@ -20,8 +20,6 @@ var ideUX = function ideUX(pluginInjectionApi) {
20
20
  var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
21
21
  return new _safePlugin.SafePlugin({
22
22
  props: {
23
- // Ignored via go/ees005
24
- // eslint-disable-next-line @typescript-eslint/max-params
25
23
  handleTextInput: function handleTextInput(view, from, to, text) {
26
24
  var _pluginInjectionApi$c;
27
25
  var state = view.state,
@@ -11,8 +11,8 @@ var _utils = require("@atlaskit/editor-common/utils");
11
11
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
12
12
  var _prosemirrorInputRules = require("@atlaskit/prosemirror-input-rules");
13
13
  var _transformToCodeBlock = require("./transform-to-code-block");
14
- function createCodeBlockInputRule(schema, editorAnalyticsAPI, isNestingInQuoteSupported) {
15
- var rules = getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported);
14
+ function createCodeBlockInputRule(schema, editorAnalyticsAPI) {
15
+ var rules = getCodeBlockRules(editorAnalyticsAPI, schema);
16
16
  return new _safePlugin.SafePlugin((0, _prosemirrorInputRules.createPlugin)('code-block-input-rule', rules, {
17
17
  isBlockNodeRule: true
18
18
  }));
@@ -24,7 +24,7 @@ function createCodeBlockInputRule(schema, editorAnalyticsAPI, isNestingInQuoteSu
24
24
  * @param {Schema} schema
25
25
  * @returns {InputRuleWithHandler[]}
26
26
  */
27
- function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported) {
27
+ function getCodeBlockRules(editorAnalyticsAPI, schema) {
28
28
  var ruleAnalytics = (0, _utils.inputRuleWithAnalytics)({
29
29
  action: _analytics.ACTION.INSERTED,
30
30
  actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
@@ -38,8 +38,7 @@ function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported
38
38
  return match.length > 0 && match[0].length === 3;
39
39
  };
40
40
 
41
- // Ignored via go/ees005
42
- // eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
41
+ // eslint-disable-next-line require-unicode-regexp
43
42
  var threeTildeRule = (0, _utils.createRule)(/(?!\s)(`{3,})$/, function (state, match, start, end) {
44
43
  if (!validMatchLength(match)) {
45
44
  return null;
@@ -52,7 +51,7 @@ function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported
52
51
  attributes.language = match[4];
53
52
  }
54
53
  if ((0, _transformToCodeBlock.isConvertableToCodeBlock)(state)) {
55
- return (0, _transformToCodeBlock.transformToCodeBlockAction)(state, start, attributes, isNestingInQuoteSupported);
54
+ return (0, _transformToCodeBlock.transformToCodeBlockAction)(state, start, attributes);
56
55
  }
57
56
  var tr = state.tr;
58
57
  tr.delete(start, end);
@@ -63,10 +62,7 @@ function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported
63
62
  var leftNodeReplacementThreeTildeRule = (0, _utils.createRule)(
64
63
  // Ignored via go/ees005
65
64
  // eslint-disable-next-line require-unicode-regexp
66
- new RegExp("((".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "`{3,})|^\\s(`{3,}))(\\S*)$")),
67
- // Ignored via go/ees005
68
- // eslint-disable-next-line @typescript-eslint/max-params
69
- function (state, match, start, end) {
65
+ new RegExp("((".concat(_prosemirrorInputRules.leafNodeReplacementCharacter, "`{3,})|^\\s(`{3,}))(\\S*)$")), function (state, match, start, end) {
70
66
  if (!validMatchLength(match)) {
71
67
  return null;
72
68
  }
@@ -86,8 +86,6 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
86
86
  decorations: _view.DecorationSet.create(state.doc, initialDecorations)
87
87
  };
88
88
  },
89
- // Ignored via go/ees005
90
- // eslint-disable-next-line @typescript-eslint/max-params
91
89
  apply: function apply(tr, pluginState, _oldState, newState) {
92
90
  var meta = tr.getMeta(_pluginKey.pluginKey);
93
91
  if ((meta === null || meta === void 0 ? void 0 : meta.type) === _actions.ACTIONS.SET_IS_WRAPPED) {
@@ -9,13 +9,10 @@ var _selection = require("@atlaskit/editor-common/selection");
9
9
  var _utils = require("@atlaskit/editor-common/utils");
10
10
  var _model = require("@atlaskit/editor-prosemirror/model");
11
11
  var _state = require("@atlaskit/editor-prosemirror/state");
12
- var _utils2 = require("@atlaskit/editor-prosemirror/utils");
13
- // Ignored via go/ees005
14
- // eslint-disable-next-line @typescript-eslint/max-params
15
12
  function transformToCodeBlockAction(state, start,
16
13
  // Ignored via go/ees005
17
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
- attrs, isNestingInQuoteSupported) {
15
+ attrs) {
19
16
  var startOfCodeBlockText = state.selection.$from;
20
17
  var endPosition = state.selection.empty && !(state.selection instanceof _selection.GapCursorSelection) ? startOfCodeBlockText.end() : state.selection.$to.pos;
21
18
  var startLinePosition = startOfCodeBlockText.start();
@@ -63,16 +60,6 @@ attrs, isNestingInQuoteSupported) {
63
60
  var startMapped = startLinePosition === start ? parentStartPosition : start;
64
61
  var codeBlock = state.schema.nodes.codeBlock;
65
62
  var codeBlockNode = codeBlock.createChecked(attrs, codeBlockSlice.content);
66
-
67
- /** we only allow the insertion of a codeblock inside a blockquote if nesting in quotes is supported */
68
- var grandParentNode = state.selection.$from.node(-1);
69
- var grandParentNodeType = grandParentNode === null || grandParentNode === void 0 ? void 0 : grandParentNode.type.name;
70
- if (grandParentNodeType === 'blockquote' && !isNestingInQuoteSupported) {
71
- var grandparentEndPos = startOfCodeBlockText.start(-1) + grandParentNode.nodeSize - 1;
72
- (0, _utils2.safeInsert)(codeBlock.createChecked(attrs, codeBlockSlice.content), grandparentEndPos)(tr).scrollIntoView();
73
- tr.delete(startMapped, Math.min(endPosition, tr.doc.content.size));
74
- return tr;
75
- }
76
63
  tr.replaceWith(startMapped, Math.min(endPosition, tr.doc.content.size), codeBlockNode);
77
64
 
78
65
  // Reposition cursor when inserting into layouts or table headers
@@ -30,9 +30,6 @@ function getAllChangedCodeBlocksInTransaction(tr) {
30
30
  var nodePositions = new Set();
31
31
  tr.steps.forEach(function (step) {
32
32
  var mapResult = step.getMap();
33
-
34
- // Ignored via go/ees005
35
- // eslint-disable-next-line @typescript-eslint/max-params
36
33
  mapResult.forEach(function (oldStart, oldEnd, newStart, newEnd) {
37
34
  tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node, pos) {
38
35
  if (node.type.name === 'codeBlock') {
@@ -3,7 +3,6 @@ import { codeBlock } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
5
5
  import { IconCode } from '@atlaskit/editor-common/quick-insert';
6
- import { fg } from '@atlaskit/platform-feature-flags';
7
6
  import { createInsertCodeBlockTransaction, insertCodeBlockWithAnalytics } from './editor-commands';
8
7
  import { codeBlockAutoFullStopTransformPlugin } from './pm-plugins/codeBlockAutoFullStopTransformPlugin';
9
8
  import { codeBlockCopySelectionPlugin, copySelectionPluginKey } from './pm-plugins/codeBlockCopySelectionPlugin';
@@ -17,8 +16,6 @@ const codeBlockPlugin = ({
17
16
  config: options,
18
17
  api
19
18
  }) => {
20
- var _api$featureFlags, _api$featureFlags$sha;
21
- const isNestingInQuoteSupported = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : (_api$featureFlags$sha = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags$sha === void 0 ? void 0 : _api$featureFlags$sha.nestMediaAndCodeblockInQuote) || fg('editor_nest_media_and_codeblock_in_quotes_jira');
22
19
  return {
23
20
  name: 'codeBlock',
24
21
  nodes() {
@@ -51,7 +48,7 @@ const codeBlockPlugin = ({
51
48
  schema
52
49
  }) => {
53
50
  var _api$analytics;
54
- return createCodeBlockInputRule(schema, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isNestingInQuoteSupported);
51
+ return createCodeBlockInputRule(schema, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
55
52
  }
56
53
  }, {
57
54
  name: 'codeBlockIDEKeyBindings',
@@ -80,7 +77,7 @@ const codeBlockPlugin = ({
80
77
  */
81
78
  insertCodeBlock: inputMethod => {
82
79
  var _api$analytics2;
83
- return insertCodeBlockWithAnalytics(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, isNestingInQuoteSupported);
80
+ return insertCodeBlockWithAnalytics(inputMethod, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
84
81
  }
85
82
  },
86
83
  pluginsOptions: {
@@ -97,8 +94,7 @@ const codeBlockPlugin = ({
97
94
  action(_insert, state) {
98
95
  var _api$analytics3;
99
96
  const tr = createInsertCodeBlockTransaction({
100
- state,
101
- isNestingInQuoteSupported
97
+ state
102
98
  });
103
99
  api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions.attachAnalyticsEvent({
104
100
  action: ACTION.INSERTED,
@@ -140,15 +140,13 @@ export const resetShouldIgnoreFollowingMutations = (state, dispatch) => {
140
140
  * append the codeblock to the end of the document.
141
141
  */
142
142
  export function createInsertCodeBlockTransaction({
143
- state,
144
- isNestingInQuoteSupported
143
+ state
145
144
  }) {
146
145
  let {
147
146
  tr
148
147
  } = state;
149
148
  const {
150
- from,
151
- $from
149
+ from
152
150
  } = state.selection;
153
151
  const {
154
152
  codeBlock
@@ -168,17 +166,13 @@ export function createInsertCodeBlockTransaction({
168
166
  content: codeBlock.createAndFill()
169
167
  }) && contentAllowedInCodeBlock(state);
170
168
  if (canInsertCodeBlock) {
171
- tr = transformToCodeBlockAction(state, from, undefined, isNestingInQuoteSupported);
172
- } else if (!isNestingInQuoteSupported && (grandParentNodeType === null || grandParentNodeType === void 0 ? void 0 : grandParentNodeType.name) === 'blockquote') {
173
- /** we only allow the insertion of a codeblock inside a blockquote if nesting in quotes is supported */
174
- const grandparentEndPos = $from.start(-1) + grandParentNode.nodeSize - 1;
175
- safeInsert(codeBlock.createAndFill(), grandparentEndPos)(tr).scrollIntoView();
169
+ tr = transformToCodeBlockAction(state, from, undefined);
176
170
  } else {
177
171
  safeInsert(codeBlock.createAndFill())(tr).scrollIntoView();
178
172
  }
179
173
  return tr;
180
174
  }
181
- export function insertCodeBlockWithAnalytics(inputMethod, analyticsAPI, isNestingInQuoteSupported) {
175
+ export function insertCodeBlockWithAnalytics(inputMethod, analyticsAPI) {
182
176
  return withAnalytics(analyticsAPI, {
183
177
  action: ACTION.INSERTED,
184
178
  actionSubject: ACTION_SUBJECT.DOCUMENT,
@@ -189,8 +183,7 @@ export function insertCodeBlockWithAnalytics(inputMethod, analyticsAPI, isNestin
189
183
  eventType: EVENT_TYPE.TRACK
190
184
  })(function (state, dispatch) {
191
185
  const tr = createInsertCodeBlockTransaction({
192
- state,
193
- isNestingInQuoteSupported
186
+ state
194
187
  });
195
188
  if (dispatch) {
196
189
  dispatch(tr);
@@ -32,8 +32,6 @@ const toDOM = (node, contentEditable, formattedAriaLabel) => ['div', {
32
32
  contenteditable: 'false'
33
33
  }]];
34
34
  export class CodeBlockView {
35
- // Ignored via go/ees005
36
- // eslint-disable-next-line @typescript-eslint/max-params
37
35
  constructor(_node, view, getPos, formattedAriaLabel, api, cleanupEditorDisabledListener) {
38
36
  var _api$editorDisabled, _api$editorDisabled$s;
39
37
  _defineProperty(this, "formattedAriaLabel", '');
@@ -170,7 +168,4 @@ export class CodeBlockView {
170
168
  this.cleanupEditorDisabledListener = undefined;
171
169
  }
172
170
  }
173
- export const codeBlockNodeView = (node, view, getPos, formattedAriaLabel, api
174
- // Ignored via go/ees005
175
- // eslint-disable-next-line @typescript-eslint/max-params
176
- ) => new CodeBlockView(node, view, getPos, formattedAriaLabel, api);
171
+ export const codeBlockNodeView = (node, view, getPos, formattedAriaLabel, api) => new CodeBlockView(node, view, getPos, formattedAriaLabel, api);
@@ -32,8 +32,6 @@ export function codeBlockCopySelectionPlugin() {
32
32
  decorationStartAndEnd: undefined
33
33
  };
34
34
  },
35
- // Ignored via go/ees005
36
- // eslint-disable-next-line @typescript-eslint/max-params
37
35
  apply(transaction, currentCodeBlockCopySelectionPluginState, _oldState, newState) {
38
36
  switch (transaction.getMeta(copySelectionPluginKey)) {
39
37
  case 'show-selection':
@@ -14,8 +14,6 @@ const ideUX = pluginInjectionApi => {
14
14
  const editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
15
15
  return new SafePlugin({
16
16
  props: {
17
- // Ignored via go/ees005
18
- // eslint-disable-next-line @typescript-eslint/max-params
19
17
  handleTextInput(view, from, to, text) {
20
18
  var _pluginInjectionApi$c;
21
19
  const {
@@ -5,8 +5,8 @@ import { createRule, inputRuleWithAnalytics } from '@atlaskit/editor-common/util
5
5
  import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
6
6
  import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
7
7
  import { isConvertableToCodeBlock, transformToCodeBlockAction } from './transform-to-code-block';
8
- export function createCodeBlockInputRule(schema, editorAnalyticsAPI, isNestingInQuoteSupported) {
9
- const rules = getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported);
8
+ export function createCodeBlockInputRule(schema, editorAnalyticsAPI) {
9
+ const rules = getCodeBlockRules(editorAnalyticsAPI, schema);
10
10
  return new SafePlugin(createPlugin('code-block-input-rule', rules, {
11
11
  isBlockNodeRule: true
12
12
  }));
@@ -18,7 +18,7 @@ export function createCodeBlockInputRule(schema, editorAnalyticsAPI, isNestingIn
18
18
  * @param {Schema} schema
19
19
  * @returns {InputRuleWithHandler[]}
20
20
  */
21
- function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported) {
21
+ function getCodeBlockRules(editorAnalyticsAPI, schema) {
22
22
  const ruleAnalytics = inputRuleWithAnalytics({
23
23
  action: ACTION.INSERTED,
24
24
  actionSubject: ACTION_SUBJECT.DOCUMENT,
@@ -30,8 +30,7 @@ function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported
30
30
  }, editorAnalyticsAPI);
31
31
  const validMatchLength = match => match.length > 0 && match[0].length === 3;
32
32
 
33
- // Ignored via go/ees005
34
- // eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
33
+ // eslint-disable-next-line require-unicode-regexp
35
34
  const threeTildeRule = createRule(/(?!\s)(`{3,})$/, (state, match, start, end) => {
36
35
  if (!validMatchLength(match)) {
37
36
  return null;
@@ -44,7 +43,7 @@ function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported
44
43
  attributes.language = match[4];
45
44
  }
46
45
  if (isConvertableToCodeBlock(state)) {
47
- return transformToCodeBlockAction(state, start, attributes, isNestingInQuoteSupported);
46
+ return transformToCodeBlockAction(state, start, attributes);
48
47
  }
49
48
  const tr = state.tr;
50
49
  tr.delete(start, end);
@@ -55,10 +54,7 @@ function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported
55
54
  const leftNodeReplacementThreeTildeRule = createRule(
56
55
  // Ignored via go/ees005
57
56
  // eslint-disable-next-line require-unicode-regexp
58
- new RegExp(`((${leafNodeReplacementCharacter}\`{3,})|^\\s(\`{3,}))(\\S*)$`),
59
- // Ignored via go/ees005
60
- // eslint-disable-next-line @typescript-eslint/max-params
61
- (state, match, start, end) => {
57
+ new RegExp(`((${leafNodeReplacementCharacter}\`{3,})|^\\s(\`{3,}))(\\S*)$`), (state, match, start, end) => {
62
58
  if (!validMatchLength(match)) {
63
59
  return null;
64
60
  }
@@ -75,8 +75,6 @@ export const createPlugin = ({
75
75
  decorations: DecorationSet.create(state.doc, initialDecorations)
76
76
  };
77
77
  },
78
- // Ignored via go/ees005
79
- // eslint-disable-next-line @typescript-eslint/max-params
80
78
  apply(tr, pluginState, _oldState, newState) {
81
79
  const meta = tr.getMeta(pluginKey);
82
80
  if ((meta === null || meta === void 0 ? void 0 : meta.type) === ACTIONS.SET_IS_WRAPPED) {
@@ -2,14 +2,10 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
2
  import { mapSlice, timestampToString } from '@atlaskit/editor-common/utils';
3
3
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
4
4
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
5
- import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
6
-
7
- // Ignored via go/ees005
8
- // eslint-disable-next-line @typescript-eslint/max-params
9
5
  export function transformToCodeBlockAction(state, start,
10
6
  // Ignored via go/ees005
11
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
- attrs, isNestingInQuoteSupported) {
8
+ attrs) {
13
9
  const startOfCodeBlockText = state.selection.$from;
14
10
  const endPosition = state.selection.empty && !(state.selection instanceof GapCursorSelection) ? startOfCodeBlockText.end() : state.selection.$to.pos;
15
11
  const startLinePosition = startOfCodeBlockText.start();
@@ -57,16 +53,6 @@ attrs, isNestingInQuoteSupported) {
57
53
  const startMapped = startLinePosition === start ? parentStartPosition : start;
58
54
  const codeBlock = state.schema.nodes.codeBlock;
59
55
  const codeBlockNode = codeBlock.createChecked(attrs, codeBlockSlice.content);
60
-
61
- /** we only allow the insertion of a codeblock inside a blockquote if nesting in quotes is supported */
62
- const grandParentNode = state.selection.$from.node(-1);
63
- const grandParentNodeType = grandParentNode === null || grandParentNode === void 0 ? void 0 : grandParentNode.type.name;
64
- if (grandParentNodeType === 'blockquote' && !isNestingInQuoteSupported) {
65
- const grandparentEndPos = startOfCodeBlockText.start(-1) + grandParentNode.nodeSize - 1;
66
- safeInsert(codeBlock.createChecked(attrs, codeBlockSlice.content), grandparentEndPos)(tr).scrollIntoView();
67
- tr.delete(startMapped, Math.min(endPosition, tr.doc.content.size));
68
- return tr;
69
- }
70
56
  tr.replaceWith(startMapped, Math.min(endPosition, tr.doc.content.size), codeBlockNode);
71
57
 
72
58
  // Reposition cursor when inserting into layouts or table headers
@@ -22,9 +22,6 @@ export function getAllChangedCodeBlocksInTransaction(tr) {
22
22
  const nodePositions = new Set();
23
23
  tr.steps.forEach(step => {
24
24
  const mapResult = step.getMap();
25
-
26
- // Ignored via go/ees005
27
- // eslint-disable-next-line @typescript-eslint/max-params
28
25
  mapResult.forEach((oldStart, oldEnd, newStart, newEnd) => {
29
26
  tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), (node, pos) => {
30
27
  if (node.type.name === 'codeBlock') {
@@ -6,7 +6,6 @@ import { codeBlock } from '@atlaskit/adf-schema';
6
6
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
7
7
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
8
8
  import { IconCode } from '@atlaskit/editor-common/quick-insert';
9
- import { fg } from '@atlaskit/platform-feature-flags';
10
9
  import { createInsertCodeBlockTransaction, insertCodeBlockWithAnalytics } from './editor-commands';
11
10
  import { codeBlockAutoFullStopTransformPlugin } from './pm-plugins/codeBlockAutoFullStopTransformPlugin';
12
11
  import { codeBlockCopySelectionPlugin, copySelectionPluginKey } from './pm-plugins/codeBlockCopySelectionPlugin';
@@ -17,10 +16,8 @@ import { createPlugin } from './pm-plugins/main';
17
16
  import refreshBrowserSelectionOnChange from './pm-plugins/refresh-browser-selection';
18
17
  import { getToolbarConfig } from './pm-plugins/toolbar';
19
18
  var codeBlockPlugin = function codeBlockPlugin(_ref) {
20
- var _api$featureFlags;
21
19
  var options = _ref.config,
22
20
  api = _ref.api;
23
- var isNestingInQuoteSupported = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 || (_api$featureFlags = _api$featureFlags.sharedState.currentState()) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.nestMediaAndCodeblockInQuote) || fg('editor_nest_media_and_codeblock_in_quotes_jira');
24
21
  return {
25
22
  name: 'codeBlock',
26
23
  nodes: function nodes() {
@@ -52,7 +49,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
52
49
  plugin: function plugin(_ref3) {
53
50
  var _api$analytics;
54
51
  var schema = _ref3.schema;
55
- return createCodeBlockInputRule(schema, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, isNestingInQuoteSupported);
52
+ return createCodeBlockInputRule(schema, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
56
53
  }
57
54
  }, {
58
55
  name: 'codeBlockIDEKeyBindings',
@@ -88,7 +85,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
88
85
  */
89
86
  insertCodeBlock: function insertCodeBlock(inputMethod) {
90
87
  var _api$analytics2;
91
- return insertCodeBlockWithAnalytics(inputMethod, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, isNestingInQuoteSupported);
88
+ return insertCodeBlockWithAnalytics(inputMethod, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions);
92
89
  }
93
90
  },
94
91
  pluginsOptions: {
@@ -107,8 +104,7 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
107
104
  action: function action(_insert, state) {
108
105
  var _api$analytics3;
109
106
  var tr = createInsertCodeBlockTransaction({
110
- state: state,
111
- isNestingInQuoteSupported: isNestingInQuoteSupported
107
+ state: state
112
108
  });
113
109
  api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || _api$analytics3.actions.attachAnalyticsEvent({
114
110
  action: ACTION.INSERTED,
@@ -128,12 +128,9 @@ export var resetShouldIgnoreFollowingMutations = function resetShouldIgnoreFollo
128
128
  * append the codeblock to the end of the document.
129
129
  */
130
130
  export function createInsertCodeBlockTransaction(_ref) {
131
- var state = _ref.state,
132
- isNestingInQuoteSupported = _ref.isNestingInQuoteSupported;
131
+ var state = _ref.state;
133
132
  var tr = state.tr;
134
- var _state$selection = state.selection,
135
- from = _state$selection.from,
136
- $from = _state$selection.$from;
133
+ var from = state.selection.from;
137
134
  var codeBlock = state.schema.nodes.codeBlock;
138
135
  var grandParentNode = state.selection.$from.node(-1);
139
136
  var grandParentNodeType = grandParentNode === null || grandParentNode === void 0 ? void 0 : grandParentNode.type;
@@ -150,17 +147,13 @@ export function createInsertCodeBlockTransaction(_ref) {
150
147
  content: codeBlock.createAndFill()
151
148
  }) && contentAllowedInCodeBlock(state);
152
149
  if (canInsertCodeBlock) {
153
- tr = transformToCodeBlockAction(state, from, undefined, isNestingInQuoteSupported);
154
- } else if (!isNestingInQuoteSupported && (grandParentNodeType === null || grandParentNodeType === void 0 ? void 0 : grandParentNodeType.name) === 'blockquote') {
155
- /** we only allow the insertion of a codeblock inside a blockquote if nesting in quotes is supported */
156
- var grandparentEndPos = $from.start(-1) + grandParentNode.nodeSize - 1;
157
- safeInsert(codeBlock.createAndFill(), grandparentEndPos)(tr).scrollIntoView();
150
+ tr = transformToCodeBlockAction(state, from, undefined);
158
151
  } else {
159
152
  safeInsert(codeBlock.createAndFill())(tr).scrollIntoView();
160
153
  }
161
154
  return tr;
162
155
  }
163
- export function insertCodeBlockWithAnalytics(inputMethod, analyticsAPI, isNestingInQuoteSupported) {
156
+ export function insertCodeBlockWithAnalytics(inputMethod, analyticsAPI) {
164
157
  return withAnalytics(analyticsAPI, {
165
158
  action: ACTION.INSERTED,
166
159
  actionSubject: ACTION_SUBJECT.DOCUMENT,
@@ -171,8 +164,7 @@ export function insertCodeBlockWithAnalytics(inputMethod, analyticsAPI, isNestin
171
164
  eventType: EVENT_TYPE.TRACK
172
165
  })(function (state, dispatch) {
173
166
  var tr = createInsertCodeBlockTransaction({
174
- state: state,
175
- isNestingInQuoteSupported: isNestingInQuoteSupported
167
+ state: state
176
168
  });
177
169
  if (dispatch) {
178
170
  dispatch(tr);
@@ -36,8 +36,6 @@ var toDOM = function toDOM(node, contentEditable, formattedAriaLabel) {
36
36
  }]];
37
37
  };
38
38
  export var CodeBlockView = /*#__PURE__*/function () {
39
- // Ignored via go/ees005
40
- // eslint-disable-next-line @typescript-eslint/max-params
41
39
  function CodeBlockView(_node, view, getPos, formattedAriaLabel, api, cleanupEditorDisabledListener) {
42
40
  var _this = this,
43
41
  _api$editorDisabled;
@@ -191,9 +189,6 @@ export var CodeBlockView = /*#__PURE__*/function () {
191
189
  }
192
190
  }]);
193
191
  }();
194
- export var codeBlockNodeView = function codeBlockNodeView(node, view, getPos, formattedAriaLabel, api
195
- // Ignored via go/ees005
196
- // eslint-disable-next-line @typescript-eslint/max-params
197
- ) {
192
+ export var codeBlockNodeView = function codeBlockNodeView(node, view, getPos, formattedAriaLabel, api) {
198
193
  return new CodeBlockView(node, view, getPos, formattedAriaLabel, api);
199
194
  };
@@ -32,8 +32,6 @@ export function codeBlockCopySelectionPlugin() {
32
32
  decorationStartAndEnd: undefined
33
33
  };
34
34
  },
35
- // Ignored via go/ees005
36
- // eslint-disable-next-line @typescript-eslint/max-params
37
35
  apply: function apply(transaction, currentCodeBlockCopySelectionPluginState, _oldState, newState) {
38
36
  switch (transaction.getMeta(copySelectionPluginKey)) {
39
37
  case 'show-selection':
@@ -14,8 +14,6 @@ var ideUX = function ideUX(pluginInjectionApi) {
14
14
  var editorAnalyticsAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions;
15
15
  return new SafePlugin({
16
16
  props: {
17
- // Ignored via go/ees005
18
- // eslint-disable-next-line @typescript-eslint/max-params
19
17
  handleTextInput: function handleTextInput(view, from, to, text) {
20
18
  var _pluginInjectionApi$c;
21
19
  var state = view.state,
@@ -5,8 +5,8 @@ import { createRule, inputRuleWithAnalytics } from '@atlaskit/editor-common/util
5
5
  import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
6
6
  import { createPlugin, leafNodeReplacementCharacter } from '@atlaskit/prosemirror-input-rules';
7
7
  import { isConvertableToCodeBlock, transformToCodeBlockAction } from './transform-to-code-block';
8
- export function createCodeBlockInputRule(schema, editorAnalyticsAPI, isNestingInQuoteSupported) {
9
- var rules = getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported);
8
+ export function createCodeBlockInputRule(schema, editorAnalyticsAPI) {
9
+ var rules = getCodeBlockRules(editorAnalyticsAPI, schema);
10
10
  return new SafePlugin(createPlugin('code-block-input-rule', rules, {
11
11
  isBlockNodeRule: true
12
12
  }));
@@ -18,7 +18,7 @@ export function createCodeBlockInputRule(schema, editorAnalyticsAPI, isNestingIn
18
18
  * @param {Schema} schema
19
19
  * @returns {InputRuleWithHandler[]}
20
20
  */
21
- function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported) {
21
+ function getCodeBlockRules(editorAnalyticsAPI, schema) {
22
22
  var ruleAnalytics = inputRuleWithAnalytics({
23
23
  action: ACTION.INSERTED,
24
24
  actionSubject: ACTION_SUBJECT.DOCUMENT,
@@ -32,8 +32,7 @@ function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported
32
32
  return match.length > 0 && match[0].length === 3;
33
33
  };
34
34
 
35
- // Ignored via go/ees005
36
- // eslint-disable-next-line require-unicode-regexp, @typescript-eslint/max-params
35
+ // eslint-disable-next-line require-unicode-regexp
37
36
  var threeTildeRule = createRule(/(?!\s)(`{3,})$/, function (state, match, start, end) {
38
37
  if (!validMatchLength(match)) {
39
38
  return null;
@@ -46,7 +45,7 @@ function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported
46
45
  attributes.language = match[4];
47
46
  }
48
47
  if (isConvertableToCodeBlock(state)) {
49
- return transformToCodeBlockAction(state, start, attributes, isNestingInQuoteSupported);
48
+ return transformToCodeBlockAction(state, start, attributes);
50
49
  }
51
50
  var tr = state.tr;
52
51
  tr.delete(start, end);
@@ -57,10 +56,7 @@ function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported
57
56
  var leftNodeReplacementThreeTildeRule = createRule(
58
57
  // Ignored via go/ees005
59
58
  // eslint-disable-next-line require-unicode-regexp
60
- new RegExp("((".concat(leafNodeReplacementCharacter, "`{3,})|^\\s(`{3,}))(\\S*)$")),
61
- // Ignored via go/ees005
62
- // eslint-disable-next-line @typescript-eslint/max-params
63
- function (state, match, start, end) {
59
+ new RegExp("((".concat(leafNodeReplacementCharacter, "`{3,})|^\\s(`{3,}))(\\S*)$")), function (state, match, start, end) {
64
60
  if (!validMatchLength(match)) {
65
61
  return null;
66
62
  }
@@ -81,8 +81,6 @@ export var createPlugin = function createPlugin(_ref) {
81
81
  decorations: DecorationSet.create(state.doc, initialDecorations)
82
82
  };
83
83
  },
84
- // Ignored via go/ees005
85
- // eslint-disable-next-line @typescript-eslint/max-params
86
84
  apply: function apply(tr, pluginState, _oldState, newState) {
87
85
  var meta = tr.getMeta(pluginKey);
88
86
  if ((meta === null || meta === void 0 ? void 0 : meta.type) === ACTIONS.SET_IS_WRAPPED) {
@@ -2,14 +2,10 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
2
  import { mapSlice, timestampToString } from '@atlaskit/editor-common/utils';
3
3
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
4
4
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
5
- import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
6
-
7
- // Ignored via go/ees005
8
- // eslint-disable-next-line @typescript-eslint/max-params
9
5
  export function transformToCodeBlockAction(state, start,
10
6
  // Ignored via go/ees005
11
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
- attrs, isNestingInQuoteSupported) {
8
+ attrs) {
13
9
  var startOfCodeBlockText = state.selection.$from;
14
10
  var endPosition = state.selection.empty && !(state.selection instanceof GapCursorSelection) ? startOfCodeBlockText.end() : state.selection.$to.pos;
15
11
  var startLinePosition = startOfCodeBlockText.start();
@@ -57,16 +53,6 @@ attrs, isNestingInQuoteSupported) {
57
53
  var startMapped = startLinePosition === start ? parentStartPosition : start;
58
54
  var codeBlock = state.schema.nodes.codeBlock;
59
55
  var codeBlockNode = codeBlock.createChecked(attrs, codeBlockSlice.content);
60
-
61
- /** we only allow the insertion of a codeblock inside a blockquote if nesting in quotes is supported */
62
- var grandParentNode = state.selection.$from.node(-1);
63
- var grandParentNodeType = grandParentNode === null || grandParentNode === void 0 ? void 0 : grandParentNode.type.name;
64
- if (grandParentNodeType === 'blockquote' && !isNestingInQuoteSupported) {
65
- var grandparentEndPos = startOfCodeBlockText.start(-1) + grandParentNode.nodeSize - 1;
66
- safeInsert(codeBlock.createChecked(attrs, codeBlockSlice.content), grandparentEndPos)(tr).scrollIntoView();
67
- tr.delete(startMapped, Math.min(endPosition, tr.doc.content.size));
68
- return tr;
69
- }
70
56
  tr.replaceWith(startMapped, Math.min(endPosition, tr.doc.content.size), codeBlockNode);
71
57
 
72
58
  // Reposition cursor when inserting into layouts or table headers
@@ -22,9 +22,6 @@ export function getAllChangedCodeBlocksInTransaction(tr) {
22
22
  var nodePositions = new Set();
23
23
  tr.steps.forEach(function (step) {
24
24
  var mapResult = step.getMap();
25
-
26
- // Ignored via go/ees005
27
- // eslint-disable-next-line @typescript-eslint/max-params
28
25
  mapResult.forEach(function (oldStart, oldEnd, newStart, newEnd) {
29
26
  tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node, pos) {
30
27
  if (node.type.name === 'codeBlock') {
@@ -12,11 +12,10 @@ export declare const resetShouldIgnoreFollowingMutations: Command;
12
12
  * if there is text selected it will wrap the current selection if not it will
13
13
  * append the codeblock to the end of the document.
14
14
  */
15
- export declare function createInsertCodeBlockTransaction({ state, isNestingInQuoteSupported, }: {
15
+ export declare function createInsertCodeBlockTransaction({ state }: {
16
16
  state: EditorState;
17
- isNestingInQuoteSupported?: boolean;
18
17
  }): import("prosemirror-state").Transaction;
19
- export declare function insertCodeBlockWithAnalytics(inputMethod: INPUT_METHOD, analyticsAPI?: EditorAnalyticsAPI, isNestingInQuoteSupported?: boolean): Command;
18
+ export declare function insertCodeBlockWithAnalytics(inputMethod: INPUT_METHOD, analyticsAPI?: EditorAnalyticsAPI): Command;
20
19
  /**
21
20
  * Add the given node to the codeBlockWrappedStates WeakMap with the toggle boolean value.
22
21
  */
@@ -1,4 +1,4 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
4
- export declare function createCodeBlockInputRule(schema: Schema, editorAnalyticsAPI?: EditorAnalyticsAPI, isNestingInQuoteSupported?: boolean): SafePlugin<any>;
4
+ export declare function createCodeBlockInputRule(schema: Schema, editorAnalyticsAPI?: EditorAnalyticsAPI): SafePlugin<any>;
@@ -1,3 +1,3 @@
1
1
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- export declare function transformToCodeBlockAction(state: EditorState, start: number, attrs?: any, isNestingInQuoteSupported?: boolean): Transaction;
2
+ export declare function transformToCodeBlockAction(state: EditorState, start: number, attrs?: any): Transaction;
3
3
  export declare function isConvertableToCodeBlock(state: EditorState): boolean;
@@ -1,2 +1,2 @@
1
- /// <reference types="react" />
2
- export declare const WrapIcon: () => JSX.Element;
1
+ import React from 'react';
2
+ export declare const WrapIcon: () => React.JSX.Element;
@@ -12,11 +12,10 @@ export declare const resetShouldIgnoreFollowingMutations: Command;
12
12
  * if there is text selected it will wrap the current selection if not it will
13
13
  * append the codeblock to the end of the document.
14
14
  */
15
- export declare function createInsertCodeBlockTransaction({ state, isNestingInQuoteSupported, }: {
15
+ export declare function createInsertCodeBlockTransaction({ state }: {
16
16
  state: EditorState;
17
- isNestingInQuoteSupported?: boolean;
18
17
  }): import("prosemirror-state").Transaction;
19
- export declare function insertCodeBlockWithAnalytics(inputMethod: INPUT_METHOD, analyticsAPI?: EditorAnalyticsAPI, isNestingInQuoteSupported?: boolean): Command;
18
+ export declare function insertCodeBlockWithAnalytics(inputMethod: INPUT_METHOD, analyticsAPI?: EditorAnalyticsAPI): Command;
20
19
  /**
21
20
  * Add the given node to the codeBlockWrappedStates WeakMap with the toggle boolean value.
22
21
  */
@@ -1,4 +1,4 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
4
- export declare function createCodeBlockInputRule(schema: Schema, editorAnalyticsAPI?: EditorAnalyticsAPI, isNestingInQuoteSupported?: boolean): SafePlugin<any>;
4
+ export declare function createCodeBlockInputRule(schema: Schema, editorAnalyticsAPI?: EditorAnalyticsAPI): SafePlugin<any>;
@@ -1,3 +1,3 @@
1
1
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- export declare function transformToCodeBlockAction(state: EditorState, start: number, attrs?: any, isNestingInQuoteSupported?: boolean): Transaction;
2
+ export declare function transformToCodeBlockAction(state: EditorState, start: number, attrs?: any): Transaction;
3
3
  export declare function isConvertableToCodeBlock(state: EditorState): boolean;
@@ -1,2 +1,2 @@
1
- /// <reference types="react" />
2
- export declare const WrapIcon: () => JSX.Element;
1
+ import React from 'react';
2
+ export declare const WrapIcon: () => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,15 +32,15 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/code": "^15.6.0",
36
- "@atlaskit/editor-common": "^99.5.0",
35
+ "@atlaskit/code": "^15.7.0",
36
+ "@atlaskit/editor-common": "^99.8.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.11.0",
38
38
  "@atlaskit/editor-plugin-composition": "^1.2.0",
39
- "@atlaskit/editor-plugin-decorations": "^1.3.0",
40
- "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
39
+ "@atlaskit/editor-plugin-decorations": "^1.4.0",
40
+ "@atlaskit/editor-plugin-editor-disabled": "^1.4.0",
41
41
  "@atlaskit/editor-prosemirror": "6.2.1",
42
- "@atlaskit/icon": "^23.4.0",
43
- "@atlaskit/platform-feature-flags": "^0.3.0",
42
+ "@atlaskit/icon": "^23.6.0",
43
+ "@atlaskit/platform-feature-flags": "^1.0.0",
44
44
  "@atlaskit/prosemirror-input-rules": "^3.2.0",
45
45
  "@babel/runtime": "^7.0.0"
46
46
  },
@@ -96,9 +96,6 @@
96
96
  "code_block_auto_insertion_bug_fix": {
97
97
  "type": "boolean"
98
98
  },
99
- "editor_nest_media_and_codeblock_in_quotes_jira": {
100
- "type": "boolean"
101
- },
102
99
  "editor_code_wrapping_perf_improvement_ed-25141": {
103
100
  "type": "boolean"
104
101
  }