@atlaskit/editor-core 179.0.4 → 179.1.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 +28 -0
- package/dist/cjs/create-editor/ReactEditorView.js +1 -1
- package/dist/cjs/create-editor/create-plugins-list.js +6 -287
- package/dist/cjs/editor.js +5 -7
- package/dist/cjs/labs/next/presets/universal.js +313 -0
- package/dist/cjs/plugins/card/ui/EditLinkToolbar.js +24 -5
- package/dist/cjs/plugins/floating-toolbar/index.js +6 -0
- package/dist/cjs/plugins/floating-toolbar/pm-plugins/force-focus/index.js +72 -0
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +12 -9
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +3 -1
- package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
- package/dist/cjs/plugins/list/actions/outdent-list-items-selected.js +40 -1
- package/dist/cjs/plugins/list/commands/outdent-list.js +22 -9
- package/dist/cjs/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +30 -12
- package/dist/cjs/plugins/list/utils/analytics.js +18 -2
- package/dist/cjs/plugins/media/commands/linking.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/alt-text/index.js +1 -12
- package/dist/cjs/plugins/media/toolbar/alt-text.js +14 -3
- package/dist/cjs/plugins/media/toolbar/linking-toolbar-appearance.js +6 -6
- package/dist/cjs/plugins/media/toolbar/linking.js +7 -1
- package/dist/cjs/plugins/paste/handlers.js +7 -5
- package/dist/cjs/plugins/placeholder/index.js +1 -0
- package/dist/cjs/plugins/placeholder/styles.js +1 -1
- package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +17 -0
- package/dist/cjs/plugins/type-ahead/ui/InputQuery.js +13 -13
- package/dist/cjs/utils/document.js +3 -2
- package/dist/cjs/utils/input-rules.js +3 -2
- package/dist/cjs/utils/lists.js +31 -0
- package/dist/cjs/utils/prepare-quick-insert-provider.js +22 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +1 -1
- package/dist/es2019/create-editor/create-plugins-list.js +5 -293
- package/dist/es2019/editor.js +5 -7
- package/dist/es2019/labs/next/presets/universal.js +311 -0
- package/dist/es2019/plugins/card/ui/EditLinkToolbar.js +19 -2
- package/dist/es2019/plugins/floating-toolbar/index.js +4 -0
- package/dist/es2019/plugins/floating-toolbar/pm-plugins/force-focus/index.js +59 -0
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +6 -3
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +3 -1
- package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
- package/dist/es2019/plugins/list/actions/outdent-list-items-selected.js +41 -1
- package/dist/es2019/plugins/list/commands/outdent-list.js +16 -1
- package/dist/es2019/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +29 -11
- package/dist/es2019/plugins/list/utils/analytics.js +12 -0
- package/dist/es2019/plugins/media/commands/linking.js +2 -2
- package/dist/es2019/plugins/media/pm-plugins/alt-text/index.js +1 -12
- package/dist/es2019/plugins/media/toolbar/alt-text.js +14 -3
- package/dist/es2019/plugins/media/toolbar/linking-toolbar-appearance.js +6 -6
- package/dist/es2019/plugins/media/toolbar/linking.js +9 -1
- package/dist/es2019/plugins/paste/handlers.js +8 -6
- package/dist/es2019/plugins/placeholder/index.js +1 -0
- package/dist/es2019/plugins/placeholder/styles.js +7 -0
- package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +17 -0
- package/dist/es2019/plugins/type-ahead/ui/InputQuery.js +13 -13
- package/dist/es2019/utils/document.js +3 -2
- package/dist/es2019/utils/input-rules.js +3 -2
- package/dist/es2019/utils/lists.js +26 -0
- package/dist/es2019/utils/prepare-quick-insert-provider.js +17 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +1 -1
- package/dist/esm/create-editor/create-plugins-list.js +6 -287
- package/dist/esm/editor.js +5 -7
- package/dist/esm/labs/next/presets/universal.js +306 -0
- package/dist/esm/plugins/card/ui/EditLinkToolbar.js +24 -5
- package/dist/esm/plugins/floating-toolbar/index.js +6 -0
- package/dist/esm/plugins/floating-toolbar/pm-plugins/force-focus/index.js +62 -0
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +12 -9
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +3 -1
- package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +3 -2
- package/dist/esm/plugins/list/actions/outdent-list-items-selected.js +40 -1
- package/dist/esm/plugins/list/commands/outdent-list.js +15 -2
- package/dist/esm/plugins/list/pm-plugins/input-rules/create-list-input-rule.js +30 -12
- package/dist/esm/plugins/list/utils/analytics.js +12 -0
- package/dist/esm/plugins/media/commands/linking.js +2 -2
- package/dist/esm/plugins/media/pm-plugins/alt-text/index.js +1 -12
- package/dist/esm/plugins/media/toolbar/alt-text.js +14 -3
- package/dist/esm/plugins/media/toolbar/linking-toolbar-appearance.js +6 -6
- package/dist/esm/plugins/media/toolbar/linking.js +7 -1
- package/dist/esm/plugins/paste/handlers.js +8 -6
- package/dist/esm/plugins/placeholder/index.js +1 -0
- package/dist/esm/plugins/placeholder/styles.js +1 -1
- package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +17 -0
- package/dist/esm/plugins/type-ahead/ui/InputQuery.js +13 -13
- package/dist/esm/utils/document.js +3 -2
- package/dist/esm/utils/input-rules.js +3 -2
- package/dist/esm/utils/lists.js +24 -0
- package/dist/esm/utils/prepare-quick-insert-provider.js +17 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/create-plugins-list.d.ts +5 -4
- package/dist/types/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.d.ts +2 -2
- package/dist/types/labs/next/presets/universal.d.ts +30 -0
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +4 -0
- package/dist/types/plugins/expand/index.d.ts +4 -1
- package/dist/types/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +18 -0
- package/dist/types/plugins/list/utils/analytics.d.ts +5 -2
- package/dist/types/plugins/media/commands/linking.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +96 -92
- package/dist/types/utils/input-rules.d.ts +2 -1
- package/dist/types/utils/lists.d.ts +2 -0
- package/dist/types/utils/prepare-quick-insert-provider.d.ts +16 -0
- package/package.json +14 -15
- package/report.api.md +89 -79
- /package/dist/cjs/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
- /package/dist/es2019/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
- /package/dist/esm/{plugins/feature-flags-context → create-editor}/feature-flags-from-props.js +0 -0
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = createUniversalPreset;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _plugins = require("../../../plugins");
|
|
11
|
+
var _editorPluginTable = require("@atlaskit/editor-plugin-table");
|
|
12
|
+
var _isFullPage = require("../../../utils/is-full-page");
|
|
13
|
+
var _mediaCommon = require("@atlaskit/media-common");
|
|
14
|
+
var _default = require("./default");
|
|
15
|
+
var _utils = require("@atlaskit/editor-common/utils");
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
/**
|
|
19
|
+
* Creates a preset with all of the available plugins.
|
|
20
|
+
* Basis for create-plugins-list and can be used to migrate from Editor -> EditorNext (Presets project)
|
|
21
|
+
* with minimal friction.
|
|
22
|
+
*
|
|
23
|
+
* @param appearance
|
|
24
|
+
* @param props A subset of full EditorProps for the full feature preset
|
|
25
|
+
* @param featureFlags
|
|
26
|
+
* @param prevAppearance The appearance of the editor in the previous render
|
|
27
|
+
* @param createAnalyticsEvent
|
|
28
|
+
* @param insertNodeAPI
|
|
29
|
+
* @param editorAnalyticsAPI
|
|
30
|
+
* @param editorSelectionAPI
|
|
31
|
+
* @param getEditorContainerWidth
|
|
32
|
+
* @returns a full featured preset configured according to the provided props - basis for create-plugins-list
|
|
33
|
+
*/
|
|
34
|
+
function createUniversalPreset(appearance, props, featureFlags, prevAppearance, createAnalyticsEvent, insertNodeAPI, editorAnalyticsAPI, editorSelectionAPI, getEditorContainerWidth) {
|
|
35
|
+
var _props$linking;
|
|
36
|
+
var isMobile = appearance === 'mobile';
|
|
37
|
+
var isComment = appearance === 'comment';
|
|
38
|
+
var isFullPage = (0, _isFullPage.isFullPage)(appearance);
|
|
39
|
+
var preset = (0, _default.createDefaultPreset)(props);
|
|
40
|
+
var getEditorFeatureFlags = function getEditorFeatureFlags() {
|
|
41
|
+
return featureFlags;
|
|
42
|
+
};
|
|
43
|
+
if (props.allowAnalyticsGASV3) {
|
|
44
|
+
var performanceTracking = props.performanceTracking;
|
|
45
|
+
preset.add([_plugins.analyticsPlugin, {
|
|
46
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
47
|
+
performanceTracking: performanceTracking
|
|
48
|
+
}]);
|
|
49
|
+
}
|
|
50
|
+
if (props.allowBreakout && isFullPage) {
|
|
51
|
+
preset.add([_plugins.breakoutPlugin, {
|
|
52
|
+
allowBreakoutButton: appearance === 'full-page'
|
|
53
|
+
}]);
|
|
54
|
+
}
|
|
55
|
+
if (props.allowTextAlignment) {
|
|
56
|
+
preset.add(_plugins.alignmentPlugin);
|
|
57
|
+
}
|
|
58
|
+
preset.add(_plugins.dataConsumerMarkPlugin);
|
|
59
|
+
if (props.allowTextColor) {
|
|
60
|
+
preset.add([_plugins.textColorPlugin, props.allowTextColor]);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Needs to be after allowTextColor as order of buttons in toolbar depends on it
|
|
64
|
+
preset.add([_plugins.listPlugin, {
|
|
65
|
+
restartNumberedLists: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.restartNumberedLists,
|
|
66
|
+
restartNumberedListsToolbar: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.restartNumberedListsToolbar,
|
|
67
|
+
listNumberContinuity: featureFlags === null || featureFlags === void 0 ? void 0 : featureFlags.listNumberContinuity
|
|
68
|
+
}]);
|
|
69
|
+
if (props.allowRule) {
|
|
70
|
+
preset.add(_plugins.rulePlugin);
|
|
71
|
+
}
|
|
72
|
+
if (props.allowExpand) {
|
|
73
|
+
preset.add([_plugins.expandPlugin, {
|
|
74
|
+
allowInsertion: (0, _plugins.isExpandInsertionEnabled)(props),
|
|
75
|
+
useLongPressSelection: false,
|
|
76
|
+
appearance: appearance
|
|
77
|
+
}]);
|
|
78
|
+
}
|
|
79
|
+
if (props.media) {
|
|
80
|
+
preset.add([_plugins.gridPlugin, {
|
|
81
|
+
shouldCalcBreakoutGridLines: isFullPage
|
|
82
|
+
}]);
|
|
83
|
+
var alignLeftOnInsert = typeof props.media.alignLeftOnInsert !== 'undefined' ? props.media.alignLeftOnInsert : isComment;
|
|
84
|
+
var showMediaLayoutOptions = typeof props.media.allowAdvancedToolBarOptions !== 'undefined' ? props.media.allowAdvancedToolBarOptions : isFullPage || isComment;
|
|
85
|
+
preset.add([_plugins.mediaPlugin, _objectSpread(_objectSpread({}, props.media), {}, {
|
|
86
|
+
allowLazyLoading: !isMobile,
|
|
87
|
+
allowBreakoutSnapPoints: isFullPage,
|
|
88
|
+
allowAdvancedToolBarOptions: showMediaLayoutOptions,
|
|
89
|
+
allowDropzoneDropLine: isFullPage,
|
|
90
|
+
allowMediaSingleEditable: !isMobile,
|
|
91
|
+
allowRemoteDimensionsFetch: !isMobile,
|
|
92
|
+
editorSelectionAPI: editorSelectionAPI,
|
|
93
|
+
// This is a wild one. I didnt quite understand what the code was doing
|
|
94
|
+
// so a bit of guess for now.
|
|
95
|
+
allowMarkingUploadsAsIncomplete: isMobile,
|
|
96
|
+
fullWidthEnabled: appearance === 'full-width',
|
|
97
|
+
uploadErrorHandler: props.uploadErrorHandler,
|
|
98
|
+
waitForMediaUpload: props.waitForMediaUpload,
|
|
99
|
+
isCopyPasteEnabled: !isMobile,
|
|
100
|
+
alignLeftOnInsert: alignLeftOnInsert
|
|
101
|
+
})]);
|
|
102
|
+
|
|
103
|
+
// EDM-799: inside caption plugin we do the feature flag in enabling the plugin
|
|
104
|
+
if ((0, _mediaCommon.getMediaFeatureFlag)('captions', props.media.featureFlags)) {
|
|
105
|
+
preset.add(_plugins.captionPlugin);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (props.mentionProvider) {
|
|
109
|
+
var _props$mention$insert, _props$mention, _props$mention2;
|
|
110
|
+
preset.add([_plugins.mentionsPlugin, {
|
|
111
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
112
|
+
sanitizePrivateContent: props.sanitizePrivateContent,
|
|
113
|
+
insertDisplayName: (_props$mention$insert = (_props$mention = props.mention) === null || _props$mention === void 0 ? void 0 : _props$mention.insertDisplayName) !== null && _props$mention$insert !== void 0 ? _props$mention$insert : props.mentionInsertDisplayName,
|
|
114
|
+
allowZeroWidthSpaceAfter: !isMobile,
|
|
115
|
+
HighlightComponent: (_props$mention2 = props.mention) === null || _props$mention2 === void 0 ? void 0 : _props$mention2.HighlightComponent
|
|
116
|
+
}]);
|
|
117
|
+
}
|
|
118
|
+
if (props.emojiProvider) {
|
|
119
|
+
preset.add([_plugins.emojiPlugin, {
|
|
120
|
+
createAnalyticsEvent: createAnalyticsEvent
|
|
121
|
+
}]);
|
|
122
|
+
}
|
|
123
|
+
if (props.allowTables) {
|
|
124
|
+
var tableOptions = !props.allowTables || typeof props.allowTables === 'boolean' ? {} : props.allowTables;
|
|
125
|
+
preset.add([_editorPluginTable.tablesPlugin, {
|
|
126
|
+
tableOptions: tableOptions,
|
|
127
|
+
breakoutEnabled: appearance === 'full-page',
|
|
128
|
+
allowContextualMenu: !isMobile,
|
|
129
|
+
fullWidthEnabled: appearance === 'full-width',
|
|
130
|
+
wasFullWidthEnabled: prevAppearance && prevAppearance === 'full-width',
|
|
131
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
132
|
+
editorSelectionAPI: editorSelectionAPI,
|
|
133
|
+
getEditorFeatureFlags: getEditorFeatureFlags
|
|
134
|
+
}]);
|
|
135
|
+
}
|
|
136
|
+
if (props.allowTasksAndDecisions || props.taskDecisionProvider) {
|
|
137
|
+
preset.add([_plugins.tasksAndDecisionsPlugin, {
|
|
138
|
+
allowNestedTasks: props.allowNestedTasks,
|
|
139
|
+
consumeTabs: isFullPage,
|
|
140
|
+
useLongPressSelection: false
|
|
141
|
+
}]);
|
|
142
|
+
}
|
|
143
|
+
if (props.feedbackInfo) {
|
|
144
|
+
preset.add([_plugins.feedbackDialogPlugin, props.feedbackInfo]);
|
|
145
|
+
}
|
|
146
|
+
if (props.allowHelpDialog) {
|
|
147
|
+
preset.add([_plugins.helpDialogPlugin, !!props.legacyImageUploadProvider]);
|
|
148
|
+
}
|
|
149
|
+
if (props.saveOnEnter && props.onSave) {
|
|
150
|
+
preset.add([_plugins.saveOnEnterPlugin, props.onSave]);
|
|
151
|
+
}
|
|
152
|
+
if (props.legacyImageUploadProvider) {
|
|
153
|
+
preset.add(_plugins.imageUploadPlugin);
|
|
154
|
+
if (!props.media) {
|
|
155
|
+
preset.add([_plugins.mediaPlugin, {
|
|
156
|
+
allowMediaSingle: {
|
|
157
|
+
disableLayout: true
|
|
158
|
+
},
|
|
159
|
+
allowMediaGroup: false,
|
|
160
|
+
isCopyPasteEnabled: true,
|
|
161
|
+
editorSelectionAPI: editorSelectionAPI
|
|
162
|
+
}]);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (props.collabEdit || props.collabEditProvider) {
|
|
166
|
+
var _collabEditOptions$EX;
|
|
167
|
+
var collabEditOptions = {
|
|
168
|
+
sanitizePrivateContent: props.sanitizePrivateContent,
|
|
169
|
+
createAnalyticsEvent: createAnalyticsEvent
|
|
170
|
+
};
|
|
171
|
+
if (props.collabEdit) {
|
|
172
|
+
collabEditOptions = _objectSpread(_objectSpread({}, props.collabEdit), collabEditOptions);
|
|
173
|
+
}
|
|
174
|
+
preset.add([_plugins.collabEditPlugin, _objectSpread(_objectSpread({}, collabEditOptions), {}, {
|
|
175
|
+
EXPERIMENTAL_allowInternalErrorAnalytics: (_collabEditOptions$EX = collabEditOptions.EXPERIMENTAL_allowInternalErrorAnalytics) !== null && _collabEditOptions$EX !== void 0 ? _collabEditOptions$EX : (0, _utils.shouldForceTracking)()
|
|
176
|
+
})]);
|
|
177
|
+
}
|
|
178
|
+
if (props.maxContentSize) {
|
|
179
|
+
preset.add([_plugins.maxContentSizePlugin, props.maxContentSize]);
|
|
180
|
+
}
|
|
181
|
+
if (props.allowJiraIssue) {
|
|
182
|
+
preset.add(_plugins.jiraIssuePlugin);
|
|
183
|
+
}
|
|
184
|
+
if (props.allowPanel) {
|
|
185
|
+
var allowPanel = (0, _typeof2.default)(props.allowPanel) === 'object' ? props.allowPanel : {};
|
|
186
|
+
preset.add([_plugins.panelPlugin, {
|
|
187
|
+
useLongPressSelection: false,
|
|
188
|
+
allowCustomPanel: allowPanel.allowCustomPanel,
|
|
189
|
+
allowCustomPanelEdit: allowPanel.allowCustomPanelEdit
|
|
190
|
+
}]);
|
|
191
|
+
}
|
|
192
|
+
if (props.allowExtension) {
|
|
193
|
+
var extensionConfig = (0, _typeof2.default)(props.allowExtension) === 'object' ? props.allowExtension : {};
|
|
194
|
+
preset.add([_plugins.extensionPlugin, {
|
|
195
|
+
breakoutEnabled: appearance === 'full-page' && extensionConfig.allowBreakout !== false,
|
|
196
|
+
allowAutoSave: extensionConfig.allowAutoSave,
|
|
197
|
+
extensionHandlers: props.extensionHandlers,
|
|
198
|
+
useLongPressSelection: false,
|
|
199
|
+
appearance: appearance
|
|
200
|
+
}]);
|
|
201
|
+
}
|
|
202
|
+
if (props.macroProvider) {
|
|
203
|
+
preset.add(_plugins.macroPlugin);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// See default list for when adding annotations with a provider
|
|
207
|
+
if (!props.annotationProviders && props.allowConfluenceInlineComment) {
|
|
208
|
+
preset.add([_plugins.annotationPlugin, undefined]);
|
|
209
|
+
}
|
|
210
|
+
if (props.allowDate) {
|
|
211
|
+
preset.add(_plugins.datePlugin);
|
|
212
|
+
}
|
|
213
|
+
if (props.allowTemplatePlaceholders) {
|
|
214
|
+
var options = props.allowTemplatePlaceholders !== true ? props.allowTemplatePlaceholders : {};
|
|
215
|
+
preset.add([_plugins.placeholderTextPlugin, options]);
|
|
216
|
+
}
|
|
217
|
+
if (props.allowLayouts) {
|
|
218
|
+
var layoutOptions = (0, _typeof2.default)(props.allowLayouts) === 'object' ? props.allowLayouts : {};
|
|
219
|
+
preset.add([_plugins.layoutPlugin, _objectSpread(_objectSpread({}, layoutOptions), {}, {
|
|
220
|
+
useLongPressSelection: false,
|
|
221
|
+
UNSAFE_allowSingleColumnLayout: layoutOptions.UNSAFE_allowSingleColumnLayout
|
|
222
|
+
})]);
|
|
223
|
+
}
|
|
224
|
+
if ((_props$linking = props.linking) !== null && _props$linking !== void 0 && _props$linking.smartLinks || props.smartLinks || props.UNSAFE_cards) {
|
|
225
|
+
var _props$linking2, _props$linking3;
|
|
226
|
+
var fullWidthMode = appearance === 'full-width';
|
|
227
|
+
preset.add([_plugins.cardPlugin, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props.UNSAFE_cards), props.smartLinks), (_props$linking2 = props.linking) === null || _props$linking2 === void 0 ? void 0 : _props$linking2.smartLinks), {}, {
|
|
228
|
+
platform: isMobile ? 'mobile' : 'web',
|
|
229
|
+
fullWidthMode: fullWidthMode,
|
|
230
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
231
|
+
linkPicker: (_props$linking3 = props.linking) === null || _props$linking3 === void 0 ? void 0 : _props$linking3.linkPicker
|
|
232
|
+
})]);
|
|
233
|
+
}
|
|
234
|
+
if (props.autoformattingProvider) {
|
|
235
|
+
preset.add(_plugins.customAutoformatPlugin);
|
|
236
|
+
}
|
|
237
|
+
var statusMenuDisabled = true;
|
|
238
|
+
if (props.allowStatus) {
|
|
239
|
+
statusMenuDisabled = (0, _typeof2.default)(props.allowStatus) === 'object' ? props.allowStatus.menuDisabled : false;
|
|
240
|
+
preset.add([_plugins.statusPlugin, {
|
|
241
|
+
menuDisabled: statusMenuDisabled,
|
|
242
|
+
allowZeroWidthSpaceAfter: !isMobile
|
|
243
|
+
}]);
|
|
244
|
+
}
|
|
245
|
+
if (props.allowIndentation) {
|
|
246
|
+
preset.add(_plugins.indentationPlugin);
|
|
247
|
+
}
|
|
248
|
+
if (isFullPage) {
|
|
249
|
+
preset.add(_plugins.contextPanelPlugin);
|
|
250
|
+
}
|
|
251
|
+
if (props.autoScrollIntoView !== false) {
|
|
252
|
+
preset.add(_plugins.scrollIntoViewPlugin);
|
|
253
|
+
}
|
|
254
|
+
if (isMobile || props.allowUndoRedoButtons) {
|
|
255
|
+
preset.add(_plugins.historyPlugin);
|
|
256
|
+
}
|
|
257
|
+
if (isMobile) {
|
|
258
|
+
preset.add(_plugins.mobileDimensionsPlugin);
|
|
259
|
+
preset.add(_plugins.mobileSelectionPlugin);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// UI only plugins
|
|
263
|
+
preset.add([_plugins.toolbarListsIndentationPlugin, {
|
|
264
|
+
showIndentationButtons: !!featureFlags.indentationButtonsInTheToolbar,
|
|
265
|
+
allowHeadingAndParagraphIndentation: !!props.allowIndentation
|
|
266
|
+
}]);
|
|
267
|
+
preset.add([_plugins.insertBlockPlugin, {
|
|
268
|
+
allowTables: !!props.allowTables,
|
|
269
|
+
allowExpand: (0, _plugins.isExpandInsertionEnabled)(props),
|
|
270
|
+
insertMenuItems: props.insertMenuItems,
|
|
271
|
+
horizontalRuleEnabled: props.allowRule,
|
|
272
|
+
nativeStatusSupported: !statusMenuDisabled,
|
|
273
|
+
showElementBrowserLink: props.elementBrowser && props.elementBrowser.showModal || false,
|
|
274
|
+
replacePlusMenuWithElementBrowser: props.elementBrowser && props.elementBrowser.replacePlusMenu || false,
|
|
275
|
+
insertNodeAPI: insertNodeAPI
|
|
276
|
+
}]);
|
|
277
|
+
var hasBeforePrimaryToolbar = function hasBeforePrimaryToolbar(components) {
|
|
278
|
+
if (components && 'before' in components) {
|
|
279
|
+
return !!components.before;
|
|
280
|
+
}
|
|
281
|
+
return false;
|
|
282
|
+
};
|
|
283
|
+
if (hasBeforePrimaryToolbar(props.primaryToolbarComponents) && !featureFlags.twoLineEditorToolbar) {
|
|
284
|
+
preset.add([_plugins.beforePrimaryToolbarPlugin, {
|
|
285
|
+
beforePrimaryToolbarComponents: props.primaryToolbarComponents.before
|
|
286
|
+
}]);
|
|
287
|
+
}
|
|
288
|
+
if (featureFlags.showAvatarGroupAsPlugin === true && !featureFlags.twoLineEditorToolbar) {
|
|
289
|
+
preset.add([_plugins.avatarGroupPlugin, {
|
|
290
|
+
collabEdit: props.collabEdit,
|
|
291
|
+
takeFullWidth: !hasBeforePrimaryToolbar(props.primaryToolbarComponents)
|
|
292
|
+
}]);
|
|
293
|
+
}
|
|
294
|
+
if (props.allowFindReplace) {
|
|
295
|
+
preset.add([_plugins.findReplacePlugin, {
|
|
296
|
+
takeFullWidth: !!featureFlags.showAvatarGroupAsPlugin === false && !hasBeforePrimaryToolbar(props.primaryToolbarComponents),
|
|
297
|
+
twoLineEditorToolbar: !!featureFlags.twoLineEditorToolbar
|
|
298
|
+
}]);
|
|
299
|
+
}
|
|
300
|
+
if (props.allowFragmentMark) {
|
|
301
|
+
preset.add(_plugins.fragmentMarkPlugin);
|
|
302
|
+
}
|
|
303
|
+
if (featureFlags.enableViewUpdateSubscription) {
|
|
304
|
+
preset.add(_plugins.viewUpdateSubscriptionPlugin);
|
|
305
|
+
}
|
|
306
|
+
preset.add([_plugins.codeBidiWarningPlugin, {
|
|
307
|
+
appearance: appearance
|
|
308
|
+
}]);
|
|
309
|
+
if (featureFlags.floatingToolbarCopyButton) {
|
|
310
|
+
preset.add(_plugins.copyButtonPlugin);
|
|
311
|
+
}
|
|
312
|
+
return preset;
|
|
313
|
+
}
|
|
@@ -7,9 +7,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.editLinkToolbarConfig = exports.editLink = exports.buildEditLinkToolbar = exports.EditLinkToolbar = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
10
11
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
15
|
var _react = _interopRequireDefault(require("react"));
|
|
14
16
|
var _HyperlinkAddToolbar = _interopRequireDefault(require("../../hyperlink/ui/HyperlinkAddToolbar"));
|
|
15
17
|
var _actions = require("../pm-plugins/actions");
|
|
@@ -19,14 +21,26 @@ var _doc = require("../pm-plugins/doc");
|
|
|
19
21
|
var _utils = require("../utils");
|
|
20
22
|
var _prosemirrorState = require("prosemirror-state");
|
|
21
23
|
var _linkingUtils = require("../../../utils/linking-utils");
|
|
24
|
+
var _forceFocus = require("../../floating-toolbar/pm-plugins/force-focus");
|
|
25
|
+
var _ui = require("@atlaskit/editor-common/ui");
|
|
26
|
+
var _messages = require("../../../messages");
|
|
22
27
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
23
28
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
29
|
+
var HyperLinkToolbarWithListeners = (0, _ui.withOuterListeners)(_HyperlinkAddToolbar.default);
|
|
24
30
|
var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
25
31
|
(0, _inherits2.default)(EditLinkToolbar, _React$Component);
|
|
26
32
|
var _super = _createSuper(EditLinkToolbar);
|
|
27
33
|
function EditLinkToolbar() {
|
|
34
|
+
var _this;
|
|
28
35
|
(0, _classCallCheck2.default)(this, EditLinkToolbar);
|
|
29
|
-
|
|
36
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
37
|
+
args[_key] = arguments[_key];
|
|
38
|
+
}
|
|
39
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
40
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleEsc", function (e) {
|
|
41
|
+
(0, _forceFocus.forceFocusSelector)("[aria-label=\"".concat(_messages.linkToolbarMessages.editLink.defaultMessage, "\"]"), _this.props.view);
|
|
42
|
+
});
|
|
43
|
+
return _this;
|
|
30
44
|
}
|
|
31
45
|
(0, _createClass2.default)(EditLinkToolbar, [{
|
|
32
46
|
key: "componentDidUpdate",
|
|
@@ -40,6 +54,10 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
40
54
|
value: function componentWillUnmount() {
|
|
41
55
|
this.hideLinkToolbar();
|
|
42
56
|
}
|
|
57
|
+
|
|
58
|
+
/** Focus should move to the 'Edit link' button when the toolbar closes
|
|
59
|
+
* and not close the floating toolbar.
|
|
60
|
+
*/
|
|
43
61
|
}, {
|
|
44
62
|
key: "hideLinkToolbar",
|
|
45
63
|
value: function hideLinkToolbar() {
|
|
@@ -49,7 +67,7 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
49
67
|
}, {
|
|
50
68
|
key: "render",
|
|
51
69
|
value: function render() {
|
|
52
|
-
var
|
|
70
|
+
var _this2 = this;
|
|
53
71
|
var _this$props = this.props,
|
|
54
72
|
linkPickerOptions = _this$props.linkPickerOptions,
|
|
55
73
|
providerFactory = _this$props.providerFactory,
|
|
@@ -57,18 +75,19 @@ var EditLinkToolbar = /*#__PURE__*/function (_React$Component) {
|
|
|
57
75
|
text = _this$props.text,
|
|
58
76
|
view = _this$props.view,
|
|
59
77
|
_onSubmit = _this$props.onSubmit;
|
|
60
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
78
|
+
return /*#__PURE__*/_react.default.createElement(HyperLinkToolbarWithListeners, {
|
|
61
79
|
view: view,
|
|
62
80
|
linkPickerOptions: linkPickerOptions,
|
|
63
81
|
providerFactory: providerFactory,
|
|
64
82
|
displayUrl: url,
|
|
65
|
-
displayText: text
|
|
83
|
+
displayText: text,
|
|
84
|
+
handleEscapeKeydown: this.handleEsc
|
|
66
85
|
// Assumes that the smart card link picker can only ever be invoked by clicking "edit"
|
|
67
86
|
// via the floating toolbar
|
|
68
87
|
,
|
|
69
88
|
invokeMethod: _analytics.INPUT_METHOD.FLOATING_TB,
|
|
70
89
|
onSubmit: function onSubmit(href, title, displayText) {
|
|
71
|
-
|
|
90
|
+
_this2.hideLinkToolbar();
|
|
72
91
|
if (_onSubmit) {
|
|
73
92
|
_onSubmit(href, displayText || title);
|
|
74
93
|
}
|
|
@@ -26,6 +26,7 @@ var _utils = require("./utils");
|
|
|
26
26
|
var _ErrorBoundary = require("../../ui/ErrorBoundary");
|
|
27
27
|
var _featureFlagsContext = require("../feature-flags-context");
|
|
28
28
|
var _toolbar = require("../copy-button/toolbar");
|
|
29
|
+
var _forceFocus = _interopRequireDefault(require("./pm-plugins/force-focus"));
|
|
29
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
30
31
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
32
|
var getRelevantConfig = function getRelevantConfig(selection, configs) {
|
|
@@ -143,6 +144,11 @@ var floatingToolbarPlugin = function floatingToolbarPlugin() {
|
|
|
143
144
|
var dispatch = _ref2.dispatch;
|
|
144
145
|
return (0, _plugin.createPlugin)(dispatch);
|
|
145
146
|
}
|
|
147
|
+
}, {
|
|
148
|
+
name: 'forceFocus',
|
|
149
|
+
plugin: function plugin() {
|
|
150
|
+
return (0, _forceFocus.default)();
|
|
151
|
+
}
|
|
146
152
|
}];
|
|
147
153
|
},
|
|
148
154
|
contentComponent: function contentComponent(_ref3) {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.checkShouldForceFocusAndApply = checkShouldForceFocusAndApply;
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
exports.forceFocusSelector = forceFocusSelector;
|
|
9
|
+
exports.forceFocusStateKey = void 0;
|
|
10
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
|
+
var _prosemirrorState = require("prosemirror-state");
|
|
12
|
+
var forceFocusStateKey = new _prosemirrorState.PluginKey('forceFocusStatePlugin');
|
|
13
|
+
/**
|
|
14
|
+
* Used in cases where a floating toolbar button opens a submenu which destroys
|
|
15
|
+
* the button, but the user has pressed ESC to close the submenu and focus needs
|
|
16
|
+
* to move back to the button. */
|
|
17
|
+
exports.forceFocusStateKey = forceFocusStateKey;
|
|
18
|
+
var _default = function _default() {
|
|
19
|
+
return new _safePlugin.SafePlugin({
|
|
20
|
+
key: forceFocusStateKey,
|
|
21
|
+
state: {
|
|
22
|
+
init: function init() {
|
|
23
|
+
return {
|
|
24
|
+
selector: null
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
apply: function apply(tr, prevState) {
|
|
28
|
+
var meta = tr.getMeta(forceFocusStateKey);
|
|
29
|
+
if (meta && 'selector' in meta) {
|
|
30
|
+
return {
|
|
31
|
+
selector: meta.selector
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return prevState;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The provided selector should be the floating toolbar button that needs focus.
|
|
41
|
+
*/
|
|
42
|
+
exports.default = _default;
|
|
43
|
+
function forceFocusSelector(selector, view) {
|
|
44
|
+
if (view) {
|
|
45
|
+
return view.dispatch(view.state.tr.setMeta(forceFocusStateKey, {
|
|
46
|
+
selector: selector
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* If a selector is set and the element exists, focus it.
|
|
53
|
+
*/
|
|
54
|
+
function checkShouldForceFocusAndApply(view) {
|
|
55
|
+
var state = view === null || view === void 0 ? void 0 : view.state;
|
|
56
|
+
if (state) {
|
|
57
|
+
var _forceFocusStateKey$g = forceFocusStateKey.getState(state),
|
|
58
|
+
selector = _forceFocusStateKey$g.selector;
|
|
59
|
+
if (selector) {
|
|
60
|
+
var focusableElement = document.querySelector(selector);
|
|
61
|
+
if (focusableElement) {
|
|
62
|
+
focusableElement.scrollIntoView({
|
|
63
|
+
behavior: 'smooth',
|
|
64
|
+
block: 'center',
|
|
65
|
+
inline: 'nearest'
|
|
66
|
+
});
|
|
67
|
+
focusableElement.focus();
|
|
68
|
+
forceFocusSelector(null, view);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -36,8 +36,10 @@ var _announcer = _interopRequireDefault(require("../../../utils/announcer/announ
|
|
|
36
36
|
var _reactIntlNext = require("react-intl-next");
|
|
37
37
|
var _messages = _interopRequireDefault(require("./messages"));
|
|
38
38
|
var _decoration = require("../../base/pm-plugins/decoration");
|
|
39
|
+
var _commands2 = require("@atlaskit/editor-plugin-table/commands");
|
|
39
40
|
var _ScrollButtons = _interopRequireDefault(require("./ScrollButtons"));
|
|
40
41
|
var _ToolbarArrowKeyNavigationProvider = require("../../../ui/ToolbarArrowKeyNavigationProvider");
|
|
42
|
+
var _forceFocus = require("../pm-plugins/force-focus");
|
|
41
43
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
|
|
42
44
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
43
45
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -347,10 +349,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
347
349
|
var _this$props$editorVie2 = this.props.editorView,
|
|
348
350
|
state = _this$props$editorVie2.state,
|
|
349
351
|
dispatch = _this$props$editorVie2.dispatch;
|
|
350
|
-
// tables use their own decorations
|
|
351
|
-
// TODO fix for tables https://product-fabric.atlassian.net/jira/servicedesk/projects/DTR/queues/issue/DTR-617
|
|
352
352
|
if (table) {
|
|
353
|
-
return
|
|
353
|
+
return (0, _commands2.clearHoverSelection)()(state, dispatch);
|
|
354
354
|
}
|
|
355
355
|
dispatch(state.tr.setMeta(_decoration.decorationStateKey, {
|
|
356
356
|
action: _decoration.ACTIONS.DECORATION_REMOVE
|
|
@@ -384,6 +384,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
384
384
|
}, {
|
|
385
385
|
key: "componentDidUpdate",
|
|
386
386
|
value: function componentDidUpdate(prevProps) {
|
|
387
|
+
var _this$props;
|
|
388
|
+
(0, _forceFocus.checkShouldForceFocusAndApply)((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.editorView);
|
|
387
389
|
if (this.props.node !== prevProps.node) {
|
|
388
390
|
this.resetStyling({
|
|
389
391
|
table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
|
|
@@ -393,6 +395,7 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
393
395
|
}, {
|
|
394
396
|
key: "componentWillUnmount",
|
|
395
397
|
value: function componentWillUnmount() {
|
|
398
|
+
(0, _forceFocus.forceFocusSelector)(null, this.props.editorView);
|
|
396
399
|
this.resetStyling({
|
|
397
400
|
table: this.props.node.type.name === 'table'
|
|
398
401
|
});
|
|
@@ -400,12 +403,12 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
400
403
|
}, {
|
|
401
404
|
key: "render",
|
|
402
405
|
value: function render() {
|
|
403
|
-
var _this$
|
|
404
|
-
items = _this$
|
|
405
|
-
className = _this$
|
|
406
|
-
node = _this$
|
|
407
|
-
intl = _this$
|
|
408
|
-
scrollable = _this$
|
|
406
|
+
var _this$props2 = this.props,
|
|
407
|
+
items = _this$props2.items,
|
|
408
|
+
className = _this$props2.className,
|
|
409
|
+
node = _this$props2.node,
|
|
410
|
+
intl = _this$props2.intl,
|
|
411
|
+
scrollable = _this$props2.scrollable;
|
|
409
412
|
if (!items || !items.length) {
|
|
410
413
|
return null;
|
|
411
414
|
}
|
|
@@ -17,7 +17,9 @@ var BlockInsertElementBrowser = function BlockInsertElementBrowser(props) {
|
|
|
17
17
|
offset: [0, 3],
|
|
18
18
|
mountTo: props.popupsMountPoint,
|
|
19
19
|
boundariesElement: props.popupsBoundariesElement,
|
|
20
|
-
scrollableElement: props.popupsScrollableElement
|
|
20
|
+
scrollableElement: props.popupsScrollableElement,
|
|
21
|
+
preventOverflow: true,
|
|
22
|
+
alignX: "right"
|
|
21
23
|
}, /*#__PURE__*/_react.default.createElement(_InsertMenu.default, {
|
|
22
24
|
editorView: props.editorView,
|
|
23
25
|
dropdownItems: props.items,
|
|
@@ -426,7 +426,8 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
426
426
|
_this$props$replacePl;
|
|
427
427
|
var _this$state = this.state,
|
|
428
428
|
buttons = _this$state.buttons,
|
|
429
|
-
dropdownItems = _this$state.dropdownItems
|
|
429
|
+
dropdownItems = _this$state.dropdownItems,
|
|
430
|
+
emojiPickerOpen = _this$state.emojiPickerOpen;
|
|
430
431
|
var _this$props5 = this.props,
|
|
431
432
|
isDisabled = _this$props5.isDisabled,
|
|
432
433
|
isReducedSpacing = _this$props5.isReducedSpacing;
|
|
@@ -444,7 +445,7 @@ var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
444
445
|
spacing: isReducedSpacing ? 'none' : 'default',
|
|
445
446
|
disabled: isDisabled || btn.isDisabled,
|
|
446
447
|
iconBefore: btn.elemBefore,
|
|
447
|
-
selected: btn.isActive,
|
|
448
|
+
selected: btn.value.name === 'emoji' && emojiPickerOpen || btn.isActive,
|
|
448
449
|
title: btn.title,
|
|
449
450
|
"aria-label": btn['aria-label'],
|
|
450
451
|
"aria-haspopup": btn['aria-haspopup'],
|
|
@@ -15,6 +15,8 @@ var _find = require("../utils/find");
|
|
|
15
15
|
var _selection = require("../utils/selection");
|
|
16
16
|
var _gapCursorSelection = require("../../selection/gap-cursor-selection");
|
|
17
17
|
var _featureFlagsContext = require("../../feature-flags-context");
|
|
18
|
+
var _analytics = require("../utils/analytics");
|
|
19
|
+
var _analytics2 = require("@atlaskit/editor-common/analytics");
|
|
18
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
20
22
|
var outdentListItemsSelected = function outdentListItemsSelected(tr, state) {
|
|
@@ -197,21 +199,53 @@ var extractListItemsRangeFromList = function extractListItemsRangeFromList(_ref3
|
|
|
197
199
|
}
|
|
198
200
|
var nextList = list.copy(_prosemirrorModel.Fragment.empty);
|
|
199
201
|
var featureFlags = (0, _featureFlagsContext.getFeatureFlags)(state);
|
|
202
|
+
var nextListStartNumber;
|
|
200
203
|
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
|
|
201
204
|
// if splitting a numbered list, keep the splitted item
|
|
202
205
|
// counter as the start of the next (second half) list (instead
|
|
203
206
|
// of reverting back to 1 as a starting number)
|
|
204
207
|
var order = (0, _utils.getOrderFromOrderedListNode)(list);
|
|
205
208
|
if (list.type.name === 'orderedList') {
|
|
209
|
+
nextListStartNumber = range.endIndex - 1 + order;
|
|
206
210
|
nextList.attrs = _objectSpread(_objectSpread({}, nextList.attrs), {}, {
|
|
207
|
-
order:
|
|
211
|
+
order: nextListStartNumber
|
|
208
212
|
});
|
|
213
|
+
var _getRestartListsAttri = (0, _analytics.getRestartListsAttributes)(tr),
|
|
214
|
+
splitListStartNumber = _getRestartListsAttri.splitListStartNumber;
|
|
215
|
+
if (typeof splitListStartNumber !== 'number') {
|
|
216
|
+
(0, _analytics.storeRestartListsAttributes)(tr, {
|
|
217
|
+
splitListStartNumber: nextListStartNumber
|
|
218
|
+
});
|
|
219
|
+
}
|
|
209
220
|
}
|
|
210
221
|
}
|
|
211
222
|
var nextListFragment = listItemContent.append(_prosemirrorModel.Fragment.from(nextList));
|
|
223
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
|
|
224
|
+
// if the split list with nextListStartNumber is below another list
|
|
225
|
+
// with order (e.g due to multi-level indent items being lifted), track the
|
|
226
|
+
// list above's order instead, as it will be the split list's order after sibling joins
|
|
227
|
+
nextListFragment.forEach(function (node, _offset, index) {
|
|
228
|
+
var _node$attrs;
|
|
229
|
+
if (node.type.name === 'orderedList' && ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.order) === nextListStartNumber) {
|
|
230
|
+
var _prev$attrs;
|
|
231
|
+
var prev = nextListFragment.child(index - 1);
|
|
232
|
+
if ((prev === null || prev === void 0 ? void 0 : (_prev$attrs = prev.attrs) === null || _prev$attrs === void 0 ? void 0 : _prev$attrs.order) >= 0) {
|
|
233
|
+
var _prev$attrs2;
|
|
234
|
+
(0, _analytics.storeRestartListsAttributes)(tr, {
|
|
235
|
+
splitListStartNumber: prev === null || prev === void 0 ? void 0 : (_prev$attrs2 = prev.attrs) === null || _prev$attrs2 === void 0 ? void 0 : _prev$attrs2.order
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
212
241
|
if (isTheEntireList) {
|
|
213
242
|
var slice = new _prosemirrorModel.Slice(listItemContent, 0, 0);
|
|
214
243
|
var step = new _prosemirrorTransform.ReplaceStep($start.pos - 1, range.end + 1, slice, false);
|
|
244
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
|
|
245
|
+
(0, _analytics.storeRestartListsAttributes)(tr, {
|
|
246
|
+
outdentScenario: undefined
|
|
247
|
+
});
|
|
248
|
+
}
|
|
215
249
|
tr.step(step);
|
|
216
250
|
} else if (isAtTop) {
|
|
217
251
|
var _slice = new _prosemirrorModel.Slice(nextListFragment, 0, 1);
|
|
@@ -222,6 +256,11 @@ var extractListItemsRangeFromList = function extractListItemsRangeFromList(_ref3
|
|
|
222
256
|
var _step2 = new _prosemirrorTransform.ReplaceStep($start.pos, listEnd + 1, _slice2, false);
|
|
223
257
|
tr.step(_step2);
|
|
224
258
|
} else {
|
|
259
|
+
if (featureFlags !== null && featureFlags !== void 0 && featureFlags.restartNumberedLists) {
|
|
260
|
+
(0, _analytics.storeRestartListsAttributes)(tr, {
|
|
261
|
+
outdentScenario: _analytics2.OUTDENT_SCENARIOS.SPLIT_LIST
|
|
262
|
+
});
|
|
263
|
+
}
|
|
225
264
|
var _slice3 = new _prosemirrorModel.Slice(nextListFragment, 1, 1);
|
|
226
265
|
var _step3 = new _prosemirrorTransform.ReplaceAroundStep($start.pos, listEnd, range.end, listEnd, _slice3, _slice3.size, false);
|
|
227
266
|
tr.step(_step3);
|