@atlaskit/editor-plugin-code-block-advanced 2.2.12 → 2.3.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 +15 -0
- package/afm-cc/tsconfig.json +7 -1
- package/dist/cjs/nodeviews/extensions/keymap/index.js +36 -0
- package/dist/cjs/nodeviews/languages/languageMap.js +1 -2
- package/dist/cjs/nodeviews/lazyCodeBlockAdvanced.js +1 -2
- package/dist/es2019/nodeviews/extensions/keymap/index.js +36 -0
- package/dist/esm/nodeviews/extensions/keymap/index.js +36 -0
- package/package.json +11 -4
- package/src/nodeviews/extensions/keymap/index.ts +36 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block-advanced
|
|
2
2
|
|
|
3
|
+
## 2.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#166502](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/166502)
|
|
8
|
+
[`ea1ed63fc9615`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ea1ed63fc9615) -
|
|
9
|
+
ED-28032 add keyboard shortcuts for new resizing experience behind
|
|
10
|
+
platform_editor_breakout_resizing
|
|
11
|
+
|
|
12
|
+
## 2.2.13
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 2.2.12
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"target": "es5",
|
|
5
5
|
"composite": true,
|
|
6
|
-
"outDir": "
|
|
6
|
+
"outDir": "../../../../../confluence/tsDist/@atlaskit__editor-plugin-code-block-advanced",
|
|
7
7
|
"rootDir": "../"
|
|
8
8
|
},
|
|
9
9
|
"include": [
|
|
@@ -35,6 +35,12 @@
|
|
|
35
35
|
{
|
|
36
36
|
"path": "../../editor-plugin-selection-marker/afm-cc/tsconfig.json"
|
|
37
37
|
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../../platform/feature-flags/afm-cc/tsconfig.json"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../tmp-editor-statsig/afm-cc/tsconfig.json"
|
|
43
|
+
},
|
|
38
44
|
{
|
|
39
45
|
"path": "../../../design-system/tokens/afm-cc/tsconfig.json"
|
|
40
46
|
}
|
|
@@ -11,6 +11,8 @@ var _view = require("@codemirror/view");
|
|
|
11
11
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
12
12
|
var _commands2 = require("@atlaskit/editor-prosemirror/commands");
|
|
13
13
|
var _history = require("@atlaskit/editor-prosemirror/history");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
16
|
var _backspace = require("./backspace");
|
|
15
17
|
var _maybeEscape = require("./maybeEscape");
|
|
16
18
|
var keymapExtension = exports.keymapExtension = function keymapExtension(_ref) {
|
|
@@ -162,5 +164,39 @@ var codeBlockKeymap = function codeBlockKeymap(_ref2) {
|
|
|
162
164
|
getPos: getPos
|
|
163
165
|
});
|
|
164
166
|
}
|
|
167
|
+
}, {
|
|
168
|
+
key: 'Ctrl-Alt-]',
|
|
169
|
+
mac: 'Cmd-Alt-]',
|
|
170
|
+
run: function run() {
|
|
171
|
+
// Pass synthetic event to prosemirror
|
|
172
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_breakout_resizing', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_hello_release')) {
|
|
173
|
+
view.dispatchEvent(new KeyboardEvent('keydown', {
|
|
174
|
+
key: ']',
|
|
175
|
+
code: 'BracketRight',
|
|
176
|
+
metaKey: _browser.browser.mac ? true : false,
|
|
177
|
+
ctrlKey: _browser.browser.mac ? false : true,
|
|
178
|
+
altKey: true
|
|
179
|
+
}));
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}, {
|
|
185
|
+
key: 'Ctrl-Alt-[',
|
|
186
|
+
mac: 'Cmd-Alt-[',
|
|
187
|
+
run: function run() {
|
|
188
|
+
// Pass synthetic event to prosemirror
|
|
189
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_breakout_resizing', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_breakout_resizing_hello_release')) {
|
|
190
|
+
view.dispatchEvent(new KeyboardEvent('keydown', {
|
|
191
|
+
key: ']',
|
|
192
|
+
code: 'BracketLeft',
|
|
193
|
+
metaKey: _browser.browser.mac ? true : false,
|
|
194
|
+
ctrlKey: _browser.browser.mac ? false : true,
|
|
195
|
+
altKey: true
|
|
196
|
+
}));
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
165
201
|
}].concat((0, _toConsumableArray2.default)(_commands.defaultKeymap.concat(_commands.indentWithTab)));
|
|
166
202
|
};
|
|
@@ -8,8 +8,7 @@ exports.mapLanguageToCodeMirror = void 0;
|
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _language = require("@codemirror/language");
|
|
10
10
|
var _languageData = require("@codemirror/language-data");
|
|
11
|
-
function
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != (0, _typeof2.default)(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
13
12
|
// getLanguageIdentifier defines `language.alias[0]`
|
|
14
13
|
var mapLanguageToCodeMirror = exports.mapLanguageToCodeMirror = function mapLanguageToCodeMirror(language) {
|
|
15
14
|
if (!language || language === 'none') {
|
|
@@ -9,8 +9,7 @@ exports.lazyCodeBlockView = void 0;
|
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
11
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
12
|
-
function
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
13
|
var lazyCodeBlockView = exports.lazyCodeBlockView = function lazyCodeBlockView(props) {
|
|
15
14
|
return (0, _lazyNodeView.withLazyLoading)({
|
|
16
15
|
nodeName: 'codeBlock',
|
|
@@ -3,6 +3,8 @@ import { keymap as cmKeymap } from '@codemirror/view';
|
|
|
3
3
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
4
4
|
import { exitCode, selectAll } from '@atlaskit/editor-prosemirror/commands';
|
|
5
5
|
import { undo, redo } from '@atlaskit/editor-prosemirror/history';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
8
|
import { backspaceKeymap } from './backspace';
|
|
7
9
|
import { maybeEscapeKeymap } from './maybeEscape';
|
|
8
10
|
export const keymapExtension = ({
|
|
@@ -140,5 +142,39 @@ const codeBlockKeymap = ({
|
|
|
140
142
|
getNode,
|
|
141
143
|
getPos
|
|
142
144
|
})
|
|
145
|
+
}, {
|
|
146
|
+
key: 'Ctrl-Alt-]',
|
|
147
|
+
mac: 'Cmd-Alt-]',
|
|
148
|
+
run: () => {
|
|
149
|
+
// Pass synthetic event to prosemirror
|
|
150
|
+
if (expValEquals('platform_editor_breakout_resizing', 'isEnabled', true) && fg('platform_editor_breakout_resizing_hello_release')) {
|
|
151
|
+
view.dispatchEvent(new KeyboardEvent('keydown', {
|
|
152
|
+
key: ']',
|
|
153
|
+
code: 'BracketRight',
|
|
154
|
+
metaKey: browser.mac ? true : false,
|
|
155
|
+
ctrlKey: browser.mac ? false : true,
|
|
156
|
+
altKey: true
|
|
157
|
+
}));
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
}, {
|
|
163
|
+
key: 'Ctrl-Alt-[',
|
|
164
|
+
mac: 'Cmd-Alt-[',
|
|
165
|
+
run: () => {
|
|
166
|
+
// Pass synthetic event to prosemirror
|
|
167
|
+
if (expValEquals('platform_editor_breakout_resizing', 'isEnabled', true) && fg('platform_editor_breakout_resizing_hello_release')) {
|
|
168
|
+
view.dispatchEvent(new KeyboardEvent('keydown', {
|
|
169
|
+
key: ']',
|
|
170
|
+
code: 'BracketLeft',
|
|
171
|
+
metaKey: browser.mac ? true : false,
|
|
172
|
+
ctrlKey: browser.mac ? false : true,
|
|
173
|
+
altKey: true
|
|
174
|
+
}));
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
143
179
|
}, ...defaultKeymap.concat(indentWithTab)];
|
|
144
180
|
};
|
|
@@ -4,6 +4,8 @@ import { keymap as cmKeymap } from '@codemirror/view';
|
|
|
4
4
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
5
5
|
import { exitCode, selectAll } from '@atlaskit/editor-prosemirror/commands';
|
|
6
6
|
import { undo, redo } from '@atlaskit/editor-prosemirror/history';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
9
|
import { backspaceKeymap } from './backspace';
|
|
8
10
|
import { maybeEscapeKeymap } from './maybeEscape';
|
|
9
11
|
export var keymapExtension = function keymapExtension(_ref) {
|
|
@@ -155,5 +157,39 @@ var codeBlockKeymap = function codeBlockKeymap(_ref2) {
|
|
|
155
157
|
getPos: getPos
|
|
156
158
|
});
|
|
157
159
|
}
|
|
160
|
+
}, {
|
|
161
|
+
key: 'Ctrl-Alt-]',
|
|
162
|
+
mac: 'Cmd-Alt-]',
|
|
163
|
+
run: function run() {
|
|
164
|
+
// Pass synthetic event to prosemirror
|
|
165
|
+
if (expValEquals('platform_editor_breakout_resizing', 'isEnabled', true) && fg('platform_editor_breakout_resizing_hello_release')) {
|
|
166
|
+
view.dispatchEvent(new KeyboardEvent('keydown', {
|
|
167
|
+
key: ']',
|
|
168
|
+
code: 'BracketRight',
|
|
169
|
+
metaKey: browser.mac ? true : false,
|
|
170
|
+
ctrlKey: browser.mac ? false : true,
|
|
171
|
+
altKey: true
|
|
172
|
+
}));
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
}, {
|
|
178
|
+
key: 'Ctrl-Alt-[',
|
|
179
|
+
mac: 'Cmd-Alt-[',
|
|
180
|
+
run: function run() {
|
|
181
|
+
// Pass synthetic event to prosemirror
|
|
182
|
+
if (expValEquals('platform_editor_breakout_resizing', 'isEnabled', true) && fg('platform_editor_breakout_resizing_hello_release')) {
|
|
183
|
+
view.dispatchEvent(new KeyboardEvent('keydown', {
|
|
184
|
+
key: ']',
|
|
185
|
+
code: 'BracketLeft',
|
|
186
|
+
metaKey: browser.mac ? true : false,
|
|
187
|
+
ctrlKey: browser.mac ? false : true,
|
|
188
|
+
altKey: true
|
|
189
|
+
}));
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
158
194
|
}].concat(_toConsumableArray(defaultKeymap.concat(indentWithTab)));
|
|
159
195
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block-advanced",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "CodeBlockAdvanced plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,14 +33,16 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^106.
|
|
36
|
+
"@atlaskit/editor-common": "^106.3.0",
|
|
37
37
|
"@atlaskit/editor-plugin-code-block": "^4.4.0",
|
|
38
38
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
39
|
-
"@atlaskit/editor-plugin-find-replace": "^2.
|
|
39
|
+
"@atlaskit/editor-plugin-find-replace": "^2.3.0",
|
|
40
40
|
"@atlaskit/editor-plugin-selection": "^2.2.0",
|
|
41
41
|
"@atlaskit/editor-plugin-selection-marker": "^2.4.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
|
-
"@atlaskit/
|
|
43
|
+
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
|
+
"@atlaskit/tmp-editor-statsig": "^5.14.0",
|
|
45
|
+
"@atlaskit/tokens": "^5.1.0",
|
|
44
46
|
"@babel/runtime": "^7.0.0",
|
|
45
47
|
"@codemirror/autocomplete": "6.18.4",
|
|
46
48
|
"@codemirror/commands": "6.7.1",
|
|
@@ -95,5 +97,10 @@
|
|
|
95
97
|
"import-no-extraneous-disable-for-examples-and-docs"
|
|
96
98
|
]
|
|
97
99
|
}
|
|
100
|
+
},
|
|
101
|
+
"platform-feature-flags": {
|
|
102
|
+
"platform_editor_breakout_resizing_hello_release": {
|
|
103
|
+
"type": "boolean"
|
|
104
|
+
}
|
|
98
105
|
}
|
|
99
106
|
}
|
|
@@ -9,6 +9,8 @@ import { exitCode, selectAll } from '@atlaskit/editor-prosemirror/commands';
|
|
|
9
9
|
import { undo, redo } from '@atlaskit/editor-prosemirror/history';
|
|
10
10
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
11
11
|
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
14
|
|
|
13
15
|
import { backspaceKeymap } from './backspace';
|
|
14
16
|
import { maybeEscapeKeymap } from './maybeEscape';
|
|
@@ -163,6 +165,40 @@ const codeBlockKeymap = ({
|
|
|
163
165
|
key: 'Backspace',
|
|
164
166
|
run: (cm) => backspaceKeymap({ cm, view, getNode, getPos }),
|
|
165
167
|
},
|
|
168
|
+
{ key: 'Ctrl-Alt-]', mac: 'Cmd-Alt-]', run: () => {
|
|
169
|
+
// Pass synthetic event to prosemirror
|
|
170
|
+
if (expValEquals('platform_editor_breakout_resizing', 'isEnabled', true) && fg('platform_editor_breakout_resizing_hello_release')) {
|
|
171
|
+
view.dispatchEvent(
|
|
172
|
+
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
|
+
);
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{ key: 'Ctrl-Alt-[', mac: 'Cmd-Alt-[', run: () => {
|
|
186
|
+
// Pass synthetic event to prosemirror
|
|
187
|
+
if (expValEquals('platform_editor_breakout_resizing', 'isEnabled', true) && fg('platform_editor_breakout_resizing_hello_release')) {
|
|
188
|
+
view.dispatchEvent(
|
|
189
|
+
new KeyboardEvent('keydown', {
|
|
190
|
+
key: ']',
|
|
191
|
+
code: 'BracketLeft',
|
|
192
|
+
metaKey: browser.mac ? true : false,
|
|
193
|
+
ctrlKey: browser.mac ? false : true,
|
|
194
|
+
altKey: true,
|
|
195
|
+
}),
|
|
196
|
+
);
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
},
|
|
166
202
|
...defaultKeymap.concat(indentWithTab),
|
|
167
203
|
];
|
|
168
204
|
};
|