@atlaskit/editor-core 184.0.4 → 185.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +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/ElementBrowser/components/StatelessElementBrowser.js +5 -3
- 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/ElementBrowser/components/StatelessElementBrowser.js +5 -3
- 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/ElementBrowser/components/StatelessElementBrowser.js +5 -3
- 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-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/package.json +15 -10
- 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
|
@@ -13,8 +13,8 @@ import { ACTION, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
13
13
|
import PropTypes from 'prop-types';
|
|
14
14
|
import { Fragment } from 'prosemirror-model';
|
|
15
15
|
import React from 'react';
|
|
16
|
-
import nodeNames from '
|
|
17
|
-
import { isSupportedInParent } from '
|
|
16
|
+
import nodeNames from '@atlaskit/editor-common/messages';
|
|
17
|
+
import { isSupportedInParent } from '@atlaskit/editor-common/utils';
|
|
18
18
|
import { messages } from '../messages';
|
|
19
19
|
import { commandWithMetadata } from '@atlaskit/editor-common/card';
|
|
20
20
|
import { changeSelectedCardToLink, setSelectedCardAppearance } from '../pm-plugins/doc';
|
|
@@ -8,11 +8,11 @@ import { getToolbarConfig } from './toolbar';
|
|
|
8
8
|
import keymap from './pm-plugins/keymaps';
|
|
9
9
|
import ideUX from './pm-plugins/ide-ux';
|
|
10
10
|
import { codeBlockCopySelectionPlugin } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
11
|
-
import {
|
|
11
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
12
12
|
import { IconCode } from '../quick-insert/assets';
|
|
13
13
|
import { messages } from '../block-type/messages';
|
|
14
14
|
import refreshBrowserSelectionOnChange from './refresh-browser-selection';
|
|
15
|
-
var codeBlockPlugin = function codeBlockPlugin(options) {
|
|
15
|
+
var codeBlockPlugin = function codeBlockPlugin(options, api) {
|
|
16
16
|
return {
|
|
17
17
|
name: 'codeBlock',
|
|
18
18
|
nodes: function nodes() {
|
|
@@ -68,9 +68,10 @@ var codeBlockPlugin = function codeBlockPlugin(options) {
|
|
|
68
68
|
return /*#__PURE__*/React.createElement(IconCode, null);
|
|
69
69
|
},
|
|
70
70
|
action: function action(insert, state) {
|
|
71
|
+
var _api$dependencies$ana;
|
|
71
72
|
var schema = state.schema;
|
|
72
73
|
var tr = insert(schema.nodes.codeBlock.createChecked());
|
|
73
|
-
|
|
74
|
+
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({
|
|
74
75
|
action: ACTION.INSERTED,
|
|
75
76
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
76
77
|
actionSubjectId: ACTION_SUBJECT_ID.CODE_BLOCK,
|
|
@@ -78,11 +79,12 @@ var codeBlockPlugin = function codeBlockPlugin(options) {
|
|
|
78
79
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
79
80
|
},
|
|
80
81
|
eventType: EVENT_TYPE.TRACK
|
|
81
|
-
});
|
|
82
|
+
})(tr);
|
|
83
|
+
return tr;
|
|
82
84
|
}
|
|
83
85
|
}];
|
|
84
86
|
},
|
|
85
|
-
floatingToolbar: getToolbarConfig(options.allowCopyToClipboard)
|
|
87
|
+
floatingToolbar: getToolbarConfig(options.allowCopyToClipboard, api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration)
|
|
86
88
|
}
|
|
87
89
|
};
|
|
88
90
|
};
|
|
@@ -6,7 +6,6 @@ import { removeCodeBlock, changeLanguage, copyContentToClipboard, resetCopiedSta
|
|
|
6
6
|
import commonMessages from '../../messages';
|
|
7
7
|
import { codeBlockButtonMessages } from '@atlaskit/editor-common/messages';
|
|
8
8
|
import { provideVisualFeedbackForCopyButton, removeVisualFeedbackForCopyButton } from './pm-plugins/codeBlockCopySelectionPlugin';
|
|
9
|
-
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
10
9
|
import { pluginKey } from './plugin-key';
|
|
11
10
|
import { createLanguageList, getLanguageIdentifier, DEFAULT_LANGUAGES } from './language-list';
|
|
12
11
|
export var messages = defineMessages({
|
|
@@ -19,6 +18,7 @@ export var messages = defineMessages({
|
|
|
19
18
|
var languageList = createLanguageList(DEFAULT_LANGUAGES);
|
|
20
19
|
export var getToolbarConfig = function getToolbarConfig() {
|
|
21
20
|
var allowCopyToClipboard = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
21
|
+
var hoverDecoration = arguments.length > 1 ? arguments[1] : undefined;
|
|
22
22
|
return function (state, _ref) {
|
|
23
23
|
var _codeBlockState$pos, _node$attrs;
|
|
24
24
|
var formatMessage = _ref.formatMessage;
|
|
@@ -86,10 +86,10 @@ export var getToolbarConfig = function getToolbarConfig() {
|
|
|
86
86
|
type: 'button',
|
|
87
87
|
appearance: 'danger',
|
|
88
88
|
icon: RemoveIcon,
|
|
89
|
-
onMouseEnter: hoverDecoration(nodeType, true),
|
|
90
|
-
onMouseLeave: hoverDecoration(nodeType, false),
|
|
91
|
-
onFocus: hoverDecoration(nodeType, true),
|
|
92
|
-
onBlur: hoverDecoration(nodeType, false),
|
|
89
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
90
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
91
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
92
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
93
93
|
onClick: removeCodeBlock,
|
|
94
94
|
title: formatMessage(commonMessages.remove),
|
|
95
95
|
tabIndex: null
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { copyButtonPluginKey } from './pm-plugins/plugin-key';
|
|
2
|
-
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
3
2
|
import { NodeSelection } from 'prosemirror-state';
|
|
4
3
|
import { copyHTMLToClipboard, copyHTMLToClipboardPolyfill } from '../../utils/clipboard';
|
|
5
4
|
import { getSelectedNodeOrNodeParentByNodeType, toDOM } from './utils';
|
|
@@ -135,7 +134,7 @@ export var createToolbarCopyCommandForNode = function createToolbarCopyCommandFo
|
|
|
135
134
|
return true;
|
|
136
135
|
};
|
|
137
136
|
};
|
|
138
|
-
export var resetCopiedState = function resetCopiedState(nodeType, onMouseLeave) {
|
|
137
|
+
export var resetCopiedState = function resetCopiedState(nodeType, hoverDecoration, onMouseLeave) {
|
|
139
138
|
return function (state, dispatch) {
|
|
140
139
|
var customTr = state.tr;
|
|
141
140
|
|
|
@@ -144,7 +143,7 @@ export var resetCopiedState = function resetCopiedState(nodeType, onMouseLeave)
|
|
|
144
143
|
var customDispatch = function customDispatch(tr) {
|
|
145
144
|
customTr = tr;
|
|
146
145
|
};
|
|
147
|
-
onMouseLeave ? onMouseLeave(state, customDispatch) : hoverDecoration(nodeType, false)(state, customDispatch);
|
|
146
|
+
onMouseLeave ? onMouseLeave(state, customDispatch) : hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false)(state, customDispatch);
|
|
148
147
|
var copyButtonState = copyButtonPluginKey.getState(state);
|
|
149
148
|
if (copyButtonState !== null && copyButtonState !== void 0 && copyButtonState.copied) {
|
|
150
149
|
customTr.setMeta(copyButtonPluginKey, {
|
|
@@ -3,7 +3,6 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import CopyIcon from '@atlaskit/icon/glyph/copy';
|
|
5
5
|
import commonMessages from '../../messages';
|
|
6
|
-
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
7
6
|
import { createToolbarCopyCommandForNode, createToolbarCopyCommandForMark, resetCopiedState, getProvideMarkVisualFeedbackForCopyButtonCommand, removeMarkVisualFeedbackForCopyButtonCommand } from './commands';
|
|
8
7
|
import { copyButtonPluginKey } from './pm-plugins/plugin-key';
|
|
9
8
|
function isSeparator(item) {
|
|
@@ -12,7 +11,7 @@ function isSeparator(item) {
|
|
|
12
11
|
function isNodeOptions(options) {
|
|
13
12
|
return 'nodeType' in options && options.nodeType !== undefined;
|
|
14
13
|
}
|
|
15
|
-
export function getCopyButtonConfig(options) {
|
|
14
|
+
export function getCopyButtonConfig(options, hoverDecoration) {
|
|
16
15
|
var state = options.state,
|
|
17
16
|
formatMessage = options.formatMessage,
|
|
18
17
|
onMouseEnter = options.onMouseEnter,
|
|
@@ -26,12 +25,12 @@ export function getCopyButtonConfig(options) {
|
|
|
26
25
|
onClick: createToolbarCopyCommandForNode(options.nodeType),
|
|
27
26
|
// Note for future changes: these two handlers should perform
|
|
28
27
|
// the same action.
|
|
29
|
-
onMouseEnter: onMouseEnter || hoverDecoration(options.nodeType, true, 'ak-editor-selected-node'),
|
|
30
|
-
onFocus: onFocus || hoverDecoration(options.nodeType, true, 'ak-editor-selected-node'),
|
|
28
|
+
onMouseEnter: onMouseEnter || (hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(options.nodeType, true, 'ak-editor-selected-node')),
|
|
29
|
+
onFocus: onFocus || (hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(options.nodeType, true, 'ak-editor-selected-node')),
|
|
31
30
|
// Note for future changes: these two handlers should perform
|
|
32
31
|
// the same action.
|
|
33
|
-
onMouseLeave: resetCopiedState(options.nodeType, onMouseLeave),
|
|
34
|
-
onBlur: resetCopiedState(options.nodeType, onBlur)
|
|
32
|
+
onMouseLeave: resetCopiedState(options.nodeType, hoverDecoration, onMouseLeave),
|
|
33
|
+
onBlur: resetCopiedState(options.nodeType, hoverDecoration, onBlur)
|
|
35
34
|
};
|
|
36
35
|
} else {
|
|
37
36
|
buttonActionHandlers = {
|
|
@@ -72,7 +71,7 @@ export var showCopyButton = function showCopyButton(state) {
|
|
|
72
71
|
* else process copy button to standard floatingtoobarbutton
|
|
73
72
|
*/
|
|
74
73
|
export function processCopyButtonItems(state) {
|
|
75
|
-
return function (items) {
|
|
74
|
+
return function (items, hoverDecoration) {
|
|
76
75
|
return items.flatMap(function (item) {
|
|
77
76
|
switch (item.type) {
|
|
78
77
|
case 'copy-button':
|
|
@@ -80,7 +79,7 @@ export function processCopyButtonItems(state) {
|
|
|
80
79
|
return [];
|
|
81
80
|
}
|
|
82
81
|
return item === null || item === void 0 ? void 0 : item.items.map(function (copyButtonItem) {
|
|
83
|
-
return isSeparator(copyButtonItem) ? copyButtonItem : getCopyButtonConfig(copyButtonItem);
|
|
82
|
+
return isSeparator(copyButtonItem) ? copyButtonItem : getCopyButtonConfig(copyButtonItem, hoverDecoration);
|
|
84
83
|
});
|
|
85
84
|
default:
|
|
86
85
|
return [item];
|
|
@@ -38,7 +38,7 @@ var expandPlugin = function expandPlugin() {
|
|
|
38
38
|
}];
|
|
39
39
|
},
|
|
40
40
|
pluginsOptions: {
|
|
41
|
-
floatingToolbar: getToolbarConfig,
|
|
41
|
+
floatingToolbar: getToolbarConfig(api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration),
|
|
42
42
|
quickInsert: function quickInsert(_ref2) {
|
|
43
43
|
var formatMessage = _ref2.formatMessage;
|
|
44
44
|
if (options && options.allowInsertion !== true) {
|
|
@@ -1,47 +1,48 @@
|
|
|
1
1
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
2
2
|
import commonMessages from '../../messages';
|
|
3
3
|
import { deleteExpand } from './commands';
|
|
4
|
-
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
5
4
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
6
|
-
export var getToolbarConfig = function getToolbarConfig(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
type: 'copy-button',
|
|
5
|
+
export var getToolbarConfig = function getToolbarConfig(hoverDecoration) {
|
|
6
|
+
return function (state, _ref) {
|
|
7
|
+
var formatMessage = _ref.formatMessage;
|
|
8
|
+
var _getPluginState = getPluginState(state),
|
|
9
|
+
expandRef = _getPluginState.expandRef;
|
|
10
|
+
if (expandRef) {
|
|
11
|
+
var _state$schema$nodes = state.schema.nodes,
|
|
12
|
+
nestedExpand = _state$schema$nodes.nestedExpand,
|
|
13
|
+
expand = _state$schema$nodes.expand;
|
|
14
|
+
return {
|
|
15
|
+
title: 'Expand toolbar',
|
|
16
|
+
getDomRef: function getDomRef() {
|
|
17
|
+
return expandRef;
|
|
18
|
+
},
|
|
19
|
+
nodeType: [nestedExpand, expand],
|
|
20
|
+
offset: [0, 6],
|
|
23
21
|
items: [{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
type: 'copy-button',
|
|
23
|
+
items: [{
|
|
24
|
+
state: state,
|
|
25
|
+
formatMessage: formatMessage,
|
|
26
|
+
nodeType: [nestedExpand, expand]
|
|
27
|
+
}, {
|
|
28
|
+
type: 'separator'
|
|
29
|
+
}]
|
|
27
30
|
}, {
|
|
28
|
-
|
|
31
|
+
id: 'editor.expand.delete',
|
|
32
|
+
type: 'button',
|
|
33
|
+
appearance: 'danger',
|
|
34
|
+
focusEditoronEnter: true,
|
|
35
|
+
icon: RemoveIcon,
|
|
36
|
+
onClick: deleteExpand(),
|
|
37
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], true),
|
|
38
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], false),
|
|
39
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], true),
|
|
40
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration([nestedExpand, expand], false),
|
|
41
|
+
title: formatMessage(commonMessages.remove),
|
|
42
|
+
tabIndex: null
|
|
29
43
|
}]
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
focusEditoronEnter: true,
|
|
35
|
-
icon: RemoveIcon,
|
|
36
|
-
onClick: deleteExpand(),
|
|
37
|
-
onMouseEnter: hoverDecoration([nestedExpand, expand], true),
|
|
38
|
-
onMouseLeave: hoverDecoration([nestedExpand, expand], false),
|
|
39
|
-
onFocus: hoverDecoration([nestedExpand, expand], true),
|
|
40
|
-
onBlur: hoverDecoration([nestedExpand, expand], false),
|
|
41
|
-
title: formatMessage(commonMessages.remove),
|
|
42
|
-
tabIndex: null
|
|
43
|
-
}]
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
return;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
};
|
|
47
48
|
};
|
|
@@ -47,7 +47,7 @@ var extensionPlugin = function extensionPlugin() {
|
|
|
47
47
|
}];
|
|
48
48
|
},
|
|
49
49
|
pluginsOptions: {
|
|
50
|
-
floatingToolbar: getToolbarConfig(options.breakoutEnabled),
|
|
50
|
+
floatingToolbar: getToolbarConfig(options.breakoutEnabled, api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration),
|
|
51
51
|
contextPanel: getContextPanel(options.allowAutoSave, featureFlags)
|
|
52
52
|
}
|
|
53
53
|
};
|
|
@@ -7,7 +7,6 @@ import FullWidthIcon from '@atlaskit/icon/glyph/editor/media-full-width';
|
|
|
7
7
|
import WideIcon from '@atlaskit/icon/glyph/editor/media-wide';
|
|
8
8
|
import CenterIcon from '@atlaskit/icon/glyph/editor/media-center';
|
|
9
9
|
import commonMessages from '../../messages';
|
|
10
|
-
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
11
10
|
import { editExtension } from './actions';
|
|
12
11
|
import { getPluginState } from './pm-plugins/main';
|
|
13
12
|
import { getSelectedExtension } from './utils';
|
|
@@ -114,6 +113,7 @@ var editButton = function editButton(formatMessage, extensionState) {
|
|
|
114
113
|
};
|
|
115
114
|
export var getToolbarConfig = function getToolbarConfig() {
|
|
116
115
|
var breakoutEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
116
|
+
var hoverDecoration = arguments.length > 1 ? arguments[1] : undefined;
|
|
117
117
|
return function (state, intl) {
|
|
118
118
|
var formatMessage = intl.formatMessage;
|
|
119
119
|
var extensionState = getPluginState(state);
|
|
@@ -173,10 +173,10 @@ export var getToolbarConfig = function getToolbarConfig() {
|
|
|
173
173
|
icon: RemoveIcon,
|
|
174
174
|
appearance: 'danger',
|
|
175
175
|
onClick: removeExtension(),
|
|
176
|
-
onMouseEnter: hoverDecoration(nodeType, true),
|
|
177
|
-
onMouseLeave: hoverDecoration(nodeType, false),
|
|
178
|
-
onFocus: hoverDecoration(nodeType, true),
|
|
179
|
-
onBlur: hoverDecoration(nodeType, false),
|
|
176
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
177
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
178
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
179
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
180
180
|
focusEditoronEnter: true,
|
|
181
181
|
title: formatMessage(commonMessages.remove),
|
|
182
182
|
tabIndex: null,
|
|
@@ -194,7 +194,7 @@ var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
|
|
|
194
194
|
return null;
|
|
195
195
|
}
|
|
196
196
|
var customPositionCalculation;
|
|
197
|
-
var toolbarItems = processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node));
|
|
197
|
+
var toolbarItems = processCopyButtonItems(editorView.state)(Array.isArray(items) ? items : items(node), api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration);
|
|
198
198
|
if (onPositionCalculated) {
|
|
199
199
|
customPositionCalculation = function customPositionCalculation(nextPos) {
|
|
200
200
|
return onPositionCalculated(editorView, nextPos);
|
|
@@ -252,7 +252,8 @@ var floatingToolbarPlugin = function floatingToolbarPlugin(_, api) {
|
|
|
252
252
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
253
253
|
extensionsProvider: extensionsState === null || extensionsState === void 0 ? void 0 : extensionsState.extensionProvider,
|
|
254
254
|
scrollable: scrollable,
|
|
255
|
-
featureFlags: featureFlags
|
|
255
|
+
featureFlags: featureFlags,
|
|
256
|
+
api: api
|
|
256
257
|
})), /*#__PURE__*/React.createElement(ConfirmationModal, {
|
|
257
258
|
testId: "ak-floating-toolbar-confirmation-modal",
|
|
258
259
|
options: confirmDialogOptions,
|
|
@@ -33,7 +33,6 @@ import { EmojiPickerButton } from './EmojiPickerButton';
|
|
|
33
33
|
import Announcer from '../../../utils/announcer/announcer';
|
|
34
34
|
import { injectIntl } from 'react-intl-next';
|
|
35
35
|
import messages from './messages';
|
|
36
|
-
import { decorationStateKey, ACTIONS } from '../../base/pm-plugins/decoration';
|
|
37
36
|
import { clearHoverSelection } from '@atlaskit/editor-plugin-table/commands';
|
|
38
37
|
import ScrollButtons from './ScrollButtons';
|
|
39
38
|
import { ToolbarArrowKeyNavigationProvider } from '../../../ui/ToolbarArrowKeyNavigationProvider';
|
|
@@ -367,15 +366,14 @@ var Toolbar = /*#__PURE__*/function (_Component) {
|
|
|
367
366
|
value: function resetStyling(_ref4) {
|
|
368
367
|
var table = _ref4.table;
|
|
369
368
|
if (this.props.editorView) {
|
|
369
|
+
var _this$props$api;
|
|
370
370
|
var _this$props$editorVie2 = this.props.editorView,
|
|
371
371
|
state = _this$props$editorVie2.state,
|
|
372
372
|
dispatch = _this$props$editorVie2.dispatch;
|
|
373
373
|
if (table) {
|
|
374
374
|
return clearHoverSelection()(state, dispatch);
|
|
375
375
|
}
|
|
376
|
-
|
|
377
|
-
action: ACTIONS.DECORATION_REMOVE
|
|
378
|
-
}));
|
|
376
|
+
(_this$props$api = this.props.api) === null || _this$props$api === void 0 ? void 0 : _this$props$api.dependencies.decorations.actions.removeDecoration(state, dispatch);
|
|
379
377
|
}
|
|
380
378
|
}
|
|
381
379
|
}, {
|
|
@@ -4,12 +4,13 @@ import { default as createLayoutPlugin } from './pm-plugins/main';
|
|
|
4
4
|
import { buildToolbar } from './toolbar';
|
|
5
5
|
import { createDefaultLayoutSection } from './actions';
|
|
6
6
|
import { IconLayout } from '../quick-insert/assets';
|
|
7
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
7
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
9
9
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
10
10
|
export { pluginKey };
|
|
11
11
|
var layoutPlugin = function layoutPlugin() {
|
|
12
12
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
13
|
+
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
13
14
|
return {
|
|
14
15
|
name: 'layout',
|
|
15
16
|
nodes: function nodes() {
|
|
@@ -37,7 +38,8 @@ var layoutPlugin = function layoutPlugin() {
|
|
|
37
38
|
addSidebarLayouts = _ref.addSidebarLayouts,
|
|
38
39
|
allowSingleColumnLayout = _ref.allowSingleColumnLayout;
|
|
39
40
|
if (pos !== null) {
|
|
40
|
-
|
|
41
|
+
var _api$dependencies$dec;
|
|
42
|
+
return 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);
|
|
41
43
|
}
|
|
42
44
|
return undefined;
|
|
43
45
|
},
|
|
@@ -53,8 +55,9 @@ var layoutPlugin = function layoutPlugin() {
|
|
|
53
55
|
return /*#__PURE__*/React.createElement(IconLayout, null);
|
|
54
56
|
},
|
|
55
57
|
action: function action(insert, state) {
|
|
58
|
+
var _api$dependencies$ana, _api$dependencies$ana2;
|
|
56
59
|
var tr = insert(createDefaultLayoutSection(state));
|
|
57
|
-
|
|
60
|
+
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({
|
|
58
61
|
action: ACTION.INSERTED,
|
|
59
62
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
60
63
|
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
@@ -62,7 +65,8 @@ var layoutPlugin = function layoutPlugin() {
|
|
|
62
65
|
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
63
66
|
},
|
|
64
67
|
eventType: EVENT_TYPE.TRACK
|
|
65
|
-
});
|
|
68
|
+
})(tr);
|
|
69
|
+
return tr;
|
|
66
70
|
}
|
|
67
71
|
}];
|
|
68
72
|
}
|
|
@@ -10,7 +10,6 @@ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
|
10
10
|
import { toolbarMessages } from './toolbar-messages';
|
|
11
11
|
import commonMessages from '../../messages';
|
|
12
12
|
import { setPresetLayout, deleteActiveLayoutNode, getPresetLayout } from './actions';
|
|
13
|
-
import { hoverDecoration } from '../base/pm-plugins/decoration';
|
|
14
13
|
var LAYOUT_TYPES = [{
|
|
15
14
|
id: 'editor.layout.twoEquals',
|
|
16
15
|
type: 'two_equal',
|
|
@@ -57,7 +56,7 @@ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout) {
|
|
|
57
56
|
};
|
|
58
57
|
};
|
|
59
58
|
export var layoutToolbarTitle = 'Layout floating controls';
|
|
60
|
-
export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout) {
|
|
59
|
+
export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, hoverDecoration) {
|
|
61
60
|
var node = state.doc.nodeAt(pos);
|
|
62
61
|
if (node) {
|
|
63
62
|
var currentLayout = getPresetLayout(node);
|
|
@@ -74,10 +73,10 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
74
73
|
testId: commonMessages.remove.id,
|
|
75
74
|
title: intl.formatMessage(commonMessages.remove),
|
|
76
75
|
onClick: deleteActiveLayoutNode,
|
|
77
|
-
onMouseEnter: hoverDecoration(nodeType, true),
|
|
78
|
-
onMouseLeave: hoverDecoration(nodeType, false),
|
|
79
|
-
onFocus: hoverDecoration(nodeType, true),
|
|
80
|
-
onBlur: hoverDecoration(nodeType, false),
|
|
76
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
77
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
78
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
79
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
81
80
|
tabIndex: null
|
|
82
81
|
};
|
|
83
82
|
var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
@@ -10,7 +10,6 @@ import DownloadIcon from '@atlaskit/icon/glyph/download';
|
|
|
10
10
|
import { mediaFilmstripItemDOMSelector } from '@atlaskit/media-filmstrip';
|
|
11
11
|
import commonMessages from '../../../messages';
|
|
12
12
|
import { stateKey } from '../pm-plugins/plugin-key';
|
|
13
|
-
import { hoverDecoration } from '../../base/pm-plugins/decoration';
|
|
14
13
|
import { getLinkingToolbar, shouldShowMediaLinkToolbar } from './linking';
|
|
15
14
|
import buildLayoutButtons from '../../../ui/MediaAndEmbedsToolbar';
|
|
16
15
|
import { getMediaLinkingState } from '../pm-plugins/linking';
|
|
@@ -18,7 +17,7 @@ import { getPluginState as getMediaAltTextPluginState } from '../pm-plugins/alt-
|
|
|
18
17
|
import { altTextButton, getAltTextToolbar } from './alt-text';
|
|
19
18
|
import { showLinkingToolbar } from '../commands/linking';
|
|
20
19
|
import { LinkToolbarAppearance } from './linking-toolbar-appearance';
|
|
21
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID,
|
|
20
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
22
21
|
import { messages } from '@atlaskit/media-ui';
|
|
23
22
|
import { messages as cardMessages } from '../../card/messages';
|
|
24
23
|
import { FilePreviewItem } from './filePreviewItem';
|
|
@@ -41,7 +40,7 @@ var handleRemoveMediaGroup = function handleRemoveMediaGroup(state, dispatch) {
|
|
|
41
40
|
}
|
|
42
41
|
return true;
|
|
43
42
|
};
|
|
44
|
-
var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState) {
|
|
43
|
+
var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration) {
|
|
45
44
|
var mediaGroup = state.schema.nodes.mediaGroup;
|
|
46
45
|
var items = [{
|
|
47
46
|
id: 'editor.media.view.switcher',
|
|
@@ -104,17 +103,17 @@ var generateMediaCardFloatingToolbar = function generateMediaCardFloatingToolbar
|
|
|
104
103
|
appearance: 'danger',
|
|
105
104
|
focusEditoronEnter: true,
|
|
106
105
|
icon: RemoveIcon,
|
|
107
|
-
onMouseEnter: hoverDecoration(mediaGroup, true),
|
|
108
|
-
onMouseLeave: hoverDecoration(mediaGroup, false),
|
|
109
|
-
onFocus: hoverDecoration(mediaGroup, true),
|
|
110
|
-
onBlur: hoverDecoration(mediaGroup, false),
|
|
106
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
|
|
107
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
|
|
108
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, true),
|
|
109
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaGroup, false),
|
|
111
110
|
title: intl.formatMessage(commonMessages.remove),
|
|
112
111
|
onClick: handleRemoveMediaGroup,
|
|
113
112
|
testId: 'media-toolbar-remove-button'
|
|
114
113
|
}];
|
|
115
114
|
return items;
|
|
116
115
|
};
|
|
117
|
-
var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState) {
|
|
116
|
+
var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration) {
|
|
118
117
|
var mediaInline = state.schema.nodes.mediaInline;
|
|
119
118
|
var items = [{
|
|
120
119
|
id: 'editor.media.view.switcher',
|
|
@@ -177,17 +176,18 @@ var generateMediaInlineFloatingToolbar = function generateMediaInlineFloatingToo
|
|
|
177
176
|
appearance: 'danger',
|
|
178
177
|
focusEditoronEnter: true,
|
|
179
178
|
icon: RemoveIcon,
|
|
180
|
-
onMouseEnter: hoverDecoration(mediaInline, true),
|
|
181
|
-
onMouseLeave: hoverDecoration(mediaInline, false),
|
|
182
|
-
onFocus: hoverDecoration(mediaInline, true),
|
|
183
|
-
onBlur: hoverDecoration(mediaInline, false),
|
|
179
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
180
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
181
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, true),
|
|
182
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaInline, false),
|
|
184
183
|
title: intl.formatMessage(commonMessages.remove),
|
|
185
184
|
onClick: removeInlineCard,
|
|
186
185
|
testId: 'media-toolbar-remove-button'
|
|
187
186
|
}];
|
|
188
187
|
return items;
|
|
189
188
|
};
|
|
190
|
-
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState,
|
|
189
|
+
var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToolbar(state, intl, options, pluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags) {
|
|
190
|
+
var _pluginInjectionApi$d2;
|
|
191
191
|
var mediaSingle = state.schema.nodes.mediaSingle;
|
|
192
192
|
var allowResizing = options.allowResizing,
|
|
193
193
|
allowLinking = options.allowLinking,
|
|
@@ -224,7 +224,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
if (allowAdvancedToolBarOptions) {
|
|
227
|
-
toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle,
|
|
227
|
+
toolbarButtons = [].concat(_toConsumableArray(toolbarButtons), _toConsumableArray(buildLayoutButtons(state, intl, state.schema.nodes.mediaSingle, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.width, allowResizing, allowResizingInTables)));
|
|
228
228
|
if (toolbarButtons.length) {
|
|
229
229
|
toolbarButtons.push({
|
|
230
230
|
type: 'separator'
|
|
@@ -245,14 +245,16 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
245
245
|
};
|
|
246
246
|
var openLink = function openLink() {
|
|
247
247
|
if (editorView) {
|
|
248
|
-
var
|
|
248
|
+
var _pluginInjectionApi$d;
|
|
249
|
+
var tr = editorView.state.tr,
|
|
249
250
|
dispatch = editorView.dispatch;
|
|
250
|
-
|
|
251
|
+
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.attachAnalyticsEvent({
|
|
251
252
|
eventType: EVENT_TYPE.TRACK,
|
|
252
253
|
action: ACTION.VISITED,
|
|
253
254
|
actionSubject: ACTION_SUBJECT.MEDIA,
|
|
254
255
|
actionSubjectId: ACTION_SUBJECT_ID.LINK
|
|
255
|
-
}));
|
|
256
|
+
})(tr);
|
|
257
|
+
dispatch(tr);
|
|
256
258
|
return true;
|
|
257
259
|
}
|
|
258
260
|
};
|
|
@@ -276,16 +278,18 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
276
278
|
type: 'separator'
|
|
277
279
|
});
|
|
278
280
|
}
|
|
281
|
+
var _ref = (_pluginInjectionApi$d2 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d2 !== void 0 ? _pluginInjectionApi$d2 : {},
|
|
282
|
+
hoverDecoration = _ref.hoverDecoration;
|
|
279
283
|
var removeButton = {
|
|
280
284
|
id: 'editor.media.delete',
|
|
281
285
|
type: 'button',
|
|
282
286
|
appearance: 'danger',
|
|
283
287
|
focusEditoronEnter: true,
|
|
284
288
|
icon: RemoveIcon,
|
|
285
|
-
onMouseEnter: hoverDecoration(mediaSingle, true),
|
|
286
|
-
onMouseLeave: hoverDecoration(mediaSingle, false),
|
|
287
|
-
onFocus: hoverDecoration(mediaSingle, true),
|
|
288
|
-
onBlur: hoverDecoration(mediaSingle, false),
|
|
289
|
+
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
|
|
290
|
+
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
|
|
291
|
+
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, true),
|
|
292
|
+
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(mediaSingle, false),
|
|
289
293
|
title: intl.formatMessage(commonMessages.remove),
|
|
290
294
|
onClick: remove,
|
|
291
295
|
testId: 'media-toolbar-remove-button'
|
|
@@ -303,6 +307,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
303
307
|
return items;
|
|
304
308
|
};
|
|
305
309
|
export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
310
|
+
var _pluginInjectionApi$d3;
|
|
306
311
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
307
312
|
var pluginInjectionApi = arguments.length > 3 ? arguments[3] : undefined;
|
|
308
313
|
var _state$schema$nodes = state.schema.nodes,
|
|
@@ -318,6 +323,8 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
318
323
|
getEditorFeatureFlags = options.getEditorFeatureFlags;
|
|
319
324
|
var mediaPluginState = stateKey.getState(state);
|
|
320
325
|
var mediaLinkingState = getMediaLinkingState(state);
|
|
326
|
+
var _ref2 = (_pluginInjectionApi$d3 = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.dependencies.decorations.actions) !== null && _pluginInjectionApi$d3 !== void 0 ? _pluginInjectionApi$d3 : {},
|
|
327
|
+
hoverDecoration = _ref2.hoverDecoration;
|
|
321
328
|
if (!mediaPluginState) {
|
|
322
329
|
return;
|
|
323
330
|
}
|
|
@@ -356,21 +363,21 @@ export var floatingToolbar = function floatingToolbar(state, intl) {
|
|
|
356
363
|
var selector = mediaFilmstripItemDOMSelector(mediaOffset);
|
|
357
364
|
return (_mediaPluginState$ele = mediaPluginState.element) === null || _mediaPluginState$ele === void 0 ? void 0 : _mediaPluginState$ele.querySelector(selector);
|
|
358
365
|
};
|
|
359
|
-
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState);
|
|
366
|
+
items = generateMediaCardFloatingToolbar(state, intl, mediaPluginState, hoverDecoration);
|
|
360
367
|
} else if (allowMediaInline && selectedNodeType && selectedNodeType === mediaInline) {
|
|
361
368
|
baseToolbar.getDomRef = function () {
|
|
362
369
|
var _mediaPluginState$ele2;
|
|
363
370
|
var element = (_mediaPluginState$ele2 = mediaPluginState.element) === null || _mediaPluginState$ele2 === void 0 ? void 0 : _mediaPluginState$ele2.querySelector(".".concat(MediaInlineNodeSelector));
|
|
364
371
|
return element || mediaPluginState.element;
|
|
365
372
|
};
|
|
366
|
-
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState);
|
|
373
|
+
items = generateMediaInlineFloatingToolbar(state, intl, mediaPluginState, hoverDecoration);
|
|
367
374
|
} else {
|
|
368
375
|
baseToolbar.getDomRef = function () {
|
|
369
376
|
var _mediaPluginState$ele3;
|
|
370
377
|
var element = (_mediaPluginState$ele3 = mediaPluginState.element) === null || _mediaPluginState$ele3 === void 0 ? void 0 : _mediaPluginState$ele3.querySelector(".".concat(MediaSingleNodeSelector));
|
|
371
378
|
return element || mediaPluginState.element;
|
|
372
379
|
};
|
|
373
|
-
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi
|
|
380
|
+
items = generateMediaSingleFloatingToolbar(state, intl, options, mediaPluginState, mediaLinkingState, pluginInjectionApi, getEditorFeatureFlags);
|
|
374
381
|
}
|
|
375
382
|
return _objectSpread(_objectSpread({}, baseToolbar), {}, {
|
|
376
383
|
items: items,
|
|
@@ -29,6 +29,7 @@ var insertPanelType = function insertPanelType(panelAttributes, state) {
|
|
|
29
29
|
};
|
|
30
30
|
var panelPlugin = function panelPlugin() {
|
|
31
31
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32
|
+
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
32
33
|
return {
|
|
33
34
|
name: 'panel',
|
|
34
35
|
nodes: function nodes() {
|
|
@@ -149,7 +150,7 @@ var panelPlugin = function panelPlugin() {
|
|
|
149
150
|
return quickInsertOptions;
|
|
150
151
|
},
|
|
151
152
|
floatingToolbar: function floatingToolbar(state, intl, providerFactory) {
|
|
152
|
-
return getToolbarConfig(state, intl, options, providerFactory);
|
|
153
|
+
return getToolbarConfig(state, intl, options, providerFactory, api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration);
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
156
|
};
|