@atlaskit/editor-core 184.0.0 → 185.0.0
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/.eslintrc.js +7 -3
- package/CHANGELOG.md +44 -0
- package/dist/cjs/create-editor/feature-flags-from-props.js +1 -2
- package/dist/cjs/editor-next/index.js +41 -34
- package/dist/cjs/editor.js +30 -269
- package/dist/cjs/i18n/en_ZZ.js +32 -6
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/labs/next/presets/default.js +2 -1
- package/dist/cjs/plugins/base/index.js +0 -12
- package/dist/cjs/plugins/card/nodeviews/blockCard.js +7 -0
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +7 -0
- package/dist/cjs/plugins/card/nodeviews/inlineCard.js +5 -1
- package/dist/cjs/plugins/card/pm-plugins/doc.js +1 -2
- package/dist/cjs/plugins/card/toolbar.js +11 -9
- package/dist/cjs/plugins/card/ui/LinkToolbarAppearance.js +4 -4
- package/dist/cjs/plugins/code-block/index.js +7 -5
- package/dist/cjs/plugins/code-block/toolbar.js +5 -5
- package/dist/cjs/plugins/copy-button/commands.js +2 -3
- package/dist/cjs/plugins/copy-button/toolbar.js +7 -8
- package/dist/cjs/plugins/expand/index.js +1 -1
- package/dist/cjs/plugins/expand/toolbar.js +40 -39
- package/dist/cjs/plugins/extension/index.js +1 -1
- package/dist/cjs/plugins/extension/toolbar.js +5 -5
- package/dist/cjs/plugins/floating-toolbar/index.js +3 -2
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +2 -4
- package/dist/cjs/plugins/layout/index.js +8 -4
- package/dist/cjs/plugins/layout/toolbar.js +5 -6
- package/dist/cjs/plugins/media/toolbar/index.js +31 -24
- package/dist/cjs/plugins/panel/index.js +2 -1
- package/dist/cjs/plugins/panel/toolbar.js +7 -7
- package/dist/cjs/plugins/placeholder-text/index.js +7 -5
- package/dist/cjs/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
- package/dist/cjs/ui/CollapsedEditor/index.js +1 -2
- package/dist/cjs/ui/ColorPickerButton/index.js +2 -2
- package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +6 -10
- package/dist/cjs/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
- package/dist/cjs/ui/styles.js +6 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/create-editor/feature-flags-from-props.js +1 -2
- package/dist/es2019/editor-next/index.js +39 -30
- package/dist/es2019/editor.js +29 -232
- package/dist/es2019/i18n/en_ZZ.js +32 -6
- package/dist/es2019/index.js +1 -2
- package/dist/es2019/labs/next/presets/default.js +2 -1
- package/dist/es2019/plugins/base/index.js +0 -7
- package/dist/es2019/plugins/card/nodeviews/blockCard.js +8 -0
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +8 -0
- package/dist/es2019/plugins/card/nodeviews/inlineCard.js +5 -1
- package/dist/es2019/plugins/card/pm-plugins/doc.js +1 -2
- package/dist/es2019/plugins/card/toolbar.js +8 -6
- package/dist/es2019/plugins/card/ui/LinkToolbarAppearance.js +2 -2
- package/dist/es2019/plugins/code-block/index.js +7 -5
- package/dist/es2019/plugins/code-block/toolbar.js +5 -6
- package/dist/es2019/plugins/copy-button/commands.js +2 -3
- package/dist/es2019/plugins/copy-button/toolbar.js +7 -8
- package/dist/es2019/plugins/expand/index.js +1 -1
- package/dist/es2019/plugins/expand/toolbar.js +5 -6
- package/dist/es2019/plugins/extension/index.js +1 -1
- package/dist/es2019/plugins/extension/toolbar.js +5 -6
- package/dist/es2019/plugins/floating-toolbar/index.js +3 -2
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +2 -4
- package/dist/es2019/plugins/layout/index.js +8 -5
- package/dist/es2019/plugins/layout/toolbar.js +5 -6
- package/dist/es2019/plugins/media/toolbar/index.js +35 -24
- package/dist/es2019/plugins/panel/index.js +2 -2
- package/dist/es2019/plugins/panel/toolbar.js +7 -8
- package/dist/es2019/plugins/placeholder-text/index.js +7 -5
- package/dist/es2019/plugins/type-ahead/ui/TypeAheadPopup.js +21 -0
- package/dist/es2019/ui/CollapsedEditor/index.js +1 -2
- package/dist/es2019/ui/ColorPickerButton/index.js +2 -2
- package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +5 -10
- package/dist/es2019/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
- package/dist/es2019/ui/styles.js +6 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/create-editor/feature-flags-from-props.js +1 -2
- package/dist/esm/editor-next/index.js +42 -33
- package/dist/esm/editor.js +29 -270
- package/dist/esm/i18n/en_ZZ.js +32 -6
- package/dist/esm/index.js +1 -2
- package/dist/esm/labs/next/presets/default.js +2 -1
- package/dist/esm/plugins/base/index.js +0 -9
- package/dist/esm/plugins/card/nodeviews/blockCard.js +7 -0
- package/dist/esm/plugins/card/nodeviews/embedCard.js +7 -0
- package/dist/esm/plugins/card/nodeviews/inlineCard.js +5 -1
- package/dist/esm/plugins/card/pm-plugins/doc.js +1 -2
- package/dist/esm/plugins/card/toolbar.js +7 -6
- package/dist/esm/plugins/card/ui/LinkToolbarAppearance.js +2 -2
- package/dist/esm/plugins/code-block/index.js +7 -5
- package/dist/esm/plugins/code-block/toolbar.js +5 -5
- package/dist/esm/plugins/copy-button/commands.js +2 -3
- package/dist/esm/plugins/copy-button/toolbar.js +7 -8
- package/dist/esm/plugins/expand/index.js +1 -1
- package/dist/esm/plugins/expand/toolbar.js +40 -39
- package/dist/esm/plugins/extension/index.js +1 -1
- package/dist/esm/plugins/extension/toolbar.js +5 -5
- package/dist/esm/plugins/floating-toolbar/index.js +3 -2
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +2 -4
- package/dist/esm/plugins/layout/index.js +8 -4
- package/dist/esm/plugins/layout/toolbar.js +5 -6
- package/dist/esm/plugins/media/toolbar/index.js +31 -24
- package/dist/esm/plugins/panel/index.js +2 -1
- package/dist/esm/plugins/panel/toolbar.js +7 -7
- package/dist/esm/plugins/placeholder-text/index.js +7 -5
- package/dist/esm/plugins/type-ahead/ui/TypeAheadPopup.js +19 -0
- package/dist/esm/ui/CollapsedEditor/index.js +1 -2
- package/dist/esm/ui/ColorPickerButton/index.js +2 -2
- package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +5 -10
- package/dist/esm/ui/ElementBrowser/components/StatelessElementBrowser.js +5 -3
- package/dist/esm/ui/styles.js +6 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/editor-next/index.d.ts +0 -6
- package/dist/types/editor.d.ts +1 -137
- package/dist/types/i18n/en_ZZ.d.ts +28 -2
- package/dist/types/index.d.ts +0 -1
- package/dist/types/labs/next/presets/cxhtml.d.ts +106 -0
- package/dist/types/labs/next/presets/default.d.ts +212 -0
- package/dist/types/labs/next/presets/mobile.d.ts +106 -0
- package/dist/types/plugins/base/index.d.ts +0 -4
- package/dist/types/plugins/card/index.d.ts +2 -2
- package/dist/types/plugins/card/nodeviews/blockCard.d.ts +3 -0
- package/dist/types/plugins/card/nodeviews/embedCard.d.ts +3 -0
- package/dist/types/plugins/card/nodeviews/inlineCard.d.ts +1 -0
- package/dist/types/plugins/card/pm-plugins/doc.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/plugins/card/pm-plugins/main.d.ts +1 -2
- package/dist/types/plugins/card/toolbar.d.ts +1 -2
- package/dist/types/plugins/card/types.d.ts +1 -1
- package/dist/types/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
- package/dist/types/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
- package/dist/types/plugins/card/ui/types.d.ts +1 -1
- package/dist/types/plugins/code-block/index.d.ts +7 -1
- package/dist/types/plugins/code-block/toolbar.d.ts +2 -1
- package/dist/types/plugins/copy-button/commands.d.ts +2 -1
- package/dist/types/plugins/copy-button/toolbar.d.ts +3 -2
- package/dist/types/plugins/expand/index.d.ts +2 -1
- package/dist/types/plugins/expand/toolbar.d.ts +2 -1
- package/dist/types/plugins/extension/index.d.ts +7 -2
- package/dist/types/plugins/extension/toolbar.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/index.d.ts +2 -1
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
- package/dist/types/plugins/layout/index.d.ts +7 -1
- package/dist/types/plugins/layout/toolbar.d.ts +2 -1
- package/dist/types/plugins/media/index.d.ts +3 -1
- package/dist/types/plugins/panel/index.d.ts +2 -0
- package/dist/types/plugins/panel/toolbar.d.ts +3 -2
- package/dist/types/plugins/placeholder-text/index.d.ts +3 -1
- package/dist/types/ui/CollapsedEditor/index.d.ts +1 -2
- package/dist/types/ui/ColorPickerButton/index.d.ts +2 -2
- package/dist/types-ts4.5/editor-next/index.d.ts +0 -6
- package/dist/types-ts4.5/editor.d.ts +1 -137
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +28 -2
- package/dist/types-ts4.5/index.d.ts +0 -1
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +122 -0
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +244 -0
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +122 -0
- package/dist/types-ts4.5/plugins/base/index.d.ts +0 -4
- package/dist/types-ts4.5/plugins/card/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/card/nodeviews/blockCard.d.ts +3 -0
- package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +3 -0
- package/dist/types-ts4.5/plugins/card/nodeviews/inlineCard.d.ts +1 -0
- package/dist/types-ts4.5/plugins/card/pm-plugins/doc.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/pm-plugins/main.d.ts +1 -2
- package/dist/types-ts4.5/plugins/card/toolbar.d.ts +1 -2
- package/dist/types-ts4.5/plugins/card/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/EditLinkToolbar.d.ts +1 -2
- package/dist/types-ts4.5/plugins/card/ui/link-toolbar-button-group-options.d.ts +1 -1
- package/dist/types-ts4.5/plugins/card/ui/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/code-block/index.d.ts +7 -1
- package/dist/types-ts4.5/plugins/code-block/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/copy-button/commands.d.ts +2 -1
- package/dist/types-ts4.5/plugins/copy-button/toolbar.d.ts +3 -2
- package/dist/types-ts4.5/plugins/expand/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/expand/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +3 -1
- package/dist/types-ts4.5/plugins/layout/index.d.ts +7 -1
- package/dist/types-ts4.5/plugins/layout/toolbar.d.ts +2 -1
- package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/panel/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/panel/toolbar.d.ts +3 -2
- package/dist/types-ts4.5/plugins/placeholder-text/index.d.ts +5 -1
- package/dist/types-ts4.5/ui/CollapsedEditor/index.d.ts +1 -2
- package/dist/types-ts4.5/ui/ColorPickerButton/index.d.ts +2 -2
- package/package.json +23 -18
- package/report.api.md +5 -93
- package/dist/cjs/editor-next/editor-migration-component.js +0 -54
- package/dist/cjs/plugins/base/pm-plugins/decoration.js +0 -122
- package/dist/es2019/editor-next/editor-migration-component.js +0 -30
- package/dist/es2019/plugins/base/pm-plugins/decoration.js +0 -111
- package/dist/esm/editor-next/editor-migration-component.js +0 -47
- package/dist/esm/plugins/base/pm-plugins/decoration.js +0 -113
- package/dist/types/editor-next/editor-migration-component.d.ts +0 -6
- package/dist/types/plugins/base/pm-plugins/decoration.d.ts +0 -24
- package/dist/types-ts4.5/editor-next/editor-migration-component.d.ts +0 -6
- package/dist/types-ts4.5/plugins/base/pm-plugins/decoration.d.ts +0 -24
|
@@ -8,48 +8,49 @@ exports.getToolbarConfig = void 0;
|
|
|
8
8
|
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
9
9
|
var _messages = _interopRequireDefault(require("../../messages"));
|
|
10
10
|
var _commands = require("./commands");
|
|
11
|
-
var _decoration = require("../base/pm-plugins/decoration");
|
|
12
11
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
13
|
-
var getToolbarConfig = function getToolbarConfig(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
type: 'copy-button',
|
|
12
|
+
var getToolbarConfig = function getToolbarConfig(hoverDecoration) {
|
|
13
|
+
return function (state, _ref) {
|
|
14
|
+
var formatMessage = _ref.formatMessage;
|
|
15
|
+
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
16
|
+
expandRef = _getPluginState.expandRef;
|
|
17
|
+
if (expandRef) {
|
|
18
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
19
|
+
nestedExpand = _state$schema$nodes.nestedExpand,
|
|
20
|
+
expand = _state$schema$nodes.expand;
|
|
21
|
+
return {
|
|
22
|
+
title: 'Expand toolbar',
|
|
23
|
+
getDomRef: function getDomRef() {
|
|
24
|
+
return expandRef;
|
|
25
|
+
},
|
|
26
|
+
nodeType: [nestedExpand, expand],
|
|
27
|
+
offset: [0, 6],
|
|
30
28
|
items: [{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
type: 'copy-button',
|
|
30
|
+
items: [{
|
|
31
|
+
state: state,
|
|
32
|
+
formatMessage: formatMessage,
|
|
33
|
+
nodeType: [nestedExpand, expand]
|
|
34
|
+
}, {
|
|
35
|
+
type: 'separator'
|
|
36
|
+
}]
|
|
34
37
|
}, {
|
|
35
|
-
|
|
38
|
+
id: 'editor.expand.delete',
|
|
39
|
+
type: 'button',
|
|
40
|
+
appearance: 'danger',
|
|
41
|
+
focusEditoronEnter: true,
|
|
42
|
+
icon: _remove.default,
|
|
43
|
+
onClick: (0, _commands.deleteExpand)(),
|
|
44
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], true),
|
|
45
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], false),
|
|
46
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], true),
|
|
47
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], false),
|
|
48
|
+
title: formatMessage(_messages.default.remove),
|
|
49
|
+
tabIndex: null
|
|
36
50
|
}]
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
focusEditoronEnter: true,
|
|
42
|
-
icon: _remove.default,
|
|
43
|
-
onClick: (0, _commands.deleteExpand)(),
|
|
44
|
-
onMouseEnter: (0, _decoration.hoverDecoration)([nestedExpand, expand], true),
|
|
45
|
-
onMouseLeave: (0, _decoration.hoverDecoration)([nestedExpand, expand], false),
|
|
46
|
-
onFocus: (0, _decoration.hoverDecoration)([nestedExpand, expand], true),
|
|
47
|
-
onBlur: (0, _decoration.hoverDecoration)([nestedExpand, expand], false),
|
|
48
|
-
title: formatMessage(_messages.default.remove),
|
|
49
|
-
tabIndex: null
|
|
50
|
-
}]
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return;
|
|
54
|
+
};
|
|
54
55
|
};
|
|
55
56
|
exports.getToolbarConfig = getToolbarConfig;
|
|
@@ -54,7 +54,7 @@ var extensionPlugin = function extensionPlugin() {
|
|
|
54
54
|
}];
|
|
55
55
|
},
|
|
56
56
|
pluginsOptions: {
|
|
57
|
-
floatingToolbar: (0, _toolbar.getToolbarConfig)(options.breakoutEnabled),
|
|
57
|
+
floatingToolbar: (0, _toolbar.getToolbarConfig)(options.breakoutEnabled, api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration),
|
|
58
58
|
contextPanel: (0, _contextPanel.getContextPanel)(options.allowAutoSave, featureFlags)
|
|
59
59
|
}
|
|
60
60
|
};
|
|
@@ -14,7 +14,6 @@ var _mediaFullWidth = _interopRequireDefault(require("@atlaskit/icon/glyph/edito
|
|
|
14
14
|
var _mediaWide = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/media-wide"));
|
|
15
15
|
var _mediaCenter = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/media-center"));
|
|
16
16
|
var _messages = _interopRequireDefault(require("../../messages"));
|
|
17
|
-
var _decoration = require("../base/pm-plugins/decoration");
|
|
18
17
|
var _actions = require("./actions");
|
|
19
18
|
var _main = require("./pm-plugins/main");
|
|
20
19
|
var _utils = require("./utils");
|
|
@@ -122,6 +121,7 @@ var editButton = function editButton(formatMessage, extensionState) {
|
|
|
122
121
|
};
|
|
123
122
|
var getToolbarConfig = function getToolbarConfig() {
|
|
124
123
|
var breakoutEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
124
|
+
var hoverDecoration = arguments.length > 1 ? arguments[1] : undefined;
|
|
125
125
|
return function (state, intl) {
|
|
126
126
|
var formatMessage = intl.formatMessage;
|
|
127
127
|
var extensionState = (0, _main.getPluginState)(state);
|
|
@@ -181,10 +181,10 @@ var getToolbarConfig = function getToolbarConfig() {
|
|
|
181
181
|
icon: _remove.default,
|
|
182
182
|
appearance: 'danger',
|
|
183
183
|
onClick: (0, _commands.removeExtension)(),
|
|
184
|
-
onMouseEnter:
|
|
185
|
-
onMouseLeave:
|
|
186
|
-
onFocus:
|
|
187
|
-
onBlur:
|
|
184
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
185
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
186
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
187
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
188
188
|
focusEditoronEnter: true,
|
|
189
189
|
title: formatMessage(_messages.default.remove),
|
|
190
190
|
tabIndex: null,
|
|
@@ -201,7 +201,7 @@ var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
|
|
|
201
201
|
return null;
|
|
202
202
|
}
|
|
203
203
|
var customPositionCalculation;
|
|
204
|
-
var toolbarItems = (0, _toolbar.processCopyButtonItems)(editorView.state)(Array.isArray(items) ? items : items(node));
|
|
204
|
+
var toolbarItems = (0, _toolbar.processCopyButtonItems)(editorView.state)(Array.isArray(items) ? items : items(node), api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration);
|
|
205
205
|
if (onPositionCalculated) {
|
|
206
206
|
customPositionCalculation = function customPositionCalculation(nextPos) {
|
|
207
207
|
return onPositionCalculated(editorView, nextPos);
|
|
@@ -259,7 +259,8 @@ var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
|
|
|
259
259
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
260
260
|
extensionsProvider: extensionsState === null || extensionsState === void 0 ? void 0 : extensionsState.extensionProvider,
|
|
261
261
|
scrollable: scrollable,
|
|
262
|
-
featureFlags: featureFlags
|
|
262
|
+
featureFlags: featureFlags,
|
|
263
|
+
api: api
|
|
263
264
|
})), /*#__PURE__*/_react.default.createElement(_ConfirmationModal.ConfirmationModal, {
|
|
264
265
|
testId: "ak-floating-toolbar-confirmation-modal",
|
|
265
266
|
options: confirmDialogOptions,
|
|
@@ -36,7 +36,6 @@ var _EmojiPickerButton = require("./EmojiPickerButton");
|
|
|
36
36
|
var _announcer = _interopRequireDefault(require("../../../utils/announcer/announcer"));
|
|
37
37
|
var _reactIntlNext = require("react-intl-next");
|
|
38
38
|
var _messages = _interopRequireDefault(require("./messages"));
|
|
39
|
-
var _decoration = require("../../base/pm-plugins/decoration");
|
|
40
39
|
var _commands2 = require("@atlaskit/editor-plugin-table/commands");
|
|
41
40
|
var _ScrollButtons = _interopRequireDefault(require("./ScrollButtons"));
|
|
42
41
|
var _ToolbarArrowKeyNavigationProvider = require("../../../ui/ToolbarArrowKeyNavigationProvider");
|
|
@@ -378,15 +377,14 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
378
377
|
value: function resetStyling(_ref4) {
|
|
379
378
|
var table = _ref4.table;
|
|
380
379
|
if (this.props.editorView) {
|
|
380
|
+
var _this$props$api;
|
|
381
381
|
var _this$props$editorVie2 = this.props.editorView,
|
|
382
382
|
state = _this$props$editorVie2.state,
|
|
383
383
|
dispatch = _this$props$editorVie2.dispatch;
|
|
384
384
|
if (table) {
|
|
385
385
|
return (0, _commands2.clearHoverSelection)()(state, dispatch);
|
|
386
386
|
}
|
|
387
|
-
|
|
388
|
-
action: _decoration.ACTIONS.DECORATION_REMOVE
|
|
389
|
-
}));
|
|
387
|
+
(_this$props$api = this.props.api) === null || _this$props$api === void 0 ? void 0 : _this$props$api.dependencies.decorations.actions.removeDecoration(state, dispatch);
|
|
390
388
|
}
|
|
391
389
|
}
|
|
392
390
|
}, {
|
|
@@ -17,11 +17,12 @@ var _main = _interopRequireDefault(require("./pm-plugins/main"));
|
|
|
17
17
|
var _toolbar = require("./toolbar");
|
|
18
18
|
var _actions = require("./actions");
|
|
19
19
|
var _assets = require("../quick-insert/assets");
|
|
20
|
-
var _analytics = require("
|
|
20
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
21
21
|
var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
|
|
22
22
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
23
23
|
var layoutPlugin = function layoutPlugin() {
|
|
24
24
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
25
|
+
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
25
26
|
return {
|
|
26
27
|
name: 'layout',
|
|
27
28
|
nodes: function nodes() {
|
|
@@ -49,7 +50,8 @@ var layoutPlugin = function layoutPlugin() {
|
|
|
49
50
|
addSidebarLayouts = _ref.addSidebarLayouts,
|
|
50
51
|
allowSingleColumnLayout = _ref.allowSingleColumnLayout;
|
|
51
52
|
if (pos !== null) {
|
|
52
|
-
|
|
53
|
+
var _api$dependencies$dec;
|
|
54
|
+
return (0, _toolbar.buildToolbar)(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api === null || api === void 0 ? void 0 : (_api$dependencies$dec = api.dependencies.decorations.actions) === null || _api$dependencies$dec === void 0 ? void 0 : _api$dependencies$dec.hoverDecoration);
|
|
53
55
|
}
|
|
54
56
|
return undefined;
|
|
55
57
|
},
|
|
@@ -65,8 +67,9 @@ var layoutPlugin = function layoutPlugin() {
|
|
|
65
67
|
return /*#__PURE__*/_react.default.createElement(_assets.IconLayout, null);
|
|
66
68
|
},
|
|
67
69
|
action: function action(insert, state) {
|
|
70
|
+
var _api$dependencies$ana, _api$dependencies$ana2;
|
|
68
71
|
var tr = insert((0, _actions.createDefaultLayoutSection)(state));
|
|
69
|
-
|
|
72
|
+
api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : (_api$dependencies$ana2 = _api$dependencies$ana.actions) === null || _api$dependencies$ana2 === void 0 ? void 0 : _api$dependencies$ana2.attachAnalyticsEvent({
|
|
70
73
|
action: _analytics.ACTION.INSERTED,
|
|
71
74
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
72
75
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.LAYOUT,
|
|
@@ -74,7 +77,8 @@ var layoutPlugin = function layoutPlugin() {
|
|
|
74
77
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
75
78
|
},
|
|
76
79
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
77
|
-
});
|
|
80
|
+
})(tr);
|
|
81
|
+
return tr;
|
|
78
82
|
}
|
|
79
83
|
}];
|
|
80
84
|
}
|
|
@@ -17,7 +17,6 @@ var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove
|
|
|
17
17
|
var _toolbarMessages = require("./toolbar-messages");
|
|
18
18
|
var _messages = _interopRequireDefault(require("../../messages"));
|
|
19
19
|
var _actions = require("./actions");
|
|
20
|
-
var _decoration = require("../base/pm-plugins/decoration");
|
|
21
20
|
var LAYOUT_TYPES = [{
|
|
22
21
|
id: 'editor.layout.twoEquals',
|
|
23
22
|
type: 'two_equal',
|
|
@@ -65,7 +64,7 @@ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout) {
|
|
|
65
64
|
};
|
|
66
65
|
var layoutToolbarTitle = 'Layout floating controls';
|
|
67
66
|
exports.layoutToolbarTitle = layoutToolbarTitle;
|
|
68
|
-
var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout) {
|
|
67
|
+
var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, hoverDecoration) {
|
|
69
68
|
var node = state.doc.nodeAt(pos);
|
|
70
69
|
if (node) {
|
|
71
70
|
var currentLayout = (0, _actions.getPresetLayout)(node);
|
|
@@ -82,10 +81,10 @@ var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSi
|
|
|
82
81
|
testId: _messages.default.remove.id,
|
|
83
82
|
title: intl.formatMessage(_messages.default.remove),
|
|
84
83
|
onClick: _actions.deleteActiveLayoutNode,
|
|
85
|
-
onMouseEnter:
|
|
86
|
-
onMouseLeave:
|
|
87
|
-
onFocus:
|
|
88
|
-
onBlur:
|
|
84
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
85
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
86
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
87
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
89
88
|
tabIndex: null
|
|
90
89
|
};
|
|
91
90
|
var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
@@ -15,7 +15,6 @@ var _download = _interopRequireDefault(require("@atlaskit/icon/glyph/download"))
|
|
|
15
15
|
var _mediaFilmstrip = require("@atlaskit/media-filmstrip");
|
|
16
16
|
var _messages = _interopRequireDefault(require("../../../messages"));
|
|
17
17
|
var _pluginKey = require("../pm-plugins/plugin-key");
|
|
18
|
-
var _decoration = require("../../base/pm-plugins/decoration");
|
|
19
18
|
var _linking = require("./linking");
|
|
20
19
|
var _MediaAndEmbedsToolbar = _interopRequireDefault(require("../../../ui/MediaAndEmbedsToolbar"));
|
|
21
20
|
var _linking2 = require("../pm-plugins/linking");
|
|
@@ -23,7 +22,7 @@ var _altText = require("../pm-plugins/alt-text");
|
|
|
23
22
|
var _altText2 = require("./alt-text");
|
|
24
23
|
var _linking3 = require("../commands/linking");
|
|
25
24
|
var _linkingToolbarAppearance = require("./linking-toolbar-appearance");
|
|
26
|
-
var _analytics = require("
|
|
25
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
27
26
|
var _mediaUi = require("@atlaskit/media-ui");
|
|
28
27
|
var _messages2 = require("../../card/messages");
|
|
29
28
|
var _filePreviewItem = require("./filePreviewItem");
|
|
@@ -48,7 +47,7 @@ var handleRemoveMediaGroup = function handleRemoveMediaGroup(state, dispatch) {
|
|
|
48
47
|
}
|
|
49
48
|
return true;
|
|
50
49
|
};
|
|
51
|
-
var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState) {
|
|
50
|
+
var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration) {
|
|
52
51
|
var mediaGroup = state.schema.nodes.mediaGroup;
|
|
53
52
|
var items = [{
|
|
54
53
|
id: 'editor.media.view.switcher',
|
|
@@ -111,17 +110,17 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
111
110
|
appearance: 'danger',
|
|
112
111
|
focusEditoronEnter: true,
|
|
113
112
|
icon: _remove.default,
|
|
114
|
-
onMouseEnter:
|
|
115
|
-
onMouseLeave:
|
|
116
|
-
onFocus:
|
|
117
|
-
onBlur:
|
|
113
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
|
|
114
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
|
|
115
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
|
|
116
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
|
|
118
117
|
title: intl.formatMessage(_messages.default.remove),
|
|
119
118
|
onClick: handleRemoveMediaGroup,
|
|
120
119
|
testId: 'media-toolbar-remove-button'
|
|
121
120
|
}];
|
|
122
121
|
return items;
|
|
123
122
|
};
|
|
124
|
-
var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState) {
|
|
123
|
+
var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration) {
|
|
125
124
|
var mediaInline = state.schema.nodes.mediaInline;
|
|
126
125
|
var items = [{
|
|
127
126
|
id: 'editor.media.view.switcher',
|
|
@@ -184,17 +183,18 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
|
|
|
184
183
|
appearance: 'danger',
|
|
185
184
|
focusEditoronEnter: true,
|
|
186
185
|
icon: _remove.default,
|
|
187
|
-
onMouseEnter:
|
|
188
|
-
onMouseLeave:
|
|
189
|
-
onFocus:
|
|
190
|
-
onBlur:
|
|
186
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
187
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
188
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
189
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
191
190
|
title: intl.formatMessage(_messages.default.remove),
|
|
192
191
|
onClick: _commands.removeInlineCard,
|
|
193
192
|
testId: 'media-toolbar-remove-button'
|
|
194
193
|
}];
|
|
195
194
|
return items;
|
|
196
195
|
};
|
|
197
|
-
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState,
|
|
196
|
+
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags) {
|
|
197
|
+
var _pluginInjectionApi$d2;
|
|
198
198
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
199
199
|
var allowResizing = options.allowResizing,
|
|
200
200
|
allowLinking = options.allowLinking,
|
|
@@ -231,7 +231,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
233
|
if (allowAdvancedToolBarOptions) {
|
|
234
|
-
toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)((0, _MediaAndEmbedsToolbar.default)(state, intl, state.schema.nodes.mediaSingle,
|
|
234
|
+
toolbarButtons = [].concat((0, _toConsumableArray2.default)(toolbarButtons), (0, _toConsumableArray2.default)((0, _MediaAndEmbedsToolbar.default)(state, intl, state.schema.nodes.mediaSingle, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width, allowResizing, allowResizingInTables)));
|
|
235
235
|
if (toolbarButtons.length) {
|
|
236
236
|
toolbarButtons.push({
|
|
237
237
|
type: 'separator'
|
|
@@ -252,14 +252,16 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
252
252
|
};
|
|
253
253
|
var openLink = function openLink() {
|
|
254
254
|
if (editorView) {
|
|
255
|
-
var
|
|
255
|
+
var _pluginInjectionApi$d;
|
|
256
|
+
var tr = editorView.state.tr,
|
|
256
257
|
dispatch = editorView.dispatch;
|
|
257
|
-
|
|
258
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.attachAnalyticsEvent({
|
|
258
259
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
259
260
|
action: _analytics.ACTION.VISITED,
|
|
260
261
|
actionSubject: _analytics.ACTION_SUBJECT.MEDIA,
|
|
261
262
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.LINK
|
|
262
|
-
}));
|
|
263
|
+
})(tr);
|
|
264
|
+
dispatch(tr);
|
|
263
265
|
return true;
|
|
264
266
|
}
|
|
265
267
|
};
|
|
@@ -283,16 +285,18 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
283
285
|
type: 'separator'
|
|
284
286
|
});
|
|
285
287
|
}
|
|
288
|
+
var _ref = (_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : {},
|
|
289
|
+
hoverDecoration = _ref.hoverDecoration;
|
|
286
290
|
var removeButton = {
|
|
287
291
|
id: 'editor.media.delete',
|
|
288
292
|
type: 'button',
|
|
289
293
|
appearance: 'danger',
|
|
290
294
|
focusEditoronEnter: true,
|
|
291
295
|
icon: _remove.default,
|
|
292
|
-
onMouseEnter:
|
|
293
|
-
onMouseLeave:
|
|
294
|
-
onFocus:
|
|
295
|
-
onBlur:
|
|
296
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
|
|
297
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
|
|
298
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
|
|
299
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
|
|
296
300
|
title: intl.formatMessage(_messages.default.remove),
|
|
297
301
|
onClick: remove,
|
|
298
302
|
testId: 'media-toolbar-remove-button'
|
|
@@ -310,6 +314,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
310
314
|
return items;
|
|
311
315
|
};
|
|
312
316
|
var floatingToolbar = function floatingToolbar(state, intl) {
|
|
317
|
+
var _pluginInjectionApi$d3;
|
|
313
318
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
314
319
|
var pluginInjectionApi = arguments.length > 3 ? arguments[3] : undefined;
|
|
315
320
|
var _state$schema$nodes = state.schema.nodes,
|
|
@@ -325,6 +330,8 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
325
330
|
getEditorFeatureFlags = options.getEditorFeatureFlags;
|
|
326
331
|
var mediaPluginState = _pluginKey.stateKey.getState(state);
|
|
327
332
|
var mediaLinkingState = (0, _linking2.getMediaLinkingState)(state);
|
|
333
|
+
var _ref2 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
|
|
334
|
+
hoverDecoration = _ref2.hoverDecoration;
|
|
328
335
|
if (!mediaPluginState) {
|
|
329
336
|
return;
|
|
330
337
|
}
|
|
@@ -363,21 +370,21 @@ var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
363
370
|
var selector = (0, _mediaFilmstrip.mediaFilmstripItemDOMSelector)(mediaOffset);
|
|
364
371
|
return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
|
|
365
372
|
};
|
|
366
|
-
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState);
|
|
373
|
+
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration);
|
|
367
374
|
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
368
375
|
baseToolbar.getDomRef = function () {
|
|
369
376
|
var _mediaPluginState$ele2;
|
|
370
377
|
var element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(".".concat(_styles.MediaInlineNodeSelector));
|
|
371
378
|
return element || mediaPluginState.element;
|
|
372
379
|
};
|
|
373
|
-
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState);
|
|
380
|
+
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration);
|
|
374
381
|
} else {
|
|
375
382
|
baseToolbar.getDomRef = function () {
|
|
376
383
|
var _mediaPluginState$ele3;
|
|
377
384
|
var element = (_mediaPluginState$ele3 = mediaPluginState.element) === null || _mediaPluginState$ele3 === void 0 ? void 0 : _mediaPluginState$ele3.querySelector(".".concat(_styles.MediaSingleNodeSelector));
|
|
378
385
|
return element || mediaPluginState.element;
|
|
379
386
|
};
|
|
380
|
-
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi
|
|
387
|
+
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags);
|
|
381
388
|
}
|
|
382
389
|
return _objectSpread(_objectSpread({}, baseToolbar), {}, {
|
|
383
390
|
items: items,
|
|
@@ -36,6 +36,7 @@ var insertPanelType = function insertPanelType(panelAttributes, state) {
|
|
|
36
36
|
};
|
|
37
37
|
var panelPlugin = function panelPlugin() {
|
|
38
38
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
39
|
+
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
39
40
|
return {
|
|
40
41
|
name: 'panel',
|
|
41
42
|
nodes: function nodes() {
|
|
@@ -156,7 +157,7 @@ var panelPlugin = function panelPlugin() {
|
|
|
156
157
|
return quickInsertOptions;
|
|
157
158
|
},
|
|
158
159
|
floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
|
|
159
|
-
return (0, _toolbar.getToolbarConfig)(state, intl, options, providerFactory);
|
|
160
|
+
return (0, _toolbar.getToolbarConfig)(state, intl, options, providerFactory, api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration);
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
};
|
|
@@ -15,7 +15,6 @@ var _error = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/error")
|
|
|
15
15
|
var _removeEmoji = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove-emoji"));
|
|
16
16
|
var _messages = _interopRequireDefault(require("../../messages"));
|
|
17
17
|
var _actions = require("./actions");
|
|
18
|
-
var _decoration = require("../base/pm-plugins/decoration");
|
|
19
18
|
var _panelBackgroundPalette = require("../../ui/ColorPalette/Palettes/panelBackgroundPalette");
|
|
20
19
|
var _panel = require("@atlaskit/editor-common/panel");
|
|
21
20
|
var _utils = require("./utils");
|
|
@@ -47,7 +46,7 @@ var panelIconMap = (_panelIconMap = {}, (0, _defineProperty2.default)(_panelIcon
|
|
|
47
46
|
id: 'atlassian-tip'
|
|
48
47
|
}), _panelIconMap);
|
|
49
48
|
exports.panelIconMap = panelIconMap;
|
|
50
|
-
var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, activePanelType, activePanelColor, activePanelIcon, state) {
|
|
49
|
+
var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isCustomPanelEnabled, isCustomPanelEditable, providerFactory, hoverDecoration, activePanelType, activePanelColor, activePanelIcon, state) {
|
|
51
50
|
// TODO: ED-14403 investigate why these titles are not getting translated for the tooltips
|
|
52
51
|
var items = [{
|
|
53
52
|
id: 'editor.panel.info',
|
|
@@ -250,10 +249,10 @@ var getToolbarItems = function getToolbarItems(formatMessage, panelNodeType, isC
|
|
|
250
249
|
focusEditoronEnter: true,
|
|
251
250
|
icon: _remove.default,
|
|
252
251
|
onClick: (0, _actions.removePanel)(),
|
|
253
|
-
onMouseEnter:
|
|
254
|
-
onMouseLeave:
|
|
255
|
-
onFocus:
|
|
256
|
-
onBlur:
|
|
252
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, true),
|
|
253
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, false),
|
|
254
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, true),
|
|
255
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(panelNodeType, false),
|
|
257
256
|
title: formatMessage(_messages.default.remove),
|
|
258
257
|
tabIndex: null
|
|
259
258
|
});
|
|
@@ -263,6 +262,7 @@ exports.getToolbarItems = getToolbarItems;
|
|
|
263
262
|
var getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
264
263
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
265
264
|
var providerFactory = arguments.length > 3 ? arguments[3] : undefined;
|
|
265
|
+
var hoverDecoration = arguments.length > 4 ? arguments[4] : undefined;
|
|
266
266
|
var formatMessage = intl.formatMessage;
|
|
267
267
|
var panelObject = (0, _utils.findPanel)(state);
|
|
268
268
|
if (panelObject) {
|
|
@@ -276,7 +276,7 @@ var getToolbarConfig = function getToolbarConfig(state, intl) {
|
|
|
276
276
|
};
|
|
277
277
|
|
|
278
278
|
// force toolbar to be turned on
|
|
279
|
-
var items = getToolbarItems(formatMessage, nodeType, options.allowCustomPanel || false, options.allowCustomPanel && options.allowCustomPanelEdit || false, providerFactory, panelType, options.allowCustomPanel ? panelColor : undefined, options.allowCustomPanel ? panelIcon || isStandardPanel(panelType) : undefined, state);
|
|
279
|
+
var 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);
|
|
280
280
|
var getDomRef = function getDomRef(editorView) {
|
|
281
281
|
var domAtPos = editorView.domAtPos.bind(editorView);
|
|
282
282
|
var element = (0, _prosemirrorUtils.findDomRefAtPos)(panelObject.pos, domAtPos);
|
|
@@ -18,7 +18,7 @@ var _PlaceholderFloatingToolbar = _interopRequireDefault(require("./ui/Placehold
|
|
|
18
18
|
var _actions = require("./actions");
|
|
19
19
|
var _placeholderTextNodeview = require("./placeholder-text-nodeview");
|
|
20
20
|
var _pluginKey = require("./plugin-key");
|
|
21
|
-
var _analytics = require("
|
|
21
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
22
22
|
var _messages = require("../insert-block/ui/ToolbarInsertBlock/messages");
|
|
23
23
|
var _selectionUtils = require("./selection-utils");
|
|
24
24
|
var _api = require("../type-ahead/api");
|
|
@@ -194,7 +194,7 @@ var basePlaceholderTextPlugin = function basePlaceholderTextPlugin(options) {
|
|
|
194
194
|
}
|
|
195
195
|
};
|
|
196
196
|
};
|
|
197
|
-
var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options) {
|
|
197
|
+
var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, options, api) {
|
|
198
198
|
if (!options.allowInserting) {
|
|
199
199
|
return plugin;
|
|
200
200
|
}
|
|
@@ -213,11 +213,12 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
213
213
|
});
|
|
214
214
|
},
|
|
215
215
|
action: function action(insert, state) {
|
|
216
|
+
var _api$dependencies$ana;
|
|
216
217
|
var tr = state.tr;
|
|
217
218
|
tr.setMeta(_pluginKey.pluginKey, {
|
|
218
219
|
showInsertPanelAt: tr.selection.anchor
|
|
219
220
|
});
|
|
220
|
-
|
|
221
|
+
api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions.attachAnalyticsEvent({
|
|
221
222
|
action: _analytics.ACTION.INSERTED,
|
|
222
223
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
223
224
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.PLACEHOLDER_TEXT,
|
|
@@ -225,7 +226,8 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
225
226
|
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
226
227
|
},
|
|
227
228
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
228
|
-
});
|
|
229
|
+
})(tr);
|
|
230
|
+
return tr;
|
|
229
231
|
}
|
|
230
232
|
}];
|
|
231
233
|
}
|
|
@@ -233,7 +235,7 @@ var decorateWithPluginOptions = function decorateWithPluginOptions(plugin, optio
|
|
|
233
235
|
return plugin;
|
|
234
236
|
};
|
|
235
237
|
var placeholderTextPlugin = function placeholderTextPlugin(options, api) {
|
|
236
|
-
return decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options);
|
|
238
|
+
return decorateWithPluginOptions(basePlaceholderTextPlugin(options, api), options, api);
|
|
237
239
|
};
|
|
238
240
|
var _default = placeholderTextPlugin;
|
|
239
241
|
exports.default = _default;
|
|
@@ -181,6 +181,25 @@ var TypeAheadPopup = /*#__PURE__*/_react.default.memo(function (props) {
|
|
|
181
181
|
element === null || element === void 0 ? void 0 : element.removeEventListener('focusout', focusOut);
|
|
182
182
|
};
|
|
183
183
|
}, [ref, cancel]);
|
|
184
|
+
|
|
185
|
+
// ED-17443 When you press escape on typeahead panel, it should remove focus and close the panel
|
|
186
|
+
// This is the expected keyboard behaviour advised by the Accessibility team
|
|
187
|
+
(0, _react.useLayoutEffect)(function () {
|
|
188
|
+
var escape = function escape(event) {
|
|
189
|
+
if (event.key === 'Escape') {
|
|
190
|
+
cancel({
|
|
191
|
+
addPrefixTrigger: true,
|
|
192
|
+
setSelectionAt: _constants2.CloseSelectionOptions.AFTER_TEXT_INSERTED,
|
|
193
|
+
forceFocusOnEditor: true
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
var element = ref.current;
|
|
198
|
+
element === null || element === void 0 ? void 0 : element.addEventListener('keydown', escape);
|
|
199
|
+
return function () {
|
|
200
|
+
element === null || element === void 0 ? void 0 : element.removeEventListener('keydown', escape);
|
|
201
|
+
};
|
|
202
|
+
}, [ref, cancel]);
|
|
184
203
|
return (0, _react2.jsx)(_ui.Popup, {
|
|
185
204
|
zIndex: _editorSharedStyles.akEditorFloatingDialogZIndex,
|
|
186
205
|
target: anchorElement,
|
|
@@ -16,7 +16,6 @@ var _ui = require("@atlaskit/editor-common/ui");
|
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
17
|
var _editor = _interopRequireDefault(require("../../editor"));
|
|
18
18
|
var _editorNext = _interopRequireDefault(require("../../editor-next"));
|
|
19
|
-
var _editorMigrationComponent = _interopRequireDefault(require("../../editor-next/editor-migration-component"));
|
|
20
19
|
var _EditorWithActions = _interopRequireDefault(require("../../labs/EditorWithActions"));
|
|
21
20
|
var _ChromeCollapsed = _interopRequireDefault(require("../ChromeCollapsed"));
|
|
22
21
|
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); }; }
|
|
@@ -53,7 +52,7 @@ var CollapsedEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
53
52
|
value: function render() {
|
|
54
53
|
var _this2 = this;
|
|
55
54
|
var child = _react.default.Children.only(this.props.children);
|
|
56
|
-
if (child.type !== _editor.default && child.type !== _EditorWithActions.default && child.type !== _editorNext.default
|
|
55
|
+
if (child.type !== _editor.default && child.type !== _EditorWithActions.default && child.type !== _editorNext.default) {
|
|
57
56
|
throw new Error('Expected child to be of type `Editor`');
|
|
58
57
|
}
|
|
59
58
|
if (!this.props.isExpanded) {
|
|
@@ -166,8 +166,8 @@ var ColorPickerButton = function ColorPickerButton(props) {
|
|
|
166
166
|
};
|
|
167
167
|
var title = props.title || '';
|
|
168
168
|
var currentColor = props.currentColor && props.hexToPaletteColor ? props.hexToPaletteColor(props.currentColor) : props.currentColor;
|
|
169
|
-
var buttonStyle = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n padding: 6px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", "
|
|
170
|
-
!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", _common.DEFAULT_BORDER_COLOR, (0, _constants.borderRadius)(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) ||
|
|
169
|
+
var buttonStyle = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n padding: 6px;\n background-color: ", ";\n ", "\n &:before {\n display: flex;\n justify-content: center;\n align-items: center;\n align-self: center;\n content: '';\n border: 1px solid ", ";\n border-radius: ", "px;\n background-color: ", ";\n width: ", ";\n height: ", ";\n padding: 0;\n }\n "])), "var(--ds-background-neutral, transparent)", /* If custom props size height, override the button base height property */
|
|
170
|
+
!!((_props$size = props.size) !== null && _props$size !== void 0 && _props$size.height) && "height: inherit;", _common.DEFAULT_BORDER_COLOR, (0, _constants.borderRadius)(), currentColor || 'transparent', ((_props$size2 = props.size) === null || _props$size2 === void 0 ? void 0 : _props$size2.width) || '14px', ((_props$size3 = props.size) === null || _props$size3 === void 0 ? void 0 : _props$size3.height) || '14px');
|
|
171
171
|
return (0, _react2.jsx)("div", {
|
|
172
172
|
css: colorPickerButtonWrapper
|
|
173
173
|
}, (0, _react2.jsx)(_tooltip.default, {
|