@atlaskit/editor-core 189.3.18 → 189.3.20
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 +14 -0
- package/dist/cjs/actions/index.js +6 -5
- package/dist/cjs/plugins/avatar-group/index.js +3 -1
- package/dist/cjs/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +2 -1
- package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +2 -2
- package/dist/cjs/plugins/collab-edit/ui/avatars-with-plugin-state.js +5 -3
- package/dist/cjs/plugins/collab-edit/ui/avatars.js +1 -1
- package/dist/cjs/plugins/collab-edit/utils.js +2 -3
- package/dist/cjs/plugins/extension/actions.js +2 -3
- package/dist/cjs/plugins/extension/context-panel.js +117 -107
- package/dist/cjs/plugins/extension/extension-api.js +1 -1
- package/dist/cjs/plugins/extension/index.js +4 -1
- package/dist/cjs/plugins/extension/plugin-factory.js +2 -2
- package/dist/cjs/plugins/extension/pm-plugins/unique-id.js +2 -2
- package/dist/cjs/plugins/extension/toolbar.js +1 -1
- package/dist/cjs/plugins/extension/utils.js +4 -5
- package/dist/cjs/plugins/find-replace/plugin.js +3 -3
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/presets/default.js +0 -11
- package/dist/cjs/test-utils.js +1 -8
- package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +4 -3
- package/dist/cjs/ui/ContentStyles/index.js +4 -4
- package/dist/cjs/ui/ToolbarFeedback/index.js +2 -2
- package/dist/cjs/ui/WithHelpTrigger/index.js +2 -2
- package/dist/cjs/utils/nodes-by-localIds.js +1 -29
- package/dist/cjs/utils/selection.js +1 -15
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/actions/index.js +5 -4
- package/dist/es2019/plugins/avatar-group/index.js +3 -1
- package/dist/es2019/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +2 -1
- package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +1 -1
- package/dist/es2019/plugins/collab-edit/ui/avatars-with-plugin-state.js +5 -3
- package/dist/es2019/plugins/collab-edit/ui/avatars.js +1 -1
- package/dist/es2019/plugins/collab-edit/utils.js +2 -3
- package/dist/es2019/plugins/extension/actions.js +1 -2
- package/dist/es2019/plugins/extension/context-panel.js +55 -47
- package/dist/es2019/plugins/extension/extension-api.js +1 -1
- package/dist/es2019/plugins/extension/index.js +4 -1
- package/dist/es2019/plugins/extension/plugin-factory.js +1 -1
- package/dist/es2019/plugins/extension/pm-plugins/macro/actions.js +1 -2
- package/dist/es2019/plugins/extension/pm-plugins/unique-id.js +1 -1
- package/dist/es2019/plugins/extension/toolbar.js +1 -1
- package/dist/es2019/plugins/extension/utils.js +1 -2
- package/dist/es2019/plugins/find-replace/plugin.js +1 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/presets/default.js +0 -13
- package/dist/es2019/test-utils.js +0 -5
- package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +4 -3
- package/dist/es2019/ui/ContentStyles/index.js +1 -1
- package/dist/es2019/ui/ToolbarFeedback/index.js +1 -1
- package/dist/es2019/ui/WithHelpTrigger/index.js +1 -1
- package/dist/es2019/utils/nodes-by-localIds.js +0 -27
- package/dist/es2019/utils/selection.js +0 -14
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/actions/index.js +5 -4
- package/dist/esm/plugins/avatar-group/index.js +3 -1
- package/dist/esm/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +2 -1
- package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +1 -1
- package/dist/esm/plugins/collab-edit/ui/avatars-with-plugin-state.js +5 -3
- package/dist/esm/plugins/collab-edit/ui/avatars.js +1 -1
- package/dist/esm/plugins/collab-edit/utils.js +2 -3
- package/dist/esm/plugins/extension/actions.js +1 -2
- package/dist/esm/plugins/extension/context-panel.js +115 -105
- package/dist/esm/plugins/extension/extension-api.js +1 -1
- package/dist/esm/plugins/extension/index.js +4 -1
- package/dist/esm/plugins/extension/plugin-factory.js +1 -1
- package/dist/esm/plugins/extension/pm-plugins/macro/actions.js +1 -2
- package/dist/esm/plugins/extension/pm-plugins/unique-id.js +1 -1
- package/dist/esm/plugins/extension/toolbar.js +1 -1
- package/dist/esm/plugins/extension/utils.js +1 -2
- package/dist/esm/plugins/find-replace/plugin.js +1 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/presets/default.js +0 -11
- package/dist/esm/test-utils.js +0 -5
- package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +4 -3
- package/dist/esm/ui/ContentStyles/index.js +1 -1
- package/dist/esm/ui/ToolbarFeedback/index.js +1 -1
- package/dist/esm/ui/WithHelpTrigger/index.js +1 -1
- package/dist/esm/utils/nodes-by-localIds.js +0 -28
- package/dist/esm/utils/selection.js +0 -14
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/avatar-group/index.d.ts +3 -2
- package/dist/types/plugins/avatar-group/ui/AvatarGroupPluginWrapper.d.ts +2 -1
- package/dist/types/plugins/collab-edit/ui/avatars-with-plugin-state.d.ts +4 -0
- package/dist/types/plugins/collab-edit/ui/avatars.d.ts +2 -0
- package/dist/types/plugins/collab-edit/utils.d.ts +2 -1
- package/dist/types/plugins/extension/actions.d.ts +1 -1
- package/dist/types/plugins/extension/context-panel.d.ts +4 -2
- package/dist/types/plugins/extension/nodeviews/extension.d.ts +3 -4
- package/dist/types/plugins/extension/plugin-factory.d.ts +1 -1
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +2 -4
- package/dist/types/plugins/extension/ui/Extension/Extension/index.d.ts +2 -3
- package/dist/types/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -3
- package/dist/types/plugins/extension/ui/Extension/index.d.ts +2 -3
- package/dist/types/plugins/extension/utils.d.ts +1 -2
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/test-utils.d.ts +1 -2
- package/dist/types/ui/Appearance/FullPage/FullPageContentArea.d.ts +1 -1
- package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +2 -2
- package/dist/types/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types/utils/document.d.ts +1 -1
- package/dist/types/utils/nodes-by-localIds.d.ts +0 -5
- package/dist/types/utils/selection.d.ts +1 -3
- package/dist/types-ts4.5/plugins/avatar-group/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/avatar-group/ui/AvatarGroupPluginWrapper.d.ts +2 -1
- package/dist/types-ts4.5/plugins/collab-edit/ui/avatars-with-plugin-state.d.ts +4 -0
- package/dist/types-ts4.5/plugins/collab-edit/ui/avatars.d.ts +2 -0
- package/dist/types-ts4.5/plugins/collab-edit/utils.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/actions.d.ts +1 -1
- package/dist/types-ts4.5/plugins/extension/context-panel.d.ts +4 -2
- package/dist/types-ts4.5/plugins/extension/nodeviews/extension.d.ts +3 -4
- package/dist/types-ts4.5/plugins/extension/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +2 -4
- package/dist/types-ts4.5/plugins/extension/ui/Extension/Extension/index.d.ts +2 -3
- package/dist/types-ts4.5/plugins/extension/ui/Extension/ExtensionComponent.d.ts +2 -3
- package/dist/types-ts4.5/plugins/extension/ui/Extension/index.d.ts +2 -3
- package/dist/types-ts4.5/plugins/extension/utils.d.ts +1 -2
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/test-utils.d.ts +1 -2
- package/dist/types-ts4.5/ui/Appearance/FullPage/FullPageContentArea.d.ts +1 -1
- package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
- package/dist/types-ts4.5/ui/ConfigPanel/ConfigPanelFieldsLoader.d.ts +2 -2
- package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
- package/dist/types-ts4.5/utils/document.d.ts +1 -1
- package/dist/types-ts4.5/utils/nodes-by-localIds.d.ts +0 -5
- package/dist/types-ts4.5/utils/selection.d.ts +1 -3
- package/package.json +5 -8
- package/dist/cjs/plugins/analytics/consts.js +0 -10
- package/dist/cjs/plugins/analytics/index.js +0 -16
- package/dist/cjs/plugins/analytics/plugin-key.js +0 -14
- package/dist/cjs/plugins/analytics/plugin.js +0 -131
- package/dist/cjs/plugins/analytics/types/dispatch-analytics-event.js +0 -5
- package/dist/cjs/plugins/analytics/types/enums.js +0 -54
- package/dist/cjs/plugins/analytics/types/events.js +0 -5
- package/dist/cjs/plugins/analytics/types/extension-events.js +0 -24
- package/dist/cjs/plugins/analytics/types/general-events.js +0 -30
- package/dist/cjs/plugins/analytics/types/index.js +0 -128
- package/dist/cjs/plugins/analytics/types/inline-comment-events.js +0 -12
- package/dist/cjs/plugins/analytics/types/link-tool-bar-events.js +0 -5
- package/dist/cjs/plugins/analytics/types/media-events.js +0 -5
- package/dist/cjs/plugins/analytics/types/node-events.js +0 -18
- package/dist/cjs/plugins/analytics/utils.js +0 -35
- package/dist/cjs/utils/step.js +0 -24
- package/dist/es2019/plugins/analytics/consts.js +0 -4
- package/dist/es2019/plugins/analytics/index.js +0 -3
- package/dist/es2019/plugins/analytics/plugin-key.js +0 -9
- package/dist/es2019/plugins/analytics/plugin.js +0 -111
- package/dist/es2019/plugins/analytics/types/dispatch-analytics-event.js +0 -1
- package/dist/es2019/plugins/analytics/types/enums.js +0 -1
- package/dist/es2019/plugins/analytics/types/events.js +0 -1
- package/dist/es2019/plugins/analytics/types/extension-events.js +0 -1
- package/dist/es2019/plugins/analytics/types/general-events.js +0 -1
- package/dist/es2019/plugins/analytics/types/index.js +0 -3
- package/dist/es2019/plugins/analytics/types/inline-comment-events.js +0 -1
- package/dist/es2019/plugins/analytics/types/link-tool-bar-events.js +0 -1
- package/dist/es2019/plugins/analytics/types/media-events.js +0 -1
- package/dist/es2019/plugins/analytics/types/node-events.js +0 -1
- package/dist/es2019/plugins/analytics/utils.js +0 -28
- package/dist/es2019/utils/step.js +0 -1
- package/dist/esm/plugins/analytics/consts.js +0 -4
- package/dist/esm/plugins/analytics/index.js +0 -3
- package/dist/esm/plugins/analytics/plugin-key.js +0 -9
- package/dist/esm/plugins/analytics/plugin.js +0 -123
- package/dist/esm/plugins/analytics/types/dispatch-analytics-event.js +0 -1
- package/dist/esm/plugins/analytics/types/enums.js +0 -1
- package/dist/esm/plugins/analytics/types/events.js +0 -1
- package/dist/esm/plugins/analytics/types/extension-events.js +0 -1
- package/dist/esm/plugins/analytics/types/general-events.js +0 -1
- package/dist/esm/plugins/analytics/types/index.js +0 -3
- package/dist/esm/plugins/analytics/types/inline-comment-events.js +0 -1
- package/dist/esm/plugins/analytics/types/link-tool-bar-events.js +0 -1
- package/dist/esm/plugins/analytics/types/media-events.js +0 -1
- package/dist/esm/plugins/analytics/types/node-events.js +0 -1
- package/dist/esm/plugins/analytics/utils.js +0 -29
- package/dist/esm/utils/step.js +0 -1
- package/dist/types/plugins/analytics/consts.d.ts +0 -3
- package/dist/types/plugins/analytics/index.d.ts +0 -3
- package/dist/types/plugins/analytics/plugin-key.d.ts +0 -8
- package/dist/types/plugins/analytics/plugin.d.ts +0 -26
- package/dist/types/plugins/analytics/types/dispatch-analytics-event.d.ts +0 -1
- package/dist/types/plugins/analytics/types/enums.d.ts +0 -1
- package/dist/types/plugins/analytics/types/events.d.ts +0 -1
- package/dist/types/plugins/analytics/types/extension-events.d.ts +0 -2
- package/dist/types/plugins/analytics/types/general-events.d.ts +0 -2
- package/dist/types/plugins/analytics/types/index.d.ts +0 -9
- package/dist/types/plugins/analytics/types/inline-comment-events.d.ts +0 -2
- package/dist/types/plugins/analytics/types/link-tool-bar-events.d.ts +0 -1
- package/dist/types/plugins/analytics/types/media-events.d.ts +0 -1
- package/dist/types/plugins/analytics/types/node-events.d.ts +0 -2
- package/dist/types/plugins/analytics/utils.d.ts +0 -11
- package/dist/types/utils/step.d.ts +0 -1
- package/dist/types-ts4.5/plugins/analytics/consts.d.ts +0 -3
- package/dist/types-ts4.5/plugins/analytics/index.d.ts +0 -3
- package/dist/types-ts4.5/plugins/analytics/plugin-key.d.ts +0 -8
- package/dist/types-ts4.5/plugins/analytics/plugin.d.ts +0 -29
- package/dist/types-ts4.5/plugins/analytics/types/dispatch-analytics-event.d.ts +0 -1
- package/dist/types-ts4.5/plugins/analytics/types/enums.d.ts +0 -1
- package/dist/types-ts4.5/plugins/analytics/types/events.d.ts +0 -1
- package/dist/types-ts4.5/plugins/analytics/types/extension-events.d.ts +0 -2
- package/dist/types-ts4.5/plugins/analytics/types/general-events.d.ts +0 -2
- package/dist/types-ts4.5/plugins/analytics/types/index.d.ts +0 -9
- package/dist/types-ts4.5/plugins/analytics/types/inline-comment-events.d.ts +0 -2
- package/dist/types-ts4.5/plugins/analytics/types/link-tool-bar-events.d.ts +0 -1
- package/dist/types-ts4.5/plugins/analytics/types/media-events.d.ts +0 -1
- package/dist/types-ts4.5/plugins/analytics/types/node-events.d.ts +0 -2
- package/dist/types-ts4.5/plugins/analytics/utils.d.ts +0 -11
- package/dist/types-ts4.5/utils/step.d.ts +0 -1
- /package/dist/cjs/{plugins/extension/ui/styles.js → ui/ContentStyles/extension.js} +0 -0
- /package/dist/es2019/{plugins/extension/ui/styles.js → ui/ContentStyles/extension.js} +0 -0
- /package/dist/esm/{plugins/extension/ui/styles.js → ui/ContentStyles/extension.js} +0 -0
- /package/dist/types/{plugins/extension/ui/styles.d.ts → ui/ContentStyles/extension.d.ts} +0 -0
- /package/dist/types-ts4.5/{plugins/extension/ui/styles.d.ts → ui/ContentStyles/extension.d.ts} +0 -0
|
@@ -2,12 +2,7 @@ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
|
2
2
|
import { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
3
3
|
import { createSchema } from './create-editor/create-schema';
|
|
4
4
|
import { sortByOrder } from './create-editor/sort-by-order';
|
|
5
|
-
import { analyticsPluginKey } from './plugins/analytics/plugin-key';
|
|
6
5
|
import { basePlugin } from '@atlaskit/editor-plugin-base';
|
|
7
|
-
export function getFireAnalytics(editorView) {
|
|
8
|
-
var _analyticsPluginKey$g;
|
|
9
|
-
return analyticsPluginKey === null || analyticsPluginKey === void 0 ? void 0 : (_analyticsPluginKey$g = analyticsPluginKey.getState(editorView.state)) === null || _analyticsPluginKey$g === void 0 ? void 0 : _analyticsPluginKey$g.fireAnalytics;
|
|
10
|
-
}
|
|
11
6
|
function lightProcessPluginsList(editorPlugins) {
|
|
12
7
|
/**
|
|
13
8
|
* First pass to collect pluginsOptions
|
|
@@ -13,7 +13,7 @@ import { fullPageMessages as messages } from '@atlaskit/editor-common/messages';
|
|
|
13
13
|
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
14
14
|
import { usePresetContext } from '../../../presets/context';
|
|
15
15
|
export const EditorToolbar = /*#__PURE__*/React.memo(props => {
|
|
16
|
-
var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$collabEdit, _props$collabEdit2, _props$collabEdit3, _editorAPI$analytics;
|
|
16
|
+
var _props$featureFlags, _props$featureFlags2, _props$featureFlags3, _props$collabEdit, _props$collabEdit2, _props$collabEdit3, _editorAPI$analytics, _editorAPI$analytics2;
|
|
17
17
|
const [shouldSplitToolbar, setShouldSplitToolbar] = useState(false);
|
|
18
18
|
const editorAPI = usePresetContext();
|
|
19
19
|
|
|
@@ -54,7 +54,8 @@ export const EditorToolbar = /*#__PURE__*/React.memo(props => {
|
|
|
54
54
|
inviteToEditComponent: (_props$collabEdit = props.collabEdit) === null || _props$collabEdit === void 0 ? void 0 : _props$collabEdit.inviteToEditComponent,
|
|
55
55
|
inviteToEditHandler: (_props$collabEdit2 = props.collabEdit) === null || _props$collabEdit2 === void 0 ? void 0 : _props$collabEdit2.inviteToEditHandler,
|
|
56
56
|
isInviteToEditButtonSelected: (_props$collabEdit3 = props.collabEdit) === null || _props$collabEdit3 === void 0 ? void 0 : _props$collabEdit3.isInviteToEditButtonSelected,
|
|
57
|
-
featureFlags: props.featureFlags || {}
|
|
57
|
+
featureFlags: props.featureFlags || {},
|
|
58
|
+
editorAnalyticsAPI: editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$analytics = editorAPI.analytics) === null || _editorAPI$analytics === void 0 ? void 0 : _editorAPI$analytics.actions
|
|
58
59
|
}), editorAPI !== null && editorAPI !== void 0 && editorAPI.findReplace && twoLineEditorToolbar ? jsx(FindReplaceToolbarButtonWithState, {
|
|
59
60
|
popupsBoundariesElement: props.popupsBoundariesElement,
|
|
60
61
|
popupsMountPoint: props.popupsMountPoint,
|
|
@@ -63,7 +64,7 @@ export const EditorToolbar = /*#__PURE__*/React.memo(props => {
|
|
|
63
64
|
containerElement: props.containerElement,
|
|
64
65
|
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
65
66
|
featureFlags: props.featureFlags,
|
|
66
|
-
editorAnalyticsAPI: editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$
|
|
67
|
+
editorAnalyticsAPI: editorAPI === null || editorAPI === void 0 ? void 0 : (_editorAPI$analytics2 = editorAPI.analytics) === null || _editorAPI$analytics2 === void 0 ? void 0 : _editorAPI$analytics2.actions
|
|
67
68
|
}) : null, !!props.customPrimaryToolbarComponents && 'after' in props.customPrimaryToolbarComponents ? props.customPrimaryToolbarComponents.after : props.customPrimaryToolbarComponents);
|
|
68
69
|
useEffect(() => {
|
|
69
70
|
if (twoLineEditorToolbar) {
|
|
@@ -13,7 +13,7 @@ import { mediaStyles } from './media';
|
|
|
13
13
|
import { layoutStyles } from './layout';
|
|
14
14
|
import { panelStyles } from './panel';
|
|
15
15
|
import { placeholderTextStyles } from '@atlaskit/editor-plugin-placeholder-text/styles';
|
|
16
|
-
import { extensionStyles } from '
|
|
16
|
+
import { extensionStyles } from './extension';
|
|
17
17
|
import { expandStyles } from './expand';
|
|
18
18
|
import { MediaSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
19
19
|
import { findReplaceStyles } from '../../plugins/find-replace/styles';
|
|
@@ -17,7 +17,7 @@ import { createDispatch } from '../../event-dispatcher';
|
|
|
17
17
|
import { openFeedbackDialog } from '../../plugins/feedback-dialog';
|
|
18
18
|
import deprecationWarnings from '../../utils/deprecation-warnings';
|
|
19
19
|
import pickBy from '../../utils/pick-by';
|
|
20
|
-
import { analyticsEventKey } from '
|
|
20
|
+
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
21
21
|
import { usePresetContext } from '../../presets/context';
|
|
22
22
|
const PopupWithOutsideListeners = withOuterListeners(Popup);
|
|
23
23
|
const POPUP_HEIGHT = 388;
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { createDispatch } from '../../event-dispatcher';
|
|
6
|
-
import { analyticsEventKey } from '
|
|
6
|
+
import { analyticsEventKey } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { deprecatedOpenHelpCommand } from '@atlaskit/editor-plugin-help-dialog';
|
|
8
8
|
export default class WithHelpTrigger extends React.Component {
|
|
9
9
|
constructor(...args) {
|
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
export const findNodePosByLocalIds = (state, ids, option = {}) => {
|
|
2
|
-
var _state$doc$attrs;
|
|
3
|
-
if (ids.length === 0) {
|
|
4
|
-
return [];
|
|
5
|
-
}
|
|
6
|
-
const nodes = [];
|
|
7
|
-
const localIdSet = new Set(ids);
|
|
8
|
-
if (option.includeDocNode && localIdSet.has((_state$doc$attrs = state.doc.attrs) === null || _state$doc$attrs === void 0 ? void 0 : _state$doc$attrs.localId)) {
|
|
9
|
-
nodes.push({
|
|
10
|
-
node: state.doc,
|
|
11
|
-
pos: 0
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
state.doc.descendants((node, pos) => {
|
|
15
|
-
var _node$attrs;
|
|
16
|
-
if (localIdSet.has((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId)) {
|
|
17
|
-
nodes.push({
|
|
18
|
-
node,
|
|
19
|
-
pos
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// stop traversing once we found all the nodes
|
|
24
|
-
return localIdSet.size !== nodes.length;
|
|
25
|
-
});
|
|
26
|
-
return nodes;
|
|
27
|
-
};
|
|
28
1
|
export const findNodePosByFragmentLocalIds = (state, ids) => {
|
|
29
2
|
if (ids.length === 0) {
|
|
30
3
|
return [];
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
2
|
-
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
4
1
|
export { setNodeSelection, setTextSelection, setAllSelection, setCellSelection } from '@atlaskit/editor-common/utils';
|
|
5
2
|
|
|
6
3
|
// checks if the given position is within the ProseMirror document
|
|
@@ -9,15 +6,4 @@ export const isValidPosition = (pos, state) => {
|
|
|
9
6
|
return true;
|
|
10
7
|
}
|
|
11
8
|
return false;
|
|
12
|
-
};
|
|
13
|
-
export const duplicateSelection = (selectionToDuplicate, doc) => {
|
|
14
|
-
if (selectionToDuplicate instanceof NodeSelection) {
|
|
15
|
-
return NodeSelection.create(doc, selectionToDuplicate.from);
|
|
16
|
-
} else if (selectionToDuplicate instanceof TextSelection) {
|
|
17
|
-
return TextSelection.create(doc, selectionToDuplicate.from, selectionToDuplicate.to);
|
|
18
|
-
} else if (selectionToDuplicate instanceof GapCursorSelection) {
|
|
19
|
-
return new GapCursorSelection(doc.resolve(selectionToDuplicate.from), selectionToDuplicate.side);
|
|
20
|
-
} else if (selectionToDuplicate instanceof CellSelection) {
|
|
21
|
-
return new CellSelection(doc.resolve(selectionToDuplicate.$anchorCell.pos), doc.resolve(selectionToDuplicate.$headCell.pos));
|
|
22
|
-
}
|
|
23
9
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = "@atlaskit/editor-core";
|
|
2
|
-
export const version = "189.3.
|
|
2
|
+
export const version = "189.3.20";
|
|
@@ -6,10 +6,9 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
6
6
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
8
|
import { findParentNode, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
-
import { analyticsEventKey, isEmptyDocument, processRawValue } from '@atlaskit/editor-common/utils';
|
|
9
|
+
import { analyticsEventKey, isEmptyDocument, processRawValue, findNodePosByLocalIds } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { createDispatch } from '../event-dispatcher';
|
|
11
11
|
import { getCollabProvider } from '../plugins/collab-edit/native-collab-provider-plugin';
|
|
12
|
-
import { findNodePosWithLocalId } from '../plugins/extension/utils';
|
|
13
12
|
import { toJSON } from '../utils';
|
|
14
13
|
import { __temporaryFixForConfigPanel as _temporaryFixForConfigPanel, getEditorValueWithMedia } from '../utils/action';
|
|
15
14
|
import deprecationWarnings from '../utils/deprecation-warnings';
|
|
@@ -255,8 +254,10 @@ var EditorActions = /*#__PURE__*/function () {
|
|
|
255
254
|
value: function getNodeByLocalId(id) {
|
|
256
255
|
var _this$editorView;
|
|
257
256
|
if ((_this$editorView = this.editorView) !== null && _this$editorView !== void 0 && _this$editorView.state) {
|
|
258
|
-
var
|
|
259
|
-
|
|
257
|
+
var _this$editorView2;
|
|
258
|
+
var nodes = findNodePosByLocalIds((_this$editorView2 = this.editorView) === null || _this$editorView2 === void 0 ? void 0 : _this$editorView2.state, [id]);
|
|
259
|
+
var node = nodes.length >= 1 ? nodes[0] : undefined;
|
|
260
|
+
return node === null || node === void 0 ? void 0 : node.node;
|
|
260
261
|
}
|
|
261
262
|
}
|
|
262
263
|
}, {
|
|
@@ -8,6 +8,7 @@ var avatarGroup = function avatarGroup(_ref) {
|
|
|
8
8
|
return {
|
|
9
9
|
name: 'avatarGroup',
|
|
10
10
|
primaryToolbarComponent: function primaryToolbarComponent(_ref2) {
|
|
11
|
+
var _api$analytics;
|
|
11
12
|
var editorView = _ref2.editorView,
|
|
12
13
|
popupsMountPoint = _ref2.popupsMountPoint,
|
|
13
14
|
popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
@@ -22,7 +23,8 @@ var avatarGroup = function avatarGroup(_ref) {
|
|
|
22
23
|
eventDispatcher: eventDispatcher,
|
|
23
24
|
collabEdit: props === null || props === void 0 ? void 0 : props.collabEdit,
|
|
24
25
|
takeFullWidth: props === null || props === void 0 ? void 0 : props.takeFullWidth,
|
|
25
|
-
featureFlags: featureFlags
|
|
26
|
+
featureFlags: featureFlags,
|
|
27
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
26
28
|
});
|
|
27
29
|
}
|
|
28
30
|
};
|
|
@@ -34,7 +34,8 @@ var AvatarGroupPluginWrapper = function AvatarGroupPluginWrapper(props) {
|
|
|
34
34
|
inviteToEditComponent: props.collabEdit && props.collabEdit.inviteToEditComponent,
|
|
35
35
|
inviteToEditHandler: props.collabEdit && props.collabEdit.inviteToEditHandler,
|
|
36
36
|
isInviteToEditButtonSelected: props.collabEdit && props.collabEdit.isInviteToEditButtonSelected,
|
|
37
|
-
featureFlags: featureFlags
|
|
37
|
+
featureFlags: featureFlags,
|
|
38
|
+
editorAnalyticsAPI: props.editorAnalyticsAPI
|
|
38
39
|
}));
|
|
39
40
|
};
|
|
40
41
|
export default AvatarGroupPluginWrapper;
|
|
@@ -7,7 +7,7 @@ import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
|
7
7
|
import CodeBidiWarning from '@atlaskit/code/bidi-warning';
|
|
8
8
|
import codeBidiWarningDecorator from '@atlaskit/code/bidi-warning-decorator';
|
|
9
9
|
import { pluginFactory } from '../../../utils/plugin-state-factory';
|
|
10
|
-
import { stepHasSlice } from '
|
|
10
|
+
import { stepHasSlice } from '@atlaskit/editor-common/utils';
|
|
11
11
|
import { codeBidiWarningPluginKey } from '../plugin-key';
|
|
12
12
|
import reducer from './reducer';
|
|
13
13
|
var _pluginFactory = pluginFactory(codeBidiWarningPluginKey, reducer, {
|
|
@@ -11,7 +11,8 @@ var AvatarsWithPluginState = function AvatarsWithPluginState(props) {
|
|
|
11
11
|
onClick = props.inviteToEditHandler,
|
|
12
12
|
Component = props.inviteToEditComponent,
|
|
13
13
|
editorView = props.editorView,
|
|
14
|
-
featureFlags = props.featureFlags
|
|
14
|
+
featureFlags = props.featureFlags,
|
|
15
|
+
editorAnalyticsAPI = props.editorAnalyticsAPI;
|
|
15
16
|
var render = React.useCallback(function (_ref) {
|
|
16
17
|
var data = _ref.data;
|
|
17
18
|
if (!data) {
|
|
@@ -21,14 +22,15 @@ var AvatarsWithPluginState = function AvatarsWithPluginState(props) {
|
|
|
21
22
|
sessionId: data.sessionId,
|
|
22
23
|
participants: data.activeParticipants,
|
|
23
24
|
editorView: editorView,
|
|
24
|
-
featureFlags: featureFlags
|
|
25
|
+
featureFlags: featureFlags,
|
|
26
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
25
27
|
}, /*#__PURE__*/React.createElement(InviteToEditButton, {
|
|
26
28
|
title: title,
|
|
27
29
|
selected: selected,
|
|
28
30
|
onClick: onClick,
|
|
29
31
|
Component: Component
|
|
30
32
|
}));
|
|
31
|
-
}, [selected, onClick, Component, title, editorView, featureFlags]);
|
|
33
|
+
}, [selected, onClick, Component, title, editorView, featureFlags, editorAnalyticsAPI]);
|
|
32
34
|
return /*#__PURE__*/React.createElement(WithPluginState, {
|
|
33
35
|
plugins: {
|
|
34
36
|
data: collabEditPluginKey
|
|
@@ -31,7 +31,7 @@ export var Avatars = /*#__PURE__*/React.memo(function (props) {
|
|
|
31
31
|
|
|
32
32
|
// user does not need to scroll to their own position (index 0)
|
|
33
33
|
if (allowCollabAvatarScroll && index > 0) {
|
|
34
|
-
scrollToCollabCursor(editorView, participants, props.sessionId, index);
|
|
34
|
+
scrollToCollabCursor(editorView, participants, props.sessionId, index, props.editorAnalyticsAPI);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}), props.children);
|
|
@@ -4,7 +4,6 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
|
4
4
|
import * as themeColors from '@atlaskit/theme/colors';
|
|
5
5
|
import { hexToRgba } from '@atlaskit/adf-schema';
|
|
6
6
|
import { ZERO_WIDTH_JOINER } from '@atlaskit/editor-common/utils';
|
|
7
|
-
import { addAnalytics } from '../analytics/utils';
|
|
8
7
|
import { EVENT_TYPE, ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
9
8
|
// TODO: https://product-fabric.atlassian.net/browse/DSP-7269
|
|
10
9
|
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
@@ -117,7 +116,7 @@ export var replaceDocument = function replaceDocument(doc, state, version, optio
|
|
|
117
116
|
}
|
|
118
117
|
return tr;
|
|
119
118
|
};
|
|
120
|
-
export var scrollToCollabCursor = function scrollToCollabCursor(editorView, participants, sessionId, index) {
|
|
119
|
+
export var scrollToCollabCursor = function scrollToCollabCursor(editorView, participants, sessionId, index, editorAnalyticsAPI) {
|
|
121
120
|
var selectedUser = participants[index];
|
|
122
121
|
if (selectedUser && selectedUser.cursorPos !== undefined && selectedUser.sessionId !== sessionId) {
|
|
123
122
|
var state = editorView.state;
|
|
@@ -128,7 +127,7 @@ export var scrollToCollabCursor = function scrollToCollabCursor(editorView, part
|
|
|
128
127
|
eventType: EVENT_TYPE.TRACK
|
|
129
128
|
};
|
|
130
129
|
tr.setSelection(Selection.near(tr.doc.resolve(selectedUser.cursorPos)));
|
|
131
|
-
|
|
130
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(analyticsPayload)(tr);
|
|
132
131
|
tr.scrollIntoView();
|
|
133
132
|
editorView.dispatch(tr);
|
|
134
133
|
if (!editorView.hasFocus()) {
|
|
@@ -6,8 +6,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
6
6
|
import { Selection, NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { replaceSelectedNode, findSelectedNodeOfType, replaceParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
8
8
|
export { transformSliceToRemoveOpenBodiedExtension } from '@atlaskit/editor-common/transforms';
|
|
9
|
-
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
10
|
-
import { TARGET_SELECTION_SOURCE } from '../analytics/types/extension-events';
|
|
9
|
+
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, TARGET_SELECTION_SOURCE } from '@atlaskit/editor-common/analytics';
|
|
11
10
|
import { findExtensionWithLocalId } from './utils';
|
|
12
11
|
import { getPluginState } from './pm-plugins/main';
|
|
13
12
|
import { getEditInLegacyMacroBrowser, createExtensionAPI } from './extension-api';
|
|
@@ -9,12 +9,13 @@ import React from 'react';
|
|
|
9
9
|
import { getExtensionKeyAndNodeKey } from '@atlaskit/editor-common/extensions';
|
|
10
10
|
import { getPluginState } from './pm-plugins/main';
|
|
11
11
|
import { getSelectedExtension } from './utils';
|
|
12
|
-
import WithEditorActions from '../../ui/WithEditorActions';
|
|
13
12
|
import ConfigPanelLoader from '../../ui/ConfigPanel/ConfigPanelLoader';
|
|
14
|
-
import { duplicateSelection } from '../../utils/selection';
|
|
15
13
|
import { clearEditingContext, forceAutoSave, updateState } from './commands';
|
|
16
14
|
import { buildExtensionNode } from './actions';
|
|
17
15
|
import { SaveIndicator } from './ui/SaveIndicator/SaveIndicator';
|
|
16
|
+
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
17
|
+
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
18
|
+
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
18
19
|
var areParametersEqual = function areParametersEqual(firstParameters, secondParameters) {
|
|
19
20
|
if (_typeof(firstParameters) === 'object' && _typeof(secondParameters) === 'object' && firstParameters !== null && secondParameters !== null) {
|
|
20
21
|
var firstKeys = Object.keys(firstParameters);
|
|
@@ -25,116 +26,125 @@ var areParametersEqual = function areParametersEqual(firstParameters, secondPara
|
|
|
25
26
|
}
|
|
26
27
|
return firstParameters === secondParameters;
|
|
27
28
|
};
|
|
28
|
-
export var
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
export var duplicateSelection = function duplicateSelection(selectionToDuplicate, doc) {
|
|
30
|
+
if (selectionToDuplicate instanceof NodeSelection) {
|
|
31
|
+
return NodeSelection.create(doc, selectionToDuplicate.from);
|
|
32
|
+
} else if (selectionToDuplicate instanceof TextSelection) {
|
|
33
|
+
return TextSelection.create(doc, selectionToDuplicate.from, selectionToDuplicate.to);
|
|
34
|
+
} else if (selectionToDuplicate instanceof GapCursorSelection) {
|
|
35
|
+
return new GapCursorSelection(doc.resolve(selectionToDuplicate.from), selectionToDuplicate.side);
|
|
36
|
+
} else if (selectionToDuplicate instanceof CellSelection) {
|
|
37
|
+
return new CellSelection(doc.resolve(selectionToDuplicate.$anchorCell.pos), doc.resolve(selectionToDuplicate.$headCell.pos));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
export var getContextPanel = function getContextPanel(getEditorView) {
|
|
41
|
+
return function (allowAutoSave, featureFlags, applyChange) {
|
|
42
|
+
return function (state) {
|
|
43
|
+
var nodeWithPos = getSelectedExtension(state, true);
|
|
31
44
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
80
|
-
while (1) switch (_context.prev = _context.next) {
|
|
81
|
-
case 0:
|
|
82
|
-
_context.next = 2;
|
|
83
|
-
return onChangeAction(editorView, updatedParameters, parameters, nodeWithPos, onSaveStarted);
|
|
84
|
-
case 2:
|
|
85
|
-
onSaveEnded();
|
|
86
|
-
if (autoSaveResolve) {
|
|
87
|
-
autoSaveResolve();
|
|
88
|
-
}
|
|
89
|
-
if (!allowAutoSave) {
|
|
90
|
-
clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
|
|
91
|
-
}
|
|
92
|
-
case 5:
|
|
93
|
-
case "end":
|
|
94
|
-
return _context.stop();
|
|
95
|
-
}
|
|
96
|
-
}, _callee);
|
|
97
|
-
}));
|
|
98
|
-
return function (_x) {
|
|
99
|
-
return _ref2.apply(this, arguments);
|
|
100
|
-
};
|
|
101
|
-
}(),
|
|
102
|
-
onCancel: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
103
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
104
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
45
|
+
// Adding checks to bail out early
|
|
46
|
+
if (!nodeWithPos) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
var extensionState = getPluginState(state);
|
|
50
|
+
var autoSaveResolve = extensionState.autoSaveResolve,
|
|
51
|
+
autoSaveReject = extensionState.autoSaveReject,
|
|
52
|
+
showContextPanel = extensionState.showContextPanel,
|
|
53
|
+
extensionProvider = extensionState.extensionProvider,
|
|
54
|
+
processParametersBefore = extensionState.processParametersBefore,
|
|
55
|
+
processParametersAfter = extensionState.processParametersAfter;
|
|
56
|
+
if (extensionState && showContextPanel && extensionProvider && processParametersAfter) {
|
|
57
|
+
var _nodeWithPos$node$att = nodeWithPos.node.attrs,
|
|
58
|
+
extensionType = _nodeWithPos$node$att.extensionType,
|
|
59
|
+
extensionKey = _nodeWithPos$node$att.extensionKey,
|
|
60
|
+
parameters = _nodeWithPos$node$att.parameters;
|
|
61
|
+
var _getExtensionKeyAndNo = getExtensionKeyAndNodeKey(extensionKey, extensionType),
|
|
62
|
+
_getExtensionKeyAndNo2 = _slicedToArray(_getExtensionKeyAndNo, 2),
|
|
63
|
+
extKey = _getExtensionKeyAndNo2[0],
|
|
64
|
+
nodeKey = _getExtensionKeyAndNo2[1];
|
|
65
|
+
var configParams = processParametersBefore ? processParametersBefore(parameters || {}) : parameters;
|
|
66
|
+
return /*#__PURE__*/React.createElement(SaveIndicator, {
|
|
67
|
+
duration: 5000,
|
|
68
|
+
visible: allowAutoSave
|
|
69
|
+
}, function (_ref) {
|
|
70
|
+
var onSaveStarted = _ref.onSaveStarted,
|
|
71
|
+
onSaveEnded = _ref.onSaveEnded;
|
|
72
|
+
var editorView = getEditorView === null || getEditorView === void 0 ? void 0 : getEditorView();
|
|
73
|
+
if (!editorView) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
return /*#__PURE__*/React.createElement(ConfigPanelLoader, {
|
|
77
|
+
showHeader: true,
|
|
78
|
+
closeOnEsc: true,
|
|
79
|
+
extensionType: extensionType,
|
|
80
|
+
extensionKey: extKey,
|
|
81
|
+
nodeKey: nodeKey,
|
|
82
|
+
extensionParameters: parameters,
|
|
83
|
+
parameters: configParams,
|
|
84
|
+
extensionProvider: extensionProvider,
|
|
85
|
+
autoSave: allowAutoSave,
|
|
86
|
+
autoSaveTrigger: autoSaveResolve,
|
|
87
|
+
autoSaveReject: autoSaveReject,
|
|
88
|
+
onChange: /*#__PURE__*/function () {
|
|
89
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(updatedParameters) {
|
|
90
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
91
|
+
while (1) switch (_context.prev = _context.next) {
|
|
105
92
|
case 0:
|
|
93
|
+
_context.next = 2;
|
|
94
|
+
return onChangeAction(editorView, updatedParameters, parameters, nodeWithPos, onSaveStarted);
|
|
95
|
+
case 2:
|
|
96
|
+
onSaveEnded();
|
|
97
|
+
if (autoSaveResolve) {
|
|
98
|
+
autoSaveResolve();
|
|
99
|
+
}
|
|
106
100
|
if (!allowAutoSave) {
|
|
107
|
-
|
|
108
|
-
break;
|
|
101
|
+
clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
|
|
109
102
|
}
|
|
110
|
-
|
|
111
|
-
_context2.next = 4;
|
|
112
|
-
return new Promise(function (resolve, reject) {
|
|
113
|
-
forceAutoSave(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
|
|
114
|
-
});
|
|
115
|
-
case 4:
|
|
116
|
-
_context2.next = 9;
|
|
117
|
-
break;
|
|
118
|
-
case 6:
|
|
119
|
-
_context2.prev = 6;
|
|
120
|
-
_context2.t0 = _context2["catch"](1);
|
|
121
|
-
// Even if the save failed, we should proceed with closing the panel
|
|
122
|
-
// eslint-disable-next-line no-console
|
|
123
|
-
console.error("Autosave failed with error", _context2.t0);
|
|
124
|
-
case 9:
|
|
125
|
-
clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
|
|
126
|
-
case 10:
|
|
103
|
+
case 5:
|
|
127
104
|
case "end":
|
|
128
|
-
return
|
|
105
|
+
return _context.stop();
|
|
129
106
|
}
|
|
130
|
-
},
|
|
131
|
-
}))
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
107
|
+
}, _callee);
|
|
108
|
+
}));
|
|
109
|
+
return function (_x) {
|
|
110
|
+
return _ref2.apply(this, arguments);
|
|
111
|
+
};
|
|
112
|
+
}(),
|
|
113
|
+
onCancel: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
114
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
115
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
116
|
+
case 0:
|
|
117
|
+
if (!allowAutoSave) {
|
|
118
|
+
_context2.next = 9;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
_context2.prev = 1;
|
|
122
|
+
_context2.next = 4;
|
|
123
|
+
return new Promise(function (resolve, reject) {
|
|
124
|
+
forceAutoSave(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
|
|
125
|
+
});
|
|
126
|
+
case 4:
|
|
127
|
+
_context2.next = 9;
|
|
128
|
+
break;
|
|
129
|
+
case 6:
|
|
130
|
+
_context2.prev = 6;
|
|
131
|
+
_context2.t0 = _context2["catch"](1);
|
|
132
|
+
// Even if the save failed, we should proceed with closing the panel
|
|
133
|
+
// eslint-disable-next-line no-console
|
|
134
|
+
console.error("Autosave failed with error", _context2.t0);
|
|
135
|
+
case 9:
|
|
136
|
+
clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
|
|
137
|
+
case 10:
|
|
138
|
+
case "end":
|
|
139
|
+
return _context2.stop();
|
|
140
|
+
}
|
|
141
|
+
}, _callee2, null, [[1, 6]]);
|
|
142
|
+
})),
|
|
143
|
+
featureFlags: featureFlags
|
|
144
|
+
});
|
|
135
145
|
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
138
148
|
};
|
|
139
149
|
};
|
|
140
150
|
export function onChangeAction(_x2) {
|
|
@@ -5,7 +5,7 @@ import { Fragment, Mark } from '@atlaskit/editor-prosemirror/model';
|
|
|
5
5
|
import { NodeSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { insertMacroFromMacroBrowser } from './pm-plugins/macro/actions';
|
|
7
7
|
import { pluginKey as macroPluginKey } from './pm-plugins/macro/plugin-key';
|
|
8
|
-
import { nodeToJSON } from '
|
|
8
|
+
import { nodeToJSON } from '@atlaskit/editor-common/utils';
|
|
9
9
|
import { setEditingContextToContextPanel } from './commands';
|
|
10
10
|
import { findNodePosWithLocalId, getDataConsumerMark, getNodeTypesReferenced, getSelectedExtension } from './utils';
|
|
11
11
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -99,7 +99,10 @@ var extensionPlugin = function extensionPlugin(_ref) {
|
|
|
99
99
|
applyChangeToContextPanel: _api === null || _api === void 0 || (_api$contextPanel3 = _api.contextPanel) === null || _api$contextPanel3 === void 0 ? void 0 : _api$contextPanel3.actions.applyChange,
|
|
100
100
|
editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics3 = _api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions
|
|
101
101
|
}),
|
|
102
|
-
contextPanel: getContextPanel(
|
|
102
|
+
contextPanel: getContextPanel(function () {
|
|
103
|
+
var _editorViewRef$curren;
|
|
104
|
+
return (_editorViewRef$curren = editorViewRef.current) !== null && _editorViewRef$curren !== void 0 ? _editorViewRef$curren : undefined;
|
|
105
|
+
})(options.allowAutoSave, featureFlags, _api === null || _api === void 0 || (_api$contextPanel4 = _api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange)
|
|
103
106
|
}
|
|
104
107
|
};
|
|
105
108
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import { pluginFactory } from '
|
|
4
|
+
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import reducer from './reducer';
|
|
6
6
|
import { pluginKey } from './plugin-key';
|
|
7
7
|
var factory = pluginFactory(pluginKey, reducer, {
|
|
@@ -9,8 +9,7 @@ import { safeInsert, replaceSelectedNode, findSelectedNodeOfType, replaceParentN
|
|
|
9
9
|
import { getValidNode } from '@atlaskit/editor-common/validator';
|
|
10
10
|
import { normaliseNestedLayout } from '@atlaskit/editor-common/insert';
|
|
11
11
|
import { getPluginState as getExtensionPluginState } from '../../plugin-factory';
|
|
12
|
-
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
13
|
-
import { TARGET_SELECTION_SOURCE } from '@atlaskit/editor-common/analytics';
|
|
12
|
+
import { ACTION, ACTION_SUBJECT, INPUT_METHOD, EVENT_TYPE, TARGET_SELECTION_SOURCE } from '@atlaskit/editor-common/analytics';
|
|
14
13
|
import { pluginKey } from './plugin-key';
|
|
15
14
|
export var insertMacroFromMacroBrowser = function insertMacroFromMacroBrowser(editorAnalyticsAPI) {
|
|
16
15
|
return function (macroProvider, macroNode, isEditing) {
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
5
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { uuid } from '@atlaskit/adf-schema';
|
|
7
|
-
import { stepAddsOneOf } from '
|
|
7
|
+
import { stepAddsOneOf } from '@atlaskit/editor-common/utils';
|
|
8
8
|
var pluginKey = new PluginKey('extensionUniqueIdPlugin');
|
|
9
9
|
var createPlugin = function createPlugin() {
|
|
10
10
|
return new SafePlugin({
|
|
@@ -6,7 +6,7 @@ import EditIcon from '@atlaskit/icon/glyph/editor/edit';
|
|
|
6
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
|
-
import commonMessages from '
|
|
9
|
+
import commonMessages from '@atlaskit/editor-common/messages';
|
|
10
10
|
import { editExtension } from './actions';
|
|
11
11
|
import { getPluginState } from './pm-plugins/main';
|
|
12
12
|
import { getSelectedExtension } from './utils';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { findParentNodeOfType, findSelectedNodeOfType, findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
|
-
import { closestElement } from '
|
|
3
|
-
import { findNodePosByLocalIds } from '../../utils/nodes-by-localIds';
|
|
2
|
+
import { findNodePosByLocalIds, closestElement } from '@atlaskit/editor-common/utils';
|
|
4
3
|
export var getSelectedExtension = function getSelectedExtension(state) {
|
|
5
4
|
var searchParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6
5
|
var _state$schema$nodes = state.schema.nodes,
|
|
@@ -9,7 +9,7 @@ import reducer from './reducer';
|
|
|
9
9
|
import { findReplacePluginKey } from './types';
|
|
10
10
|
import { findMatches, createDecorations, removeDecorationsFromSet, findSearchIndex, removeMatchesFromSet, findDecorationFromMatch, isMatchAffectedByStep } from './utils';
|
|
11
11
|
import { findUniqueItemsIn } from '../../utils/array';
|
|
12
|
-
import { stepHasSlice } from '
|
|
12
|
+
import { stepHasSlice } from '@atlaskit/editor-common/utils';
|
|
13
13
|
export var initialState = {
|
|
14
14
|
isActive: false,
|
|
15
15
|
shouldFocus: false,
|
|
@@ -11,7 +11,6 @@ export { default as alignmentPlugin } from './alignment';
|
|
|
11
11
|
export { default as dataConsumerMarkPlugin } from './data-consumer';
|
|
12
12
|
export { default as indentationPlugin } from './indentation';
|
|
13
13
|
export { default as annotationPlugin } from './annotation';
|
|
14
|
-
export { default as analyticsPlugin } from './analytics';
|
|
15
14
|
export { default as customAutoformatPlugin } from './custom-autoformat';
|
|
16
15
|
export { default as feedbackDialogPlugin } from './feedback-dialog';
|
|
17
16
|
export { default as mobileDimensionsPlugin } from './mobile-dimensions';
|