@atlaskit/editor-core 189.1.1 → 189.1.3
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 +13 -0
- package/dist/cjs/plugins/indentation/commands/index.js +23 -15
- package/dist/cjs/plugins/indentation/commands/utils.js +4 -3
- package/dist/cjs/plugins/indentation/index.js +4 -2
- package/dist/cjs/plugins/indentation/pm-plugins/keymap.js +4 -4
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +8 -6
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/indentation/commands/index.js +9 -5
- package/dist/es2019/plugins/indentation/commands/utils.js +4 -3
- package/dist/es2019/plugins/indentation/index.js +7 -2
- package/dist/es2019/plugins/indentation/pm-plugins/keymap.js +4 -4
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +8 -6
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/indentation/commands/index.js +23 -15
- package/dist/esm/plugins/indentation/commands/utils.js +4 -3
- package/dist/esm/plugins/indentation/index.js +4 -2
- package/dist/esm/plugins/indentation/pm-plugins/keymap.js +4 -4
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +8 -6
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/indentation/commands/index.d.ts +3 -2
- package/dist/types/plugins/indentation/commands/utils.d.ts +3 -2
- package/dist/types/plugins/indentation/index.d.ts +5 -2
- package/dist/types/plugins/indentation/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/plugins/indentation/commands/index.d.ts +3 -2
- package/dist/types-ts4.5/plugins/indentation/commands/utils.d.ts +3 -2
- package/dist/types-ts4.5/plugins/indentation/index.d.ts +7 -2
- package/dist/types-ts4.5/plugins/indentation/pm-plugins/keymap.d.ts +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-core
|
|
2
2
|
|
|
3
|
+
## 189.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#42329](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42329) [`2bdcd641710`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2bdcd641710) - Decouple indentation plugin from deprecated analytics plugin.
|
|
8
|
+
|
|
9
|
+
## 189.1.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#42323](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42323) [`a4cb1c16536`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a4cb1c16536) - Fix useSharedPluginState if the editor API changes to ensure that the state updates.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 189.1.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -40,7 +40,8 @@ function createIndentationCommand(getNewIndentationAttrs) {
|
|
|
40
40
|
function createIndentationCommandWithAnalytics(_ref) {
|
|
41
41
|
var getNewIndentationAttrs = _ref.getNewIndentationAttrs,
|
|
42
42
|
direction = _ref.direction,
|
|
43
|
-
inputMethod = _ref.inputMethod
|
|
43
|
+
inputMethod = _ref.inputMethod,
|
|
44
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI;
|
|
44
45
|
// Create a new getAttrs function to record the changes
|
|
45
46
|
var _getAttrsWithChangesR = (0, _getAttrsWithChangesRecorder.default)(getNewIndentationAttrs, {
|
|
46
47
|
direction: direction
|
|
@@ -56,6 +57,7 @@ function createIndentationCommandWithAnalytics(_ref) {
|
|
|
56
57
|
return indentationCommand(state, (0, _utils.createAnalyticsDispatch)({
|
|
57
58
|
getAttrsChanges: getAndResetAttrsChanges,
|
|
58
59
|
inputMethod: inputMethod,
|
|
60
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
59
61
|
state: state,
|
|
60
62
|
dispatch: dispatch
|
|
61
63
|
}));
|
|
@@ -86,13 +88,16 @@ var getIndentAttrs = function getIndentAttrs(oldAttr) {
|
|
|
86
88
|
}; // Otherwise, increase the level by one
|
|
87
89
|
};
|
|
88
90
|
|
|
89
|
-
var getIndentCommand = exports.getIndentCommand = function getIndentCommand() {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
var getIndentCommand = exports.getIndentCommand = function getIndentCommand(editorAnalyticsAPI) {
|
|
92
|
+
return function () {
|
|
93
|
+
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
|
|
94
|
+
return createIndentationCommandWithAnalytics({
|
|
95
|
+
getNewIndentationAttrs: getIndentAttrs,
|
|
96
|
+
direction: _analytics.INDENT_DIRECTION.INDENT,
|
|
97
|
+
inputMethod: inputMethod,
|
|
98
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
99
|
+
});
|
|
100
|
+
};
|
|
96
101
|
};
|
|
97
102
|
|
|
98
103
|
/**
|
|
@@ -117,13 +122,16 @@ var getOutdentAttrs = function getOutdentAttrs(oldAttr) {
|
|
|
117
122
|
}; // Decrease the level on other cases
|
|
118
123
|
};
|
|
119
124
|
|
|
120
|
-
var getOutdentCommand = exports.getOutdentCommand = function getOutdentCommand() {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
var getOutdentCommand = exports.getOutdentCommand = function getOutdentCommand(editorAnalyticsAPI) {
|
|
126
|
+
return function () {
|
|
127
|
+
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _analytics.INPUT_METHOD.KEYBOARD;
|
|
128
|
+
return createIndentationCommandWithAnalytics({
|
|
129
|
+
getNewIndentationAttrs: getOutdentAttrs,
|
|
130
|
+
direction: _analytics.INDENT_DIRECTION.OUTDENT,
|
|
131
|
+
inputMethod: inputMethod,
|
|
132
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
133
|
+
});
|
|
134
|
+
};
|
|
127
135
|
};
|
|
128
136
|
var removeIndentation = exports.removeIndentation = function removeIndentation(state, dispatch) {
|
|
129
137
|
return (0, _commands.toggleBlockMark)(state.schema.marks.indentation, function () {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.createAnalyticsDispatch = createAnalyticsDispatch;
|
|
7
7
|
exports.getNewIndentLevel = getNewIndentLevel;
|
|
8
8
|
exports.getPrevIndentLevel = getPrevIndentLevel;
|
|
9
|
-
var _analytics = require("
|
|
9
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
10
|
// Analytics GAS v3 Utils
|
|
11
11
|
|
|
12
12
|
var indentTypes = {
|
|
@@ -51,6 +51,7 @@ function getPrevIndentLevel(prevAttrs) {
|
|
|
51
51
|
function createAnalyticsDispatch(_ref) {
|
|
52
52
|
var getAttrsChanges = _ref.getAttrsChanges,
|
|
53
53
|
inputMethod = _ref.inputMethod,
|
|
54
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
54
55
|
state = _ref.state,
|
|
55
56
|
dispatch = _ref.dispatch;
|
|
56
57
|
return function (tr) {
|
|
@@ -68,7 +69,7 @@ function createAnalyticsDispatch(_ref) {
|
|
|
68
69
|
return; // If no valid indent type continue
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
72
73
|
action: _analytics.ACTION.FORMATTED,
|
|
73
74
|
actionSubject: _analytics.ACTION_SUBJECT.TEXT,
|
|
74
75
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_INDENT,
|
|
@@ -80,7 +81,7 @@ function createAnalyticsDispatch(_ref) {
|
|
|
80
81
|
direction: direction,
|
|
81
82
|
indentType: indentType
|
|
82
83
|
}
|
|
83
|
-
});
|
|
84
|
+
})(currentTr);
|
|
84
85
|
});
|
|
85
86
|
|
|
86
87
|
// Dispatch analytics if exist
|
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
8
8
|
var _keymap = require("./pm-plugins/keymap");
|
|
9
|
-
var indentationPlugin = function indentationPlugin() {
|
|
9
|
+
var indentationPlugin = function indentationPlugin(_ref) {
|
|
10
|
+
var api = _ref.api;
|
|
10
11
|
return {
|
|
11
12
|
name: 'indentation',
|
|
12
13
|
marks: function marks() {
|
|
@@ -19,7 +20,8 @@ var indentationPlugin = function indentationPlugin() {
|
|
|
19
20
|
return [{
|
|
20
21
|
name: 'indentationKeymap',
|
|
21
22
|
plugin: function plugin() {
|
|
22
|
-
|
|
23
|
+
var _api$analytics;
|
|
24
|
+
return (0, _keymap.keymapPlugin)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
23
25
|
}
|
|
24
26
|
}];
|
|
25
27
|
}
|
|
@@ -10,14 +10,14 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
10
10
|
var _utils = require("../../../utils");
|
|
11
11
|
var _commands = require("../commands");
|
|
12
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
|
-
function keymapPlugin() {
|
|
13
|
+
function keymapPlugin(editorAnalyticsAPI) {
|
|
14
14
|
var list = {};
|
|
15
|
-
(0, _keymaps.bindKeymapWithCommand)((0, _keymaps.findShortcutByKeymap)(_keymaps.indent), (0, _commands.getIndentCommand)(_analytics.INPUT_METHOD.KEYBOARD), list);
|
|
16
|
-
(0, _keymaps.bindKeymapWithCommand)((0, _keymaps.findShortcutByKeymap)(_keymaps.outdent), (0, _commands.getOutdentCommand)(_analytics.INPUT_METHOD.KEYBOARD), list);
|
|
15
|
+
(0, _keymaps.bindKeymapWithCommand)((0, _keymaps.findShortcutByKeymap)(_keymaps.indent), (0, _commands.getIndentCommand)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD), list);
|
|
16
|
+
(0, _keymaps.bindKeymapWithCommand)((0, _keymaps.findShortcutByKeymap)(_keymaps.outdent), (0, _commands.getOutdentCommand)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD), list);
|
|
17
17
|
(0, _keymaps.bindKeymapWithCommand)((0, _keymaps.findShortcutByKeymap)(_keymaps.backspace), function (state, dispatch) {
|
|
18
18
|
var selection = state.selection;
|
|
19
19
|
if ((0, _utils.isTextSelection)(selection) && selection.$cursor && selection.$cursor.parentOffset === 0) {
|
|
20
|
-
return dispatch ? (0, _commands.getOutdentCommand)(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) : false;
|
|
20
|
+
return dispatch ? (0, _commands.getOutdentCommand)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD)(state, dispatch) : false;
|
|
21
21
|
}
|
|
22
22
|
return false;
|
|
23
23
|
}, list);
|
|
@@ -24,14 +24,15 @@ var onItemActivated = exports.onItemActivated = function onItemActivated(pluginI
|
|
|
24
24
|
var _indentationButtonsPl;
|
|
25
25
|
var node = (_indentationButtonsPl = _indentationButtons.pluginKey.getState(editorView.state)) === null || _indentationButtonsPl === void 0 ? void 0 : _indentationButtonsPl.node;
|
|
26
26
|
if (node === 'paragraph_heading') {
|
|
27
|
-
|
|
27
|
+
var _pluginInjectionApi$a;
|
|
28
|
+
(0, _commands.getIndentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
28
29
|
}
|
|
29
30
|
if (node === 'list') {
|
|
30
31
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.indentList(_analytics.INPUT_METHOD.TOOLBAR));
|
|
31
32
|
}
|
|
32
33
|
if (node === 'taskList') {
|
|
33
|
-
var _pluginInjectionApi$
|
|
34
|
-
(0, _keymaps.getIndentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
34
|
+
var _pluginInjectionApi$a2;
|
|
35
|
+
(0, _keymaps.getIndentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
35
36
|
}
|
|
36
37
|
break;
|
|
37
38
|
}
|
|
@@ -40,14 +41,15 @@ var onItemActivated = exports.onItemActivated = function onItemActivated(pluginI
|
|
|
40
41
|
var _indentationButtonsPl2;
|
|
41
42
|
var _node = (_indentationButtonsPl2 = _indentationButtons.pluginKey.getState(editorView.state)) === null || _indentationButtonsPl2 === void 0 ? void 0 : _indentationButtonsPl2.node;
|
|
42
43
|
if (_node === 'paragraph_heading') {
|
|
43
|
-
|
|
44
|
+
var _pluginInjectionApi$a3;
|
|
45
|
+
(0, _commands.getOutdentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
44
46
|
}
|
|
45
47
|
if (_node === 'list') {
|
|
46
48
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.outdentList(_analytics.INPUT_METHOD.TOOLBAR));
|
|
47
49
|
}
|
|
48
50
|
if (_node === 'taskList') {
|
|
49
|
-
var _pluginInjectionApi$
|
|
50
|
-
(0, _keymaps.getUnindentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
51
|
+
var _pluginInjectionApi$a4;
|
|
52
|
+
(0, _keymaps.getUnindentCommand)(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions)(_analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
51
53
|
}
|
|
52
54
|
break;
|
|
53
55
|
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.version = exports.nextMajorVersion = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
|
-
var version = exports.version = "189.1.
|
|
8
|
+
var version = exports.version = "189.1.3";
|
|
9
9
|
var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
|
|
10
10
|
return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
|
|
11
11
|
};
|
|
@@ -38,7 +38,8 @@ function createIndentationCommand(getNewIndentationAttrs) {
|
|
|
38
38
|
function createIndentationCommandWithAnalytics({
|
|
39
39
|
getNewIndentationAttrs,
|
|
40
40
|
direction,
|
|
41
|
-
inputMethod
|
|
41
|
+
inputMethod,
|
|
42
|
+
editorAnalyticsAPI
|
|
42
43
|
}) {
|
|
43
44
|
// Create a new getAttrs function to record the changes
|
|
44
45
|
const {
|
|
@@ -56,6 +57,7 @@ function createIndentationCommandWithAnalytics({
|
|
|
56
57
|
return indentationCommand(state, createAnalyticsDispatch({
|
|
57
58
|
getAttrsChanges: getAndResetAttrsChanges,
|
|
58
59
|
inputMethod,
|
|
60
|
+
editorAnalyticsAPI,
|
|
59
61
|
state,
|
|
60
62
|
dispatch
|
|
61
63
|
}));
|
|
@@ -88,10 +90,11 @@ const getIndentAttrs = oldAttr => {
|
|
|
88
90
|
}; // Otherwise, increase the level by one
|
|
89
91
|
};
|
|
90
92
|
|
|
91
|
-
export const getIndentCommand = (inputMethod = INPUT_METHOD.KEYBOARD) => createIndentationCommandWithAnalytics({
|
|
93
|
+
export const getIndentCommand = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.KEYBOARD) => createIndentationCommandWithAnalytics({
|
|
92
94
|
getNewIndentationAttrs: getIndentAttrs,
|
|
93
95
|
direction: INDENT_DIRECTION.INDENT,
|
|
94
|
-
inputMethod
|
|
96
|
+
inputMethod,
|
|
97
|
+
editorAnalyticsAPI
|
|
95
98
|
});
|
|
96
99
|
|
|
97
100
|
/**
|
|
@@ -118,9 +121,10 @@ const getOutdentAttrs = oldAttr => {
|
|
|
118
121
|
}; // Decrease the level on other cases
|
|
119
122
|
};
|
|
120
123
|
|
|
121
|
-
export const getOutdentCommand = (inputMethod = INPUT_METHOD.KEYBOARD) => createIndentationCommandWithAnalytics({
|
|
124
|
+
export const getOutdentCommand = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.KEYBOARD) => createIndentationCommandWithAnalytics({
|
|
122
125
|
getNewIndentationAttrs: getOutdentAttrs,
|
|
123
126
|
direction: INDENT_DIRECTION.OUTDENT,
|
|
124
|
-
inputMethod
|
|
127
|
+
inputMethod,
|
|
128
|
+
editorAnalyticsAPI
|
|
125
129
|
});
|
|
126
130
|
export const removeIndentation = (state, dispatch) => toggleBlockMark(state.schema.marks.indentation, () => false)(state, dispatch);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INDENT_TYPE, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
|
|
3
3
|
// Analytics GAS v3 Utils
|
|
4
4
|
|
|
@@ -44,6 +44,7 @@ export function getPrevIndentLevel(prevAttrs) {
|
|
|
44
44
|
export function createAnalyticsDispatch({
|
|
45
45
|
getAttrsChanges,
|
|
46
46
|
inputMethod,
|
|
47
|
+
editorAnalyticsAPI,
|
|
47
48
|
state,
|
|
48
49
|
dispatch
|
|
49
50
|
}) {
|
|
@@ -65,7 +66,7 @@ export function createAnalyticsDispatch({
|
|
|
65
66
|
return; // If no valid indent type continue
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
69
70
|
action: ACTION.FORMATTED,
|
|
70
71
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
71
72
|
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_INDENT,
|
|
@@ -77,7 +78,7 @@ export function createAnalyticsDispatch({
|
|
|
77
78
|
direction,
|
|
78
79
|
indentType
|
|
79
80
|
}
|
|
80
|
-
});
|
|
81
|
+
})(currentTr);
|
|
81
82
|
});
|
|
82
83
|
|
|
83
84
|
// Dispatch analytics if exist
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { indentation } from '@atlaskit/adf-schema';
|
|
2
2
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
3
|
-
const indentationPlugin = (
|
|
3
|
+
const indentationPlugin = ({
|
|
4
|
+
api
|
|
5
|
+
}) => ({
|
|
4
6
|
name: 'indentation',
|
|
5
7
|
marks() {
|
|
6
8
|
return [{
|
|
@@ -11,7 +13,10 @@ const indentationPlugin = () => ({
|
|
|
11
13
|
pmPlugins() {
|
|
12
14
|
return [{
|
|
13
15
|
name: 'indentationKeymap',
|
|
14
|
-
plugin: () =>
|
|
16
|
+
plugin: () => {
|
|
17
|
+
var _api$analytics;
|
|
18
|
+
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
19
|
+
}
|
|
15
20
|
}];
|
|
16
21
|
}
|
|
17
22
|
});
|
|
@@ -3,16 +3,16 @@ import { bindKeymapWithCommand, findShortcutByKeymap, outdent, indent, backspace
|
|
|
3
3
|
import { isTextSelection } from '../../../utils';
|
|
4
4
|
import { getIndentCommand, getOutdentCommand } from '../commands';
|
|
5
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
export function keymapPlugin() {
|
|
6
|
+
export function keymapPlugin(editorAnalyticsAPI) {
|
|
7
7
|
const list = {};
|
|
8
|
-
bindKeymapWithCommand(findShortcutByKeymap(indent), getIndentCommand(INPUT_METHOD.KEYBOARD), list);
|
|
9
|
-
bindKeymapWithCommand(findShortcutByKeymap(outdent), getOutdentCommand(INPUT_METHOD.KEYBOARD), list);
|
|
8
|
+
bindKeymapWithCommand(findShortcutByKeymap(indent), getIndentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
|
|
9
|
+
bindKeymapWithCommand(findShortcutByKeymap(outdent), getOutdentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
|
|
10
10
|
bindKeymapWithCommand(findShortcutByKeymap(backspace), (state, dispatch) => {
|
|
11
11
|
const {
|
|
12
12
|
selection
|
|
13
13
|
} = state;
|
|
14
14
|
if (isTextSelection(selection) && selection.$cursor && selection.$cursor.parentOffset === 0) {
|
|
15
|
-
return dispatch ? getOutdentCommand(INPUT_METHOD.KEYBOARD)(state, dispatch) : false;
|
|
15
|
+
return dispatch ? getOutdentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)(state, dispatch) : false;
|
|
16
16
|
}
|
|
17
17
|
return false;
|
|
18
18
|
}, list);
|
|
@@ -18,14 +18,15 @@ export const onItemActivated = pluginInjectionApi => ({
|
|
|
18
18
|
var _indentationButtonsPl;
|
|
19
19
|
const node = (_indentationButtonsPl = indentationButtonsPluginKey.getState(editorView.state)) === null || _indentationButtonsPl === void 0 ? void 0 : _indentationButtonsPl.node;
|
|
20
20
|
if (node === 'paragraph_heading') {
|
|
21
|
-
|
|
21
|
+
var _pluginInjectionApi$a;
|
|
22
|
+
indentParagraphOrHeading(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
22
23
|
}
|
|
23
24
|
if (node === 'list') {
|
|
24
25
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.indentList(INPUT_METHOD.TOOLBAR));
|
|
25
26
|
}
|
|
26
27
|
if (node === 'taskList') {
|
|
27
|
-
var _pluginInjectionApi$
|
|
28
|
-
indentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
28
|
+
var _pluginInjectionApi$a2;
|
|
29
|
+
indentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
29
30
|
}
|
|
30
31
|
break;
|
|
31
32
|
}
|
|
@@ -34,14 +35,15 @@ export const onItemActivated = pluginInjectionApi => ({
|
|
|
34
35
|
var _indentationButtonsPl2;
|
|
35
36
|
const node = (_indentationButtonsPl2 = indentationButtonsPluginKey.getState(editorView.state)) === null || _indentationButtonsPl2 === void 0 ? void 0 : _indentationButtonsPl2.node;
|
|
36
37
|
if (node === 'paragraph_heading') {
|
|
37
|
-
|
|
38
|
+
var _pluginInjectionApi$a3;
|
|
39
|
+
outdentParagraphOrHeading(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
38
40
|
}
|
|
39
41
|
if (node === 'list') {
|
|
40
42
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.outdentList(INPUT_METHOD.TOOLBAR));
|
|
41
43
|
}
|
|
42
44
|
if (node === 'taskList') {
|
|
43
|
-
var _pluginInjectionApi$
|
|
44
|
-
outdentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
45
|
+
var _pluginInjectionApi$a4;
|
|
46
|
+
outdentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
45
47
|
}
|
|
46
48
|
break;
|
|
47
49
|
}
|
|
@@ -33,7 +33,8 @@ function createIndentationCommand(getNewIndentationAttrs) {
|
|
|
33
33
|
function createIndentationCommandWithAnalytics(_ref) {
|
|
34
34
|
var getNewIndentationAttrs = _ref.getNewIndentationAttrs,
|
|
35
35
|
direction = _ref.direction,
|
|
36
|
-
inputMethod = _ref.inputMethod
|
|
36
|
+
inputMethod = _ref.inputMethod,
|
|
37
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI;
|
|
37
38
|
// Create a new getAttrs function to record the changes
|
|
38
39
|
var _getAttrsWithChangesR = getAttrsWithChangesRecorder(getNewIndentationAttrs, {
|
|
39
40
|
direction: direction
|
|
@@ -49,6 +50,7 @@ function createIndentationCommandWithAnalytics(_ref) {
|
|
|
49
50
|
return indentationCommand(state, createAnalyticsDispatch({
|
|
50
51
|
getAttrsChanges: getAndResetAttrsChanges,
|
|
51
52
|
inputMethod: inputMethod,
|
|
53
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
52
54
|
state: state,
|
|
53
55
|
dispatch: dispatch
|
|
54
56
|
}));
|
|
@@ -79,13 +81,16 @@ var getIndentAttrs = function getIndentAttrs(oldAttr) {
|
|
|
79
81
|
}; // Otherwise, increase the level by one
|
|
80
82
|
};
|
|
81
83
|
|
|
82
|
-
export var getIndentCommand = function getIndentCommand() {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
export var getIndentCommand = function getIndentCommand(editorAnalyticsAPI) {
|
|
85
|
+
return function () {
|
|
86
|
+
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.KEYBOARD;
|
|
87
|
+
return createIndentationCommandWithAnalytics({
|
|
88
|
+
getNewIndentationAttrs: getIndentAttrs,
|
|
89
|
+
direction: INDENT_DIRECTION.INDENT,
|
|
90
|
+
inputMethod: inputMethod,
|
|
91
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
92
|
+
});
|
|
93
|
+
};
|
|
89
94
|
};
|
|
90
95
|
|
|
91
96
|
/**
|
|
@@ -110,13 +115,16 @@ var getOutdentAttrs = function getOutdentAttrs(oldAttr) {
|
|
|
110
115
|
}; // Decrease the level on other cases
|
|
111
116
|
};
|
|
112
117
|
|
|
113
|
-
export var getOutdentCommand = function getOutdentCommand() {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
export var getOutdentCommand = function getOutdentCommand(editorAnalyticsAPI) {
|
|
119
|
+
return function () {
|
|
120
|
+
var inputMethod = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INPUT_METHOD.KEYBOARD;
|
|
121
|
+
return createIndentationCommandWithAnalytics({
|
|
122
|
+
getNewIndentationAttrs: getOutdentAttrs,
|
|
123
|
+
direction: INDENT_DIRECTION.OUTDENT,
|
|
124
|
+
inputMethod: inputMethod,
|
|
125
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
126
|
+
});
|
|
127
|
+
};
|
|
120
128
|
};
|
|
121
129
|
export var removeIndentation = function removeIndentation(state, dispatch) {
|
|
122
130
|
return toggleBlockMark(state.schema.marks.indentation, function () {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { INDENT_TYPE, ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
|
|
3
3
|
// Analytics GAS v3 Utils
|
|
4
4
|
|
|
@@ -44,6 +44,7 @@ export function getPrevIndentLevel(prevAttrs) {
|
|
|
44
44
|
export function createAnalyticsDispatch(_ref) {
|
|
45
45
|
var getAttrsChanges = _ref.getAttrsChanges,
|
|
46
46
|
inputMethod = _ref.inputMethod,
|
|
47
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
47
48
|
state = _ref.state,
|
|
48
49
|
dispatch = _ref.dispatch;
|
|
49
50
|
return function (tr) {
|
|
@@ -61,7 +62,7 @@ export function createAnalyticsDispatch(_ref) {
|
|
|
61
62
|
return; // If no valid indent type continue
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
65
66
|
action: ACTION.FORMATTED,
|
|
66
67
|
actionSubject: ACTION_SUBJECT.TEXT,
|
|
67
68
|
actionSubjectId: ACTION_SUBJECT_ID.FORMAT_INDENT,
|
|
@@ -73,7 +74,7 @@ export function createAnalyticsDispatch(_ref) {
|
|
|
73
74
|
direction: direction,
|
|
74
75
|
indentType: indentType
|
|
75
76
|
}
|
|
76
|
-
});
|
|
77
|
+
})(currentTr);
|
|
77
78
|
});
|
|
78
79
|
|
|
79
80
|
// Dispatch analytics if exist
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { indentation } from '@atlaskit/adf-schema';
|
|
2
2
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
3
|
-
var indentationPlugin = function indentationPlugin() {
|
|
3
|
+
var indentationPlugin = function indentationPlugin(_ref) {
|
|
4
|
+
var api = _ref.api;
|
|
4
5
|
return {
|
|
5
6
|
name: 'indentation',
|
|
6
7
|
marks: function marks() {
|
|
@@ -13,7 +14,8 @@ var indentationPlugin = function indentationPlugin() {
|
|
|
13
14
|
return [{
|
|
14
15
|
name: 'indentationKeymap',
|
|
15
16
|
plugin: function plugin() {
|
|
16
|
-
|
|
17
|
+
var _api$analytics;
|
|
18
|
+
return keymapPlugin(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
17
19
|
}
|
|
18
20
|
}];
|
|
19
21
|
}
|
|
@@ -3,14 +3,14 @@ import { bindKeymapWithCommand, findShortcutByKeymap, outdent, indent, backspace
|
|
|
3
3
|
import { isTextSelection } from '../../../utils';
|
|
4
4
|
import { getIndentCommand, getOutdentCommand } from '../commands';
|
|
5
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
export function keymapPlugin() {
|
|
6
|
+
export function keymapPlugin(editorAnalyticsAPI) {
|
|
7
7
|
var list = {};
|
|
8
|
-
bindKeymapWithCommand(findShortcutByKeymap(indent), getIndentCommand(INPUT_METHOD.KEYBOARD), list);
|
|
9
|
-
bindKeymapWithCommand(findShortcutByKeymap(outdent), getOutdentCommand(INPUT_METHOD.KEYBOARD), list);
|
|
8
|
+
bindKeymapWithCommand(findShortcutByKeymap(indent), getIndentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
|
|
9
|
+
bindKeymapWithCommand(findShortcutByKeymap(outdent), getOutdentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), list);
|
|
10
10
|
bindKeymapWithCommand(findShortcutByKeymap(backspace), function (state, dispatch) {
|
|
11
11
|
var selection = state.selection;
|
|
12
12
|
if (isTextSelection(selection) && selection.$cursor && selection.$cursor.parentOffset === 0) {
|
|
13
|
-
return dispatch ? getOutdentCommand(INPUT_METHOD.KEYBOARD)(state, dispatch) : false;
|
|
13
|
+
return dispatch ? getOutdentCommand(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)(state, dispatch) : false;
|
|
14
14
|
}
|
|
15
15
|
return false;
|
|
16
16
|
}, list);
|
|
@@ -18,14 +18,15 @@ export var onItemActivated = function onItemActivated(pluginInjectionApi) {
|
|
|
18
18
|
var _indentationButtonsPl;
|
|
19
19
|
var node = (_indentationButtonsPl = indentationButtonsPluginKey.getState(editorView.state)) === null || _indentationButtonsPl === void 0 ? void 0 : _indentationButtonsPl.node;
|
|
20
20
|
if (node === 'paragraph_heading') {
|
|
21
|
-
|
|
21
|
+
var _pluginInjectionApi$a;
|
|
22
|
+
indentParagraphOrHeading(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
22
23
|
}
|
|
23
24
|
if (node === 'list') {
|
|
24
25
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.indentList(INPUT_METHOD.TOOLBAR));
|
|
25
26
|
}
|
|
26
27
|
if (node === 'taskList') {
|
|
27
|
-
var _pluginInjectionApi$
|
|
28
|
-
indentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
28
|
+
var _pluginInjectionApi$a2;
|
|
29
|
+
indentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
29
30
|
}
|
|
30
31
|
break;
|
|
31
32
|
}
|
|
@@ -34,14 +35,15 @@ export var onItemActivated = function onItemActivated(pluginInjectionApi) {
|
|
|
34
35
|
var _indentationButtonsPl2;
|
|
35
36
|
var _node = (_indentationButtonsPl2 = indentationButtonsPluginKey.getState(editorView.state)) === null || _indentationButtonsPl2 === void 0 ? void 0 : _indentationButtonsPl2.node;
|
|
36
37
|
if (_node === 'paragraph_heading') {
|
|
37
|
-
|
|
38
|
+
var _pluginInjectionApi$a3;
|
|
39
|
+
outdentParagraphOrHeading(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a3 === void 0 ? void 0 : _pluginInjectionApi$a3.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
38
40
|
}
|
|
39
41
|
if (_node === 'list') {
|
|
40
42
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || pluginInjectionApi.core.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.commands.outdentList(INPUT_METHOD.TOOLBAR));
|
|
41
43
|
}
|
|
42
44
|
if (_node === 'taskList') {
|
|
43
|
-
var _pluginInjectionApi$
|
|
44
|
-
outdentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$
|
|
45
|
+
var _pluginInjectionApi$a4;
|
|
46
|
+
outdentTaskList(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a4 === void 0 ? void 0 : _pluginInjectionApi$a4.actions)(INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
45
47
|
}
|
|
46
48
|
break;
|
|
47
49
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Node as PmNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { Command } from '../../../types/command';
|
|
3
4
|
import type { IndentationInputMethod } from './utils';
|
|
4
5
|
export declare const MAX_INDENTATION_LEVEL = 6;
|
|
5
6
|
export declare const isIndentationAllowed: (schema: Schema, node: PmNode) => boolean;
|
|
6
|
-
export declare const getIndentCommand: (inputMethod?: IndentationInputMethod) => Command;
|
|
7
|
-
export declare const getOutdentCommand: (inputMethod?: IndentationInputMethod) => Command;
|
|
7
|
+
export declare const getIndentCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: IndentationInputMethod) => Command;
|
|
8
|
+
export declare const getOutdentCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: IndentationInputMethod) => Command;
|
|
8
9
|
export declare const removeIndentation: Command;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IndentationMarkAttributes } from '@atlaskit/adf-schema';
|
|
2
|
-
import type { INDENT_DIRECTION, INPUT_METHOD } from '
|
|
2
|
+
import type { INDENT_DIRECTION, INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { GetAttrsChange } from '../../../utils/getAttrsWithChangesRecorder';
|
|
5
5
|
export type PrevAttributes = IndentationMarkAttributes | undefined;
|
|
@@ -28,9 +28,10 @@ export declare function getPrevIndentLevel(prevAttrs: PrevAttributes): number;
|
|
|
28
28
|
* @param dispatch
|
|
29
29
|
* @returns
|
|
30
30
|
*/
|
|
31
|
-
export declare function createAnalyticsDispatch({ getAttrsChanges, inputMethod, state, dispatch, }: {
|
|
31
|
+
export declare function createAnalyticsDispatch({ getAttrsChanges, inputMethod, editorAnalyticsAPI, state, dispatch, }: {
|
|
32
32
|
getAttrsChanges: () => GetAttrsChange<IndentationMarkAttributes, IndentationChangesOptions>[];
|
|
33
33
|
inputMethod: IndentationInputMethod;
|
|
34
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
34
35
|
state: EditorState;
|
|
35
36
|
dispatch?: (tr: Transaction) => void;
|
|
36
37
|
}): (tr: Transaction) => void;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
declare const indentationPlugin: NextEditorPlugin<'indentation', {
|
|
4
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>];
|
|
5
|
+
}>;
|
|
3
6
|
export default indentationPlugin;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
export declare function keymapPlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
|
|
3
4
|
export default keymapPlugin;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Node as PmNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { Command } from '../../../types/command';
|
|
3
4
|
import type { IndentationInputMethod } from './utils';
|
|
4
5
|
export declare const MAX_INDENTATION_LEVEL = 6;
|
|
5
6
|
export declare const isIndentationAllowed: (schema: Schema, node: PmNode) => boolean;
|
|
6
|
-
export declare const getIndentCommand: (inputMethod?: IndentationInputMethod) => Command;
|
|
7
|
-
export declare const getOutdentCommand: (inputMethod?: IndentationInputMethod) => Command;
|
|
7
|
+
export declare const getIndentCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: IndentationInputMethod) => Command;
|
|
8
|
+
export declare const getOutdentCommand: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod?: IndentationInputMethod) => Command;
|
|
8
9
|
export declare const removeIndentation: Command;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IndentationMarkAttributes } from '@atlaskit/adf-schema';
|
|
2
|
-
import type { INDENT_DIRECTION, INPUT_METHOD } from '
|
|
2
|
+
import type { INDENT_DIRECTION, INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { GetAttrsChange } from '../../../utils/getAttrsWithChangesRecorder';
|
|
5
5
|
export type PrevAttributes = IndentationMarkAttributes | undefined;
|
|
@@ -28,9 +28,10 @@ export declare function getPrevIndentLevel(prevAttrs: PrevAttributes): number;
|
|
|
28
28
|
* @param dispatch
|
|
29
29
|
* @returns
|
|
30
30
|
*/
|
|
31
|
-
export declare function createAnalyticsDispatch({ getAttrsChanges, inputMethod, state, dispatch, }: {
|
|
31
|
+
export declare function createAnalyticsDispatch({ getAttrsChanges, inputMethod, editorAnalyticsAPI, state, dispatch, }: {
|
|
32
32
|
getAttrsChanges: () => GetAttrsChange<IndentationMarkAttributes, IndentationChangesOptions>[];
|
|
33
33
|
inputMethod: IndentationInputMethod;
|
|
34
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
34
35
|
state: EditorState;
|
|
35
36
|
dispatch?: (tr: Transaction) => void;
|
|
36
37
|
}): (tr: Transaction) => void;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
|
|
1
|
+
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
|
+
declare const indentationPlugin: NextEditorPlugin<'indentation', {
|
|
4
|
+
dependencies: [
|
|
5
|
+
OptionalPlugin<AnalyticsPlugin>
|
|
6
|
+
];
|
|
7
|
+
}>;
|
|
3
8
|
export default indentationPlugin;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
export declare function keymapPlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin | undefined;
|
|
3
4
|
export default keymapPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "189.1.
|
|
3
|
+
"version": "189.1.3",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/analytics-next-stable-react-context": "1.0.1",
|
|
49
49
|
"@atlaskit/avatar": "^21.4.0",
|
|
50
50
|
"@atlaskit/avatar-group": "^9.4.0",
|
|
51
|
-
"@atlaskit/button": "^16.
|
|
51
|
+
"@atlaskit/button": "^16.12.0",
|
|
52
52
|
"@atlaskit/checkbox": "^12.6.0",
|
|
53
53
|
"@atlaskit/code": "^14.6.0",
|
|
54
54
|
"@atlaskit/date": "^0.10.0",
|