@atlaskit/editor-core 188.12.0 → 188.12.2
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 +15 -0
- package/dist/cjs/labs/next/presets/universal.js +12 -1
- 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/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/plugins/media.js +50 -24
- package/dist/cjs/plugins/paste/pm-plugins/analytics.js +0 -6
- package/dist/cjs/plugins/paste/pm-plugins/main.js +1 -0
- 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/version-wrapper.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +12 -1
- 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/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/plugins/media.js +53 -25
- package/dist/es2019/plugins/paste/pm-plugins/analytics.js +1 -4
- package/dist/es2019/plugins/paste/pm-plugins/main.js +4 -5
- 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/version-wrapper.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +12 -1
- 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/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/plugins/media.js +50 -23
- package/dist/esm/plugins/paste/pm-plugins/analytics.js +1 -6
- package/dist/esm/plugins/paste/pm-plugins/main.js +4 -5
- 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/version-wrapper.js +1 -1
- package/dist/types/plugins/annotation/pm-plugins/types.d.ts +1 -0
- 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/plugins/media.d.ts +11 -0
- 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-ts4.5/plugins/annotation/pm-plugins/types.d.ts +1 -0
- 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/plugins/media.d.ts +11 -0
- 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/package.json +6 -2
|
@@ -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
|
}
|
|
@@ -24,6 +24,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
|
24
24
|
import { saveOnEnterPlugin } from '@atlaskit/editor-plugin-save-on-enter';
|
|
25
25
|
import { scrollIntoViewPlugin } from '@atlaskit/editor-plugin-scroll-into-view';
|
|
26
26
|
import { mentionsPlugin } from '@atlaskit/editor-plugin-mentions';
|
|
27
|
+
import { selectionToolbarPlugin } from '@atlaskit/editor-plugin-selection-toolbar';
|
|
27
28
|
import { isFullPage as fullPageCheck } from '../../../utils/is-full-page';
|
|
28
29
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
29
30
|
import { createDefaultPreset } from './default';
|
|
@@ -394,6 +395,16 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
394
395
|
return builder;
|
|
395
396
|
}).add([codeBidiWarningPlugin, {
|
|
396
397
|
appearance: appearance
|
|
397
|
-
}])
|
|
398
|
+
}])
|
|
399
|
+
/**
|
|
400
|
+
* Do not use this plugin - it is for AI purposes only.
|
|
401
|
+
*/.maybeAdd(selectionToolbarPlugin, function (plugin, builder) {
|
|
402
|
+
if (getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd')) {
|
|
403
|
+
return builder.add([plugin, {
|
|
404
|
+
preferenceToolbarAboveSelection: false
|
|
405
|
+
}]);
|
|
406
|
+
}
|
|
407
|
+
return builder;
|
|
408
|
+
});
|
|
398
409
|
return finalPreset;
|
|
399
410
|
}
|
|
@@ -7,6 +7,7 @@ import { getPluginState } from './utils';
|
|
|
7
7
|
import { buildToolbar } from './toolbar';
|
|
8
8
|
import { InlineCommentView } from './ui/InlineCommentView';
|
|
9
9
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
var annotationPlugin = function annotationPlugin(_ref) {
|
|
11
12
|
var annotationProviders = _ref.config,
|
|
12
13
|
api = _ref.api;
|
|
@@ -53,7 +54,17 @@ var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
53
54
|
},
|
|
54
55
|
pluginsOptions: {
|
|
55
56
|
floatingToolbar: function floatingToolbar(state, intl) {
|
|
56
|
-
if (!annotationProviders) {
|
|
57
|
+
if (getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd') || !annotationProviders) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
var pluginState = getPluginState(state);
|
|
61
|
+
if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
|
|
62
|
+
var isToolbarAbove = annotationProviders.inlineComment.isToolbarAbove;
|
|
63
|
+
return buildToolbar(state, intl, isToolbarAbove);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
selectionToolbar: function selectionToolbar(state, intl) {
|
|
67
|
+
if (!getBooleanFF('platform.editor.enable-selection-toolbar_ucdwd') || !annotationProviders) {
|
|
57
68
|
return;
|
|
58
69
|
}
|
|
59
70
|
var pluginState = getPluginState(state);
|
|
@@ -77,7 +77,8 @@ var initialState = function initialState() {
|
|
|
77
77
|
isSelecting: false
|
|
78
78
|
},
|
|
79
79
|
disallowOnWhitespace: disallowOnWhitespace,
|
|
80
|
-
isVisible: true
|
|
80
|
+
isVisible: true,
|
|
81
|
+
skipSelectionHandling: false
|
|
81
82
|
};
|
|
82
83
|
};
|
|
83
84
|
var hideToolbar = function hideToolbar(state, dispatch) {
|
|
@@ -13,6 +13,11 @@ var handleDocChanged = function handleDocChanged(tr, prevPluginState) {
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
var handleSelectionChanged = function handleSelectionChanged(tr, pluginState) {
|
|
16
|
+
if (pluginState.skipSelectionHandling) {
|
|
17
|
+
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
18
|
+
skipSelectionHandling: false
|
|
19
|
+
});
|
|
20
|
+
}
|
|
16
21
|
var selectedAnnotations = findAnnotationsInSelection(tr.selection, tr.doc);
|
|
17
22
|
var changed = selectedAnnotations.length !== pluginState.selectedAnnotations.length || selectedAnnotations.some(function (annotationInfo) {
|
|
18
23
|
return !pluginState.selectedAnnotations.some(function (aInfo) {
|
|
@@ -43,7 +43,8 @@ export default (function (pluginState, action) {
|
|
|
43
43
|
});
|
|
44
44
|
case ACTIONS.SET_SELECTED_ANNOTATION:
|
|
45
45
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
46
|
-
selectedAnnotations: _toConsumableArray(action.data.selectedAnnotations)
|
|
46
|
+
selectedAnnotations: _toConsumableArray(action.data.selectedAnnotations),
|
|
47
|
+
skipSelectionHandling: true
|
|
47
48
|
});
|
|
48
49
|
default:
|
|
49
50
|
return pluginState;
|
|
@@ -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
|
-
var getCoordsBelowSelection = function 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
|
-
var calculateToolbarPositionAboveSelection = function calculateToolbarPositionAboveSelection(toolbarTitle) {
|
|
36
|
-
return function (editorView, nextPos) {
|
|
37
|
-
var toolbar = document.querySelector("div[aria-label=\"".concat(toolbarTitle, "\"]"));
|
|
38
|
-
if (!toolbar) {
|
|
39
|
-
return nextPos;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// scroll wrapper for full page, fall back to document body
|
|
43
|
-
// TODO: look into using getScrollGutterOptions()
|
|
44
|
-
var scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
|
|
45
|
-
var wrapperBounds = scrollWrapper.getBoundingClientRect();
|
|
46
|
-
var selection = window && window.getSelection();
|
|
47
|
-
var range = selection && !selection.isCollapsed && selection.getRangeAt(0);
|
|
48
|
-
if (!range) {
|
|
49
|
-
return nextPos;
|
|
50
|
-
}
|
|
51
|
-
var toolbarRect = toolbar.getBoundingClientRect();
|
|
52
|
-
var _editorView$state$sel = editorView.state.selection,
|
|
53
|
-
head = _editorView$state$sel.head,
|
|
54
|
-
anchor = _editorView$state$sel.anchor;
|
|
55
|
-
var topCoords = editorView.coordsAtPos(Math.min(head, anchor));
|
|
56
|
-
var bottomCoords = editorView.coordsAtPos(Math.max(head, anchor) - Math.min(range.endOffset, 1));
|
|
57
|
-
var top = (topCoords.top || 0) - toolbarRect.height * 1.5;
|
|
58
|
-
var 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
|
-
var 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
|
-
var _getCoordsBelowSelect = getCoordsBelowSelection(bottomCoords, toolbarRect);
|
|
91
|
-
top = _getCoordsBelowSelect.top;
|
|
92
|
-
left = _getCoordsBelowSelect.left;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// remap positions from browser document to wrapperBounds
|
|
96
|
-
return {
|
|
97
|
-
top: top - wrapperBounds.top + scrollWrapper.scrollTop,
|
|
98
|
-
left: Math.max(0, left - wrapperBounds.left)
|
|
99
|
-
};
|
|
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
|
-
var calculateToolbarPositionTrackHead = function calculateToolbarPositionTrackHead(toolbarTitle) {
|
|
118
|
-
return function (editorView, nextPos) {
|
|
119
|
-
var toolbar = document.querySelector("div[aria-label=\"".concat(toolbarTitle, "\"]"));
|
|
120
|
-
if (!toolbar) {
|
|
121
|
-
return nextPos;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// scroll wrapper for full page, fall back to document body
|
|
125
|
-
// TODO: look into using getScrollGutterOptions()
|
|
126
|
-
var scrollWrapper = editorView.dom.closest('.fabric-editor-popup-scroll-parent') || document.body;
|
|
127
|
-
var wrapperBounds = scrollWrapper.getBoundingClientRect();
|
|
128
|
-
var selection = window && window.getSelection();
|
|
129
|
-
var range = selection && !selection.isCollapsed && selection.getRangeAt(0);
|
|
130
|
-
if (!range) {
|
|
131
|
-
return nextPos;
|
|
132
|
-
}
|
|
133
|
-
var toolbarRect = toolbar.getBoundingClientRect();
|
|
134
|
-
var _editorView$state$sel2 = editorView.state.selection,
|
|
135
|
-
head = _editorView$state$sel2.head,
|
|
136
|
-
anchor = _editorView$state$sel2.anchor;
|
|
137
|
-
var topCoords = editorView.coordsAtPos(Math.min(head, anchor));
|
|
138
|
-
var bottomCoords = editorView.coordsAtPos(Math.max(head, anchor) - Math.min(range.endOffset, 1));
|
|
139
|
-
var 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
|
-
var 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
|
-
var _getCoordsBelowSelect2 = getCoordsBelowSelection(bottomCoords, toolbarRect);
|
|
153
|
-
top = _getCoordsBelowSelect2.top;
|
|
154
|
-
left = _getCoordsBelowSelect2.left;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// remap positions from browser document to wrapperBounds
|
|
158
|
-
return {
|
|
159
|
-
top: top - wrapperBounds.top + scrollWrapper.scrollTop,
|
|
160
|
-
left: Math.max(0, left - wrapperBounds.left)
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
};
|
|
8
|
+
import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
|
|
164
9
|
export var buildToolbar = function buildToolbar(state, intl) {
|
|
165
10
|
var isToolbarAbove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
166
11
|
var schema = state.schema;
|
|
@@ -21,7 +21,6 @@ import ToolbarButton from '../../../../ui/ToolbarButton';
|
|
|
21
21
|
import { separatorStyles, buttonGroupStyle, wrapperStyle } from '@atlaskit/editor-common/styles';
|
|
22
22
|
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
23
23
|
import { showPlaceholderFloatingToolbar } from '../../../placeholder-text/actions';
|
|
24
|
-
import { insertLayoutColumnsWithAnalytics } from '../../../layout/actions';
|
|
25
24
|
import { insertTaskDecisionCommand } from '../../../tasks-and-decisions/commands';
|
|
26
25
|
import { insertExpand } from '../../../expand/commands';
|
|
27
26
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -210,21 +209,24 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
210
209
|
return true;
|
|
211
210
|
});
|
|
212
211
|
_defineProperty(_assertThisInitialized(_this), "insertLayoutColumns", function (inputMethod) {
|
|
213
|
-
var
|
|
214
|
-
|
|
212
|
+
var _pluginInjectionApi$l;
|
|
213
|
+
var _this$props3 = _this.props,
|
|
214
|
+
editorView = _this$props3.editorView,
|
|
215
|
+
pluginInjectionApi = _this$props3.pluginInjectionApi;
|
|
216
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$l = pluginInjectionApi.layout) === null || _pluginInjectionApi$l === void 0 || _pluginInjectionApi$l.actions.insertLayoutColumns(inputMethod)(editorView.state, editorView.dispatch);
|
|
215
217
|
return true;
|
|
216
218
|
});
|
|
217
219
|
_defineProperty(_assertThisInitialized(_this), "createStatus", function (inputMethod) {
|
|
218
220
|
var _pluginInjectionApi$s, _pluginInjectionApi$s2;
|
|
219
|
-
var _this$
|
|
220
|
-
pluginInjectionApi = _this$
|
|
221
|
-
editorView = _this$
|
|
221
|
+
var _this$props4 = _this.props,
|
|
222
|
+
pluginInjectionApi = _this$props4.pluginInjectionApi,
|
|
223
|
+
editorView = _this$props4.editorView;
|
|
222
224
|
return (_pluginInjectionApi$s = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s2 = pluginInjectionApi.status) === null || _pluginInjectionApi$s2 === void 0 || (_pluginInjectionApi$s2 = _pluginInjectionApi$s2.actions) === null || _pluginInjectionApi$s2 === void 0 ? void 0 : _pluginInjectionApi$s2.updateStatus(inputMethod)(editorView.state, editorView.dispatch)) !== null && _pluginInjectionApi$s !== void 0 ? _pluginInjectionApi$s : false;
|
|
223
225
|
});
|
|
224
226
|
_defineProperty(_assertThisInitialized(_this), "openMediaPicker", function (inputMethod) {
|
|
225
|
-
var _this$
|
|
226
|
-
onShowMediaPicker = _this$
|
|
227
|
-
dispatchAnalyticsEvent = _this$
|
|
227
|
+
var _this$props5 = _this.props,
|
|
228
|
+
onShowMediaPicker = _this$props5.onShowMediaPicker,
|
|
229
|
+
dispatchAnalyticsEvent = _this$props5.dispatchAnalyticsEvent;
|
|
228
230
|
if (onShowMediaPicker) {
|
|
229
231
|
onShowMediaPicker();
|
|
230
232
|
if (dispatchAnalyticsEvent) {
|
|
@@ -252,11 +254,11 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
252
254
|
});
|
|
253
255
|
_defineProperty(_assertThisInitialized(_this), "insertHorizontalRule", function (inputMethod) {
|
|
254
256
|
var _pluginInjectionApi$r, _pluginInjectionApi$r2;
|
|
255
|
-
var _this$
|
|
256
|
-
_this$
|
|
257
|
-
state = _this$
|
|
258
|
-
dispatch = _this$
|
|
259
|
-
pluginInjectionApi = _this$
|
|
257
|
+
var _this$props6 = _this.props,
|
|
258
|
+
_this$props6$editorVi = _this$props6.editorView,
|
|
259
|
+
state = _this$props6$editorVi.state,
|
|
260
|
+
dispatch = _this$props6$editorVi.dispatch,
|
|
261
|
+
pluginInjectionApi = _this$props6.pluginInjectionApi;
|
|
260
262
|
return (_pluginInjectionApi$r = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$r2 = pluginInjectionApi.rule) === null || _pluginInjectionApi$r2 === void 0 ? void 0 : _pluginInjectionApi$r2.actions.insertHorizontalRule(inputMethod)(state, dispatch)) !== null && _pluginInjectionApi$r !== void 0 ? _pluginInjectionApi$r : false;
|
|
261
263
|
});
|
|
262
264
|
_defineProperty(_assertThisInitialized(_this), "insertExpand", function () {
|
|
@@ -267,9 +269,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
267
269
|
});
|
|
268
270
|
_defineProperty(_assertThisInitialized(_this), "insertBlockType", function (itemName) {
|
|
269
271
|
return function () {
|
|
270
|
-
var _this$
|
|
271
|
-
editorView = _this$
|
|
272
|
-
onInsertBlockType = _this$
|
|
272
|
+
var _this$props7 = _this.props,
|
|
273
|
+
editorView = _this$props7.editorView,
|
|
274
|
+
onInsertBlockType = _this$props7.onInsertBlockType;
|
|
273
275
|
var state = editorView.state,
|
|
274
276
|
dispatch = editorView.dispatch;
|
|
275
277
|
onInsertBlockType(itemName)(state, dispatch);
|
|
@@ -292,11 +294,11 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
292
294
|
_defineProperty(_assertThisInitialized(_this), "onItemActivated", function (_ref2) {
|
|
293
295
|
var item = _ref2.item,
|
|
294
296
|
inputMethod = _ref2.inputMethod;
|
|
295
|
-
var _this$
|
|
296
|
-
editorView = _this$
|
|
297
|
-
editorActions = _this$
|
|
298
|
-
handleImageUpload = _this$
|
|
299
|
-
expandEnabled = _this$
|
|
297
|
+
var _this$props8 = _this.props,
|
|
298
|
+
editorView = _this$props8.editorView,
|
|
299
|
+
editorActions = _this$props8.editorActions,
|
|
300
|
+
handleImageUpload = _this$props8.handleImageUpload,
|
|
301
|
+
expandEnabled = _this$props8.expandEnabled;
|
|
300
302
|
|
|
301
303
|
// need to do this before inserting nodes so scrollIntoView works properly
|
|
302
304
|
if (!editorView.hasFocus()) {
|
|
@@ -412,12 +414,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
412
414
|
key: "renderPopup",
|
|
413
415
|
value: function renderPopup() {
|
|
414
416
|
var emojiPickerOpen = this.state.emojiPickerOpen;
|
|
415
|
-
var _this$
|
|
416
|
-
popupsMountPoint = _this$
|
|
417
|
-
popupsBoundariesElement = _this$
|
|
418
|
-
popupsScrollableElement = _this$
|
|
419
|
-
emojiProvider = _this$
|
|
420
|
-
replacePlusMenuWithElementBrowser = _this$
|
|
417
|
+
var _this$props9 = this.props,
|
|
418
|
+
popupsMountPoint = _this$props9.popupsMountPoint,
|
|
419
|
+
popupsBoundariesElement = _this$props9.popupsBoundariesElement,
|
|
420
|
+
popupsScrollableElement = _this$props9.popupsScrollableElement,
|
|
421
|
+
emojiProvider = _this$props9.emojiProvider,
|
|
422
|
+
replacePlusMenuWithElementBrowser = _this$props9.replacePlusMenuWithElementBrowser;
|
|
421
423
|
var dropdownEmoji = this.state.dropdownItems.some(function (_ref4) {
|
|
422
424
|
var name = _ref4.value.name;
|
|
423
425
|
return name === 'emoji';
|
|
@@ -454,9 +456,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
454
456
|
buttons = _this$state.buttons,
|
|
455
457
|
dropdownItems = _this$state.dropdownItems,
|
|
456
458
|
emojiPickerOpen = _this$state.emojiPickerOpen;
|
|
457
|
-
var _this$
|
|
458
|
-
isDisabled = _this$
|
|
459
|
-
isReducedSpacing = _this$
|
|
459
|
+
var _this$props10 = this.props,
|
|
460
|
+
isDisabled = _this$props10.isDisabled,
|
|
461
|
+
isReducedSpacing = _this$props10.isReducedSpacing;
|
|
460
462
|
if (buttons.length === 0 && dropdownItems.length === 0) {
|
|
461
463
|
return null;
|
|
462
464
|
}
|
|
@@ -6,8 +6,9 @@ import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
|
6
6
|
import { TextSelection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { flatmap, mapChildren } from '../../utils/slice';
|
|
8
8
|
import { getStepRange, isEmptyDocument } from '@atlaskit/editor-common/utils';
|
|
9
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '
|
|
10
|
-
import { addAnalytics
|
|
9
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
10
|
+
import { addAnalytics } from '../analytics/utils';
|
|
11
|
+
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
11
12
|
import { LAYOUT_TYPE } from '../analytics/types/node-events';
|
|
12
13
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
13
14
|
export var ONE_COL_LAYOUTS = ['single'];
|
|
@@ -79,16 +80,18 @@ export var insertLayoutColumns = function insertLayoutColumns(state, dispatch) {
|
|
|
79
80
|
}
|
|
80
81
|
return true;
|
|
81
82
|
};
|
|
82
|
-
export var insertLayoutColumnsWithAnalytics = function insertLayoutColumnsWithAnalytics(
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
export var insertLayoutColumnsWithAnalytics = function insertLayoutColumnsWithAnalytics(editorAnalyticsAPI) {
|
|
84
|
+
return function (inputMethod) {
|
|
85
|
+
return withAnalytics(editorAnalyticsAPI, {
|
|
86
|
+
action: ACTION.INSERTED,
|
|
87
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
88
|
+
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
89
|
+
attributes: {
|
|
90
|
+
inputMethod: inputMethod
|
|
91
|
+
},
|
|
92
|
+
eventType: EVENT_TYPE.TRACK
|
|
93
|
+
})(insertLayoutColumns);
|
|
94
|
+
};
|
|
92
95
|
};
|
|
93
96
|
|
|
94
97
|
/**
|
|
@@ -2,13 +2,14 @@ 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';
|
|
9
9
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
10
10
|
export { pluginKey };
|
|
11
11
|
var layoutPlugin = function layoutPlugin(_ref) {
|
|
12
|
+
var _api$analytics;
|
|
12
13
|
var _ref$config = _ref.config,
|
|
13
14
|
options = _ref$config === void 0 ? {} : _ref$config,
|
|
14
15
|
api = _ref.api;
|
|
@@ -31,6 +32,9 @@ var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
31
32
|
}
|
|
32
33
|
}];
|
|
33
34
|
},
|
|
35
|
+
actions: {
|
|
36
|
+
insertLayoutColumns: insertLayoutColumnsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
|
|
37
|
+
},
|
|
34
38
|
pluginsOptions: {
|
|
35
39
|
floatingToolbar: function floatingToolbar(state, intl) {
|
|
36
40
|
var _ref2 = pluginKey.getState(state),
|
|
@@ -56,9 +60,9 @@ var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
56
60
|
return /*#__PURE__*/React.createElement(IconLayout, null);
|
|
57
61
|
},
|
|
58
62
|
action: function action(insert, state) {
|
|
59
|
-
var _api$
|
|
63
|
+
var _api$analytics2;
|
|
60
64
|
var tr = insert(createDefaultLayoutSection(state));
|
|
61
|
-
api === null || api === void 0 || (_api$
|
|
65
|
+
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.attachAnalyticsEvent({
|
|
62
66
|
action: ACTION.INSERTED,
|
|
63
67
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
64
68
|
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
@@ -158,7 +158,7 @@ var panelPlugin = function panelPlugin(_ref) {
|
|
|
158
158
|
return quickInsertOptions;
|
|
159
159
|
},
|
|
160
160
|
floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
|
|
161
|
-
return getToolbarConfig(state, intl, options, providerFactory, api
|
|
161
|
+
return getToolbarConfig(state, intl, options, providerFactory, api);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
};
|