@atlaskit/editor-plugin-code-block-advanced 2.3.2 → 2.3.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,19 @@
1
1
  # @atlaskit/editor-plugin-code-block-advanced
2
2
 
3
+ ## 2.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.3.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#172642](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/172642)
14
+ [`4742ad40d0dde`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4742ad40d0dde) -
15
+ [ux] Fixes height of the new resize handle when a code block is the first node in the document.
16
+
3
17
  ## 2.3.2
4
18
 
5
19
  ### Patch Changes
@@ -21,6 +21,7 @@ var _syntaxHighlightingTheme = require("../ui/syntaxHighlightingTheme");
21
21
  var _theme = require("../ui/theme");
22
22
  var _syncCMWithPM = require("./codemirrorSync/syncCMWithPM");
23
23
  var _updateCMSelection = require("./codemirrorSync/updateCMSelection");
24
+ var _firstCodeBlockInDocument = require("./extensions/firstCodeBlockInDocument");
24
25
  var _keymap = require("./extensions/keymap");
25
26
  var _manageSelectionMarker = require("./extensions/manageSelectionMarker");
26
27
  var _prosemirrorDecorations = require("./extensions/prosemirrorDecorations");
@@ -83,7 +84,7 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
83
84
  contentEditable: "".concat(this.view.editable)
84
85
  })]), (0, _autocomplete.closeBrackets)(), _view.EditorView.editorAttributes.of({
85
86
  class: 'code-block'
86
- }), (0, _manageSelectionMarker.manageSelectionMarker)(config.api), (0, _prosemirrorDecorations.prosemirrorDecorationPlugin)(this.pmFacet, view, getPos), (0, _tripleClickExtension.tripleClickSelectAllExtension)()])
87
+ }), (0, _manageSelectionMarker.manageSelectionMarker)(config.api), (0, _prosemirrorDecorations.prosemirrorDecorationPlugin)(this.pmFacet, view, getPos), (0, _tripleClickExtension.tripleClickSelectAllExtension)(), (0, _firstCodeBlockInDocument.firstCodeBlockInDocument)(getPos)])
87
88
  });
88
89
 
89
90
  // We append an additional element that fixes a selection bug on chrome if the code block
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.firstCodeBlockInDocument = void 0;
7
+ var _view = require("@codemirror/view");
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
9
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
10
+ /**
11
+ * Keeps 'first-node-in-document' class if it was added to a codeBlock by
12
+ * platform/packages/editor/editor-plugin-block-controls/src/pm-plugins/first-node-dec-plugin.ts
13
+ *
14
+ * @param getPos
15
+ * @returns CodeMirror Extension
16
+ * @example
17
+ */
18
+ var firstCodeBlockInDocument = exports.firstCodeBlockInDocument = function firstCodeBlockInDocument(getPos) {
19
+ if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_controls', 'cohort', 'variant1') && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_breakout_resizing', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_hello_release')) {
20
+ return _view.EditorView.editorAttributes.of({
21
+ class: (getPos === null || getPos === void 0 ? void 0 : getPos()) === 0 ? 'first-node-in-document' : ''
22
+ });
23
+ } else {
24
+ return [];
25
+ }
26
+ };
@@ -11,6 +11,7 @@ import { highlightStyle } from '../ui/syntaxHighlightingTheme';
11
11
  import { cmTheme } from '../ui/theme';
12
12
  import { syncCMWithPM } from './codemirrorSync/syncCMWithPM';
13
13
  import { getCMSelectionChanges } from './codemirrorSync/updateCMSelection';
14
+ import { firstCodeBlockInDocument } from './extensions/firstCodeBlockInDocument';
14
15
  import { keymapExtension } from './extensions/keymap';
15
16
  import { manageSelectionMarker } from './extensions/manageSelectionMarker';
16
17
  import { prosemirrorDecorationPlugin } from './extensions/prosemirrorDecorations';
