@atlaskit/editor-plugin-code-block 8.1.17 → 8.1.19
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 +16 -0
- package/dist/cjs/pm-plugins/codeBlockCopySelectionPlugin.js +1 -11
- package/dist/cjs/pm-plugins/ide-ux.js +0 -3
- package/dist/cjs/pm-plugins/main.js +0 -9
- package/dist/cjs/pm-plugins/utils.js +0 -9
- package/dist/es2019/pm-plugins/codeBlockCopySelectionPlugin.js +1 -14
- package/dist/es2019/pm-plugins/ide-ux.js +0 -4
- package/dist/es2019/pm-plugins/main.js +0 -12
- package/dist/es2019/pm-plugins/utils.js +0 -9
- package/dist/esm/pm-plugins/codeBlockCopySelectionPlugin.js +1 -11
- package/dist/esm/pm-plugins/ide-ux.js +0 -3
- package/dist/esm/pm-plugins/main.js +0 -9
- package/dist/esm/pm-plugins/utils.js +0 -9
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block
|
|
2
2
|
|
|
3
|
+
## 8.1.19
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e3779b75fdeca`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3779b75fdeca) -
|
|
8
|
+
EDITOR-1643 Promote syncBlock and bodiedSyncBlock to full schema
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 8.1.18
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`55920a92e882a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55920a92e882a) -
|
|
16
|
+
tsignores added for help-center local consumpton removed
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 8.1.17
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -37,21 +37,12 @@ function codeBlockCopySelectionPlugin() {
|
|
|
37
37
|
return new _safePlugin.SafePlugin({
|
|
38
38
|
key: copySelectionPluginKey,
|
|
39
39
|
state: {
|
|
40
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
41
40
|
init: function init() {
|
|
42
41
|
return {
|
|
43
42
|
decorationStartAndEnd: undefined
|
|
44
43
|
};
|
|
45
44
|
},
|
|
46
|
-
|
|
47
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
48
|
-
apply: function apply(
|
|
49
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
50
|
-
transaction, currentCodeBlockCopySelectionPluginState,
|
|
51
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
52
|
-
_oldState,
|
|
53
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
54
|
-
newState) {
|
|
45
|
+
apply: function apply(transaction, currentCodeBlockCopySelectionPluginState, _oldState, newState) {
|
|
55
46
|
switch (transaction.getMeta(copySelectionPluginKey)) {
|
|
56
47
|
case 'show-selection':
|
|
57
48
|
{
|
|
@@ -80,7 +71,6 @@ function codeBlockCopySelectionPlugin() {
|
|
|
80
71
|
}
|
|
81
72
|
},
|
|
82
73
|
props: {
|
|
83
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
84
74
|
decorations: function decorations(state) {
|
|
85
75
|
if (copySelectionPluginKey.getState(state).decorationStartAndEnd) {
|
|
86
76
|
var _copySelectionPluginK = (0, _slicedToArray2.default)(copySelectionPluginKey.getState(state).decorationStartAndEnd, 2),
|
|
@@ -20,7 +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
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
24
23
|
handleTextInput: function handleTextInput(view, from, to, text) {
|
|
25
24
|
var _pluginInjectionApi$c;
|
|
26
25
|
var state = view.state,
|
|
@@ -64,8 +63,6 @@ var ideUX = function ideUX(pluginInjectionApi) {
|
|
|
64
63
|
}
|
|
65
64
|
return false;
|
|
66
65
|
},
|
|
67
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
68
|
-
|
|
69
66
|
handleKeyDown: (0, _keymap.keydownHandler)({
|
|
70
67
|
Backspace: function Backspace(state, dispatch) {
|
|
71
68
|
if ((0, _lineHandling.isCursorInsideCodeBlock)(state)) {
|
|
@@ -32,8 +32,6 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
|
32
32
|
allowCompositionInputOverride = _ref$allowComposition === void 0 ? false : _ref$allowComposition,
|
|
33
33
|
api = _ref.api;
|
|
34
34
|
var handleDOMEvents = {
|
|
35
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
36
|
-
|
|
37
35
|
click: function click() {
|
|
38
36
|
var _api$core, _api$interaction;
|
|
39
37
|
// Set hasHadInteraction to true on any click of code blocks, as clicks
|
|
@@ -85,7 +83,6 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
|
85
83
|
}
|
|
86
84
|
return new _safePlugin.SafePlugin({
|
|
87
85
|
state: {
|
|
88
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
89
86
|
init: function init(_, state) {
|
|
90
87
|
var node = (0, _transforms.findCodeBlock)(state, state.selection);
|
|
91
88
|
var initialDecorations =
|
|
@@ -102,7 +99,6 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
|
102
99
|
decorations: _view.DecorationSet.create(state.doc, initialDecorations)
|
|
103
100
|
};
|
|
104
101
|
},
|
|
105
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
106
102
|
apply: function apply(tr, pluginState, _oldState, newState) {
|
|
107
103
|
var meta = tr.getMeta(_pluginKey.pluginKey);
|
|
108
104
|
if ((meta === null || meta === void 0 ? void 0 : meta.type) === _actions.ACTIONS.SET_IS_WRAPPED) {
|
|
@@ -116,8 +112,6 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
|
116
112
|
|
|
117
113
|
// Updates mapping position of all existing decorations to new positions
|
|
118
114
|
// specifically used for updating word wrap node decorators (does not cover drag & drop, validateWordWrappedDecorators does).
|
|
119
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
120
|
-
|
|
121
115
|
var updatedDecorationSet = pluginState.decorations.map(tr.mapping, tr.doc);
|
|
122
116
|
var codeBlockNodes = (0, _utils.getAllChangedCodeBlocksInTransaction)(tr);
|
|
123
117
|
if (codeBlockNodes) {
|
|
@@ -157,12 +151,9 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
|
157
151
|
},
|
|
158
152
|
key: _pluginKey.pluginKey,
|
|
159
153
|
props: {
|
|
160
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
161
154
|
decorations: function decorations(state) {
|
|
162
155
|
return _pluginKey.pluginKey.getState(state).decorations || _view.DecorationSet.empty;
|
|
163
156
|
},
|
|
164
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
165
|
-
|
|
166
157
|
nodeViews: {
|
|
167
158
|
codeBlock: function codeBlock(node, view, getPos) {
|
|
168
159
|
var _getIntl = getIntl(),
|
|
@@ -11,8 +11,6 @@ function getCursor(selection) {
|
|
|
11
11
|
}
|
|
12
12
|
function getAllCodeBlockNodesInDoc(state) {
|
|
13
13
|
var codeBlockNodes = [];
|
|
14
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
15
|
-
|
|
16
14
|
state.doc.descendants(function (node, pos) {
|
|
17
15
|
if (node.type === state.schema.nodes.codeBlock) {
|
|
18
16
|
codeBlockNodes.push({
|
|
@@ -28,16 +26,9 @@ function getAllCodeBlockNodesInDoc(state) {
|
|
|
28
26
|
function getAllChangedCodeBlocksInTransaction(tr) {
|
|
29
27
|
var changedCodeBlocks = [];
|
|
30
28
|
var nodePositions = new Set();
|
|
31
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
32
|
-
|
|
33
29
|
tr.steps.forEach(function (step) {
|
|
34
30
|
var mapResult = step.getMap();
|
|
35
|
-
|
|
36
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
37
|
-
|
|
38
31
|
mapResult.forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
39
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
40
|
-
|
|
41
32
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node, pos) {
|
|
42
33
|
if (node.type.name === 'codeBlock') {
|
|
43
34
|
if (!nodePositions.has(pos)) {
|
|
@@ -27,23 +27,12 @@ export function codeBlockCopySelectionPlugin() {
|
|
|
27
27
|
return new SafePlugin({
|
|
28
28
|
key: copySelectionPluginKey,
|
|
29
29
|
state: {
|
|
30
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
31
|
-
|
|
32
30
|
init() {
|
|
33
31
|
return {
|
|
34
32
|
decorationStartAndEnd: undefined
|
|
35
33
|
};
|
|
36
34
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
40
|
-
apply(
|
|
41
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
42
|
-
transaction, currentCodeBlockCopySelectionPluginState,
|
|
43
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
44
|
-
_oldState,
|
|
45
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
46
|
-
newState) {
|
|
35
|
+
apply(transaction, currentCodeBlockCopySelectionPluginState, _oldState, newState) {
|
|
47
36
|
switch (transaction.getMeta(copySelectionPluginKey)) {
|
|
48
37
|
case 'show-selection':
|
|
49
38
|
{
|
|
@@ -72,8 +61,6 @@ export function codeBlockCopySelectionPlugin() {
|
|
|
72
61
|
}
|
|
73
62
|
},
|
|
74
63
|
props: {
|
|
75
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
76
|
-
|
|
77
64
|
decorations(state) {
|
|
78
65
|
if (copySelectionPluginKey.getState(state).decorationStartAndEnd) {
|
|
79
66
|
const [start, end] = copySelectionPluginKey.getState(state).decorationStartAndEnd;
|
|
@@ -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
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
18
|
-
|
|
19
17
|
handleTextInput(view, from, to, text) {
|
|
20
18
|
var _pluginInjectionApi$c;
|
|
21
19
|
const {
|
|
@@ -63,8 +61,6 @@ const ideUX = pluginInjectionApi => {
|
|
|
63
61
|
}
|
|
64
62
|
return false;
|
|
65
63
|
},
|
|
66
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
67
|
-
|
|
68
64
|
handleKeyDown: keydownHandler({
|
|
69
65
|
Backspace: (state, dispatch) => {
|
|
70
66
|
if (isCursorInsideCodeBlock(state)) {
|
|
@@ -21,8 +21,6 @@ export const createPlugin = ({
|
|
|
21
21
|
api
|
|
22
22
|
}) => {
|
|
23
23
|
const handleDOMEvents = {
|
|
24
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
25
|
-
|
|
26
24
|
click: () => {
|
|
27
25
|
var _api$core, _api$interaction;
|
|
28
26
|
// Set hasHadInteraction to true on any click of code blocks, as clicks
|
|
@@ -72,8 +70,6 @@ export const createPlugin = ({
|
|
|
72
70
|
}
|
|
73
71
|
return new SafePlugin({
|
|
74
72
|
state: {
|
|
75
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
76
|
-
|
|
77
73
|
init(_, state) {
|
|
78
74
|
const node = findCodeBlock(state, state.selection);
|
|
79
75
|
const initialDecorations =
|
|
@@ -90,8 +86,6 @@ export const createPlugin = ({
|
|
|
90
86
|
decorations: DecorationSet.create(state.doc, initialDecorations)
|
|
91
87
|
};
|
|
92
88
|
},
|
|
93
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
94
|
-
|
|
95
89
|
apply(tr, pluginState, _oldState, newState) {
|
|
96
90
|
const meta = tr.getMeta(pluginKey);
|
|
97
91
|
if ((meta === null || meta === void 0 ? void 0 : meta.type) === ACTIONS.SET_IS_WRAPPED) {
|
|
@@ -106,8 +100,6 @@ export const createPlugin = ({
|
|
|
106
100
|
|
|
107
101
|
// Updates mapping position of all existing decorations to new positions
|
|
108
102
|
// specifically used for updating word wrap node decorators (does not cover drag & drop, validateWordWrappedDecorators does).
|
|
109
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
110
|
-
|
|
111
103
|
let updatedDecorationSet = pluginState.decorations.map(tr.mapping, tr.doc);
|
|
112
104
|
const codeBlockNodes = getAllChangedCodeBlocksInTransaction(tr);
|
|
113
105
|
if (codeBlockNodes) {
|
|
@@ -151,13 +143,9 @@ export const createPlugin = ({
|
|
|
151
143
|
},
|
|
152
144
|
key: pluginKey,
|
|
153
145
|
props: {
|
|
154
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
155
|
-
|
|
156
146
|
decorations(state) {
|
|
157
147
|
return pluginKey.getState(state).decorations || DecorationSet.empty;
|
|
158
148
|
},
|
|
159
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
160
|
-
|
|
161
149
|
nodeViews: {
|
|
162
150
|
codeBlock: (node, view, getPos) => {
|
|
163
151
|
const {
|
|
@@ -3,8 +3,6 @@ export function getCursor(selection) {
|
|
|
3
3
|
}
|
|
4
4
|
export function getAllCodeBlockNodesInDoc(state) {
|
|
5
5
|
const codeBlockNodes = [];
|
|
6
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
7
|
-
|
|
8
6
|
state.doc.descendants((node, pos) => {
|
|
9
7
|
if (node.type === state.schema.nodes.codeBlock) {
|
|
10
8
|
codeBlockNodes.push({
|
|
@@ -20,16 +18,9 @@ export function getAllCodeBlockNodesInDoc(state) {
|
|
|
20
18
|
export function getAllChangedCodeBlocksInTransaction(tr) {
|
|
21
19
|
const changedCodeBlocks = [];
|
|
22
20
|
const nodePositions = new Set();
|
|
23
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
24
|
-
|
|
25
21
|
tr.steps.forEach(step => {
|
|
26
22
|
const mapResult = step.getMap();
|
|
27
|
-
|
|
28
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
29
|
-
|
|
30
23
|
mapResult.forEach((oldStart, oldEnd, newStart, newEnd) => {
|
|
31
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
32
|
-
|
|
33
24
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), (node, pos) => {
|
|
34
25
|
if (node.type.name === 'codeBlock') {
|
|
35
26
|
if (!nodePositions.has(pos)) {
|
|
@@ -27,21 +27,12 @@ export function codeBlockCopySelectionPlugin() {
|
|
|
27
27
|
return new SafePlugin({
|
|
28
28
|
key: copySelectionPluginKey,
|
|
29
29
|
state: {
|
|
30
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
31
30
|
init: function init() {
|
|
32
31
|
return {
|
|
33
32
|
decorationStartAndEnd: undefined
|
|
34
33
|
};
|
|
35
34
|
},
|
|
36
|
-
|
|
37
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
38
|
-
apply: function apply(
|
|
39
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
40
|
-
transaction, currentCodeBlockCopySelectionPluginState,
|
|
41
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
42
|
-
_oldState,
|
|
43
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
44
|
-
newState) {
|
|
35
|
+
apply: function apply(transaction, currentCodeBlockCopySelectionPluginState, _oldState, newState) {
|
|
45
36
|
switch (transaction.getMeta(copySelectionPluginKey)) {
|
|
46
37
|
case 'show-selection':
|
|
47
38
|
{
|
|
@@ -70,7 +61,6 @@ export function codeBlockCopySelectionPlugin() {
|
|
|
70
61
|
}
|
|
71
62
|
},
|
|
72
63
|
props: {
|
|
73
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
74
64
|
decorations: function decorations(state) {
|
|
75
65
|
if (copySelectionPluginKey.getState(state).decorationStartAndEnd) {
|
|
76
66
|
var _copySelectionPluginK = _slicedToArray(copySelectionPluginKey.getState(state).decorationStartAndEnd, 2),
|
|
@@ -14,7 +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
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
18
17
|
handleTextInput: function handleTextInput(view, from, to, text) {
|
|
19
18
|
var _pluginInjectionApi$c;
|
|
20
19
|
var state = view.state,
|
|
@@ -58,8 +57,6 @@ var ideUX = function ideUX(pluginInjectionApi) {
|
|
|
58
57
|
}
|
|
59
58
|
return false;
|
|
60
59
|
},
|
|
61
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
62
|
-
|
|
63
60
|
handleKeyDown: keydownHandler({
|
|
64
61
|
Backspace: function Backspace(state, dispatch) {
|
|
65
62
|
if (isCursorInsideCodeBlock(state)) {
|
|
@@ -25,8 +25,6 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
25
25
|
allowCompositionInputOverride = _ref$allowComposition === void 0 ? false : _ref$allowComposition,
|
|
26
26
|
api = _ref.api;
|
|
27
27
|
var handleDOMEvents = {
|
|
28
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
29
|
-
|
|
30
28
|
click: function click() {
|
|
31
29
|
var _api$core, _api$interaction;
|
|
32
30
|
// Set hasHadInteraction to true on any click of code blocks, as clicks
|
|
@@ -78,7 +76,6 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
78
76
|
}
|
|
79
77
|
return new SafePlugin({
|
|
80
78
|
state: {
|
|
81
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
82
79
|
init: function init(_, state) {
|
|
83
80
|
var node = findCodeBlock(state, state.selection);
|
|
84
81
|
var initialDecorations =
|
|
@@ -95,7 +92,6 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
95
92
|
decorations: DecorationSet.create(state.doc, initialDecorations)
|
|
96
93
|
};
|
|
97
94
|
},
|
|
98
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
99
95
|
apply: function apply(tr, pluginState, _oldState, newState) {
|
|
100
96
|
var meta = tr.getMeta(pluginKey);
|
|
101
97
|
if ((meta === null || meta === void 0 ? void 0 : meta.type) === ACTIONS.SET_IS_WRAPPED) {
|
|
@@ -109,8 +105,6 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
109
105
|
|
|
110
106
|
// Updates mapping position of all existing decorations to new positions
|
|
111
107
|
// specifically used for updating word wrap node decorators (does not cover drag & drop, validateWordWrappedDecorators does).
|
|
112
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
113
|
-
|
|
114
108
|
var updatedDecorationSet = pluginState.decorations.map(tr.mapping, tr.doc);
|
|
115
109
|
var codeBlockNodes = getAllChangedCodeBlocksInTransaction(tr);
|
|
116
110
|
if (codeBlockNodes) {
|
|
@@ -150,12 +144,9 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
150
144
|
},
|
|
151
145
|
key: pluginKey,
|
|
152
146
|
props: {
|
|
153
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
154
147
|
decorations: function decorations(state) {
|
|
155
148
|
return pluginKey.getState(state).decorations || DecorationSet.empty;
|
|
156
149
|
},
|
|
157
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
158
|
-
|
|
159
150
|
nodeViews: {
|
|
160
151
|
codeBlock: function codeBlock(node, view, getPos) {
|
|
161
152
|
var _getIntl = getIntl(),
|
|
@@ -3,8 +3,6 @@ export function getCursor(selection) {
|
|
|
3
3
|
}
|
|
4
4
|
export function getAllCodeBlockNodesInDoc(state) {
|
|
5
5
|
var codeBlockNodes = [];
|
|
6
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
7
|
-
|
|
8
6
|
state.doc.descendants(function (node, pos) {
|
|
9
7
|
if (node.type === state.schema.nodes.codeBlock) {
|
|
10
8
|
codeBlockNodes.push({
|
|
@@ -20,16 +18,9 @@ export function getAllCodeBlockNodesInDoc(state) {
|
|
|
20
18
|
export function getAllChangedCodeBlocksInTransaction(tr) {
|
|
21
19
|
var changedCodeBlocks = [];
|
|
22
20
|
var nodePositions = new Set();
|
|
23
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
24
|
-
|
|
25
21
|
tr.steps.forEach(function (step) {
|
|
26
22
|
var mapResult = step.getMap();
|
|
27
|
-
|
|
28
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
29
|
-
|
|
30
23
|
mapResult.forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
31
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
32
|
-
|
|
33
24
|
tr.doc.nodesBetween(newStart, Math.min(newEnd, tr.doc.content.size), function (node, pos) {
|
|
34
25
|
if (node.type.name === 'codeBlock') {
|
|
35
26
|
if (!nodePositions.has(pos)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.19",
|
|
4
4
|
"description": "Code block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"atlaskit:src": "src/index.ts",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@atlaskit/adf-schema": "^51.
|
|
30
|
+
"@atlaskit/adf-schema": "^51.5.1",
|
|
31
31
|
"@atlaskit/code": "^17.3.0",
|
|
32
32
|
"@atlaskit/editor-plugin-analytics": "^6.2.0",
|
|
33
33
|
"@atlaskit/editor-plugin-block-menu": "^5.1.0",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@atlaskit/icon": "^29.0.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/prosemirror-input-rules": "^3.6.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^14.
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^14.5.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@atlaskit/editor-common": "^110.
|
|
50
|
+
"@atlaskit/editor-common": "^110.38.0",
|
|
51
51
|
"react": "^18.2.0",
|
|
52
52
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
53
53
|
},
|