@atlaskit/editor-plugin-code-block 1.1.6 → 1.1.7
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 +7 -0
- package/dist/cjs/nodeviews/code-block.js +13 -7
- package/dist/cjs/plugin.js +2 -1
- package/dist/cjs/pm-plugins/main.js +5 -2
- package/dist/es2019/nodeviews/code-block.js +11 -5
- package/dist/es2019/plugin.js +2 -1
- package/dist/es2019/pm-plugins/main.js +3 -2
- package/dist/esm/nodeviews/code-block.js +13 -7
- package/dist/esm/plugin.js +2 -1
- package/dist/esm/pm-plugins/main.js +5 -2
- package/dist/types/nodeviews/code-block.d.ts +5 -3
- package/dist/types/plugin.d.ts +3 -1
- package/dist/types/pm-plugins/main.d.ts +138 -2
- package/dist/types-ts4.5/nodeviews/code-block.d.ts +5 -3
- package/dist/types-ts4.5/plugin.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +167 -2
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-code-block
|
|
2
2
|
|
|
3
|
+
## 1.1.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#89138](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/89138) [`f70dc8331119`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f70dc8331119) - Disable code block content editing in live view mode
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
3
10
|
## 1.1.6
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -16,7 +16,7 @@ var _actions = require("../actions");
|
|
|
16
16
|
var _mainState = require("../pm-plugins/main-state");
|
|
17
17
|
var _classNames = require("../ui/class-names");
|
|
18
18
|
var MATCH_NEWLINES = new RegExp('\n', 'g');
|
|
19
|
-
var toDOM = function toDOM(node) {
|
|
19
|
+
var toDOM = function toDOM(node, isViewOnly) {
|
|
20
20
|
return ['div', {
|
|
21
21
|
class: 'code-block'
|
|
22
22
|
}, ['div', {
|
|
@@ -32,7 +32,7 @@ var toDOM = function toDOM(node) {
|
|
|
32
32
|
}, ['code', {
|
|
33
33
|
'data-language': node.attrs.language || '',
|
|
34
34
|
spellcheck: 'false',
|
|
35
|
-
contenteditable: 'true',
|
|
35
|
+
contenteditable: isViewOnly ? 'false' : 'true',
|
|
36
36
|
'data-testid': 'code-block--code'
|
|
37
37
|
}, 0]]], ['div', {
|
|
38
38
|
class: _classNames.codeBlockClassNames.end,
|
|
@@ -40,8 +40,9 @@ var toDOM = function toDOM(node) {
|
|
|
40
40
|
}]];
|
|
41
41
|
};
|
|
42
42
|
var CodeBlockView = exports.CodeBlockView = /*#__PURE__*/function () {
|
|
43
|
-
function CodeBlockView(_node, view, getPos) {
|
|
44
|
-
var _this = this
|
|
43
|
+
function CodeBlockView(_node, view, getPos, api) {
|
|
44
|
+
var _this = this,
|
|
45
|
+
_api$editorViewMode;
|
|
45
46
|
(0, _classCallCheck2.default)(this, CodeBlockView);
|
|
46
47
|
(0, _defineProperty2.default)(this, "ensureLineNumbers", (0, _rafSchd.default)(function () {
|
|
47
48
|
var lines = 1;
|
|
@@ -58,7 +59,8 @@ var CodeBlockView = exports.CodeBlockView = /*#__PURE__*/function () {
|
|
|
58
59
|
_this.lineNumberGutter.removeChild(_this.lineNumberGutter.lastChild);
|
|
59
60
|
}
|
|
60
61
|
}));
|
|
61
|
-
var
|
|
62
|
+
var isViewOnly = (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view' || !view.editable;
|
|
63
|
+
var _DOMSerializer$render = _model.DOMSerializer.renderSpec(document, toDOM(_node, isViewOnly)),
|
|
62
64
|
dom = _DOMSerializer$render.dom,
|
|
63
65
|
contentDOM = _DOMSerializer$render.contentDOM;
|
|
64
66
|
this.getPos = getPos;
|
|
@@ -67,6 +69,7 @@ var CodeBlockView = exports.CodeBlockView = /*#__PURE__*/function () {
|
|
|
67
69
|
this.dom = dom;
|
|
68
70
|
this.contentDOM = contentDOM;
|
|
69
71
|
this.lineNumberGutter = this.dom.querySelector(".".concat(_classNames.codeBlockClassNames.gutter));
|
|
72
|
+
this.api = api;
|
|
70
73
|
this.ensureLineNumbers();
|
|
71
74
|
}
|
|
72
75
|
(0, _createClass2.default)(CodeBlockView, [{
|
|
@@ -118,6 +121,7 @@ var CodeBlockView = exports.CodeBlockView = /*#__PURE__*/function () {
|
|
|
118
121
|
}, {
|
|
119
122
|
key: "update",
|
|
120
123
|
value: function update(node) {
|
|
124
|
+
var _this$api;
|
|
121
125
|
if (node.type !== this.node.type) {
|
|
122
126
|
return false;
|
|
123
127
|
}
|
|
@@ -132,6 +136,8 @@ var CodeBlockView = exports.CodeBlockView = /*#__PURE__*/function () {
|
|
|
132
136
|
(0, _actions.resetShouldIgnoreFollowingMutations)(this.view.state, this.view.dispatch);
|
|
133
137
|
}
|
|
134
138
|
}
|
|
139
|
+
var editorViewModePluginState = (_this$api = this.api) === null || _this$api === void 0 || (_this$api = _this$api.editorViewMode) === null || _this$api === void 0 ? void 0 : _this$api.sharedState.currentState();
|
|
140
|
+
this.contentDOM.setAttribute('contenteditable', (editorViewModePluginState === null || editorViewModePluginState === void 0 ? void 0 : editorViewModePluginState.mode) === 'view' || !this.view.editable ? 'false' : 'true');
|
|
135
141
|
return true;
|
|
136
142
|
}
|
|
137
143
|
}, {
|
|
@@ -148,6 +154,6 @@ var CodeBlockView = exports.CodeBlockView = /*#__PURE__*/function () {
|
|
|
148
154
|
}]);
|
|
149
155
|
return CodeBlockView;
|
|
150
156
|
}();
|
|
151
|
-
var codeBlockNodeView = exports.codeBlockNodeView = function codeBlockNodeView(node, view, getPos) {
|
|
152
|
-
return new CodeBlockView(node, view, getPos);
|
|
157
|
+
var codeBlockNodeView = exports.codeBlockNodeView = function codeBlockNodeView(node, view, getPos, api) {
|
|
158
|
+
return new CodeBlockView(node, view, getPos, api);
|
|
153
159
|
};
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -40,7 +40,8 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
40
40
|
var getIntl = _ref2.getIntl;
|
|
41
41
|
return (0, _main.createPlugin)(_objectSpread(_objectSpread({}, options), {}, {
|
|
42
42
|
getIntl: getIntl,
|
|
43
|
-
appearance: (_options$appearance = options === null || options === void 0 ? void 0 : options.appearance) !== null && _options$appearance !== void 0 ? _options$appearance : 'comment'
|
|
43
|
+
appearance: (_options$appearance = options === null || options === void 0 ? void 0 : options.appearance) !== null && _options$appearance !== void 0 ? _options$appearance : 'comment',
|
|
44
|
+
api: api
|
|
44
45
|
}));
|
|
45
46
|
}
|
|
46
47
|
}, {
|
|
@@ -24,7 +24,8 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
|
24
24
|
getIntl = _ref.getIntl,
|
|
25
25
|
appearance = _ref.appearance,
|
|
26
26
|
_ref$allowComposition = _ref.allowCompositionInputOverride,
|
|
27
|
-
allowCompositionInputOverride = _ref$allowComposition === void 0 ? false : _ref$allowComposition
|
|
27
|
+
allowCompositionInputOverride = _ref$allowComposition === void 0 ? false : _ref$allowComposition,
|
|
28
|
+
api = _ref.api;
|
|
28
29
|
var handleDOMEvents = {};
|
|
29
30
|
|
|
30
31
|
// ME-1599: Composition on mobile was causing the DOM observer to mutate the code block
|
|
@@ -101,7 +102,9 @@ var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
|
101
102
|
key: _pluginKey.pluginKey,
|
|
102
103
|
props: {
|
|
103
104
|
nodeViews: {
|
|
104
|
-
codeBlock:
|
|
105
|
+
codeBlock: function codeBlock(node, view, getPos) {
|
|
106
|
+
return (0, _codeBlock.codeBlockNodeView)(node, view, getPos, api);
|
|
107
|
+
}
|
|
105
108
|
},
|
|
106
109
|
handleClickOn: (0, _selection.createSelectionClickHandler)(['codeBlock'], function (target) {
|
|
107
110
|
return !!(target.closest(".".concat(_classNames.codeBlockClassNames.gutter)) || target.classList.contains(_classNames.codeBlockClassNames.content));
|
|
@@ -6,7 +6,7 @@ import { resetShouldIgnoreFollowingMutations } from '../actions';
|
|
|
6
6
|
import { getPluginState } from '../pm-plugins/main-state';
|
|
7
7
|
import { codeBlockClassNames } from '../ui/class-names';
|
|
8
8
|
const MATCH_NEWLINES = new RegExp('\n', 'g');
|
|
9
|
-
const toDOM = node => ['div', {
|
|
9
|
+
const toDOM = (node, isViewOnly) => ['div', {
|
|
10
10
|
class: 'code-block'
|
|
11
11
|
}, ['div', {
|
|
12
12
|
class: codeBlockClassNames.start,
|
|
@@ -21,14 +21,15 @@ const toDOM = node => ['div', {
|
|
|
21
21
|
}, ['code', {
|
|
22
22
|
'data-language': node.attrs.language || '',
|
|
23
23
|
spellcheck: 'false',
|
|
24
|
-
contenteditable: 'true',
|
|
24
|
+
contenteditable: isViewOnly ? 'false' : 'true',
|
|
25
25
|
'data-testid': 'code-block--code'
|
|
26
26
|
}, 0]]], ['div', {
|
|
27
27
|
class: codeBlockClassNames.end,
|
|
28
28
|
contenteditable: 'false'
|
|
29
29
|
}]];
|
|
30
30
|
export class CodeBlockView {
|
|
31
|
-
constructor(_node, view, getPos) {
|
|
31
|
+
constructor(_node, view, getPos, api) {
|
|
32
|
+
var _api$editorViewMode, _api$editorViewMode$s;
|
|
32
33
|
_defineProperty(this, "ensureLineNumbers", rafSchedule(() => {
|
|
33
34
|
let lines = 1;
|
|
34
35
|
this.node.forEach(node => {
|
|
@@ -44,16 +45,18 @@ export class CodeBlockView {
|
|
|
44
45
|
this.lineNumberGutter.removeChild(this.lineNumberGutter.lastChild);
|
|
45
46
|
}
|
|
46
47
|
}));
|
|
48
|
+
const isViewOnly = (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view' || !view.editable;
|
|
47
49
|
const {
|
|
48
50
|
dom,
|
|
49
51
|
contentDOM
|
|
50
|
-
} = DOMSerializer.renderSpec(document, toDOM(_node));
|
|
52
|
+
} = DOMSerializer.renderSpec(document, toDOM(_node, isViewOnly));
|
|
51
53
|
this.getPos = getPos;
|
|
52
54
|
this.view = view;
|
|
53
55
|
this.node = _node;
|
|
54
56
|
this.dom = dom;
|
|
55
57
|
this.contentDOM = contentDOM;
|
|
56
58
|
this.lineNumberGutter = this.dom.querySelector(`.${codeBlockClassNames.gutter}`);
|
|
59
|
+
this.api = api;
|
|
57
60
|
this.ensureLineNumbers();
|
|
58
61
|
}
|
|
59
62
|
updateDOMAndSelection(savedInnerHTML, newCursorPosition) {
|
|
@@ -97,6 +100,7 @@ export class CodeBlockView {
|
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
update(node) {
|
|
103
|
+
var _this$api, _this$api$editorViewM;
|
|
100
104
|
if (node.type !== this.node.type) {
|
|
101
105
|
return false;
|
|
102
106
|
}
|
|
@@ -111,6 +115,8 @@ export class CodeBlockView {
|
|
|
111
115
|
resetShouldIgnoreFollowingMutations(this.view.state, this.view.dispatch);
|
|
112
116
|
}
|
|
113
117
|
}
|
|
118
|
+
const editorViewModePluginState = (_this$api = this.api) === null || _this$api === void 0 ? void 0 : (_this$api$editorViewM = _this$api.editorViewMode) === null || _this$api$editorViewM === void 0 ? void 0 : _this$api$editorViewM.sharedState.currentState();
|
|
119
|
+
this.contentDOM.setAttribute('contenteditable', (editorViewModePluginState === null || editorViewModePluginState === void 0 ? void 0 : editorViewModePluginState.mode) === 'view' || !this.view.editable ? 'false' : 'true');
|
|
114
120
|
return true;
|
|
115
121
|
}
|
|
116
122
|
ignoreMutation(record) {
|
|
@@ -123,4 +129,4 @@ export class CodeBlockView {
|
|
|
123
129
|
return record.target === this.lineNumberGutter || record.target.parentNode === this.lineNumberGutter;
|
|
124
130
|
}
|
|
125
131
|
}
|
|
126
|
-
export const codeBlockNodeView = (node, view, getPos) => new CodeBlockView(node, view, getPos);
|
|
132
|
+
export const codeBlockNodeView = (node, view, getPos, api) => new CodeBlockView(node, view, getPos, api);
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -32,7 +32,8 @@ const codeBlockPlugin = ({
|
|
|
32
32
|
return createPlugin({
|
|
33
33
|
...options,
|
|
34
34
|
getIntl,
|
|
35
|
-
appearance: (_options$appearance = options === null || options === void 0 ? void 0 : options.appearance) !== null && _options$appearance !== void 0 ? _options$appearance : 'comment'
|
|
35
|
+
appearance: (_options$appearance = options === null || options === void 0 ? void 0 : options.appearance) !== null && _options$appearance !== void 0 ? _options$appearance : 'comment',
|
|
36
|
+
api
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
}, {
|
|
@@ -12,7 +12,8 @@ export const createPlugin = ({
|
|
|
12
12
|
useLongPressSelection = false,
|
|
13
13
|
getIntl,
|
|
14
14
|
appearance,
|
|
15
|
-
allowCompositionInputOverride = false
|
|
15
|
+
allowCompositionInputOverride = false,
|
|
16
|
+
api
|
|
16
17
|
}) => {
|
|
17
18
|
const handleDOMEvents = {};
|
|
18
19
|
|
|
@@ -91,7 +92,7 @@ export const createPlugin = ({
|
|
|
91
92
|
key: pluginKey,
|
|
92
93
|
props: {
|
|
93
94
|
nodeViews: {
|
|
94
|
-
codeBlock: codeBlockNodeView
|
|
95
|
+
codeBlock: (node, view, getPos) => codeBlockNodeView(node, view, getPos, api)
|
|
95
96
|
},
|
|
96
97
|
handleClickOn: createSelectionClickHandler(['codeBlock'], target => !!(target.closest(`.${codeBlockClassNames.gutter}`) || target.classList.contains(codeBlockClassNames.content)), {
|
|
97
98
|
useLongPressSelection
|
|
@@ -9,7 +9,7 @@ import { resetShouldIgnoreFollowingMutations } from '../actions';
|
|
|
9
9
|
import { getPluginState } from '../pm-plugins/main-state';
|
|
10
10
|
import { codeBlockClassNames } from '../ui/class-names';
|
|
11
11
|
var MATCH_NEWLINES = new RegExp('\n', 'g');
|
|
12
|
-
var toDOM = function toDOM(node) {
|
|
12
|
+
var toDOM = function toDOM(node, isViewOnly) {
|
|
13
13
|
return ['div', {
|
|
14
14
|
class: 'code-block'
|
|
15
15
|
}, ['div', {
|
|
@@ -25,7 +25,7 @@ var toDOM = function toDOM(node) {
|
|
|
25
25
|
}, ['code', {
|
|
26
26
|
'data-language': node.attrs.language || '',
|
|
27
27
|
spellcheck: 'false',
|
|
28
|
-
contenteditable: 'true',
|
|
28
|
+
contenteditable: isViewOnly ? 'false' : 'true',
|
|
29
29
|
'data-testid': 'code-block--code'
|
|
30
30
|
}, 0]]], ['div', {
|
|
31
31
|
class: codeBlockClassNames.end,
|
|
@@ -33,8 +33,9 @@ var toDOM = function toDOM(node) {
|
|
|
33
33
|
}]];
|
|
34
34
|
};
|
|
35
35
|
export var CodeBlockView = /*#__PURE__*/function () {
|
|
36
|
-
function CodeBlockView(_node, view, getPos) {
|
|
37
|
-
var _this = this
|
|
36
|
+
function CodeBlockView(_node, view, getPos, api) {
|
|
37
|
+
var _this = this,
|
|
38
|
+
_api$editorViewMode;
|
|
38
39
|
_classCallCheck(this, CodeBlockView);
|
|
39
40
|
_defineProperty(this, "ensureLineNumbers", rafSchedule(function () {
|
|
40
41
|
var lines = 1;
|
|
@@ -51,7 +52,8 @@ export var CodeBlockView = /*#__PURE__*/function () {
|
|
|
51
52
|
_this.lineNumberGutter.removeChild(_this.lineNumberGutter.lastChild);
|
|
52
53
|
}
|
|
53
54
|
}));
|
|
54
|
-
var
|
|
55
|
+
var isViewOnly = (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view' || !view.editable;
|
|
56
|
+
var _DOMSerializer$render = DOMSerializer.renderSpec(document, toDOM(_node, isViewOnly)),
|
|
55
57
|
dom = _DOMSerializer$render.dom,
|
|
56
58
|
contentDOM = _DOMSerializer$render.contentDOM;
|
|
57
59
|
this.getPos = getPos;
|
|
@@ -60,6 +62,7 @@ export var CodeBlockView = /*#__PURE__*/function () {
|
|
|
60
62
|
this.dom = dom;
|
|
61
63
|
this.contentDOM = contentDOM;
|
|
62
64
|
this.lineNumberGutter = this.dom.querySelector(".".concat(codeBlockClassNames.gutter));
|
|
65
|
+
this.api = api;
|
|
63
66
|
this.ensureLineNumbers();
|
|
64
67
|
}
|
|
65
68
|
_createClass(CodeBlockView, [{
|
|
@@ -111,6 +114,7 @@ export var CodeBlockView = /*#__PURE__*/function () {
|
|
|
111
114
|
}, {
|
|
112
115
|
key: "update",
|
|
113
116
|
value: function update(node) {
|
|
117
|
+
var _this$api;
|
|
114
118
|
if (node.type !== this.node.type) {
|
|
115
119
|
return false;
|
|
116
120
|
}
|
|
@@ -125,6 +129,8 @@ export var CodeBlockView = /*#__PURE__*/function () {
|
|
|
125
129
|
resetShouldIgnoreFollowingMutations(this.view.state, this.view.dispatch);
|
|
126
130
|
}
|
|
127
131
|
}
|
|
132
|
+
var editorViewModePluginState = (_this$api = this.api) === null || _this$api === void 0 || (_this$api = _this$api.editorViewMode) === null || _this$api === void 0 ? void 0 : _this$api.sharedState.currentState();
|
|
133
|
+
this.contentDOM.setAttribute('contenteditable', (editorViewModePluginState === null || editorViewModePluginState === void 0 ? void 0 : editorViewModePluginState.mode) === 'view' || !this.view.editable ? 'false' : 'true');
|
|
128
134
|
return true;
|
|
129
135
|
}
|
|
130
136
|
}, {
|
|
@@ -141,6 +147,6 @@ export var CodeBlockView = /*#__PURE__*/function () {
|
|
|
141
147
|
}]);
|
|
142
148
|
return CodeBlockView;
|
|
143
149
|
}();
|
|
144
|
-
export var codeBlockNodeView = function codeBlockNodeView(node, view, getPos) {
|
|
145
|
-
return new CodeBlockView(node, view, getPos);
|
|
150
|
+
export var codeBlockNodeView = function codeBlockNodeView(node, view, getPos, api) {
|
|
151
|
+
return new CodeBlockView(node, view, getPos, api);
|
|
146
152
|
};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -33,7 +33,8 @@ var codeBlockPlugin = function codeBlockPlugin(_ref) {
|
|
|
33
33
|
var getIntl = _ref2.getIntl;
|
|
34
34
|
return createPlugin(_objectSpread(_objectSpread({}, options), {}, {
|
|
35
35
|
getIntl: getIntl,
|
|
36
|
-
appearance: (_options$appearance = options === null || options === void 0 ? void 0 : options.appearance) !== null && _options$appearance !== void 0 ? _options$appearance : 'comment'
|
|
36
|
+
appearance: (_options$appearance = options === null || options === void 0 ? void 0 : options.appearance) !== null && _options$appearance !== void 0 ? _options$appearance : 'comment',
|
|
37
|
+
api: api
|
|
37
38
|
}));
|
|
38
39
|
}
|
|
39
40
|
}, {
|
|
@@ -17,7 +17,8 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
17
17
|
getIntl = _ref.getIntl,
|
|
18
18
|
appearance = _ref.appearance,
|
|
19
19
|
_ref$allowComposition = _ref.allowCompositionInputOverride,
|
|
20
|
-
allowCompositionInputOverride = _ref$allowComposition === void 0 ? false : _ref$allowComposition
|
|
20
|
+
allowCompositionInputOverride = _ref$allowComposition === void 0 ? false : _ref$allowComposition,
|
|
21
|
+
api = _ref.api;
|
|
21
22
|
var handleDOMEvents = {};
|
|
22
23
|
|
|
23
24
|
// ME-1599: Composition on mobile was causing the DOM observer to mutate the code block
|
|
@@ -94,7 +95,9 @@ export var createPlugin = function createPlugin(_ref) {
|
|
|
94
95
|
key: pluginKey,
|
|
95
96
|
props: {
|
|
96
97
|
nodeViews: {
|
|
97
|
-
codeBlock:
|
|
98
|
+
codeBlock: function codeBlock(node, view, getPos) {
|
|
99
|
+
return codeBlockNodeView(node, view, getPos, api);
|
|
100
|
+
}
|
|
98
101
|
},
|
|
99
102
|
handleClickOn: createSelectionClickHandler(['codeBlock'], function (target) {
|
|
100
103
|
return !!(target.closest(".".concat(codeBlockClassNames.gutter)) || target.classList.contains(codeBlockClassNames.content));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { CodeBlockPlugin } from '../index';
|
|
4
5
|
export declare class CodeBlockView {
|
|
5
6
|
node: Node;
|
|
6
7
|
dom: HTMLElement;
|
|
@@ -8,7 +9,8 @@ export declare class CodeBlockView {
|
|
|
8
9
|
lineNumberGutter: HTMLElement;
|
|
9
10
|
getPos: getPosHandlerNode;
|
|
10
11
|
view: EditorView;
|
|
11
|
-
|
|
12
|
+
api?: ExtractInjectionAPI<CodeBlockPlugin>;
|
|
13
|
+
constructor(node: Node, view: EditorView, getPos: getPosHandlerNode, api?: ExtractInjectionAPI<CodeBlockPlugin>);
|
|
12
14
|
updateDOMAndSelection(savedInnerHTML: string, newCursorPosition: number): void;
|
|
13
15
|
coalesceDOMElements(): void;
|
|
14
16
|
private ensureLineNumbers;
|
|
@@ -18,4 +20,4 @@ export declare class CodeBlockView {
|
|
|
18
20
|
target: Element;
|
|
19
21
|
}): boolean;
|
|
20
22
|
}
|
|
21
|
-
export declare const codeBlockNodeView: (node: Node, view: EditorView, getPos: getPosHandler) => CodeBlockView;
|
|
23
|
+
export declare const codeBlockNodeView: (node: Node, view: EditorView, getPos: getPosHandler, api?: ExtractInjectionAPI<CodeBlockPlugin>) => CodeBlockView;
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -3,13 +3,15 @@ import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor
|
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { CompositionPlugin } from '@atlaskit/editor-plugin-composition';
|
|
5
5
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
6
|
+
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
7
|
import type { CodeBlockOptions } from './types';
|
|
7
8
|
export type CodeBlockPlugin = NextEditorPlugin<'codeBlock', {
|
|
8
9
|
pluginConfiguration: CodeBlockOptions | undefined;
|
|
9
10
|
dependencies: [
|
|
10
11
|
DecorationsPlugin,
|
|
11
12
|
CompositionPlugin,
|
|
12
|
-
OptionalPlugin<AnalyticsPlugin
|
|
13
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
14
|
+
OptionalPlugin<EditorViewModePlugin>
|
|
13
15
|
];
|
|
14
16
|
actions: {
|
|
15
17
|
insertCodeBlock: (inputMethod: INPUT_METHOD) => Command;
|
|
@@ -1,10 +1,146 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { CodeBlockPlugin } from '../index';
|
|
4
5
|
import type { CodeBlockState } from './main-state';
|
|
5
|
-
export declare const createPlugin: ({ useLongPressSelection, getIntl, appearance, allowCompositionInputOverride, }: {
|
|
6
|
+
export declare const createPlugin: ({ useLongPressSelection, getIntl, appearance, allowCompositionInputOverride, api, }: {
|
|
6
7
|
useLongPressSelection?: boolean | undefined;
|
|
7
8
|
getIntl: () => IntlShape;
|
|
8
9
|
appearance: EditorAppearance;
|
|
9
10
|
allowCompositionInputOverride?: boolean | undefined;
|
|
11
|
+
api?: import("@atlaskit/editor-common/types").PublicPluginAPI<[import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"codeBlock", {
|
|
12
|
+
pluginConfiguration: import("../types").CodeBlockOptions | undefined;
|
|
13
|
+
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"decorations", {
|
|
14
|
+
sharedState: import("@atlaskit/editor-plugin-decorations").DecorationState;
|
|
15
|
+
actions: {
|
|
16
|
+
hoverDecoration: (nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
17
|
+
removeDecoration: import("@atlaskit/editor-common/types").Command;
|
|
18
|
+
};
|
|
19
|
+
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"composition", {
|
|
20
|
+
sharedState: import("@atlaskit/editor-plugin-composition").CompositionState;
|
|
21
|
+
}, undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
22
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
23
|
+
sharedState: {
|
|
24
|
+
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
25
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
26
|
+
performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
|
|
27
|
+
};
|
|
28
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
29
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
30
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
31
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>];
|
|
32
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
33
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
|
|
34
|
+
sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
|
|
35
|
+
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
|
|
36
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
|
|
37
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
38
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
39
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
40
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
41
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
42
|
+
sharedState: {
|
|
43
|
+
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
44
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
45
|
+
performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
|
|
46
|
+
};
|
|
47
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
48
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
49
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
50
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>];
|
|
51
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
52
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
|
|
53
|
+
sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
|
|
54
|
+
actions: {
|
|
55
|
+
getAvatarColor: (str: string) => {
|
|
56
|
+
index: number;
|
|
57
|
+
color: import("@atlaskit/editor-common/collab").Color;
|
|
58
|
+
};
|
|
59
|
+
addInlineCommentMark: (props: {
|
|
60
|
+
from: number;
|
|
61
|
+
to: number;
|
|
62
|
+
mark: import("prosemirror-model").Mark;
|
|
63
|
+
}) => boolean;
|
|
64
|
+
};
|
|
65
|
+
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
66
|
+
pluginConfiguration?: {
|
|
67
|
+
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
68
|
+
} | undefined;
|
|
69
|
+
commands: {
|
|
70
|
+
updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
71
|
+
};
|
|
72
|
+
actions: {
|
|
73
|
+
applyViewModeStepAt: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
74
|
+
};
|
|
75
|
+
}, {
|
|
76
|
+
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
77
|
+
} | undefined>>];
|
|
78
|
+
actions: {
|
|
79
|
+
insertCodeBlock: (inputMethod: import("@atlaskit/editor-common/analytics").INPUT_METHOD) => import("@atlaskit/editor-common/types").Command;
|
|
80
|
+
};
|
|
81
|
+
}, import("../types").CodeBlockOptions | undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"decorations", {
|
|
82
|
+
sharedState: import("@atlaskit/editor-plugin-decorations").DecorationState;
|
|
83
|
+
actions: {
|
|
84
|
+
hoverDecoration: (nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
85
|
+
removeDecoration: import("@atlaskit/editor-common/types").Command;
|
|
86
|
+
};
|
|
87
|
+
}, undefined>, import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"composition", {
|
|
88
|
+
sharedState: import("@atlaskit/editor-plugin-composition").CompositionState;
|
|
89
|
+
}, undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
90
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
91
|
+
sharedState: {
|
|
92
|
+
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
93
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
94
|
+
performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
|
|
95
|
+
};
|
|
96
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
97
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
98
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
99
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>];
|
|
100
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
101
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
|
|
102
|
+
sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
|
|
103
|
+
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
|
|
104
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
|
|
105
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
106
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
107
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
108
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
109
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
110
|
+
sharedState: {
|
|
111
|
+
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
112
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
113
|
+
performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
|
|
114
|
+
};
|
|
115
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
116
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
117
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
118
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>];
|
|
119
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
120
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
|
|
121
|
+
sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
|
|
122
|
+
actions: {
|
|
123
|
+
getAvatarColor: (str: string) => {
|
|
124
|
+
index: number;
|
|
125
|
+
color: import("@atlaskit/editor-common/collab").Color;
|
|
126
|
+
};
|
|
127
|
+
addInlineCommentMark: (props: {
|
|
128
|
+
from: number;
|
|
129
|
+
to: number;
|
|
130
|
+
mark: import("prosemirror-model").Mark;
|
|
131
|
+
}) => boolean;
|
|
132
|
+
};
|
|
133
|
+
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
134
|
+
pluginConfiguration?: {
|
|
135
|
+
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
136
|
+
} | undefined;
|
|
137
|
+
commands: {
|
|
138
|
+
updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
139
|
+
};
|
|
140
|
+
actions: {
|
|
141
|
+
applyViewModeStepAt: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
142
|
+
};
|
|
143
|
+
}, {
|
|
144
|
+
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
145
|
+
} | undefined>>]> | undefined;
|
|
10
146
|
}) => SafePlugin<CodeBlockState>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { ExtractInjectionAPI, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { CodeBlockPlugin } from '../index';
|
|
4
5
|
export declare class CodeBlockView {
|
|
5
6
|
node: Node;
|
|
6
7
|
dom: HTMLElement;
|
|
@@ -8,7 +9,8 @@ export declare class CodeBlockView {
|
|
|
8
9
|
lineNumberGutter: HTMLElement;
|
|
9
10
|
getPos: getPosHandlerNode;
|
|
10
11
|
view: EditorView;
|
|
11
|
-
|
|
12
|
+
api?: ExtractInjectionAPI<CodeBlockPlugin>;
|
|
13
|
+
constructor(node: Node, view: EditorView, getPos: getPosHandlerNode, api?: ExtractInjectionAPI<CodeBlockPlugin>);
|
|
12
14
|
updateDOMAndSelection(savedInnerHTML: string, newCursorPosition: number): void;
|
|
13
15
|
coalesceDOMElements(): void;
|
|
14
16
|
private ensureLineNumbers;
|
|
@@ -18,4 +20,4 @@ export declare class CodeBlockView {
|
|
|
18
20
|
target: Element;
|
|
19
21
|
}): boolean;
|
|
20
22
|
}
|
|
21
|
-
export declare const codeBlockNodeView: (node: Node, view: EditorView, getPos: getPosHandler) => CodeBlockView;
|
|
23
|
+
export declare const codeBlockNodeView: (node: Node, view: EditorView, getPos: getPosHandler, api?: ExtractInjectionAPI<CodeBlockPlugin>) => CodeBlockView;
|
|
@@ -3,13 +3,15 @@ import type { Command, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor
|
|
|
3
3
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
4
|
import type { CompositionPlugin } from '@atlaskit/editor-plugin-composition';
|
|
5
5
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
6
|
+
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
6
7
|
import type { CodeBlockOptions } from './types';
|
|
7
8
|
export type CodeBlockPlugin = NextEditorPlugin<'codeBlock', {
|
|
8
9
|
pluginConfiguration: CodeBlockOptions | undefined;
|
|
9
10
|
dependencies: [
|
|
10
11
|
DecorationsPlugin,
|
|
11
12
|
CompositionPlugin,
|
|
12
|
-
OptionalPlugin<AnalyticsPlugin
|
|
13
|
+
OptionalPlugin<AnalyticsPlugin>,
|
|
14
|
+
OptionalPlugin<EditorViewModePlugin>
|
|
13
15
|
];
|
|
14
16
|
actions: {
|
|
15
17
|
insertCodeBlock: (inputMethod: INPUT_METHOD) => Command;
|
|
@@ -1,10 +1,175 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl-next';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import type { EditorAppearance } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorAppearance, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { CodeBlockPlugin } from '../index';
|
|
4
5
|
import type { CodeBlockState } from './main-state';
|
|
5
|
-
export declare const createPlugin: ({ useLongPressSelection, getIntl, appearance, allowCompositionInputOverride, }: {
|
|
6
|
+
export declare const createPlugin: ({ useLongPressSelection, getIntl, appearance, allowCompositionInputOverride, api, }: {
|
|
6
7
|
useLongPressSelection?: boolean | undefined;
|
|
7
8
|
getIntl: () => IntlShape;
|
|
8
9
|
appearance: EditorAppearance;
|
|
9
10
|
allowCompositionInputOverride?: boolean | undefined;
|
|
11
|
+
api?: import("@atlaskit/editor-common/types").PublicPluginAPI<[
|
|
12
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"codeBlock", {
|
|
13
|
+
pluginConfiguration: import("../types").CodeBlockOptions | undefined;
|
|
14
|
+
dependencies: [
|
|
15
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"decorations", {
|
|
16
|
+
sharedState: import("@atlaskit/editor-plugin-decorations").DecorationState;
|
|
17
|
+
actions: {
|
|
18
|
+
hoverDecoration: (nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
19
|
+
removeDecoration: import("@atlaskit/editor-common/types").Command;
|
|
20
|
+
};
|
|
21
|
+
}, undefined>,
|
|
22
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"composition", {
|
|
23
|
+
sharedState: import("@atlaskit/editor-plugin-composition").CompositionState;
|
|
24
|
+
}, undefined>,
|
|
25
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
26
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
27
|
+
sharedState: {
|
|
28
|
+
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
29
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
30
|
+
performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
|
|
31
|
+
};
|
|
32
|
+
dependencies: [
|
|
33
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
34
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
35
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
36
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>
|
|
37
|
+
];
|
|
38
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
39
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>,
|
|
40
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
|
|
41
|
+
sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
|
|
42
|
+
dependencies: [
|
|
43
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
|
|
44
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
|
|
45
|
+
dependencies: [
|
|
46
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
47
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
48
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
49
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>,
|
|
50
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
51
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
52
|
+
sharedState: {
|
|
53
|
+
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
54
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
55
|
+
performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
|
|
56
|
+
};
|
|
57
|
+
dependencies: [
|
|
58
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
59
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
60
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
61
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>
|
|
62
|
+
];
|
|
63
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
64
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>
|
|
65
|
+
];
|
|
66
|
+
sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
|
|
67
|
+
actions: {
|
|
68
|
+
getAvatarColor: (str: string) => {
|
|
69
|
+
index: number;
|
|
70
|
+
color: import("@atlaskit/editor-common/collab").Color;
|
|
71
|
+
};
|
|
72
|
+
addInlineCommentMark: (props: {
|
|
73
|
+
from: number;
|
|
74
|
+
to: number;
|
|
75
|
+
mark: import("prosemirror-model").Mark;
|
|
76
|
+
}) => boolean;
|
|
77
|
+
};
|
|
78
|
+
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
|
|
79
|
+
];
|
|
80
|
+
pluginConfiguration?: {
|
|
81
|
+
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
82
|
+
} | undefined;
|
|
83
|
+
commands: {
|
|
84
|
+
updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
85
|
+
};
|
|
86
|
+
actions: {
|
|
87
|
+
applyViewModeStepAt: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
88
|
+
};
|
|
89
|
+
}, {
|
|
90
|
+
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
91
|
+
} | undefined>>
|
|
92
|
+
];
|
|
93
|
+
actions: {
|
|
94
|
+
insertCodeBlock: (inputMethod: import("@atlaskit/editor-common/analytics").INPUT_METHOD) => import("@atlaskit/editor-common/types").Command;
|
|
95
|
+
};
|
|
96
|
+
}, import("../types").CodeBlockOptions | undefined>,
|
|
97
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"decorations", {
|
|
98
|
+
sharedState: import("@atlaskit/editor-plugin-decorations").DecorationState;
|
|
99
|
+
actions: {
|
|
100
|
+
hoverDecoration: (nodeType: import("prosemirror-model").NodeType | import("prosemirror-model").NodeType[], add: boolean, className?: string | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
101
|
+
removeDecoration: import("@atlaskit/editor-common/types").Command;
|
|
102
|
+
};
|
|
103
|
+
}, undefined>,
|
|
104
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"composition", {
|
|
105
|
+
sharedState: import("@atlaskit/editor-plugin-composition").CompositionState;
|
|
106
|
+
}, undefined>,
|
|
107
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
108
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
109
|
+
sharedState: {
|
|
110
|
+
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
111
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
112
|
+
performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
|
|
113
|
+
};
|
|
114
|
+
dependencies: [
|
|
115
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
116
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
117
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
118
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>
|
|
119
|
+
];
|
|
120
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
121
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>,
|
|
122
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
|
|
123
|
+
sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
|
|
124
|
+
dependencies: [
|
|
125
|
+
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
|
|
126
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
|
|
127
|
+
dependencies: [
|
|
128
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
129
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
130
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
131
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>,
|
|
132
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
133
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
134
|
+
sharedState: {
|
|
135
|
+
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
136
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
137
|
+
performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
|
|
138
|
+
};
|
|
139
|
+
dependencies: [
|
|
140
|
+
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
141
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
142
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
143
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>
|
|
144
|
+
];
|
|
145
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
146
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>
|
|
147
|
+
];
|
|
148
|
+
sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
|
|
149
|
+
actions: {
|
|
150
|
+
getAvatarColor: (str: string) => {
|
|
151
|
+
index: number;
|
|
152
|
+
color: import("@atlaskit/editor-common/collab").Color;
|
|
153
|
+
};
|
|
154
|
+
addInlineCommentMark: (props: {
|
|
155
|
+
from: number;
|
|
156
|
+
to: number;
|
|
157
|
+
mark: import("prosemirror-model").Mark;
|
|
158
|
+
}) => boolean;
|
|
159
|
+
};
|
|
160
|
+
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
|
|
161
|
+
];
|
|
162
|
+
pluginConfiguration?: {
|
|
163
|
+
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
164
|
+
} | undefined;
|
|
165
|
+
commands: {
|
|
166
|
+
updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
167
|
+
};
|
|
168
|
+
actions: {
|
|
169
|
+
applyViewModeStepAt: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
170
|
+
};
|
|
171
|
+
}, {
|
|
172
|
+
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
173
|
+
} | undefined>>
|
|
174
|
+
]> | undefined;
|
|
10
175
|
}) => SafePlugin<CodeBlockState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-code-block",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "Code block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,10 +35,11 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^35.8.0",
|
|
37
37
|
"@atlaskit/code": "^15.1.0",
|
|
38
|
-
"@atlaskit/editor-common": "^78.
|
|
38
|
+
"@atlaskit/editor-common": "^78.26.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-composition": "^1.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-decorations": "^1.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^1.0.0",
|
|
42
43
|
"@atlaskit/editor-prosemirror": "3.0.0",
|
|
43
44
|
"@atlaskit/icon": "^22.1.0",
|
|
44
45
|
"@atlaskit/prosemirror-input-rules": "^3.0.0",
|