@@ -61,7 +62,7 @@ class CodeBlockAdvancedNodeView {
61
62
  contentEditable: `${this.view.editable}`
62
63
  })]), closeBrackets(), CodeMirror.editorAttributes.of({
63
64
  class: 'code-block'
64
- }), manageSelectionMarker(config.api), prosemirrorDecorationPlugin(this.pmFacet, view, getPos), tripleClickSelectAllExtension()]
65
+ }), manageSelectionMarker(config.api), prosemirrorDecorationPlugin(this.pmFacet, view, getPos), tripleClickSelectAllExtension(), firstCodeBlockInDocument(getPos)]
65
66
  });
66
67
 
67
68
  // We append an additional element that fixes a selection bug on chrome if the code block
@@ -0,0 +1,21 @@
1
+ import { EditorView as CodeMirror } from '@codemirror/view';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
3
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
4
+
5
+ /**
6
+ * Keeps 'first-node-in-document' class if it was added to a codeBlock by
7
+ * platform/packages/editor/editor-plugin-block-controls/src/pm-plugins/first-node-dec-plugin.ts
8
+ *
9
+ * @param getPos
10
+ * @returns CodeMirror Extension
11
+ * @example
12
+ */
13
+ export const firstCodeBlockInDocument = getPos => {
14
+ if (expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1') && expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true) && fg('platform_editor_breakout_resizing_hello_release')) {
15
+ return CodeMirror.editorAttributes.of({
16
+ class: (getPos === null || getPos === void 0 ? void 0 : getPos()) === 0 ? 'first-node-in-document' : ''
17
+ });
18
+ } else {
19
+ return [];
20
+ }
21
+ };
@@ -14,6 +14,7 @@ import { highlightStyle } from '../ui/syntaxHighlightingTheme';
14
14
  import { cmTheme } from '../ui/theme';
15
15
  import { syncCMWithPM } from './codemirrorSync/syncCMWithPM';
16
16
  import { getCMSelectionChanges } from './codemirrorSync/updateCMSelection';
17
+ import { firstCodeBlockInDocument } from './extensions/firstCodeBlockInDocument';
17
18
  import { keymapExtension } from './extensions/keymap';
18
19
  import { manageSelectionMarker } from './extensions/manageSelectionMarker';
19
20
  import { prosemirrorDecorationPlugin } from './extensions/prosemirrorDecorations';
@@ -76,7 +77,7 @@ var CodeBlockAdvancedNodeView = /*#__PURE__*/function () {
76
77
  contentEditable: "".concat(this.view.editable)
77
78
  })]), closeBrackets(), CodeMirror.editorAttributes.of({
78
79
  class: 'code-block'
79
- }), manageSelectionMarker(config.api), prosemirrorDecorationPlugin(this.pmFacet, view, getPos), tripleClickSelectAllExtension()])
80
+ }), manageSelectionMarker(config.api), prosemirrorDecorationPlugin(this.pmFacet, view, getPos), tripleClickSelectAllExtension(), firstCodeBlockInDocument(getPos)])
80
81
  });
81
82
 
82
83
  // We append an additional element that fixes a selection bug on chrome if the code block
@@ -0,0 +1,21 @@
1
+ import { EditorView as CodeMirror } from '@codemirror/view';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
3
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
4
+
5
+ /**
6
+ * Keeps 'first-node-in-document' class if it was added to a codeBlock by
7
+ * platform/packages/editor/editor-plugin-block-controls/src/pm-plugins/first-node-dec-plugin.ts
8
+ *
9
+ * @param getPos
10
+ * @returns CodeMirror Extension
11
+ * @example
12
+ */
13
+ export var firstCodeBlockInDocument = function firstCodeBlockInDocument(getPos) {
14
+ if (expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1') && expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true) && fg('platform_editor_breakout_resizing_hello_release')) {
15
+ return CodeMirror.editorAttributes.of({
16
+ class: (getPos === null || getPos === void 0 ? void 0 : getPos()) === 0 ? 'first-node-in-document' : ''
17
+ });
18
+ } else {
19
+ return [];
20
+ }
21
+ };
@@ -0,0 +1,10 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ /**
3
+ * Keeps 'first-node-in-document' class if it was added to a codeBlock by
4
+ * platform/packages/editor/editor-plugin-block-controls/src/pm-plugins/first-node-dec-plugin.ts
5
+ *
6
+ * @param getPos
7
+ * @returns CodeMirror Extension
8
+ * @example
9
+ */
10
+ export declare const firstCodeBlockInDocument: (getPos: () => number | undefined) => Extension;
@@ -0,0 +1,10 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ /**
3
+ * Keeps 'first-node-in-document' class if it was added to a codeBlock by
4
+ * platform/packages/editor/editor-plugin-block-controls/src/pm-plugins/first-node-dec-plugin.ts
5
+ *
6
+ * @param getPos
7
+ * @returns CodeMirror Extension
8
+ * @example
9
+ */
10
+ export declare const firstCodeBlockInDocument: (getPos: () => number | undefined) => Extension;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block-advanced",
3
- "version": "2.3.2",
3
+ "version": "2.3.4",
4
4
  "description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,16 +33,16 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^47.6.0",
