@atlaskit/editor-plugin-code-block-advanced 24.0.3 → 25.0.0
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 +18 -0
- package/dist/cjs/nodeviews/extensions/firstCodeBlockInDocument.js +1 -2
- package/dist/cjs/nodeviews/extensions/keymap/index.js +16 -23
- package/dist/es2019/nodeviews/extensions/firstCodeBlockInDocument.js +1 -2
- package/dist/es2019/nodeviews/extensions/keymap/index.js +16 -23
- package/dist/esm/nodeviews/extensions/firstCodeBlockInDocument.js +1 -2
- package/dist/esm/nodeviews/extensions/keymap/index.js +16 -23
- package/package.json +10 -10
- package/src/nodeviews/extensions/firstCodeBlockInDocument.ts +1 -5
- package/src/nodeviews/extensions/keymap/index.ts +20 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block-advanced
|
|
2
2
|
|
|
3
|
+
## 25.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 24.0.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`0a81f6fa7cbf8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0a81f6fa7cbf8) -
|
|
14
|
+
Clean up experiment `platform_editor_breakout_resizing`. Behind the
|
|
15
|
+
`platform_editor_list_join_strip_breakout` experiment, strip the breakout mark from a code block
|
|
16
|
+
before nesting it into a list item when joining from a gap cursor. Behind the
|
|
17
|
+
`platform_editor_resizer_selector_jsdom_fix` experiment, make the panel and rule breakout resizer
|
|
18
|
+
selectors parseable by jsdom (`> *[data-prosemirror-node-name=…]`).
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 24.0.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.firstCodeBlockInDocument = void 0;
|
|
7
7
|
var _view = require("@codemirror/view");
|
|
8
8
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
9
|
-
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
10
9
|
/**
|
|
11
10
|
* Keeps 'first-node-in-document' class if it was added to a codeBlock by
|
|
12
11
|
* platform/packages/editor/editor-plugin-block-controls/src/pm-plugins/first-node-dec-plugin.ts
|
|
@@ -16,7 +15,7 @@ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equa
|
|
|
16
15
|
* @example
|
|
17
16
|
*/
|
|
18
17
|
var firstCodeBlockInDocument = exports.firstCodeBlockInDocument = function firstCodeBlockInDocument(getPos) {
|
|
19
|
-
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')
|
|
18
|
+
if ((0, _editorExperiment.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
20
19
|
return _view.EditorView.editorAttributes.of({
|
|
21
20
|
class: (getPos === null || getPos === void 0 ? void 0 : getPos()) === 0 ? 'first-node-in-document' : ''
|
|
22
21
|
});
|
|
@@ -12,7 +12,6 @@ var _browser = require("@atlaskit/editor-common/browser");
|
|
|
12
12
|
var _commands2 = require("@atlaskit/editor-prosemirror/commands");
|
|
13
13
|
var _redo = require("@atlaskit/prosemirror-history/redo");
|
|
14
14
|
var _undo = require("@atlaskit/prosemirror-history/undo");
|
|
15
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
15
|
var _backspace = require("./backspace");
|
|
17
16
|
var _maybeEscape = require("./maybeEscape");
|
|
18
17
|
var keymapExtension = exports.keymapExtension = function keymapExtension(_ref) {
|
|
@@ -170,34 +169,28 @@ var codeBlockKeymap = function codeBlockKeymap(_ref2) {
|
|
|
170
169
|
mac: 'Cmd-Alt-]',
|
|
171
170
|
run: function run() {
|
|
172
171
|
// Pass synthetic event to prosemirror
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return true;
|
|
182
|
-
}
|
|
183
|
-
return false;
|
|
172
|
+
view.dispatchEvent(new KeyboardEvent('keydown', {
|
|
173
|
+
key: ']',
|
|
174
|
+
code: 'BracketRight',
|
|
175
|
+
metaKey: browser.mac ? true : false,
|
|
176
|
+
ctrlKey: browser.mac ? false : true,
|
|
177
|
+
altKey: true
|
|
178
|
+
}));
|
|
179
|
+
return true;
|
|
184
180
|
}
|
|
185
181
|
}, {
|
|
186
182
|
key: 'Ctrl-Alt-[',
|
|
187
183
|
mac: 'Cmd-Alt-[',
|
|
188
184
|
run: function run() {
|
|
189
185
|
// Pass synthetic event to prosemirror
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return true;
|
|
199
|
-
}
|
|
200
|
-
return false;
|
|
186
|
+
view.dispatchEvent(new KeyboardEvent('keydown', {
|
|
187
|
+
key: ']',
|
|
188
|
+
code: 'BracketLeft',
|
|
189
|
+
metaKey: browser.mac ? true : false,
|
|
190
|
+
ctrlKey: browser.mac ? false : true,
|
|
191
|
+
altKey: true
|
|
192
|
+
}));
|
|
193
|
+
return true;
|
|
201
194
|
}
|
|
202
195
|
}].concat((0, _toConsumableArray2.default)(_commands.defaultKeymap.concat(_commands.indentWithTab)));
|
|
203
196
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EditorView as CodeMirror } from '@codemirror/view';
|
|
2
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
3
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Keeps 'first-node-in-document' class if it was added to a codeBlock by
|
|
@@ -11,7 +10,7 @@ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equ
|
|
|
11
10
|
* @example
|
|
12
11
|
*/
|
|
13
12
|
export const firstCodeBlockInDocument = getPos => {
|
|
14
|
-
if (editorExperiment('platform_editor_controls', 'variant1')
|
|
13
|
+
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
15
14
|
return CodeMirror.editorAttributes.of({
|
|
16
15
|
class: (getPos === null || getPos === void 0 ? void 0 : getPos()) === 0 ? 'first-node-in-document' : ''
|
|
17
16
|
});
|
|
@@ -4,7 +4,6 @@ import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
|
4
4
|
import { exitCode, selectAll } from '@atlaskit/editor-prosemirror/commands';
|
|
5
5
|
import { redo } from '@atlaskit/prosemirror-history/redo';
|
|
6
6
|
import { undo } from '@atlaskit/prosemirror-history/undo';
|
|
7
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
7
|
import { backspaceKeymap } from './backspace';
|
|
9
8
|
import { maybeEscapeKeymap } from './maybeEscape';
|
|
10
9
|
export const keymapExtension = ({
|
|
@@ -148,34 +147,28 @@ const codeBlockKeymap = ({
|
|
|
148
147
|
mac: 'Cmd-Alt-]',
|
|
149
148
|
run: () => {
|
|
150
149
|
// Pass synthetic event to prosemirror
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
return true;
|
|
160
|
-
}
|
|
161
|
-
return false;
|
|
150
|
+
view.dispatchEvent(new KeyboardEvent('keydown', {
|
|
151
|
+
key: ']',
|
|
152
|
+
code: 'BracketRight',
|
|
153
|
+
metaKey: browser.mac ? true : false,
|
|
154
|
+
ctrlKey: browser.mac ? false : true,
|
|
155
|
+
altKey: true
|
|
156
|
+
}));
|
|
157
|
+
return true;
|
|
162
158
|
}
|
|
163
159
|
}, {
|
|
164
160
|
key: 'Ctrl-Alt-[',
|
|
165
161
|
mac: 'Cmd-Alt-[',
|
|
166
162
|
run: () => {
|
|
167
163
|
// Pass synthetic event to prosemirror
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return true;
|
|
177
|
-
}
|
|
178
|
-
return false;
|
|
164
|
+
view.dispatchEvent(new KeyboardEvent('keydown', {
|
|
165
|
+
key: ']',
|
|
166
|
+
code: 'BracketLeft',
|
|
167
|
+
metaKey: browser.mac ? true : false,
|
|
168
|
+
ctrlKey: browser.mac ? false : true,
|
|
169
|
+
altKey: true
|
|
170
|
+
}));
|
|
171
|
+
return true;
|
|
179
172
|
}
|
|
180
173
|
}, ...defaultKeymap.concat(indentWithTab)];
|
|
181
174
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EditorView as CodeMirror } from '@codemirror/view';
|
|
2
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
3
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Keeps 'first-node-in-document' class if it was added to a codeBlock by
|
|
@@ -11,7 +10,7 @@ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equ
|
|
|
11
10
|
* @example
|
|
12
11
|
*/
|
|
13
12
|
export var firstCodeBlockInDocument = function firstCodeBlockInDocument(getPos) {
|
|
14
|
-
if (editorExperiment('platform_editor_controls', 'variant1')
|
|
13
|
+
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
15
14
|
return CodeMirror.editorAttributes.of({
|
|
16
15
|
class: (getPos === null || getPos === void 0 ? void 0 : getPos()) === 0 ? 'first-node-in-document' : ''
|
|
17
16
|
});
|
|
@@ -5,7 +5,6 @@ import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
|
5
5
|
import { exitCode, selectAll } from '@atlaskit/editor-prosemirror/commands';
|
|
6
6
|
import { redo } from '@atlaskit/prosemirror-history/redo';
|
|
7
7
|
import { undo } from '@atlaskit/prosemirror-history/undo';
|
|
8
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
8
|
import { backspaceKeymap } from './backspace';
|
|
10
9
|
import { maybeEscapeKeymap } from './maybeEscape';
|
|
11
10
|
export var keymapExtension = function keymapExtension(_ref) {
|
|
@@ -163,34 +162,28 @@ var codeBlockKeymap = function codeBlockKeymap(_ref2) {
|
|
|
163
162
|
mac: 'Cmd-Alt-]',
|
|
164
163
|
run: function run() {
|
|
165
164
|
// Pass synthetic event to prosemirror
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return true;
|
|
175
|
-
}
|
|
176
|
-
return false;
|
|
165
|
+
view.dispatchEvent(new KeyboardEvent('keydown', {
|
|
166
|
+
key: ']',
|
|
167
|
+
code: 'BracketRight',
|
|
168
|
+
metaKey: browser.mac ? true : false,
|
|
169
|
+
ctrlKey: browser.mac ? false : true,
|
|
170
|
+
altKey: true
|
|
171
|
+
}));
|
|
172
|
+
return true;
|
|
177
173
|
}
|
|
178
174
|
}, {
|
|
179
175
|
key: 'Ctrl-Alt-[',
|
|
180
176
|
mac: 'Cmd-Alt-[',
|
|
181
177
|
run: function run() {
|
|
182
178
|
// Pass synthetic event to prosemirror
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
return true;
|
|
192
|
-
}
|
|
193
|
-
return false;
|
|
179
|
+
view.dispatchEvent(new KeyboardEvent('keydown', {
|
|
180
|
+
key: ']',
|
|
181
|
+
code: 'BracketLeft',
|
|
182
|
+
metaKey: browser.mac ? true : false,
|
|
183
|
+
ctrlKey: browser.mac ? false : true,
|
|
184
|
+
altKey: true
|
|
185
|
+
}));
|
|
186
|
+
return true;
|
|
194
187
|
}
|
|
195
188
|
}].concat(_toConsumableArray(defaultKeymap.concat(indentWithTab)));
|
|
196
189
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block-advanced",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0",
|
|
4
4
|
"description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"atlaskit:src": "src/index.ts",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@atlaskit/adf-schema": "^57.
|
|
23
|
+
"@atlaskit/adf-schema": "^57.7.0",
|
|
24
24
|
"@atlaskit/code": "^20.0.0",
|
|
25
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
26
|
-
"@atlaskit/editor-plugin-code-block": "^
|
|
27
|
-
"@atlaskit/editor-plugin-editor-disabled": "^
|
|
28
|
-
"@atlaskit/editor-plugin-find-replace": "^
|
|
29
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
30
|
-
"@atlaskit/editor-plugin-selection-marker": "^
|
|
25
|
+
"@atlaskit/editor-plugin-analytics": "^25.0.0",
|
|
26
|
+
"@atlaskit/editor-plugin-code-block": "^27.0.0",
|
|
27
|
+
"@atlaskit/editor-plugin-editor-disabled": "^25.0.0",
|
|
28
|
+
"@atlaskit/editor-plugin-find-replace": "^25.0.0",
|
|
29
|
+
"@atlaskit/editor-plugin-selection": "^25.0.0",
|
|
30
|
+
"@atlaskit/editor-plugin-selection-marker": "^25.0.0",
|
|
31
31
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
32
32
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
33
33
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
34
34
|
"@atlaskit/prosemirror-history": "^1.3.0",
|
|
35
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
35
|
+
"@atlaskit/tmp-editor-statsig": "^224.0.0",
|
|
36
36
|
"@atlaskit/tokens": "^20.3.0",
|
|
37
37
|
"@babel/runtime": "^7.0.0",
|
|
38
38
|
"@codemirror/autocomplete": "6.18.4",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"codemirror-lang-mermaid": "0.4.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@atlaskit/editor-common": "^
|
|
54
|
+
"@atlaskit/editor-common": "^129.0.0",
|
|
55
55
|
"react": "^18.2.0 || ^19.2.0",
|
|
56
56
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
57
57
|
},
|
|
@@ -2,7 +2,6 @@ import type { Extension } from '@codemirror/state';
|
|
|
2
2
|
import { EditorView as CodeMirror } from '@codemirror/view';
|
|
3
3
|
|
|
4
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
5
|
-
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Keeps 'first-node-in-document' class if it was added to a codeBlock by
|
|
@@ -13,10 +12,7 @@ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equ
|
|
|
13
12
|
* @example
|
|
14
13
|
*/
|
|
15
14
|
export const firstCodeBlockInDocument = (getPos: () => number | undefined): Extension => {
|
|
16
|
-
if (
|
|
17
|
-
editorExperiment('platform_editor_controls', 'variant1') &&
|
|
18
|
-
expValEqualsNoExposure('platform_editor_breakout_resizing', 'isEnabled', true)
|
|
19
|
-
) {
|
|
15
|
+
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
20
16
|
return CodeMirror.editorAttributes.of({
|
|
21
17
|
class: getPos?.() === 0 ? 'first-node-in-document' : '',
|
|
22
18
|
});
|
|
@@ -11,7 +11,6 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
11
11
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
12
12
|
import { redo } from '@atlaskit/prosemirror-history/redo';
|
|
13
13
|
import { undo } from '@atlaskit/prosemirror-history/undo';
|
|
14
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
14
|
|
|
16
15
|
import { backspaceKeymap } from './backspace';
|
|
17
16
|
import { maybeEscapeKeymap } from './maybeEscape';
|
|
@@ -172,19 +171,16 @@ const codeBlockKeymap = ({
|
|
|
172
171
|
mac: 'Cmd-Alt-]',
|
|
173
172
|
run: () => {
|
|
174
173
|
// Pass synthetic event to prosemirror
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return true;
|
|
186
|
-
}
|
|
187
|
-
return false;
|
|
174
|
+
view.dispatchEvent(
|
|
175
|
+
new KeyboardEvent('keydown', {
|
|
176
|
+
key: ']',
|
|
177
|
+
code: 'BracketRight',
|
|
178
|
+
metaKey: browser.mac ? true : false,
|
|
179
|
+
ctrlKey: browser.mac ? false : true,
|
|
180
|
+
altKey: true,
|
|
181
|
+
}),
|
|
182
|
+
);
|
|
183
|
+
return true;
|
|
188
184
|
},
|
|
189
185
|
},
|
|
190
186
|
{
|
|
@@ -192,19 +188,16 @@ const codeBlockKeymap = ({
|
|
|
192
188
|
mac: 'Cmd-Alt-[',
|
|
193
189
|
run: () => {
|
|
194
190
|
// Pass synthetic event to prosemirror
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
return false;
|
|
191
|
+
view.dispatchEvent(
|
|
192
|
+
new KeyboardEvent('keydown', {
|
|
193
|
+
key: ']',
|
|
194
|
+
code: 'BracketLeft',
|
|
195
|
+
metaKey: browser.mac ? true : false,
|
|
196
|
+
ctrlKey: browser.mac ? false : true,
|
|
197
|
+
altKey: true,
|
|
198
|
+
}),
|
|
199
|
+
);
|
|
200
|
+
return true;
|
|
208
201
|
},
|
|
209
202
|
},
|
|
210
203
|
...defaultKeymap.concat(indentWithTab),
|