@atlaskit/editor-plugin-code-block 3.6.0 → 3.6.1
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 +6 -0
- package/dist/cjs/nodeviews/code-block.js +1 -6
- package/dist/cjs/pm-plugins/codeBlockCopySelectionPlugin.js +0 -2
- package/dist/cjs/pm-plugins/ide-ux.js +0 -2
- package/dist/cjs/pm-plugins/input-rule.js +2 -6
- package/dist/cjs/pm-plugins/main.js +0 -2
- package/dist/cjs/pm-plugins/transform-to-code-block.js +0 -2
- package/dist/cjs/pm-plugins/utils.js +0 -3
- package/dist/es2019/nodeviews/code-block.js +1 -6
- package/dist/es2019/pm-plugins/codeBlockCopySelectionPlugin.js +0 -2
- package/dist/es2019/pm-plugins/ide-ux.js +0 -2
- package/dist/es2019/pm-plugins/input-rule.js +2 -6
- package/dist/es2019/pm-plugins/main.js +0 -2
- package/dist/es2019/pm-plugins/transform-to-code-block.js +0 -3
- package/dist/es2019/pm-plugins/utils.js +0 -3
- package/dist/esm/nodeviews/code-block.js +1 -6
- package/dist/esm/pm-plugins/codeBlockCopySelectionPlugin.js +0 -2
- package/dist/esm/pm-plugins/ide-ux.js +0 -2
- package/dist/esm/pm-plugins/input-rule.js +2 -6
- package/dist/esm/pm-plugins/main.js +0 -2
- package/dist/esm/pm-plugins/transform-to-code-block.js +0 -3
- package/dist/esm/pm-plugins/utils.js +0 -3
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -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,
|
|
@@ -38,8 +38,7 @@ function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported
|
|
|
38
38
|
return match.length > 0 && match[0].length === 3;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
//
|
|
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;
|
|
@@ -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) {
|
|
@@ -10,8 +10,6 @@ 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
12
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
13
|
-
// Ignored via go/ees005
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
15
13
|
function transformToCodeBlockAction(state, start,
|
|
16
14
|
// Ignored via go/ees005
|
|
17
15
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -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') {
|
|
@@ -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 {
|
|
@@ -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
|
-
//
|
|
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;
|
|
@@ -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) {
|
|
@@ -3,9 +3,6 @@ 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
5
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
|
|
7
|
-
// Ignored via go/ees005
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
9
6
|
export function transformToCodeBlockAction(state, start,
|
|
10
7
|
// Ignored via go/ees005
|
|
11
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -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') {
|
|
@@ -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,
|
|
@@ -32,8 +32,7 @@ function getCodeBlockRules(editorAnalyticsAPI, schema, isNestingInQuoteSupported
|
|
|
32
32
|
return match.length > 0 && match[0].length === 3;
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
//
|
|
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;
|
|
@@ -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) {
|
|
@@ -3,9 +3,6 @@ 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
5
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
6
|
-
|
|
7
|
-
// Ignored via go/ees005
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
9
6
|
export function transformToCodeBlockAction(state, start,
|
|
10
7
|
// Ignored via go/ees005
|
|
11
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -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') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.1",
|
|
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.
|
|
36
|
-
"@atlaskit/editor-common": "^99.
|
|
35
|
+
"@atlaskit/code": "^15.7.0",
|
|
36
|
+
"@atlaskit/editor-common": "^99.7.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.
|
|
40
|
-
"@atlaskit/editor-plugin-editor-disabled": "^1.
|
|
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.
|
|
43
|
-
"@atlaskit/platform-feature-flags": "^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
|
},
|