36
- "@atlaskit/editor-common": "^106.6.0",
36
+ "@atlaskit/editor-common": "^107.0.0",
37
37
  "@atlaskit/editor-plugin-code-block": "^4.4.0",
38
- "@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
39
- "@atlaskit/editor-plugin-find-replace": "^2.4.0",
38
+ "@atlaskit/editor-plugin-editor-disabled": "^2.1.0",
39
+ "@atlaskit/editor-plugin-find-replace": "^2.6.0",
40
40
  "@atlaskit/editor-plugin-selection": "^2.2.0",
41
- "@atlaskit/editor-plugin-selection-marker": "^2.4.0",
41
+ "@atlaskit/editor-plugin-selection-marker": "^2.5.0",
42
42
  "@atlaskit/editor-prosemirror": "7.0.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
- "@atlaskit/tmp-editor-statsig": "^7.0.0",
45
- "@atlaskit/tokens": "^5.1.0",
44
+ "@atlaskit/tmp-editor-statsig": "^7.1.0",
45
+ "@atlaskit/tokens": "^5.2.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@codemirror/autocomplete": "6.18.4",
48
48
  "@codemirror/commands": "6.7.1",
@@ -35,6 +35,7 @@ import { cmTheme } from '../ui/theme';
35
35
 
36
36
  import { syncCMWithPM } from './codemirrorSync/syncCMWithPM';
37
37
  import { getCMSelectionChanges } from './codemirrorSync/updateCMSelection';
38
+ import { firstCodeBlockInDocument } from './extensions/firstCodeBlockInDocument';
38
39
  import { keymapExtension } from './extensions/keymap';
39
40
  import { manageSelectionMarker } from './extensions/manageSelectionMarker';
40
41
  import { prosemirrorDecorationPlugin } from './extensions/prosemirrorDecorations';
@@ -122,6 +123,7 @@ class CodeBlockAdvancedNodeView implements NodeView {
122
123
  manageSelectionMarker(config.api),
123
124
  prosemirrorDecorationPlugin(this.pmFacet, view, getPos),
124
125
  tripleClickSelectAllExtension(),
126
+ firstCodeBlockInDocument(getPos),
125
127
  ],
126
128
  });
127
129
 
@@ -0,0 +1,27 @@
1
+ import { type Extension } from '@codemirror/state';
2
+ import { EditorView as CodeMirror } from '@codemirror/view';
3
+
4
+ import { fg } from '@atlaskit/platform-feature-flags';
5
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
6
+
7
+ /**
8
+ * Keeps 'first-node-in-document' class if it was added to a codeBlock by
9
+ * platform/packages/editor/editor-plugin-block-controls/src/pm-plugins/first-node-dec-plugin.ts
10
+ *
11
+ * @param getPos
12
+ * @returns CodeMirror Extension
13
+ * @example
14
+ */
15
+ export const firstCodeBlockInDocument = (getPos: () => number | undefined): Extension => {
16
+ if (
17
+ expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1') &&
18
+ expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true) &&
19
+ fg('platform_editor_breakout_resizing_hello_release')
20
+ ) {
21
+ return CodeMirror.editorAttributes.of({
22
+ class: getPos?.() === 0 ? 'first-node-in-document' : '',
23
+ });
24
+ } else {
25
+ return [];
26
+ }
27
+ };