@atlaskit/editor-core 188.11.4 → 188.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/cjs/labs/next/presets/universal.js +15 -3
- package/dist/cjs/plugins/annotation/index.js +12 -1
- package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +2 -1
- package/dist/cjs/plugins/annotation/pm-plugins/plugin-factory.js +5 -0
- package/dist/cjs/plugins/annotation/pm-plugins/reducer.js +2 -1
- package/dist/cjs/plugins/annotation/toolbar.js +2 -156
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +33 -31
- package/dist/cjs/plugins/layout/actions.js +20 -17
- package/dist/cjs/plugins/layout/index.js +6 -2
- package/dist/cjs/plugins/panel/index.js +1 -1
- package/dist/cjs/plugins/panel/toolbar.js +9 -7
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +0 -6
- package/dist/cjs/plugins/rank.js +1 -1
- package/dist/cjs/plugins/tasks-and-decisions/index.js +1 -1
- package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/keymaps.js +104 -90
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -2
- package/dist/cjs/plugins/undo-redo/index.js +7 -16
- package/dist/cjs/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +59 -75
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +14 -2
- package/dist/es2019/plugins/annotation/index.js +14 -1
- package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +2 -1
- package/dist/es2019/plugins/annotation/pm-plugins/plugin-factory.js +6 -0
- package/dist/es2019/plugins/annotation/pm-plugins/reducer.js +2 -1
- package/dist/es2019/plugins/annotation/toolbar.js +1 -156
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +4 -3
- package/dist/es2019/plugins/layout/actions.js +4 -3
- package/dist/es2019/plugins/layout/index.js +63 -57
- package/dist/es2019/plugins/panel/index.js +1 -1
- package/dist/es2019/plugins/panel/toolbar.js +9 -7
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +1 -4
- package/dist/es2019/plugins/rank.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/index.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/keymaps.js +22 -14
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -2
- package/dist/es2019/plugins/undo-redo/index.js +6 -17
- package/dist/es2019/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +60 -61
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +14 -2
- package/dist/esm/plugins/annotation/index.js +12 -1
- package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +2 -1
- package/dist/esm/plugins/annotation/pm-plugins/plugin-factory.js +5 -0
- package/dist/esm/plugins/annotation/pm-plugins/reducer.js +2 -1
- package/dist/esm/plugins/annotation/toolbar.js +1 -156
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +33 -31
- package/dist/esm/plugins/layout/actions.js +15 -12
- package/dist/esm/plugins/layout/index.js +7 -3
- package/dist/esm/plugins/panel/index.js +1 -1
- package/dist/esm/plugins/panel/toolbar.js +9 -7
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +1 -6
- package/dist/esm/plugins/rank.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/index.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/pm-plugins/keymaps.js +104 -90
- package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +4 -2
- package/dist/esm/plugins/undo-redo/index.js +6 -16
- package/dist/esm/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +56 -74
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/annotation/pm-plugins/types.d.ts +1 -0
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/insert-block/types.d.ts +3 -1
- package/dist/types/plugins/layout/actions.d.ts +2 -1
- package/dist/types/plugins/layout/index.d.ts +4 -0
- package/dist/types/plugins/panel/index.d.ts +2 -2
- package/dist/types/plugins/panel/toolbar.d.ts +5 -3
- package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +0 -1
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +7 -4
- package/dist/types/plugins/tasks-and-decisions/types.d.ts +5 -1
- package/dist/types/plugins/undo-redo/types.d.ts +2 -1
- package/dist/types/plugins/undo-redo/ui/ToolbarUndoRedo/index.d.ts +2 -6
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +3 -1
- package/dist/types-ts4.5/plugins/layout/actions.d.ts +2 -1
- package/dist/types-ts4.5/plugins/layout/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/panel/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +5 -3
- package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +0 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/keymaps.d.ts +7 -4
- package/dist/types-ts4.5/plugins/tasks-and-decisions/types.d.ts +3 -1
- package/dist/types-ts4.5/plugins/undo-redo/types.d.ts +3 -1
- package/dist/types-ts4.5/plugins/undo-redo/ui/ToolbarUndoRedo/index.d.ts +2 -6
- package/package.json +8 -3
- package/dist/cjs/plugins/history/actions.js +0 -10
- package/dist/cjs/plugins/history/index.js +0 -75
- package/dist/cjs/plugins/history/pm-history-types.js +0 -5
- package/dist/cjs/plugins/history/reducer.js +0 -18
- package/dist/cjs/plugins/history/types.js +0 -5
- package/dist/cjs/plugins/history/utils.js +0 -19
- package/dist/es2019/plugins/history/actions.js +0 -4
- package/dist/es2019/plugins/history/index.js +0 -61
- package/dist/es2019/plugins/history/pm-history-types.js +0 -1
- package/dist/es2019/plugins/history/reducer.js +0 -12
- package/dist/es2019/plugins/history/types.js +0 -1
- package/dist/es2019/plugins/history/utils.js +0 -11
- package/dist/esm/plugins/history/actions.js +0 -4
- package/dist/esm/plugins/history/index.js +0 -68
- package/dist/esm/plugins/history/pm-history-types.js +0 -1
- package/dist/esm/plugins/history/reducer.js +0 -12
- package/dist/esm/plugins/history/types.js +0 -1
- package/dist/esm/plugins/history/utils.js +0 -13
- package/dist/types/plugins/history/actions.d.ts +0 -8
- package/dist/types/plugins/history/index.d.ts +0 -13
- package/dist/types/plugins/history/pm-history-types.d.ts +0 -17
- package/dist/types/plugins/history/reducer.d.ts +0 -4
- package/dist/types/plugins/history/types.d.ts +0 -4
- package/dist/types/plugins/history/utils.d.ts +0 -4
- package/dist/types-ts4.5/plugins/history/actions.d.ts +0 -8
- package/dist/types-ts4.5/plugins/history/index.d.ts +0 -13
- package/dist/types-ts4.5/plugins/history/pm-history-types.d.ts +0 -17
- package/dist/types-ts4.5/plugins/history/reducer.d.ts +0 -4
- package/dist/types-ts4.5/plugins/history/types.d.ts +0 -4
- package/dist/types-ts4.5/plugins/history/utils.d.ts +0 -4
|
@@ -1,166 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import CommentIcon from '@atlaskit/icon/glyph/comment';
|
|
3
|
-
// AFP-2532 TODO: Fix automatic suppressions below
|
|
4
|
-
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
5
3
|
import { addInlineComment, ToolTipContent } from '../../keymaps';
|
|
6
4
|
import { setInlineCommentDraftState } from './commands';
|
|
7
5
|
import { AnnotationTestIds, AnnotationSelectionType } from './types';
|
|
8
6
|
import { isSelectionValid } from './utils';
|
|
9
7
|
import { annotationMessages } from '@atlaskit/editor-common/messages';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Returns the coordintes at the bottom the selection.
|
|
13
|
-
*/
|
|
14
|
-
const getCoordsBelowSelection = (bottomCoords, toolbarRect) => {
|
|
15
|
-
return {
|
|
16
|
-
top: (bottomCoords.top || 0) + toolbarRect.height / 1.15,
|
|
17
|
-
left: bottomCoords.right - toolbarRect.width / 2
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/*
|
|
22
|
-
Calculates the position of the floating toolbar relative to the selection.
|
|
23
|
-
|
|
24
|
-
This is a re-implementation which closely matches the behaviour on Confluence renderer.
|
|
25
|
-
The main difference is the popup is always above the selection.
|
|
26
|
-
|
|
27
|
-
Things to consider:
|
|
28
|
-
- popup is always above the selection
|
|
29
|
-
- coordinates of head X and getBoundingClientRect() are absolute in client viewport (not including scroll offsets)
|
|
30
|
-
- popup may appear in '.fabric-editor-popup-scroll-parent' (or body)
|
|
31
|
-
- we use the toolbarRect to center align toolbar
|
|
32
|
-
- use wrapperBounds to clamp values
|
|
33
|
-
- editorView.dom bounds differ to wrapperBounds, convert at the end
|
|
34
|
-
*/
|
|
35
|
-
const calculateToolbarPositionAboveSelection = toolbarTitle => (editorView, nextPos) => {
|
|
36
|
-
const toolbar = document.querySelector(`div[aria-label="${toolbarTitle}"]`);
|
|
37
|
-
if (!toolbar) {
|
|
38
|
-
return nextPos;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// scroll wrapper for full page, fall back to document body
|
|
42
|
-
// TODO: look into using getScrollGutterOptions()
|
|
43
|
-
const scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
|
|
44
|
-
const wrapperBounds = scrollWrapper.getBoundingClientRect();
|
|
45
|
-
const selection = window && window.getSelection();
|
|
46
|
-
const range = selection && !selection.isCollapsed && selection.getRangeAt(0);
|
|
47
|
-
if (!range) {
|
|
48
|
-
return nextPos;
|
|
49
|
-
}
|
|
50
|
-
const toolbarRect = toolbar.getBoundingClientRect();
|
|
51
|
-
const {
|
|
52
|
-
head,
|
|
53
|
-
anchor
|
|
54
|
-
} = editorView.state.selection;
|
|
55
|
-
const topCoords = editorView.coordsAtPos(Math.min(head, anchor));
|
|
56
|
-
const bottomCoords = editorView.coordsAtPos(Math.max(head, anchor) - Math.min(range.endOffset, 1));
|
|
57
|
-
let top = (topCoords.top || 0) - toolbarRect.height * 1.5;
|
|
58
|
-
let left = 0;
|
|
59
|
-
|
|
60
|
-
// If not on the same line
|
|
61
|
-
if (topCoords.top !== bottomCoords.top) {
|
|
62
|
-
// selecting downwards
|
|
63
|
-
if (head > anchor) {
|
|
64
|
-
left = Math.max(topCoords.right, bottomCoords.right);
|
|
65
|
-
} else {
|
|
66
|
-
left = Math.min(topCoords.left, bottomCoords.left);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/*
|
|
70
|
-
short selection above a long paragraph
|
|
71
|
-
eg. short {<}heading
|
|
72
|
-
The purpose of this text is to show the selection range{>}.
|
|
73
|
-
The horizontal positioning should center around "heading",
|
|
74
|
-
not where it ends at "range".
|
|
75
|
-
Note: if it was "head<b>ing</b>" then it would only center
|
|
76
|
-
around "head". Undesireable but matches the current renderer.
|
|
77
|
-
*/
|
|
78
|
-
const cliffPosition = range.getClientRects()[0];
|
|
79
|
-
if (cliffPosition.right < left) {
|
|
80
|
-
left = cliffPosition.left + cliffPosition.width / 2;
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
// Otherwise center on the single line selection
|
|
84
|
-
left = topCoords.left + (bottomCoords.right - topCoords.left) / 2;
|
|
85
|
-
}
|
|
86
|
-
left -= toolbarRect.width / 2;
|
|
87
|
-
|
|
88
|
-
// Place toolbar below selection if not sufficient space above
|
|
89
|
-
if (top < wrapperBounds.top) {
|
|
90
|
-
({
|
|
91
|
-
top,
|
|
92
|
-
left
|
|
93
|
-
} = getCoordsBelowSelection(bottomCoords, toolbarRect));
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// remap positions from browser document to wrapperBounds
|
|
97
|
-
return {
|
|
98
|
-
top: top - wrapperBounds.top + scrollWrapper.scrollTop,
|
|
99
|
-
left: Math.max(0, left - wrapperBounds.left)
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
/*
|
|
104
|
-
Calculates the position of the floating toolbar relative to the selection.
|
|
105
|
-
|
|
106
|
-
This is a re-implementation which closely matches the behaviour on Confluence renderer.
|
|
107
|
-
The main difference is the popup is always above the selection.
|
|
108
|
-
|
|
109
|
-
Things to consider:
|
|
110
|
-
- stick as close to the head X release coordinates as possible
|
|
111
|
-
- coordinates of head X and getBoundingClientRect() are absolute in client viewport (not including scroll offsets)
|
|
112
|
-
- popup may appear in '.fabric-editor-popup-scroll-parent' (or body)
|
|
113
|
-
- we use the toolbarRect to center align toolbar
|
|
114
|
-
- use wrapperBounds to clamp values
|
|
115
|
-
- editorView.dom bounds differ to wrapperBounds, convert at the end
|
|
116
|
-
*/
|
|
117
|
-
const calculateToolbarPositionTrackHead = toolbarTitle => (editorView, nextPos) => {
|
|
118
|
-
const toolbar = document.querySelector(`div[aria-label="${toolbarTitle}"]`);
|
|
119
|
-
if (!toolbar) {
|
|
120
|
-
return nextPos;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// scroll wrapper for full page, fall back to document body
|
|
124
|
-
// TODO: look into using getScrollGutterOptions()
|
|
125
|
-
const scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
|
|
126
|
-
const wrapperBounds = scrollWrapper.getBoundingClientRect();
|
|
127
|
-
const selection = window && window.getSelection();
|
|
128
|
-
const range = selection && !selection.isCollapsed && selection.getRangeAt(0);
|
|
129
|
-
if (!range) {
|
|
130
|
-
return nextPos;
|
|
131
|
-
}
|
|
132
|
-
const toolbarRect = toolbar.getBoundingClientRect();
|
|
133
|
-
const {
|
|
134
|
-
head,
|
|
135
|
-
anchor
|
|
136
|
-
} = editorView.state.selection;
|
|
137
|
-
let topCoords = editorView.coordsAtPos(Math.min(head, anchor));
|
|
138
|
-
let bottomCoords = editorView.coordsAtPos(Math.max(head, anchor) - Math.min(range.endOffset, 1));
|
|
139
|
-
let top;
|
|
140
|
-
// If not the same line, display toolbar below.
|
|
141
|
-
if (head > anchor && topCoords.top !== bottomCoords.top) {
|
|
142
|
-
// We are taking the previous pos to the maxium, so avoid end of line positions
|
|
143
|
-
// returning the next line's rect.
|
|
144
|
-
top = (bottomCoords.top || 0) + toolbarRect.height / 1.15;
|
|
145
|
-
} else {
|
|
146
|
-
top = (topCoords.top || 0) - toolbarRect.height * 1.5;
|
|
147
|
-
}
|
|
148
|
-
let left = (head > anchor ? bottomCoords.right : topCoords.left) - toolbarRect.width / 2;
|
|
149
|
-
|
|
150
|
-
// Place toolbar below selection if not sufficient space above
|
|
151
|
-
if (top < wrapperBounds.top) {
|
|
152
|
-
({
|
|
153
|
-
top,
|
|
154
|
-
left
|
|
155
|
-
} = getCoordsBelowSelection(bottomCoords, toolbarRect));
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// remap positions from browser document to wrapperBounds
|
|
159
|
-
return {
|
|
160
|
-
top: top - wrapperBounds.top + scrollWrapper.scrollTop,
|
|
161
|
-
left: Math.max(0, left - wrapperBounds.left)
|
|
162
|
-
};
|
|
163
|
-
};
|
|
8
|
+
import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
|
|
164
9
|
export const buildToolbar = (state, intl, isToolbarAbove = false) => {
|
|
165
10
|
const {
|
|
166
11
|
schema
|
|
@@ -24,7 +24,6 @@ export { default as annotationPlugin } from './annotation';
|
|
|
24
24
|
export { default as analyticsPlugin } from './analytics';
|
|
25
25
|
export { default as customAutoformatPlugin } from './custom-autoformat';
|
|
26
26
|
export { default as feedbackDialogPlugin } from './feedback-dialog';
|
|
27
|
-
export { default as historyPlugin } from './history';
|
|
28
27
|
export { default as expandPlugin, isExpandInsertionEnabled } from './expand';
|
|
29
28
|
export { default as mobileDimensionsPlugin } from './mobile-dimensions';
|
|
30
29
|
export { default as findReplacePlugin } from './find-replace';
|
|
@@ -10,7 +10,6 @@ import ToolbarButton from '../../../../ui/ToolbarButton';
|
|
|
10
10
|
import { separatorStyles, buttonGroupStyle, wrapperStyle } from '@atlaskit/editor-common/styles';
|
|
11
11
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
12
12
|
import { showPlaceholderFloatingToolbar } from '../../../placeholder-text/actions';
|
|
13
|
-
import { insertLayoutColumnsWithAnalytics } from '../../../layout/actions';
|
|
14
13
|
import { insertTaskDecisionCommand } from '../../../tasks-and-decisions/commands';
|
|
15
14
|
import { insertExpand } from '../../../expand/commands';
|
|
16
15
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -206,10 +205,12 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
206
205
|
return true;
|
|
207
206
|
});
|
|
208
207
|
_defineProperty(this, "insertLayoutColumns", inputMethod => {
|
|
208
|
+
var _pluginInjectionApi$l;
|
|
209
209
|
const {
|
|
210
|
-
editorView
|
|
210
|
+
editorView,
|
|
211
|
+
pluginInjectionApi
|
|
211
212
|
} = this.props;
|
|
212
|
-
|
|
213
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$l = pluginInjectionApi.layout) === null || _pluginInjectionApi$l === void 0 ? void 0 : _pluginInjectionApi$l.actions.insertLayoutColumns(inputMethod)(editorView.state, editorView.dispatch);
|
|
213
214
|
return true;
|
|
214
215
|
});
|
|
215
216
|
_defineProperty(this, "createStatus", inputMethod => {
|
|
@@ -3,8 +3,9 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
3
3
|
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import { flatmap, mapChildren } from '../../utils/slice';
|
|
5
5
|
import { getStepRange, isEmptyDocument } from '@atlaskit/editor-common/utils';
|
|
6
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '
|
|
7
|
-
import { addAnalytics
|
|
6
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
7
|
+
import { addAnalytics } from '../analytics/utils';
|
|
8
|
+
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
8
9
|
import { LAYOUT_TYPE } from '../analytics/types/node-events';
|
|
9
10
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
10
11
|
export const ONE_COL_LAYOUTS = ['single'];
|
|
@@ -75,7 +76,7 @@ export const insertLayoutColumns = (state, dispatch) => {
|
|
|
75
76
|
}
|
|
76
77
|
return true;
|
|
77
78
|
};
|
|
78
|
-
export const insertLayoutColumnsWithAnalytics = inputMethod => withAnalytics({
|
|
79
|
+
export const insertLayoutColumnsWithAnalytics = editorAnalyticsAPI => inputMethod => withAnalytics(editorAnalyticsAPI, {
|
|
79
80
|
action: ACTION.INSERTED,
|
|
80
81
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
81
82
|
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { layoutColumn, layoutSection } from '@atlaskit/adf-schema';
|
|
3
3
|
import { default as createLayoutPlugin } from './pm-plugins/main';
|
|
4
4
|
import { buildToolbar } from './toolbar';
|
|
5
|
-
import { createDefaultLayoutSection } from './actions';
|
|
5
|
+
import { createDefaultLayoutSection, insertLayoutColumnsWithAnalytics } from './actions';
|
|
6
6
|
import { IconLayout } from '@atlaskit/editor-common/quick-insert';
|
|
7
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
@@ -11,61 +11,67 @@ export { pluginKey };
|
|
|
11
11
|
const layoutPlugin = ({
|
|
12
12
|
config: options = {},
|
|
13
13
|
api
|
|
14
|
-
}) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return [{
|
|
27
|
-
name: 'layout',
|
|
28
|
-
plugin: () => createLayoutPlugin(options)
|
|
29
|
-
}];
|
|
30
|
-
},
|
|
31
|
-
pluginsOptions: {
|
|
32
|
-
floatingToolbar(state, intl) {
|
|
33
|
-
const {
|
|
34
|
-
pos,
|
|
35
|
-
allowBreakout,
|
|
36
|
-
addSidebarLayouts,
|
|
37
|
-
allowSingleColumnLayout
|
|
38
|
-
} = pluginKey.getState(state);
|
|
39
|
-
if (pos !== null) {
|
|
40
|
-
var _api$decorations$acti;
|
|
41
|
-
return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api === null || api === void 0 ? void 0 : (_api$decorations$acti = api.decorations.actions) === null || _api$decorations$acti === void 0 ? void 0 : _api$decorations$acti.hoverDecoration);
|
|
42
|
-
}
|
|
43
|
-
return undefined;
|
|
14
|
+
}) => {
|
|
15
|
+
var _api$analytics;
|
|
16
|
+
return {
|
|
17
|
+
name: 'layout',
|
|
18
|
+
nodes() {
|
|
19
|
+
return [{
|
|
20
|
+
name: 'layoutSection',
|
|
21
|
+
node: layoutSection
|
|
22
|
+
}, {
|
|
23
|
+
name: 'layoutColumn',
|
|
24
|
+
node: layoutColumn
|
|
25
|
+
}];
|
|
44
26
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
return
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
})
|
|
27
|
+
pmPlugins() {
|
|
28
|
+
return [{
|
|
29
|
+
name: 'layout',
|
|
30
|
+
plugin: () => createLayoutPlugin(options)
|
|
31
|
+
}];
|
|
32
|
+
},
|
|
33
|
+
actions: {
|
|
34
|
+
insertLayoutColumns: insertLayoutColumnsWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
|
|
35
|
+
},
|
|
36
|
+
pluginsOptions: {
|
|
37
|
+
floatingToolbar(state, intl) {
|
|
38
|
+
const {
|
|
39
|
+
pos,
|
|
40
|
+
allowBreakout,
|
|
41
|
+
addSidebarLayouts,
|
|
42
|
+
allowSingleColumnLayout
|
|
43
|
+
} = pluginKey.getState(state);
|
|
44
|
+
if (pos !== null) {
|
|
45
|
+
var _api$decorations$acti;
|
|
46
|
+
return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api === null || api === void 0 ? void 0 : (_api$decorations$acti = api.decorations.actions) === null || _api$decorations$acti === void 0 ? void 0 : _api$decorations$acti.hoverDecoration);
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
49
|
+
},
|
|
50
|
+
quickInsert: ({
|
|
51
|
+
formatMessage
|
|
52
|
+
}) => [{
|
|
53
|
+
id: 'layout',
|
|
54
|
+
title: formatMessage(messages.columns),
|
|
55
|
+
description: formatMessage(messages.columnsDescription),
|
|
56
|
+
keywords: ['column', 'section'],
|
|
57
|
+
priority: 1100,
|
|
58
|
+
icon: () => /*#__PURE__*/React.createElement(IconLayout, null),
|
|
59
|
+
action(insert, state) {
|
|
60
|
+
var _api$analytics2, _api$analytics2$actio;
|
|
61
|
+
const tr = insert(createDefaultLayoutSection(state));
|
|
62
|
+
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : (_api$analytics2$actio = _api$analytics2.actions) === null || _api$analytics2$actio === void 0 ? void 0 : _api$analytics2$actio.attachAnalyticsEvent({
|
|
63
|
+
action: ACTION.INSERTED,
|
|
64
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
65
|
+
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
66
|
+
attributes: {
|
|
67
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
68
|
+
},
|
|
69
|
+
eventType: EVENT_TYPE.TRACK
|
|
70
|
+
})(tr);
|
|
71
|
+
return tr;
|
|
72
|
+
}
|
|
73
|
+
}]
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
};
|
|
71
77
|
export default layoutPlugin;
|
|
@@ -142,7 +142,7 @@ const panelPlugin = ({
|
|
|
142
142
|
}
|
|
143
143
|
return quickInsertOptions;
|
|
144
144
|
},
|
|
145
|
-
floatingToolbar: (state, intl, providerFactory) => getToolbarConfig(state, intl, options, providerFactory, api
|
|
145
|
+
floatingToolbar: (state, intl, providerFactory) => getToolbarConfig(state, intl, options, providerFactory, api)
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
148
|
|
|
@@ -13,7 +13,8 @@ import { findPanel } from './utils';
|
|
|
13
13
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
14
14
|
import { DEFAULT_BORDER_COLOR } from '@atlaskit/editor-common/ui-color';
|
|
15
15
|
import { PanelType } from '@atlaskit/adf-schema';
|
|
16
|
-
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID
|
|
16
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
17
|
+
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
17
18
|
import { messages } from './message';
|
|
18
19
|
export const panelIconMap = {
|
|
19
20
|
[PanelType.INFO]: {
|
|
@@ -41,7 +42,7 @@ export const panelIconMap = {
|
|
|
41
42
|
id: 'atlassian-tip'
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
|
-
export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, hoverDecoration, activePanelType, activePanelColor, activePanelIcon, state) => {
|
|
45
|
+
export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, hoverDecoration, editorAnalyticsAPI, activePanelType, activePanelColor, activePanelIcon, state) => {
|
|
45
46
|
// TODO: ED-14403 investigate why these titles are not getting translated for the tooltips
|
|
46
47
|
const items = [{
|
|
47
48
|
id: 'editor.panel.info',
|
|
@@ -114,7 +115,7 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
|
|
|
114
115
|
},
|
|
115
116
|
eventType: EVENT_TYPE.TRACK
|
|
116
117
|
};
|
|
117
|
-
withAnalytics(payload)(changePanelType(PanelType.CUSTOM, {
|
|
118
|
+
withAnalytics(editorAnalyticsAPI, payload)(changePanelType(PanelType.CUSTOM, {
|
|
118
119
|
color,
|
|
119
120
|
...previousEmoji
|
|
120
121
|
}, isCustomPanelEnabled))(state, dispatch);
|
|
@@ -144,7 +145,7 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
|
|
|
144
145
|
},
|
|
145
146
|
eventType: EVENT_TYPE.TRACK
|
|
146
147
|
};
|
|
147
|
-
withAnalytics(payload)(changePanelType(PanelType.CUSTOM, {
|
|
148
|
+
withAnalytics(editorAnalyticsAPI, payload)(changePanelType(PanelType.CUSTOM, {
|
|
148
149
|
emoji: emoji.shortName,
|
|
149
150
|
emojiId: emoji.id,
|
|
150
151
|
emojiText: emoji.fallback
|
|
@@ -168,7 +169,7 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
|
|
|
168
169
|
},
|
|
169
170
|
eventType: EVENT_TYPE.TRACK
|
|
170
171
|
};
|
|
171
|
-
withAnalytics(payload)(changePanelType(PanelType.CUSTOM, {
|
|
172
|
+
withAnalytics(editorAnalyticsAPI, payload)(changePanelType(PanelType.CUSTOM, {
|
|
172
173
|
emoji: undefined,
|
|
173
174
|
emojiId: undefined,
|
|
174
175
|
emojiText: undefined
|
|
@@ -243,12 +244,13 @@ export const getToolbarItems = (formatMessage, panelNodeType, isCustomPanelEnabl
|
|
|
243
244
|
});
|
|
244
245
|
return items;
|
|
245
246
|
};
|
|
246
|
-
export const getToolbarConfig = (state, intl, options = {}, providerFactory,
|
|
247
|
+
export const getToolbarConfig = (state, intl, options = {}, providerFactory, api) => {
|
|
247
248
|
const {
|
|
248
249
|
formatMessage
|
|
249
250
|
} = intl;
|
|
250
251
|
const panelObject = findPanel(state);
|
|
251
252
|
if (panelObject) {
|
|
253
|
+
var _api$analytics;
|
|
252
254
|
const nodeType = state.schema.nodes.panel;
|
|
253
255
|
const {
|
|
254
256
|
panelType,
|
|
@@ -260,7 +262,7 @@ export const getToolbarConfig = (state, intl, options = {}, providerFactory, hov
|
|
|
260
262
|
};
|
|
261
263
|
|
|
262
264
|
// force toolbar to be turned on
|
|
263
|
-
const items = getToolbarItems(formatMessage, nodeType, options.allowCustomPanel || false, options.allowCustomPanel && options.allowCustomPanelEdit || false, providerFactory, hoverDecoration, panelType, options.allowCustomPanel ? panelColor : undefined, options.allowCustomPanel ? panelIcon || isStandardPanel(panelType) : undefined, state);
|
|
265
|
+
const items = getToolbarItems(formatMessage, nodeType, options.allowCustomPanel || false, options.allowCustomPanel && options.allowCustomPanelEdit || false, providerFactory, api === null || api === void 0 ? void 0 : api.decorations.actions.hoverDecoration, api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, panelType, options.allowCustomPanel ? panelColor : undefined, options.allowCustomPanel ? panelIcon || isStandardPanel(panelType) : undefined, state);
|
|
264
266
|
const getDomRef = editorView => {
|
|
265
267
|
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
266
268
|
const element = findDomRefAtPos(panelObject.pos, domAtPos);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, PasteTypes, PasteContents
|
|
1
|
+
import { ACTION, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT, ACTION_SUBJECT_ID, addAnalytics, PasteTypes, PasteContents } from '../../analytics';
|
|
2
2
|
import { getPasteSource } from '../util';
|
|
3
3
|
import { handlePasteAsPlainText, handlePasteIntoTaskOrDecisionOrPanel, handleCodeBlock, handleMediaSingle, handlePastePreservingMarks, handleMarkdown, handleRichText, handleExpandPasteInTable, handleSelectedTable, handlePasteLinkOnSelectedText, handlePasteIntoCaption, handlePastePanelOrDecisionContentIntoList, handlePasteNonNestableBlockNodesIntoList } from '../handlers';
|
|
4
4
|
import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
|
|
@@ -219,9 +219,6 @@ export function sendPasteAnalyticsEvent(view, event, slice, pasteContext) {
|
|
|
219
219
|
const payload = createPasteAnalyticsPayload(view, event, slice, pasteContext);
|
|
220
220
|
view.dispatch(addAnalytics(view.state, view.state.tr, payload));
|
|
221
221
|
}
|
|
222
|
-
export function pasteCommandWithAnalytics(view, event, slice, pasteContext) {
|
|
223
|
-
return withAnalytics(() => createPasteAnalyticsPayload(view, event, slice, pasteContext));
|
|
224
|
-
}
|
|
225
222
|
export const handlePasteAsPlainTextWithAnalytics = (view, event, slice) => injectAnalyticsPayloadBeforeCommand(createPasteAnalyticsPayloadBySelection(event, slice, {
|
|
226
223
|
type: PasteTypes.plain,
|
|
227
224
|
asPlain: true
|
|
@@ -13,7 +13,7 @@ export default {
|
|
|
13
13
|
'mediaKeymap',
|
|
14
14
|
// selection keymap needs to be above gap cursor keymap so it can set node selections from
|
|
15
15
|
// left/right arrows
|
|
16
|
-
'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
|
|
16
|
+
'selectionKeymap', 'gapCursorKeymap', 'gapCursor', 'syncUrlText', 'fakeCursorToolbarPlugin', 'hyperLink', 'table', 'tableDecorations', 'hyperlinkInputRule', 'tablePMColResizing', 'hyperlinkKeymap', 'tableColResizing', 'undoRedoKeyMap', 'blockTypeKeyMap', 'tableEditing', 'filterStepsPlugin', 'pmCollab', 'collab', 'ruleInputRule', 'ruleKeymap', 'panel', 'media', 'mediaSingleKeymap', 'mediaEditor', 'unsupportedContent', 'jiraIssue', 'fakeTextCursor', 'helpDialog', 'helpDialogKeymap', 'macro', 'expand', 'extension', 'layout', 'contextPanel', 'selectionToolbar', 'floatingToolbar', 'clearMarksOnChange', 'reactNodeView', 'history', 'undoRedoPlugin', 'codeBlockIndent', 'placeholder', 'width', 'maxContentSize', 'multilineContent', 'grid', 'mobileDimensions', 'scrollGutterPlugin', 'analytics', 'findReplace', 'selection', 'avatarGroup', 'viewUpdateSubscription', 'beforePrimaryToolbar', 'inlineCode'],
|
|
17
17
|
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'rule', 'panel', 'mention', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'unsupportedBlock', 'unsupportedInline', 'confluenceJiraIssue', 'hardBreak', 'emoji', 'placeholder', 'mediaSingle', 'mediaGroup', 'table', 'expand', 'nestedExpand', 'media', 'tableHeader', 'decisionList', 'tableRow', 'decisionItem', 'tableCell', 'taskList', 'taskItem', 'extension', 'bodiedExtension', 'inlineExtension', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard'],
|
|
18
18
|
marks: [
|
|
19
19
|
// Fragment mark is both for inline and block elements
|
|
@@ -72,7 +72,7 @@ const tasksAndDecisionsPlugin = ({
|
|
|
72
72
|
name: 'tasksAndDecisionsKeyMap',
|
|
73
73
|
plugin: ({
|
|
74
74
|
schema
|
|
75
|
-
}) => keymap(schema, allowNestedTasks, consumeTabs)
|
|
75
|
+
}) => keymap(schema, api, allowNestedTasks, consumeTabs)
|
|
76
76
|
} // Needs to be after "save-on-enter"
|
|
77
77
|
];
|
|
78
78
|
},
|
|
@@ -6,7 +6,8 @@ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
|
6
6
|
import { findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
7
7
|
import { uuid } from '@atlaskit/adf-schema';
|
|
8
8
|
import { filterCommand as filter, isEmptySelectionAtStart, isEmptySelectionAtEnd, deleteEmptyParagraphAndMoveBlockUp } from '@atlaskit/editor-common/utils';
|
|
9
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD
|
|
9
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INDENT_DIRECTION, INDENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
10
|
+
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
10
11
|
import { insertTaskDecisionWithAnalytics } from '../commands';
|
|
11
12
|
import { joinAtCut, liftSelection, wrapSelectionInTaskList } from './commands';
|
|
12
13
|
import { getBlockRange, getCurrentIndentLevel, isActionOrDecisionItem, isActionOrDecisionList, isEmptyTaskDecision, isInsideTask, isInsideTaskOrDecisionItem, liftBlock, walkOut, getTaskItemIndex, isInsideDecision, isTable } from './helpers';
|
|
@@ -82,13 +83,13 @@ const joinTaskDecisionFollowing = (state, dispatch) => {
|
|
|
82
83
|
}
|
|
83
84
|
return false;
|
|
84
85
|
};
|
|
85
|
-
export const getUnindentCommand = (inputMethod = INPUT_METHOD.KEYBOARD) => filter(isInsideTask, (state, dispatch) => {
|
|
86
|
+
export const getUnindentCommand = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.KEYBOARD) => filter(isInsideTask, (state, dispatch) => {
|
|
86
87
|
const normalizedSelection = normalizeTaskItemsSelection(state.selection);
|
|
87
88
|
const curIndentLevel = getCurrentIndentLevel(normalizedSelection);
|
|
88
89
|
if (!curIndentLevel || curIndentLevel === 1) {
|
|
89
90
|
return false;
|
|
90
91
|
}
|
|
91
|
-
return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.OUTDENT, inputMethod))(autoJoin(liftSelection, ['taskList']))(state, dispatch);
|
|
92
|
+
return withAnalytics(editorAnalyticsAPI, indentationAnalytics(curIndentLevel, INDENT_DIRECTION.OUTDENT, inputMethod))(autoJoin(liftSelection, ['taskList']))(state, dispatch);
|
|
92
93
|
});
|
|
93
94
|
|
|
94
95
|
// if selection is decision item or first action item in table cell
|
|
@@ -106,15 +107,15 @@ const shouldLetTabThroughInTable = state => {
|
|
|
106
107
|
}
|
|
107
108
|
return false;
|
|
108
109
|
};
|
|
109
|
-
export const getIndentCommand = (inputMethod = INPUT_METHOD.KEYBOARD) => filter(isInsideTask, (state, dispatch) => {
|
|
110
|
+
export const getIndentCommand = editorAnalyticsAPI => (inputMethod = INPUT_METHOD.KEYBOARD) => filter(isInsideTask, (state, dispatch) => {
|
|
110
111
|
const normalizedSelection = normalizeTaskItemsSelection(state.selection);
|
|
111
112
|
const curIndentLevel = getCurrentIndentLevel(normalizedSelection);
|
|
112
113
|
if (!curIndentLevel || curIndentLevel >= 6) {
|
|
113
114
|
return true;
|
|
114
115
|
}
|
|
115
|
-
return withAnalytics(indentationAnalytics(curIndentLevel, INDENT_DIRECTION.INDENT, inputMethod))(autoJoin(wrapSelectionInTaskList, ['taskList']))(state, dispatch);
|
|
116
|
+
return withAnalytics(editorAnalyticsAPI, indentationAnalytics(curIndentLevel, INDENT_DIRECTION.INDENT, inputMethod))(autoJoin(wrapSelectionInTaskList, ['taskList']))(state, dispatch);
|
|
116
117
|
});
|
|
117
|
-
const backspaceFrom = $from => (state, dispatch) => {
|
|
118
|
+
const backspaceFrom = editorAnalyticsAPI => $from => (state, dispatch) => {
|
|
118
119
|
// previous was empty, just delete backwards
|
|
119
120
|
const taskBefore = $from.doc.resolve($from.before());
|
|
120
121
|
if (taskBefore.nodeBefore && isActionOrDecisionItem(taskBefore.nodeBefore) && taskBefore.nodeBefore.nodeSize === 2) {
|
|
@@ -127,7 +128,7 @@ const backspaceFrom = $from => (state, dispatch) => {
|
|
|
127
128
|
paragraph
|
|
128
129
|
} = state.schema.nodes;
|
|
129
130
|
if ($from.node($from.depth - 2).type === taskList) {
|
|
130
|
-
return getUnindentCommand()(state, dispatch);
|
|
131
|
+
return getUnindentCommand(editorAnalyticsAPI)()(state, dispatch);
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
// bottom level, should "unwrap" taskItem contents into paragraph
|
|
@@ -144,7 +145,7 @@ const backspaceFrom = $from => (state, dispatch) => {
|
|
|
144
145
|
}
|
|
145
146
|
return false;
|
|
146
147
|
};
|
|
147
|
-
const backspace = filter(isEmptySelectionAtStart, autoJoin(chainCommands((state, dispatch) => joinAtCut(state.selection.$from)(state, dispatch), filter(isInsideTaskOrDecisionItem, (state, dispatch) => backspaceFrom(state.selection.$from)(state, dispatch))), ['taskList', 'decisionList']));
|
|
148
|
+
const backspace = editorAnalyticsAPI => filter(isEmptySelectionAtStart, autoJoin(chainCommands((state, dispatch) => joinAtCut(state.selection.$from)(state, dispatch), filter(isInsideTaskOrDecisionItem, (state, dispatch) => backspaceFrom(editorAnalyticsAPI)(state.selection.$from)(state, dispatch))), ['taskList', 'decisionList']));
|
|
148
149
|
const unindentTaskOrUnwrapTaskDecisionFollowing = (state, dispatch) => {
|
|
149
150
|
const {
|
|
150
151
|
selection: {
|
|
@@ -271,7 +272,7 @@ const splitListItem = (state, dispatch) => {
|
|
|
271
272
|
}
|
|
272
273
|
return false;
|
|
273
274
|
};
|
|
274
|
-
const enter = filter(isInsideTaskOrDecisionItem, chainCommands(filter(isEmptyTaskDecision, chainCommands(getUnindentCommand(), splitListItem)), (state, dispatch) => {
|
|
275
|
+
const enter = editorAnalyticsAPI => filter(isInsideTaskOrDecisionItem, chainCommands(filter(isEmptyTaskDecision, chainCommands(getUnindentCommand(editorAnalyticsAPI)(), splitListItem)), (state, dispatch) => {
|
|
275
276
|
const {
|
|
276
277
|
selection,
|
|
277
278
|
schema
|
|
@@ -340,20 +341,27 @@ const cmdOptEnter = filter(isInsideTaskOrDecisionItem, (state, dispatch) => {
|
|
|
340
341
|
}
|
|
341
342
|
return true;
|
|
342
343
|
});
|
|
343
|
-
export function keymapPlugin(schema, allowNestedTasks, consumeTabs) {
|
|
344
|
+
export function keymapPlugin(schema, api, allowNestedTasks, consumeTabs) {
|
|
345
|
+
var _api$analytics3, _api$analytics4;
|
|
344
346
|
const indentHandlers = {
|
|
345
|
-
'Shift-Tab': filter([isInsideTaskOrDecisionItem, state => !shouldLetTabThroughInTable(state)], (state, dispatch) =>
|
|
346
|
-
|
|
347
|
+
'Shift-Tab': filter([isInsideTaskOrDecisionItem, state => !shouldLetTabThroughInTable(state)], (state, dispatch) => {
|
|
348
|
+
var _api$analytics;
|
|
349
|
+
return getUnindentCommand(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
|
|
350
|
+
}),
|
|
351
|
+
Tab: filter([isInsideTaskOrDecisionItem, state => !shouldLetTabThroughInTable(state)], (state, dispatch) => {
|
|
352
|
+
var _api$analytics2;
|
|
353
|
+
return getIndentCommand(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(INPUT_METHOD.KEYBOARD)(state, dispatch) || !!consumeTabs;
|
|
354
|
+
})
|
|
347
355
|
};
|
|
348
356
|
const defaultHandlers = consumeTabs ? {
|
|
349
357
|
'Shift-Tab': isInsideTaskOrDecisionItem,
|
|
350
358
|
Tab: isInsideTaskOrDecisionItem
|
|
351
359
|
} : {};
|
|
352
360
|
const keymaps = {
|
|
353
|
-
Backspace: backspace,
|
|
361
|
+
Backspace: backspace(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions),
|
|
354
362
|
Delete: deleteForwards,
|
|
355
363
|
'Ctrl-d': deleteForwards,
|
|
356
|
-
Enter: enter,
|
|
364
|
+
Enter: enter(api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions),
|
|
357
365
|
[toggleTaskItemCheckbox.common]: cmdOptEnter,
|
|
358
366
|
...(allowNestedTasks ? indentHandlers : defaultHandlers)
|
|
359
367
|
};
|
|
@@ -24,7 +24,8 @@ export const onItemActivated = pluginInjectionApi => ({
|
|
|
24
24
|
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
25
|
}
|
|
26
26
|
if (node === 'taskList') {
|
|
27
|
-
|
|
27
|
+
var _pluginInjectionApi$a;
|
|
28
|
+
indentTaskList(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);
|
|
28
29
|
}
|
|
29
30
|
break;
|
|
30
31
|
}
|
|
@@ -39,7 +40,8 @@ export const onItemActivated = pluginInjectionApi => ({
|
|
|
39
40
|
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));
|
|
40
41
|
}
|
|
41
42
|
if (node === 'taskList') {
|
|
42
|
-
|
|
43
|
+
var _pluginInjectionApi$a2;
|
|
44
|
+
outdentTaskList(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);
|
|
43
45
|
}
|
|
44
46
|
break;
|
|
45
47
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { keymapPlugin } from './pm-plugins/keymaps';
|
|
3
3
|
import { createPlugin } from './pm-plugins/main';
|
|
4
|
-
|
|
4
|
+
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
5
5
|
import ToolbarUndoRedo from './ui/ToolbarUndoRedo';
|
|
6
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
7
6
|
const undoRedoPlugin = ({
|
|
8
7
|
api
|
|
9
8
|
}) => ({
|
|
@@ -22,21 +21,11 @@ const undoRedoPlugin = ({
|
|
|
22
21
|
disabled,
|
|
23
22
|
isToolbarReducedSpacing
|
|
24
23
|
}) {
|
|
25
|
-
return /*#__PURE__*/React.createElement(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
historyState
|
|
31
|
-
}) => {
|
|
32
|
-
return /*#__PURE__*/React.createElement(ToolbarUndoRedo, {
|
|
33
|
-
isReducedSpacing: isToolbarReducedSpacing,
|
|
34
|
-
disabled: disabled,
|
|
35
|
-
historyState: historyState,
|
|
36
|
-
editorView: editorView,
|
|
37
|
-
api: api
|
|
38
|
-
});
|
|
39
|
-
}
|
|
24
|
+
return /*#__PURE__*/React.createElement(ToolbarUndoRedo, {
|
|
25
|
+
isReducedSpacing: isToolbarReducedSpacing,
|
|
26
|
+
disabled: disabled,
|
|
27
|
+
editorView: editorView,
|
|
28
|
+
api: api
|
|
40
29
|
});
|
|
41
30
|
}
|
|
42
31
|
});
|