@atlaskit/editor-plugin-code-block-advanced 3.0.4 → 3.0.5

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,14 @@
1
1
  # @atlaskit/editor-plugin-code-block-advanced
2
2
 
3
+ ## 3.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#194707](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/194707)
8
+ [`03234d0ecc5a6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/03234d0ecc5a6) -
9
+ Cleanup feature gate to fix right click in code blocks
10
+ - Updated dependencies
11
+
3
12
  ## 3.0.4
4
13
 
5
14
  ### Patch Changes
@@ -14,7 +14,12 @@
14
14
  "../src/**/__tests__/*",
15
15
  "../src/**/*.test.*",
16
16
  "../src/**/test.*",
17
- "../src/**/examples.*"
17
+ "../src/**/examples.*",
18
+ "../src/**/examples/*",
19
+ "../src/**/examples/**/*",
20
+ "../src/**/*.stories.*",
21
+ "../src/**/stories/*",
22
+ "../src/**/stories/**/*"
18
23
  ],
19
24
  "references": [
20
25
  {
@@ -14,7 +14,12 @@
14
14
  "../src/**/__tests__/*",
15
15
  "../src/**/*.test.*",
16
16
  "../src/**/test.*",
17
- "../src/**/examples.*"
17
+ "../src/**/examples.*",
18
+ "../src/**/examples/*",
19
+ "../src/**/examples/**/*",
20
+ "../src/**/*.stories.*",
21
+ "../src/**/stories/*",
22
+ "../src/**/stories/**/*"
18
23
  ],
19
24
  "references": [
20
25
  {
@@ -14,7 +14,12 @@
14
14
  "../src/**/__tests__/*",
15
15
  "../src/**/*.test.*",
16
16
  "../src/**/test.*",
17
- "../src/**/examples.*"
17
+ "../src/**/examples.*",
18
+ "../src/**/examples/*",
19
+ "../src/**/examples/**/*",
20
+ "../src/**/*.stories.*",
21
+ "../src/**/stories/*",
22
+ "../src/**/stories/**/*"
18
23
  ],
19
24
  "references": [
20
25
  {
@@ -14,7 +14,12 @@
14
14
  "../src/**/__tests__/*",
15
15
  "../src/**/*.test.*",
16
16
  "../src/**/test.*",
17
- "../src/**/examples.*"
17
+ "../src/**/examples.*",
18
+ "../src/**/examples/*",
19
+ "../src/**/examples/**/*",
20
+ "../src/**/*.stories.*",
21
+ "../src/**/stories/*",
22
+ "../src/**/stories/**/*"
18
23
  ],
19
24
  "references": [
20
25
  {
@@ -1,17 +1,22 @@
1
1
  {
2
- "extends": "../tsconfig",
3
- "compilerOptions": {
4
- "target": "es5",
5
- "paths": {}
6
- },
7
- "include": [
8
- "../src/**/*.ts",
9
- "../src/**/*.tsx"
10
- ],
11
- "exclude": [
12
- "../src/**/__tests__/*",
13
- "../src/**/*.test.*",
14
- "../src/**/test.*",
15
- "../src/**/examples.*"
16
- ]
2
+ "extends": "../tsconfig",
3
+ "compilerOptions": {
4
+ "target": "es5",
5
+ "paths": {}
6
+ },
7
+ "include": [
8
+ "../src/**/*.ts",
9
+ "../src/**/*.tsx"
10
+ ],
11
+ "exclude": [
12
+ "../src/**/__tests__/*",
13
+ "../src/**/*.test.*",
14
+ "../src/**/test.*",
15
+ "../src/**/examples.*",
16
+ "../src/**/examples/*",
17
+ "../src/**/examples/**/*",
18
+ "../src/**/*.stories.*",
19
+ "../src/**/stories/*",
20
+ "../src/**/stories/**/*"
21
+ ]
17
22
  }
@@ -18,7 +18,6 @@ var _messages = require("@atlaskit/editor-common/messages");
18
18
  var _whitespace = require("@atlaskit/editor-common/whitespace");
19
19
  var _state2 = require("@atlaskit/editor-prosemirror/state");
20
20
  var _view2 = require("@atlaskit/editor-prosemirror/view");
21
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
21
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
23
22
  var _syntaxHighlightingTheme = require("../ui/syntaxHighlightingTheme");
24
23
  var _theme = require("../ui/theme");
@@ -80,13 +79,13 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
80
79
  onMaybeNodeSelection: onMaybeNodeSelection,
81
80
  customFindReplace: Boolean((_config$api3 = config.api) === null || _config$api3 === void 0 ? void 0 : _config$api3.findReplace)
82
81
  }), _theme.cmTheme, (0, _language.syntaxHighlighting)(_syntaxHighlightingTheme.highlightStyle), (0, _language.bracketMatching)(), (0, _view.lineNumbers)({
83
- domEventHandlers: (0, _platformFeatureFlags.fg)('platform_editor_fix_right_click_paste') ? {
82
+ domEventHandlers: {
84
83
  click: function click() {
85
84
  _this.selectCodeBlockNode(undefined);
86
85
  _this.view.focus();
87
86
  return true;
88
87
  }
89
- } : undefined
88
+ }
90
89
  }),
91
90
  // Explicitly disable "sticky" positioning on line numbers to match
92
91
  // Renderer behaviour
@@ -256,28 +255,7 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
256
255
  }, {
257
256
  key: "stopEvent",
258
257
  value: function stopEvent(e) {
259
- var _this2 = this,
260
- _this$getPos5;
261
- if (!(0, _platformFeatureFlags.fg)('platform_editor_fix_right_click_paste')) {
262
- if (e instanceof MouseEvent && e.type === 'mousedown') {
263
- // !Warning: Side effect!
264
- // CodeMirror on blur updates the dom observer with a `setTimeout(..., 10);`
265
- // We need to select the nodeview after this has taken place to ensure
266
- // ProseMirror takes over
267
- // https://github.com/codemirror/view/commit/70a9a253df04a57004247b9463198c17832f92f4#diff-cb8cbffa623ff0975389e7e8c315e69d5e10345239ffe2c9b4b7986a56ad95efR720
268
- setTimeout(function () {
269
- // Ensure the CM selection is reset - if we have a ranged selection when we do node selection can
270
- // cause funky behaviour
271
- _this2.updating = true;
272
- _this2.cm.dispatch({
273
- selection: _state.EditorSelection.create([_state.EditorSelection.cursor(0)], 0)
274
- });
275
- _this2.updating = false;
276
- _this2.selectCodeBlockNode(undefined);
277
- _this2.view.focus();
278
- }, 20);
279
- }
280
- }
258
+ var _this$getPos5;
281
259
  // If we have selected the node we should not stop these events
282
260
  if ((e instanceof KeyboardEvent || e instanceof ClipboardEvent) && this.view.state.selection instanceof _state2.NodeSelection && this.view.state.selection.from === ((_this$getPos5 = this.getPos) === null || _this$getPos5 === void 0 ? void 0 : _this$getPos5.call(this))) {
283
261
  return false;
@@ -1,14 +1,13 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { closeBrackets } from '@codemirror/autocomplete';
3
3
  import { syntaxHighlighting, bracketMatching } from '@codemirror/language';
4
- import { Compartment, EditorSelection, Facet, EditorState as CodeMirrorState } from '@codemirror/state';
4
+ import { Compartment, Facet, EditorState as CodeMirrorState } from '@codemirror/state';
5
5
  import { EditorView as CodeMirror, lineNumbers, gutters } from '@codemirror/view';
6
6
  import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
7
7
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
8
8
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
9
9
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
10
10
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
11
- import { fg } from '@atlaskit/platform-feature-flags';
12
11
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
13
12
  import { highlightStyle } from '../ui/syntaxHighlightingTheme';
14
13
  import { cmTheme } from '../ui/theme';
@@ -61,13 +60,13 @@ class CodeBlockAdvancedNodeView {
61
60
  onMaybeNodeSelection,
62
61
  customFindReplace: Boolean((_config$api3 = config.api) === null || _config$api3 === void 0 ? void 0 : _config$api3.findReplace)
63
62
  }), cmTheme, syntaxHighlighting(highlightStyle), bracketMatching(), lineNumbers({
64
- domEventHandlers: fg('platform_editor_fix_right_click_paste') ? {
63
+ domEventHandlers: {
65
64
  click: () => {
66
65
  this.selectCodeBlockNode(undefined);
67
66
  this.view.focus();
68
67
  return true;
69
68
  }
70
- } : undefined
69
+ }
71
70
  }),
72
71
  // Explicitly disable "sticky" positioning on line numbers to match
73
72
  // Renderer behaviour
@@ -208,26 +207,6 @@ class CodeBlockAdvancedNodeView {
208
207
  }
209
208
  stopEvent(e) {
210
209
  var _this$getPos5;
211
- if (!fg('platform_editor_fix_right_click_paste')) {
212
- if (e instanceof MouseEvent && e.type === 'mousedown') {
213
- // !Warning: Side effect!
214
- // CodeMirror on blur updates the dom observer with a `setTimeout(..., 10);`
215
- // We need to select the nodeview after this has taken place to ensure
216
- // ProseMirror takes over
217
- // https://github.com/codemirror/view/commit/70a9a253df04a57004247b9463198c17832f92f4#diff-cb8cbffa623ff0975389e7e8c315e69d5e10345239ffe2c9b4b7986a56ad95efR720
218
- setTimeout(() => {
219
- // Ensure the CM selection is reset - if we have a ranged selection when we do node selection can
220
- // cause funky behaviour
221
- this.updating = true;
222
- this.cm.dispatch({
223
- selection: EditorSelection.create([EditorSelection.cursor(0)], 0)
224
- });
225
- this.updating = false;
226
- this.selectCodeBlockNode(undefined);
227
- this.view.focus();
228
- }, 20);
229
- }
230
- }
231
210
  // If we have selected the node we should not stop these events
232
211
  if ((e instanceof KeyboardEvent || e instanceof ClipboardEvent) && this.view.state.selection instanceof NodeSelection && this.view.state.selection.from === ((_this$getPos5 = this.getPos) === null || _this$getPos5 === void 0 ? void 0 : _this$getPos5.call(this))) {
233
212
  return false;
@@ -4,14 +4,13 @@ import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
5
  import { closeBrackets } from '@codemirror/autocomplete';
6
6
  import { syntaxHighlighting, bracketMatching } from '@codemirror/language';
7
- import { Compartment, EditorSelection, Facet, EditorState as CodeMirrorState } from '@codemirror/state';
7
+ import { Compartment, Facet, EditorState as CodeMirrorState } from '@codemirror/state';
8
8
  import { EditorView as CodeMirror, lineNumbers, gutters } from '@codemirror/view';
9
9
  import { isCodeBlockWordWrapEnabled } from '@atlaskit/editor-common/code-block';
10
10
  import { blockTypeMessages } from '@atlaskit/editor-common/messages';
11
11
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
12
12
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
13
13
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
14
- import { fg } from '@atlaskit/platform-feature-flags';
15
14
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
16
15
  import { highlightStyle } from '../ui/syntaxHighlightingTheme';
17
16
  import { cmTheme } from '../ui/theme';
@@ -73,13 +72,13 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
73
72
  onMaybeNodeSelection: onMaybeNodeSelection,
74
73
  customFindReplace: Boolean((_config$api3 = config.api) === null || _config$api3 === void 0 ? void 0 : _config$api3.findReplace)
75
74
  }), cmTheme, syntaxHighlighting(highlightStyle), bracketMatching(), lineNumbers({
76
- domEventHandlers: fg('platform_editor_fix_right_click_paste') ? {
75
+ domEventHandlers: {
77
76
  click: function click() {
78
77
  _this.selectCodeBlockNode(undefined);
79
78
  _this.view.focus();
80
79
  return true;
81
80
  }
82
- } : undefined
81
+ }
83
82
  }),
84
83
  // Explicitly disable "sticky" positioning on line numbers to match
85
84
  // Renderer behaviour
@@ -249,28 +248,7 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
249
248
  }, {
250
249
  key: "stopEvent",
251
250
  value: function stopEvent(e) {
252
- var _this2 = this,
253
- _this$getPos5;
254
- if (!fg('platform_editor_fix_right_click_paste')) {
255
- if (e instanceof MouseEvent && e.type === 'mousedown') {
256
- // !Warning: Side effect!
257
- // CodeMirror on blur updates the dom observer with a `setTimeout(..., 10);`
258
- // We need to select the nodeview after this has taken place to ensure
259
- // ProseMirror takes over
260
- // https://github.com/codemirror/view/commit/70a9a253df04a57004247b9463198c17832f92f4#diff-cb8cbffa623ff0975389e7e8c315e69d5e10345239ffe2c9b4b7986a56ad95efR720
261
- setTimeout(function () {
262
- // Ensure the CM selection is reset - if we have a ranged selection when we do node selection can
263
- // cause funky behaviour
264
- _this2.updating = true;
265
- _this2.cm.dispatch({
266
- selection: EditorSelection.create([EditorSelection.cursor(0)], 0)
267
- });
268
- _this2.updating = false;
269
- _this2.selectCodeBlockNode(undefined);
270
- _this2.view.focus();
271
- }, 20);
272
- }
273
- }
251
+ var _this$getPos5;
274
252
  // If we have selected the node we should not stop these events
275
253
  if ((e instanceof KeyboardEvent || e instanceof ClipboardEvent) && this.view.state.selection instanceof NodeSelection && this.view.state.selection.from === ((_this$getPos5 = this.getPos) === null || _this$getPos5 === void 0 ? void 0 : _this$getPos5.call(this))) {
276
254
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block-advanced",
3
- "version": "3.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/editor-plugin-selection-marker": "^3.0.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
- "@atlaskit/tmp-editor-statsig": "^9.17.0",
42
+ "@atlaskit/tmp-editor-statsig": "^9.20.0",
43
43
  "@atlaskit/tokens": "^5.6.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@codemirror/autocomplete": "6.18.4",
@@ -54,7 +54,7 @@
54
54
  "codemirror-lang-elixir": "4.0.0"
55
55
  },
56
56
  "peerDependencies": {
57
- "@atlaskit/editor-common": "^107.12.0",
57
+ "@atlaskit/editor-common": "^107.16.0",
58
58
  "react": "^18.2.0"
59
59
  },
60
60
  "devDependencies": {
@@ -100,9 +100,6 @@
100
100
  "platform-feature-flags": {
101
101
  "platform_editor_breakout_resizing_hello_release": {
102
102
  "type": "boolean"
103
- },
104
- "platform_editor_fix_right_click_paste": {
105
- "type": "boolean"
106
103
  }
107
104
  }
108
105
  }
@@ -3,7 +3,6 @@ import { syntaxHighlighting, bracketMatching } from '@codemirror/language';
3
3
  import {
4
4
  Compartment,
5
5
  type Extension,
6
- EditorSelection,
7
6
  Facet,
8
7
  EditorState as CodeMirrorState,
9
8
  type StateEffect,
@@ -30,7 +29,6 @@ import type {
30
29
  NodeView,
31
30
  } from '@atlaskit/editor-prosemirror/view';
32
31
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
33
- import { fg } from '@atlaskit/platform-feature-flags';
34
32
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
35
33
 
36
34
  import type { CodeBlockAdvancedPlugin } from '../codeBlockAdvancedPluginType';
@@ -117,15 +115,13 @@ class CodeBlockAdvancedNodeView implements NodeView {
117
115
  syntaxHighlighting(highlightStyle),
118
116
  bracketMatching(),
119
117
  lineNumbers({
120
- domEventHandlers: fg('platform_editor_fix_right_click_paste')
121
- ? {
122
- click: () => {
123
- this.selectCodeBlockNode(undefined);
124
- this.view.focus();
125
- return true;
126
- },
127
- }
128
- : undefined,
118
+ domEventHandlers: {
119
+ click: () => {
120
+ this.selectCodeBlockNode(undefined);
121
+ this.view.focus();
122
+ return true;
123
+ },
124
+ },
129
125
  }),
130
126
  // Explicitly disable "sticky" positioning on line numbers to match
131
127
  // Renderer behaviour
@@ -281,26 +277,6 @@ class CodeBlockAdvancedNodeView implements NodeView {
281
277
  }
282
278
 
283
279
  stopEvent(e: Event) {
284
- if (!fg('platform_editor_fix_right_click_paste')) {
285
- if (e instanceof MouseEvent && e.type === 'mousedown') {
286
- // !Warning: Side effect!
287
- // CodeMirror on blur updates the dom observer with a `setTimeout(..., 10);`
288
- // We need to select the nodeview after this has taken place to ensure
289
- // ProseMirror takes over
290
- // https://github.com/codemirror/view/commit/70a9a253df04a57004247b9463198c17832f92f4#diff-cb8cbffa623ff0975389e7e8c315e69d5e10345239ffe2c9b4b7986a56ad95efR720
291
- setTimeout(() => {
292
- // Ensure the CM selection is reset - if we have a ranged selection when we do node selection can
293
- // cause funky behaviour
294
- this.updating = true;
295
- this.cm.dispatch({
296
- selection: EditorSelection.create([EditorSelection.cursor(0)], 0),
297
- });
298
- this.updating = false;
299
- this.selectCodeBlockNode(undefined);
300
- this.view.focus();
301
- }, 20);
302
- }
303
- }
304
280
  // If we have selected the node we should not stop these events
305
281
  if (
306
282
  (e instanceof KeyboardEvent || e instanceof ClipboardEvent) &&
package/tsconfig.dev.json CHANGED
@@ -23,7 +23,13 @@
23
23
  "./__mocks__/**/*",
24
24
  "**/mock.*",
25
25
  "**/codemods/**/*.ts",
26
- "**/codemods/**/*.tsx"
26
+ "**/codemods/**/*.tsx",
27
+ "**/stories.ts",
28
+ "**/stories.tsx",
29
+ "**/stories/*.ts",
30
+ "**/stories/*.tsx",
31
+ "**/stories/**/*.ts",
32
+ "**/stories/**/*.tsx"
27
33
  ],
28
34
  "exclude": ["./dist/**/*", "./build/**/*", "./node_modules/**/*"],
29
35
  "compilerOptions": {