@atlaskit/editor-core 185.2.24 → 185.2.26
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/editor-next/editor-internal.js +3 -3
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/labs/next/Editor.js +3 -3
- package/dist/cjs/labs/next/presets/universal.js +6 -5
- package/dist/cjs/nodeviews/index.js +1 -16
- package/dist/cjs/plugins/annotation/index.js +31 -21
- package/dist/cjs/plugins/annotation/nodeviews/index.js +2 -2
- package/dist/cjs/plugins/base/index.js +0 -6
- package/dist/cjs/plugins/caption/index.js +1 -2
- package/dist/cjs/plugins/caption/nodeviews/index.js +3 -3
- package/dist/cjs/plugins/caption/pm-plugins/main.js +4 -2
- package/dist/cjs/plugins/card/nodeviews/embedCard.js +4 -4
- package/dist/cjs/plugins/extension/actions.js +6 -4
- package/dist/cjs/plugins/extension/commands.js +19 -16
- package/dist/cjs/plugins/extension/context-panel.js +4 -4
- package/dist/cjs/plugins/extension/extension-api.js +1 -1
- package/dist/cjs/plugins/extension/index.js +11 -4
- package/dist/cjs/plugins/extension/nodeviews/extension.js +2 -2
- package/dist/cjs/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/cjs/plugins/extension/pm-plugins/main.js +10 -5
- package/dist/cjs/plugins/extension/toolbar.js +8 -6
- package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
- package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +5 -2
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/jira-issue/index.js +2 -2
- package/dist/cjs/plugins/media/index.js +2 -2
- package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +25 -19
- package/dist/cjs/plugins/media/nodeviews/mediaInline.js +3 -3
- package/dist/cjs/plugins/media/nodeviews/mediaNodeView/index.js +16 -10
- package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -2
- package/dist/cjs/plugins/media/pm-plugins/main.js +25 -8
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +2 -2
- package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +2 -2
- package/dist/cjs/plugins/unsupported-content/index.js +6 -4
- package/dist/cjs/test-utils.js +0 -7
- package/dist/cjs/ui/ContextPanel/index.js +9 -2
- package/dist/cjs/utils/action.js +1 -1
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/editor-next/editor-internal.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/labs/next/Editor.js +1 -1
- package/dist/es2019/labs/next/presets/universal.js +7 -6
- package/dist/es2019/nodeviews/index.js +1 -2
- package/dist/es2019/plugins/annotation/index.js +34 -23
- package/dist/es2019/plugins/annotation/nodeviews/index.js +1 -1
- package/dist/es2019/plugins/base/index.js +0 -4
- package/dist/es2019/plugins/caption/index.js +1 -4
- package/dist/es2019/plugins/caption/nodeviews/index.js +2 -2
- package/dist/es2019/plugins/caption/pm-plugins/main.js +4 -2
- package/dist/es2019/plugins/card/nodeviews/embedCard.js +2 -2
- package/dist/es2019/plugins/extension/actions.js +6 -4
- package/dist/es2019/plugins/extension/commands.js +6 -7
- package/dist/es2019/plugins/extension/context-panel.js +4 -4
- package/dist/es2019/plugins/extension/extension-api.js +1 -1
- package/dist/es2019/plugins/extension/index.js +11 -4
- package/dist/es2019/plugins/extension/nodeviews/extension.js +1 -1
- package/dist/es2019/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/es2019/plugins/extension/pm-plugins/main.js +10 -5
- package/dist/es2019/plugins/extension/toolbar.js +8 -4
- package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
- package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +5 -2
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/jira-issue/index.js +1 -1
- package/dist/es2019/plugins/media/index.js +2 -2
- package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +21 -14
- package/dist/es2019/plugins/media/nodeviews/mediaInline.js +2 -2
- package/dist/es2019/plugins/media/nodeviews/mediaNodeView/index.js +13 -9
- package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/es2019/plugins/media/pm-plugins/main.js +28 -11
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
- package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
- package/dist/es2019/plugins/unsupported-content/index.js +1 -1
- package/dist/es2019/test-utils.js +0 -1
- package/dist/es2019/ui/ContextPanel/index.js +8 -1
- package/dist/es2019/utils/action.js +1 -1
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/editor-next/editor-internal.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/labs/next/Editor.js +1 -1
- package/dist/esm/labs/next/presets/universal.js +7 -6
- package/dist/esm/nodeviews/index.js +1 -2
- package/dist/esm/plugins/annotation/index.js +32 -22
- package/dist/esm/plugins/annotation/nodeviews/index.js +1 -1
- package/dist/esm/plugins/base/index.js +0 -6
- package/dist/esm/plugins/caption/index.js +1 -2
- package/dist/esm/plugins/caption/nodeviews/index.js +2 -2
- package/dist/esm/plugins/caption/pm-plugins/main.js +4 -2
- package/dist/esm/plugins/card/nodeviews/embedCard.js +4 -4
- package/dist/esm/plugins/extension/actions.js +6 -4
- package/dist/esm/plugins/extension/commands.js +18 -15
- package/dist/esm/plugins/extension/context-panel.js +4 -4
- package/dist/esm/plugins/extension/extension-api.js +1 -1
- package/dist/esm/plugins/extension/index.js +11 -4
- package/dist/esm/plugins/extension/nodeviews/extension.js +1 -1
- package/dist/esm/plugins/extension/pm-plugins/keymap.js +2 -2
- package/dist/esm/plugins/extension/pm-plugins/main.js +10 -5
- package/dist/esm/plugins/extension/toolbar.js +8 -6
- package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +11 -6
- package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +5 -2
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/jira-issue/index.js +1 -1
- package/dist/esm/plugins/media/index.js +2 -2
- package/dist/esm/plugins/media/nodeviews/mediaGroup.js +24 -18
- package/dist/esm/plugins/media/nodeviews/mediaInline.js +2 -2
- package/dist/esm/plugins/media/nodeviews/mediaNodeView/index.js +15 -9
- package/dist/esm/plugins/media/nodeviews/mediaSingle.js +1 -1
- package/dist/esm/plugins/media/pm-plugins/main.js +26 -9
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
- package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
- package/dist/esm/plugins/unsupported-content/index.js +1 -1
- package/dist/esm/test-utils.js +0 -1
- package/dist/esm/ui/ContextPanel/index.js +8 -1
- package/dist/esm/utils/action.js +1 -1
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/labs/next/internal/components/EditorInternal.d.ts +2 -2
- package/dist/types/labs/next/internal/editor-props-type.d.ts +1 -1
- package/dist/types/labs/next/internal/hooks/use-editor/create-editor.d.ts +1 -1
- package/dist/types/labs/next/presets/cxhtml.d.ts +18 -2
- package/dist/types/labs/next/presets/default.d.ts +36 -4
- package/dist/types/labs/next/presets/mobile.d.ts +18 -2
- package/dist/types/nodeviews/index.d.ts +0 -2
- package/dist/types/plugins/annotation/index.d.ts +3 -1
- package/dist/types/plugins/annotation/nodeviews/index.d.ts +2 -1
- package/dist/types/plugins/annotation/pm-plugins/types.d.ts +2 -2
- package/dist/types/plugins/caption/index.d.ts +1 -1
- package/dist/types/plugins/caption/nodeviews/index.d.ts +7 -4
- package/dist/types/plugins/caption/pm-plugins/main.d.ts +5 -4
- package/dist/types/plugins/card/nodeviews/embedCard.d.ts +2 -2
- package/dist/types/plugins/extension/actions.d.ts +2 -1
- package/dist/types/plugins/extension/commands.d.ts +4 -3
- package/dist/types/plugins/extension/context-panel.d.ts +2 -1
- package/dist/types/plugins/extension/extension-api.d.ts +2 -0
- package/dist/types/plugins/extension/index.d.ts +4 -2
- package/dist/types/plugins/extension/nodeviews/extension.d.ts +3 -2
- package/dist/types/plugins/extension/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/plugins/extension/pm-plugins/main.d.ts +5 -3
- package/dist/types/plugins/extension/toolbar.d.ts +8 -1
- package/dist/types/plugins/extension/types.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
- package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/media/index.d.ts +3 -1
- package/dist/types/plugins/media/nodeviews/mediaGroup.d.ts +5 -3
- package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +6 -3
- package/dist/types/plugins/media/nodeviews/mediaNodeView/index.d.ts +6 -4
- package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +2 -2
- package/dist/types/plugins/media/types.d.ts +4 -0
- package/dist/types/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +1 -1
- package/dist/types/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +1 -1
- package/dist/types/plugins/tasks-and-decisions/pm-plugins/main.d.ts +1 -1
- package/dist/types/test-utils.d.ts +0 -1
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/internal/components/EditorInternal.d.ts +2 -2
- package/dist/types-ts4.5/labs/next/internal/editor-props-type.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/internal/hooks/use-editor/create-editor.d.ts +1 -1
- package/dist/types-ts4.5/labs/next/presets/cxhtml.d.ts +20 -2
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +40 -4
- package/dist/types-ts4.5/labs/next/presets/mobile.d.ts +20 -2
- package/dist/types-ts4.5/nodeviews/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/annotation/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/annotation/nodeviews/index.d.ts +2 -1
- package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +2 -2
- package/dist/types-ts4.5/plugins/caption/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/caption/nodeviews/index.d.ts +7 -4
- package/dist/types-ts4.5/plugins/caption/pm-plugins/main.d.ts +5 -4
- package/dist/types-ts4.5/plugins/card/nodeviews/embedCard.d.ts +2 -2
- package/dist/types-ts4.5/plugins/extension/actions.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/commands.d.ts +4 -3
- package/dist/types-ts4.5/plugins/extension/context-panel.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/extension-api.d.ts +2 -0
- package/dist/types-ts4.5/plugins/extension/index.d.ts +4 -2
- package/dist/types-ts4.5/plugins/extension/nodeviews/extension.d.ts +3 -2
- package/dist/types-ts4.5/plugins/extension/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/plugins/extension/pm-plugins/main.d.ts +5 -3
- package/dist/types-ts4.5/plugins/extension/toolbar.d.ts +8 -1
- package/dist/types-ts4.5/plugins/extension/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +2 -0
- package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +7 -3
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/media/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaGroup.d.ts +5 -3
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaInline.d.ts +6 -3
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaNodeView/index.d.ts +6 -4
- package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +2 -2
- package/dist/types-ts4.5/plugins/media/types.d.ts +4 -0
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/decisionItem.d.ts +1 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/nodeviews/taskItem.d.ts +1 -1
- package/dist/types-ts4.5/plugins/tasks-and-decisions/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/test-utils.d.ts +0 -1
- package/package.json +3 -2
- package/report.api.md +20 -85
- package/tmp/api-report-tmp.d.ts +18 -68
- package/dist/cjs/nodeviews/ReactNodeView.js +0 -224
- package/dist/cjs/nodeviews/SelectionBasedNodeView.js +0 -169
- package/dist/cjs/plugins/base/pm-plugins/react-nodeview.js +0 -72
- package/dist/cjs/plugins/context-panel/index.js +0 -66
- package/dist/cjs/plugins/context-panel/transforms.js +0 -13
- package/dist/cjs/plugins/context-panel/types.js +0 -5
- package/dist/cjs/ui/PortalProvider/PortalProviderThemesProvider.js +0 -43
- package/dist/cjs/ui/PortalProvider/index.js +0 -252
- package/dist/es2019/nodeviews/ReactNodeView.js +0 -170
- package/dist/es2019/nodeviews/SelectionBasedNodeView.js +0 -158
- package/dist/es2019/plugins/base/pm-plugins/react-nodeview.js +0 -48
- package/dist/es2019/plugins/context-panel/index.js +0 -45
- package/dist/es2019/plugins/context-panel/transforms.js +0 -4
- package/dist/es2019/plugins/context-panel/types.js +0 -1
- package/dist/es2019/ui/PortalProvider/PortalProviderThemesProvider.js +0 -37
- package/dist/es2019/ui/PortalProvider/index.js +0 -184
- package/dist/esm/nodeviews/ReactNodeView.js +0 -217
- package/dist/esm/nodeviews/SelectionBasedNodeView.js +0 -163
- package/dist/esm/plugins/base/pm-plugins/react-nodeview.js +0 -62
- package/dist/esm/plugins/context-panel/index.js +0 -57
- package/dist/esm/plugins/context-panel/transforms.js +0 -6
- package/dist/esm/plugins/context-panel/types.js +0 -1
- package/dist/esm/ui/PortalProvider/PortalProviderThemesProvider.js +0 -36
- package/dist/esm/ui/PortalProvider/index.js +0 -242
- package/dist/types/nodeviews/ReactNodeView.d.ts +0 -52
- package/dist/types/nodeviews/SelectionBasedNodeView.d.ts +0 -53
- package/dist/types/plugins/base/pm-plugins/react-nodeview.d.ts +0 -13
- package/dist/types/plugins/context-panel/index.d.ts +0 -11
- package/dist/types/plugins/context-panel/transforms.d.ts +0 -2
- package/dist/types/plugins/context-panel/types.d.ts +0 -1
- package/dist/types/ui/PortalProvider/PortalProviderThemesProvider.d.ts +0 -6
- package/dist/types/ui/PortalProvider/index.d.ts +0 -51
- package/dist/types-ts4.5/nodeviews/ReactNodeView.d.ts +0 -52
- package/dist/types-ts4.5/nodeviews/SelectionBasedNodeView.d.ts +0 -53
- package/dist/types-ts4.5/plugins/base/pm-plugins/react-nodeview.d.ts +0 -13
- package/dist/types-ts4.5/plugins/context-panel/index.d.ts +0 -11
- package/dist/types-ts4.5/plugins/context-panel/transforms.d.ts +0 -2
- package/dist/types-ts4.5/plugins/context-panel/types.d.ts +0 -1
- package/dist/types-ts4.5/ui/PortalProvider/PortalProviderThemesProvider.d.ts +0 -6
- package/dist/types-ts4.5/ui/PortalProvider/index.d.ts +0 -51
|
@@ -3,17 +3,15 @@ import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
|
3
3
|
import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
|
|
4
4
|
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import ReactNodeView from '
|
|
7
|
-
import { stateKey as reactNodeViewStateKey } from '../../../plugins/base/pm-plugins/react-nodeview';
|
|
8
|
-
import WithPluginState from '../../../ui/WithPluginState';
|
|
6
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
9
7
|
import { setNodeSelection } from '../../../utils';
|
|
10
8
|
import { isNodeSelectedOrInRange, SelectedState } from '../../../utils/nodes';
|
|
11
|
-
import { pluginKey as editorDisabledPluginKey } from '../../editor-disabled';
|
|
12
9
|
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
13
10
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
14
11
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
15
12
|
import { injectIntl } from 'react-intl-next';
|
|
16
13
|
import { messages } from './messages';
|
|
14
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
17
15
|
const isMediaGroupSelectedFromProps = props => {
|
|
18
16
|
return isNodeSelectedOrInRange(props.anchorPos, props.headPos, props.getPos(), props.node.nodeSize);
|
|
19
17
|
};
|
|
@@ -202,11 +200,23 @@ class MediaGroup extends React.Component {
|
|
|
202
200
|
_defineProperty(MediaGroup, "displayName", 'MediaGroup');
|
|
203
201
|
const IntlMediaGroup = injectIntl(MediaGroup);
|
|
204
202
|
export default IntlMediaGroup;
|
|
203
|
+
function MediaGroupNodeViewInternal({
|
|
204
|
+
renderFn,
|
|
205
|
+
pluginInjectionApi
|
|
206
|
+
}) {
|
|
207
|
+
const {
|
|
208
|
+
editorDisabledState: editorDisabledPlugin
|
|
209
|
+
} = useSharedPluginState(pluginInjectionApi, ['editorDisabled']);
|
|
210
|
+
return renderFn({
|
|
211
|
+
editorDisabledPlugin
|
|
212
|
+
});
|
|
213
|
+
}
|
|
205
214
|
class MediaGroupNodeView extends ReactNodeView {
|
|
206
215
|
render(props, forwardRef) {
|
|
207
216
|
const {
|
|
208
217
|
providerFactory,
|
|
209
|
-
mediaOptions
|
|
218
|
+
mediaOptions,
|
|
219
|
+
pluginInjectionApi
|
|
210
220
|
} = props;
|
|
211
221
|
const getPos = this.getPos;
|
|
212
222
|
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
@@ -237,22 +247,19 @@ class MediaGroupNodeView extends ReactNodeView {
|
|
|
237
247
|
mediaOptions: mediaOptions
|
|
238
248
|
});
|
|
239
249
|
};
|
|
240
|
-
return /*#__PURE__*/React.createElement(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
reactNodeViewState: reactNodeViewStateKey,
|
|
244
|
-
editorDisabledPlugin: editorDisabledPluginKey
|
|
245
|
-
},
|
|
246
|
-
render: renderFn
|
|
250
|
+
return /*#__PURE__*/React.createElement(MediaGroupNodeViewInternal, {
|
|
251
|
+
renderFn: renderFn,
|
|
252
|
+
pluginInjectionApi: pluginInjectionApi
|
|
247
253
|
});
|
|
248
254
|
}
|
|
249
255
|
});
|
|
250
256
|
}
|
|
251
257
|
}
|
|
252
|
-
export const ReactMediaGroupNode = (portalProviderAPI, eventDispatcher, providerFactory, mediaOptions = {}) => (node, view, getPos) => {
|
|
258
|
+
export const ReactMediaGroupNode = (portalProviderAPI, eventDispatcher, providerFactory, mediaOptions = {}, pluginInjectionApi) => (node, view, getPos) => {
|
|
253
259
|
const hasIntlContext = true;
|
|
254
260
|
return new MediaGroupNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
255
261
|
providerFactory,
|
|
256
|
-
mediaOptions
|
|
262
|
+
mediaOptions,
|
|
263
|
+
pluginInjectionApi
|
|
257
264
|
}, undefined, undefined, undefined, hasIntlContext).init();
|
|
258
265
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { SelectionBasedNodeView } from '
|
|
2
|
+
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
3
3
|
import WithPluginState from '../../../ui/WithPluginState';
|
|
4
4
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
5
5
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
@@ -175,7 +175,7 @@ export class MediaInlineNodeView extends SelectionBasedNodeView {
|
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
export const ReactMediaInlineNode = (portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent) => (node, view, getPos) => {
|
|
178
|
+
export const ReactMediaInlineNode = (portalProviderAPI, eventDispatcher, providerFactory, pluginInjectionApi, dispatchAnalyticsEvent) => (node, view, getPos) => {
|
|
179
179
|
return new MediaInlineNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
180
180
|
providerFactory,
|
|
181
181
|
dispatchAnalyticsEvent
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
3
|
import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
|
|
4
|
-
import { NodeSelection } from 'prosemirror-state';
|
|
5
4
|
import React from 'react';
|
|
6
|
-
import { SelectionBasedNodeView } from '
|
|
5
|
+
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
7
6
|
import MediaNode from './media';
|
|
8
7
|
import { getAttrsFromUrl } from '@atlaskit/media-client';
|
|
9
8
|
import { isMediaBlobUrlFromAttrs } from '../../utils/media-common';
|
|
@@ -19,9 +18,13 @@ const MediaNodeWithProviders = ({
|
|
|
19
18
|
width: widthState
|
|
20
19
|
});
|
|
21
20
|
};
|
|
21
|
+
function isMediaDecorationSpec(decoration) {
|
|
22
|
+
return decoration.spec.type !== undefined && decoration.spec.selected !== undefined;
|
|
23
|
+
}
|
|
22
24
|
class MediaNodeView extends SelectionBasedNodeView {
|
|
23
25
|
constructor(...args) {
|
|
24
26
|
super(...args);
|
|
27
|
+
_defineProperty(this, "isSelected", false);
|
|
25
28
|
_defineProperty(this, "renderMediaNodeWithState", (mediaProvider, contextIdentifierProvider) => {
|
|
26
29
|
return ({
|
|
27
30
|
width: editorWidth
|
|
@@ -30,10 +33,6 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
30
33
|
const {
|
|
31
34
|
mediaOptions
|
|
32
35
|
} = this.reactComponentProps;
|
|
33
|
-
const {
|
|
34
|
-
selection
|
|
35
|
-
} = this.view.state;
|
|
36
|
-
const isSelected = () => this.isNodeInsideSelection(selection.from, selection.to) || selection instanceof NodeSelection && selection.from === getPos();
|
|
37
36
|
const attrs = this.getAttrs();
|
|
38
37
|
const url = attrs.type === 'external' ? attrs.url : '';
|
|
39
38
|
let {
|
|
@@ -65,7 +64,7 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
65
64
|
view: this.view,
|
|
66
65
|
node: this.node,
|
|
67
66
|
getPos: getPos,
|
|
68
|
-
selected:
|
|
67
|
+
selected: this.nodeInsideSelection(),
|
|
69
68
|
originalDimensions: originalDimensions,
|
|
70
69
|
maxDimensions: maxDimensions,
|
|
71
70
|
url: url,
|
|
@@ -97,11 +96,16 @@ class MediaNodeView extends SelectionBasedNodeView {
|
|
|
97
96
|
}
|
|
98
97
|
return domRef;
|
|
99
98
|
}
|
|
100
|
-
viewShouldUpdate(nextNode) {
|
|
99
|
+
viewShouldUpdate(nextNode, decorations) {
|
|
100
|
+
const hasMediaNodeSelectedDecoration = decorations.some(decoration => isMediaDecorationSpec(decoration) && decoration.spec.type === 'media' && decoration.spec.selected);
|
|
101
|
+
if (this.isSelected !== hasMediaNodeSelectedDecoration) {
|
|
102
|
+
this.isSelected = hasMediaNodeSelectedDecoration;
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
101
105
|
if (this.node.attrs !== nextNode.attrs) {
|
|
102
106
|
return true;
|
|
103
107
|
}
|
|
104
|
-
return super.viewShouldUpdate(nextNode);
|
|
108
|
+
return super.viewShouldUpdate(nextNode, decorations);
|
|
105
109
|
}
|
|
106
110
|
stopEvent(event) {
|
|
107
111
|
// Don't trap right click events on media node
|
|
@@ -18,7 +18,7 @@ import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-
|
|
|
18
18
|
import { getAttrsFromUrl } from '@atlaskit/media-client';
|
|
19
19
|
import { isMediaBlobUrlFromAttrs } from '../utils/media-common';
|
|
20
20
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
21
|
-
import ReactNodeView from '
|
|
21
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
22
22
|
import CaptionPlaceholder from '../ui/CaptionPlaceholder';
|
|
23
23
|
import { NodeSelection } from 'prosemirror-state';
|
|
24
24
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import ReactDOM from 'react-dom';
|
|
4
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
-
import { NodeSelection } from 'prosemirror-state';
|
|
5
|
+
import { NodeSelection, TextSelection, AllSelection } from 'prosemirror-state';
|
|
6
6
|
import { insertPoint } from 'prosemirror-transform';
|
|
7
7
|
import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
8
8
|
import { ErrorReporter, browser } from '@atlaskit/editor-common/utils';
|
|
@@ -23,6 +23,7 @@ import { isInListItem } from '../../../utils';
|
|
|
23
23
|
import { CAPTION_PLACEHOLDER_ID } from '../ui/CaptionPlaceholder';
|
|
24
24
|
import { RawIntlProvider } from 'react-intl-next';
|
|
25
25
|
import { MediaTaskManager } from './mediaTaskManager';
|
|
26
|
+
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
26
27
|
export { stateKey } from './plugin-key';
|
|
27
28
|
export const MEDIA_CONTENT_WRAP_CLASS_NAME = 'media-content-wrap';
|
|
28
29
|
const createDropPlaceholder = (intl, allowDropLine) => {
|
|
@@ -522,7 +523,6 @@ export const createPlugin = (_schema, options, reactContext, getIntl, dispatch,
|
|
|
522
523
|
// we shift it to the media single parent as other code is opinionated about
|
|
523
524
|
// the selection landing there. In particular the caption insertion and selection
|
|
524
525
|
// action.
|
|
525
|
-
|
|
526
526
|
return newState.tr.setSelection(NodeSelection.create(newState.doc, transaction.selection.$from.pos - 1));
|
|
527
527
|
}
|
|
528
528
|
}
|
|
@@ -541,17 +541,34 @@ export const createPlugin = (_schema, options, reactContext, getIntl, dispatch,
|
|
|
541
541
|
},
|
|
542
542
|
props: {
|
|
543
543
|
decorations: state => {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
544
|
+
// Use this to indicate that the media node is selected
|
|
545
|
+
const mediaNodes = [];
|
|
548
546
|
const {
|
|
549
547
|
schema,
|
|
550
548
|
selection: {
|
|
551
549
|
$anchor
|
|
552
|
-
}
|
|
550
|
+
},
|
|
551
|
+
doc
|
|
553
552
|
} = state;
|
|
554
553
|
|
|
554
|
+
// Find any media nodes in the current selection
|
|
555
|
+
if (state.selection instanceof TextSelection || state.selection instanceof AllSelection || state.selection instanceof NodeSelection || state.selection instanceof CellSelection) {
|
|
556
|
+
doc.nodesBetween(state.selection.from, state.selection.to, (node, pos) => {
|
|
557
|
+
if (node.type === schema.nodes.media) {
|
|
558
|
+
mediaNodes.push(Decoration.node(pos, pos + node.nodeSize, {}, {
|
|
559
|
+
type: 'media',
|
|
560
|
+
selected: true
|
|
561
|
+
}));
|
|
562
|
+
return false;
|
|
563
|
+
}
|
|
564
|
+
return true;
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
const pluginState = getMediaPluginState(state);
|
|
568
|
+
if (!pluginState.showDropzone) {
|
|
569
|
+
return DecorationSet.create(state.doc, mediaNodes);
|
|
570
|
+
}
|
|
571
|
+
|
|
555
572
|
// When a media is already selected
|
|
556
573
|
if (state.selection instanceof NodeSelection) {
|
|
557
574
|
const node = state.selection.node;
|
|
@@ -559,20 +576,20 @@ export const createPlugin = (_schema, options, reactContext, getIntl, dispatch,
|
|
|
559
576
|
const deco = Decoration.node(state.selection.from, state.selection.to, {
|
|
560
577
|
class: 'richMedia-selected'
|
|
561
578
|
});
|
|
562
|
-
return DecorationSet.create(state.doc, [deco]);
|
|
579
|
+
return DecorationSet.create(state.doc, [deco, ...mediaNodes]);
|
|
563
580
|
}
|
|
564
|
-
return;
|
|
581
|
+
return DecorationSet.create(state.doc, mediaNodes);
|
|
565
582
|
}
|
|
566
583
|
let pos = $anchor.pos;
|
|
567
584
|
if ($anchor.parent.type !== schema.nodes.paragraph && $anchor.parent.type !== schema.nodes.codeBlock) {
|
|
568
585
|
pos = insertPoint(state.doc, pos, schema.nodes.mediaGroup);
|
|
569
586
|
}
|
|
570
587
|
if (pos === null || pos === undefined) {
|
|
571
|
-
return;
|
|
588
|
+
return DecorationSet.create(state.doc, mediaNodes);
|
|
572
589
|
}
|
|
573
590
|
const dropPlaceholders = [Decoration.widget(pos, dropPlaceholder, {
|
|
574
591
|
key: 'drop-placeholder'
|
|
575
|
-
})];
|
|
592
|
+
}), ...mediaNodes];
|
|
576
593
|
return DecorationSet.create(state.doc, dropPlaceholders);
|
|
577
594
|
},
|
|
578
595
|
nodeViews: options.nodeViews,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
3
3
|
import DecisionItem from '../ui/Decision';
|
|
4
4
|
import { isTypeAheadOpen } from '../../type-ahead/utils';
|
|
5
5
|
class Decision extends ReactNodeView {
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AnalyticsListener } from '@atlaskit/analytics-next';
|
|
4
4
|
import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
5
|
-
import
|
|
5
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
6
6
|
import WithPluginState from '../../../ui/WithPluginState';
|
|
7
7
|
import { stateKey as taskPluginKey } from '../pm-plugins/plugin-key';
|
|
8
8
|
import TaskItem from '../ui/Task';
|
|
@@ -3,7 +3,7 @@ import { PluginKey } from 'prosemirror-state';
|
|
|
3
3
|
import { confluenceUnsupportedBlock, confluenceUnsupportedInline, unsupportedBlock, unsupportedInline, unsupportedMark, unsupportedNodeAttribute } from '@atlaskit/adf-schema';
|
|
4
4
|
import { UnsupportedBlock } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { UnsupportedInlineNodeView } from './unsupported-inline-node-view';
|
|
6
|
-
import
|
|
6
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
7
7
|
import { getInlineNodeViewProducer } from '@atlaskit/editor-common/react-node-view';
|
|
8
8
|
export const pluginKey = new PluginKey('unsupportedContentPlugin');
|
|
9
9
|
const createPlugin = pmPluginFactoryParams => {
|
|
@@ -78,7 +78,6 @@ export const createPMSchemaAndPlugins = (inputPreset = new EditorPresetBuilder()
|
|
|
78
78
|
editorConfig
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
|
-
export { PortalProviderAPI } from './ui/PortalProvider';
|
|
82
81
|
export { EventDispatcher } from './event-dispatcher';
|
|
83
82
|
export { GapCursorSelection, Side as GapCursorSide } from './plugins/selection/gap-cursor/selection';
|
|
84
83
|
export function setTextSelection(view, anchor, head) {
|
|
@@ -8,7 +8,6 @@ import { N30 } from '@atlaskit/theme/colors';
|
|
|
8
8
|
import { akEditorSwoopCubicBezier, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth, akEditorBreakoutPadding, akEditorContextPanelWidth, ATLASSIAN_NAVIGATION_HEIGHT } from '@atlaskit/editor-shared-styles';
|
|
9
9
|
import { ContextPanelConsumer } from '@atlaskit/editor-common/ui';
|
|
10
10
|
import WithPluginState from '../WithPluginState';
|
|
11
|
-
import { pluginKey as contextPanelPluginKey } from '../../plugins/context-panel';
|
|
12
11
|
import WithEditorActions from '../WithEditorActions';
|
|
13
12
|
import { getChildBreakoutModes } from '../../utils/document';
|
|
14
13
|
import { WidthContext } from '@atlaskit/editor-common/ui';
|
|
@@ -167,6 +166,14 @@ const widthPluginKey = {
|
|
|
167
166
|
return state['widthPlugin$'];
|
|
168
167
|
}
|
|
169
168
|
};
|
|
169
|
+
|
|
170
|
+
// @ts-ignore
|
|
171
|
+
const contextPanelPluginKey = {
|
|
172
|
+
key: 'contextPanelPluginKey$',
|
|
173
|
+
getState: state => {
|
|
174
|
+
return state['contextPanelPluginKey$'];
|
|
175
|
+
}
|
|
176
|
+
};
|
|
170
177
|
function ContextPanelWithActions({
|
|
171
178
|
actions,
|
|
172
179
|
...props
|
|
@@ -6,7 +6,7 @@ export async function __temporaryFixForConfigPanel(editorView) {
|
|
|
6
6
|
const extensionPluginState = editorView.state && extensionPluginKey.getState(editorView.state);
|
|
7
7
|
if (extensionPluginState && extensionPluginState.showContextPanel) {
|
|
8
8
|
await new Promise(resolve => {
|
|
9
|
-
forceAutoSave(resolve)(editorView.state, editorView.dispatch);
|
|
9
|
+
forceAutoSave(extensionPluginState.applyChangeToContextPanel)(resolve)(editorView.state, editorView.dispatch);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
}
|
package/dist/es2019/version.json
CHANGED
|
@@ -13,7 +13,7 @@ import { createFeatureFlagsFromProps } from '../create-editor/feature-flags-from
|
|
|
13
13
|
import { ContextAdapter } from '../nodeviews/context-adapter';
|
|
14
14
|
import { ACTION, ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
15
15
|
import EditorContext from '../ui/EditorContext';
|
|
16
|
-
import { PortalProviderWithThemeProviders, PortalRenderer } from '
|
|
16
|
+
import { PortalProviderWithThemeProviders, PortalRenderer } from '@atlaskit/editor-common/portal-provider';
|
|
17
17
|
import { RenderTracking } from '../utils/performance/components/RenderTracking';
|
|
18
18
|
import { getBaseFontSize } from './utils/getBaseFontSize';
|
|
19
19
|
import useMeasureEditorMountTime from './hooks/useMeasureEditorMountTime';
|
package/dist/esm/index.js
CHANGED
|
@@ -51,7 +51,7 @@ export { getDefaultPresetOptionsFromEditorProps } from './create-editor';
|
|
|
51
51
|
export { default as EditorActions } from './actions';
|
|
52
52
|
// Re-export from provider factory to not cause a breaking change
|
|
53
53
|
|
|
54
|
-
export { PortalProvider, PortalProviderAPI, PortalRenderer } from '
|
|
54
|
+
export { PortalProvider, PortalProviderAPI, PortalRenderer } from '@atlaskit/editor-common/portal-provider';
|
|
55
55
|
export { GapCursorSelection, Side as GapCursorSide } from './plugins/selection/gap-cursor-selection';
|
|
56
56
|
export { selectionPluginKey } from './plugins/mobile-selection';
|
|
57
57
|
export { insertExpand } from './plugins/expand/commands';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { IntlProvider } from 'react-intl-next';
|
|
4
|
-
import { PortalRenderer, PortalProvider } from '
|
|
4
|
+
import { PortalRenderer, PortalProvider } from '@atlaskit/editor-common/portal-provider';
|
|
5
5
|
import { EditorInternal } from './internal/components/EditorInternal';
|
|
6
6
|
import { usePresetContext, PresetProvider } from './internal/context/preset-context';
|
|
7
7
|
import { EditorSharedConfigConsumer, useEditorSharedConfig } from './internal/context/shared-config';
|
|
@@ -2,7 +2,8 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
4
|
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; }
|
|
5
|
-
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin,
|
|
5
|
+
import { breakoutPlugin, collabEditPlugin, dataConsumerMarkPlugin, datePlugin, emojiPlugin, extensionPlugin, fragmentMarkPlugin, helpDialogPlugin, imageUploadPlugin, insertBlockPlugin, jiraIssuePlugin, layoutPlugin, listPlugin, toolbarListsIndentationPlugin, macroPlugin, maxContentSizePlugin, mediaPlugin, mentionsPlugin, panelPlugin, placeholderTextPlugin, rulePlugin, saveOnEnterPlugin, tasksAndDecisionsPlugin, textColorPlugin, statusPlugin, alignmentPlugin, indentationPlugin, customAutoformatPlugin, feedbackDialogPlugin, historyPlugin, expandPlugin, isExpandInsertionEnabled, scrollIntoViewPlugin, mobileDimensionsPlugin, findReplacePlugin, mobileSelectionPlugin, annotationPlugin, captionPlugin, avatarGroupPlugin, viewUpdateSubscriptionPlugin, beforePrimaryToolbarPlugin, codeBidiWarningPlugin, copyButtonPlugin, borderPlugin } from '../../../plugins';
|
|
6
|
+
import { contextPanelPlugin } from '@atlaskit/editor-plugin-context-panel';
|
|
6
7
|
import { gridPlugin } from '@atlaskit/editor-plugin-grid';
|
|
7
8
|
import cardPlugin from '../../../plugins/card';
|
|
8
9
|
import { tablesPlugin } from '@atlaskit/editor-plugin-table';
|
|
@@ -225,6 +226,11 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
225
226
|
}]);
|
|
226
227
|
}
|
|
227
228
|
return builder;
|
|
229
|
+
}).maybeAdd(contextPanelPlugin, function (plugin, builder) {
|
|
230
|
+
if (isFullPage) {
|
|
231
|
+
return builder.add(contextPanelPlugin);
|
|
232
|
+
}
|
|
233
|
+
return builder;
|
|
228
234
|
}).maybeAdd(extensionPlugin, function (plugin, builder) {
|
|
229
235
|
if (props.allowExtension) {
|
|
230
236
|
var extensionConfig = _typeof(props.allowExtension) === 'object' ? props.allowExtension : {};
|
|
@@ -300,11 +306,6 @@ export default function createUniversalPreset(appearance, props, featureFlags, p
|
|
|
300
306
|
return builder.add(plugin);
|
|
301
307
|
}
|
|
302
308
|
return builder;
|
|
303
|
-
}).maybeAdd(contextPanelPlugin, function (plugin, builder) {
|
|
304
|
-
if (isFullPage) {
|
|
305
|
-
return builder.add(contextPanelPlugin);
|
|
306
|
-
}
|
|
307
|
-
return builder;
|
|
308
309
|
}).maybeAdd(scrollIntoViewPlugin, function (plugin, builder) {
|
|
309
310
|
if (props.autoScrollIntoView !== false) {
|
|
310
311
|
return builder.add(scrollIntoViewPlugin);
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { SelectionBasedNodeView } from './SelectionBasedNodeView';
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { annotation } from '@atlaskit/adf-schema';
|
|
3
|
-
import WithPluginState from '../../ui/WithPluginState';
|
|
4
|
-
import { stateKey as reactPluginKey } from '../../plugins/base/pm-plugins/react-nodeview';
|
|
5
3
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
6
4
|
import { inlineCommentPlugin } from './pm-plugins/inline-comment';
|
|
7
5
|
import { AnnotationUpdateEmitter } from './update-provider';
|
|
8
|
-
import { getPluginState
|
|
6
|
+
import { getPluginState } from './utils';
|
|
9
7
|
import { buildToolbar } from './toolbar';
|
|
10
8
|
import { InlineCommentView } from './ui/InlineCommentView';
|
|
11
|
-
|
|
9
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
var annotationPlugin = function annotationPlugin(annotationProviders, api) {
|
|
12
11
|
return {
|
|
13
12
|
name: 'annotation',
|
|
14
13
|
marks: function marks() {
|
|
@@ -17,6 +16,12 @@ var annotationPlugin = function annotationPlugin(annotationProviders) {
|
|
|
17
16
|
mark: annotation
|
|
18
17
|
}];
|
|
19
18
|
},
|
|
19
|
+
getSharedState: function getSharedState(editorState) {
|
|
20
|
+
if (!editorState) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return getPluginState(editorState);
|
|
24
|
+
},
|
|
20
25
|
pmPlugins: function pmPlugins() {
|
|
21
26
|
return [{
|
|
22
27
|
name: 'annotation',
|
|
@@ -62,27 +67,32 @@ var annotationPlugin = function annotationPlugin(annotationProviders) {
|
|
|
62
67
|
if (!annotationProviders) {
|
|
63
68
|
return null;
|
|
64
69
|
}
|
|
65
|
-
return /*#__PURE__*/React.createElement(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
render: function render(_ref3) {
|
|
71
|
-
var inlineCommentState = _ref3.inlineCommentState;
|
|
72
|
-
if (inlineCommentState && !inlineCommentState.isVisible) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
76
|
-
"data-editor-popup": "true"
|
|
77
|
-
}, /*#__PURE__*/React.createElement(InlineCommentView, {
|
|
78
|
-
providers: annotationProviders,
|
|
79
|
-
editorView: editorView,
|
|
80
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
81
|
-
}));
|
|
82
|
-
}
|
|
70
|
+
return /*#__PURE__*/React.createElement(AnnotationContentComponent, {
|
|
71
|
+
api: api,
|
|
72
|
+
editorView: editorView,
|
|
73
|
+
annotationProviders: annotationProviders,
|
|
74
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
83
75
|
});
|
|
84
76
|
}
|
|
85
77
|
};
|
|
86
78
|
};
|
|
79
|
+
function AnnotationContentComponent(_ref3) {
|
|
80
|
+
var api = _ref3.api,
|
|
81
|
+
editorView = _ref3.editorView,
|
|
82
|
+
annotationProviders = _ref3.annotationProviders,
|
|
83
|
+
dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent;
|
|
84
|
+
var _useSharedPluginState = useSharedPluginState(api, ['annotation']),
|
|
85
|
+
inlineCommentState = _useSharedPluginState.annotationState;
|
|
86
|
+
if (inlineCommentState && !inlineCommentState.isVisible) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
"data-editor-popup": "true"
|
|
91
|
+
}, /*#__PURE__*/React.createElement(InlineCommentView, {
|
|
92
|
+
providers: annotationProviders,
|
|
93
|
+
editorView: editorView,
|
|
94
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
87
97
|
export default annotationPlugin;
|
|
88
98
|
export { AnnotationUpdateEmitter };
|
|
@@ -7,7 +7,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
7
7
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import { AnnotationSharedClassNames } from '@atlaskit/editor-common/styles';
|
|
10
|
-
import
|
|
10
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
11
11
|
export var AnnotationNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
12
12
|
_inherits(AnnotationNodeView, _ReactNodeView);
|
|
13
13
|
var _super = _createSuper(AnnotationNodeView);
|
|
@@ -13,7 +13,6 @@ import contextIdentifierPlugin from './pm-plugins/context-identifier';
|
|
|
13
13
|
import newlinePreserveMarksPlugin from './pm-plugins/newline-preserve-marks';
|
|
14
14
|
import inlineCursorTargetPlugin from './pm-plugins/inline-cursor-target';
|
|
15
15
|
import betterTypeHistoryPlugin from './pm-plugins/better-type-history';
|
|
16
|
-
import { plugin as reactNodeView } from './pm-plugins/react-nodeview';
|
|
17
16
|
import scrollGutter from './pm-plugins/scroll-gutter';
|
|
18
17
|
import { keymap } from '../../utils/keymap';
|
|
19
18
|
import frozenEditor from './pm-plugins/frozen-editor';
|
|
@@ -57,11 +56,6 @@ var basePlugin = function basePlugin(options, api) {
|
|
|
57
56
|
}, {
|
|
58
57
|
name: 'newlinePreserveMarksPlugin',
|
|
59
58
|
plugin: newlinePreserveMarksPlugin
|
|
60
|
-
}, {
|
|
61
|
-
name: 'reactNodeView',
|
|
62
|
-
plugin: function plugin() {
|
|
63
|
-
return reactNodeView;
|
|
64
|
-
}
|
|
65
59
|
}, {
|
|
66
60
|
name: 'frozenEditor',
|
|
67
61
|
plugin: function plugin(_ref3) {
|
|
@@ -14,12 +14,11 @@ var captionPlugin = function captionPlugin(_, api) {
|
|
|
14
14
|
return [{
|
|
15
15
|
name: 'caption',
|
|
16
16
|
plugin: function plugin(_ref) {
|
|
17
|
-
var _api$dependencies$ana;
|
|
18
17
|
var portalProviderAPI = _ref.portalProviderAPI,
|
|
19
18
|
providerFactory = _ref.providerFactory,
|
|
20
19
|
eventDispatcher = _ref.eventDispatcher,
|
|
21
20
|
dispatch = _ref.dispatch;
|
|
22
|
-
return createCaptionPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api
|
|
21
|
+
return createCaptionPlugin(portalProviderAPI, eventDispatcher, providerFactory, dispatch, api);
|
|
23
22
|
}
|
|
24
23
|
}, {
|
|
25
24
|
name: 'captionKeymap',
|
|
@@ -9,7 +9,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
9
9
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { Caption } from '@atlaskit/editor-common/ui';
|
|
12
|
-
import { SelectionBasedNodeView } from '
|
|
12
|
+
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
13
13
|
export var CaptionNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
14
14
|
_inherits(CaptionNodeView, _SelectionBasedNodeVi);
|
|
15
15
|
var _super = _createSuper(CaptionNodeView);
|
|
@@ -65,7 +65,7 @@ export var CaptionNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
65
65
|
}]);
|
|
66
66
|
return CaptionNodeView;
|
|
67
67
|
}(SelectionBasedNodeView);
|
|
68
|
-
export default function captionNodeView(portalProviderAPI, eventDispatcher) {
|
|
68
|
+
export default function captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi) {
|
|
69
69
|
return function (node, view, getPos) {
|
|
70
70
|
var hasIntlContext = true;
|
|
71
71
|
return new CaptionNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {}, undefined, undefined, undefined, hasIntlContext).init();
|
|
@@ -11,7 +11,9 @@ var fireAnalytics = function fireAnalytics(tr, action, analyticsApi) {
|
|
|
11
11
|
actionSubjectId: ACTION_SUBJECT_ID.CAPTION
|
|
12
12
|
})(tr);
|
|
13
13
|
};
|
|
14
|
-
export default (function (portalProviderAPI, eventDispatcher, providerFactory, dispatch,
|
|
14
|
+
export default (function (portalProviderAPI, eventDispatcher, providerFactory, dispatch, pluginInjectionApi) {
|
|
15
|
+
var _pluginInjectionApi$d;
|
|
16
|
+
var analyticsApi = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.analytics) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions;
|
|
15
17
|
return new SafePlugin({
|
|
16
18
|
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
17
19
|
// only run for transactions that change selection
|
|
@@ -41,7 +43,7 @@ export default (function (portalProviderAPI, eventDispatcher, providerFactory, d
|
|
|
41
43
|
key: pluginKey,
|
|
42
44
|
props: {
|
|
43
45
|
nodeViews: {
|
|
44
|
-
caption: captionNodeView(portalProviderAPI, eventDispatcher)
|
|
46
|
+
caption: captionNodeView(portalProviderAPI, eventDispatcher, pluginInjectionApi)
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
});
|
|
@@ -18,7 +18,7 @@ import rafSchedule from 'raf-schd';
|
|
|
18
18
|
import { Card } from './genericCard';
|
|
19
19
|
import { UnsupportedBlock, MediaSingle as RichMediaWrapper, findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
20
20
|
import { DEFAULT_EMBED_CARD_HEIGHT, DEFAULT_EMBED_CARD_WIDTH } from '@atlaskit/editor-shared-styles';
|
|
21
|
-
import
|
|
21
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
22
22
|
import { registerCard } from '../pm-plugins/actions';
|
|
23
23
|
import ResizableEmbedCard from '../ui/ResizableEmbedCard';
|
|
24
24
|
import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-common/utils';
|
|
@@ -333,8 +333,8 @@ _defineProperty(EmbedCardComponent, "contextTypes", {
|
|
|
333
333
|
contextAdapter: PropTypes.object
|
|
334
334
|
});
|
|
335
335
|
var WrappedBlockCard = Card(EmbedCardComponent, UnsupportedBlock);
|
|
336
|
-
export var EmbedCard = /*#__PURE__*/function (
|
|
337
|
-
_inherits(EmbedCard,
|
|
336
|
+
export var EmbedCard = /*#__PURE__*/function (_ReactNodeView) {
|
|
337
|
+
_inherits(EmbedCard, _ReactNodeView);
|
|
338
338
|
var _super2 = _createSuper(EmbedCard);
|
|
339
339
|
function EmbedCard() {
|
|
340
340
|
_classCallCheck(this, EmbedCard);
|
|
@@ -384,4 +384,4 @@ export var EmbedCard = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
384
384
|
}
|
|
385
385
|
}]);
|
|
386
386
|
return EmbedCard;
|
|
387
|
-
}(
|
|
387
|
+
}(ReactNodeView);
|
|
@@ -150,10 +150,11 @@ export var updateExtensionParams = function updateExtensionParams(updateExtensio
|
|
|
150
150
|
export var editSelectedExtension = function editSelectedExtension(editorActions) {
|
|
151
151
|
var editorView = editorActions._privateGetEditorView();
|
|
152
152
|
var _getPluginState = getPluginState(editorView.state),
|
|
153
|
-
updateExtension = _getPluginState.updateExtension
|
|
154
|
-
|
|
153
|
+
updateExtension = _getPluginState.updateExtension,
|
|
154
|
+
applyChangeToContextPanel = _getPluginState.applyChangeToContextPanel;
|
|
155
|
+
return editExtension(null, applyChangeToContextPanel, updateExtension)(editorView.state, editorView.dispatch, editorView);
|
|
155
156
|
};
|
|
156
|
-
export var editExtension = function editExtension(macroProvider, updateExtension) {
|
|
157
|
+
export var editExtension = function editExtension(macroProvider, applyChangeToContextPanel, updateExtension) {
|
|
157
158
|
return function (state, dispatch, view) {
|
|
158
159
|
if (!view) {
|
|
159
160
|
return false;
|
|
@@ -173,7 +174,8 @@ export var editExtension = function editExtension(macroProvider, updateExtension
|
|
|
173
174
|
if (updateMethod && view) {
|
|
174
175
|
var actions = createExtensionAPI({
|
|
175
176
|
editorView: view,
|
|
176
|
-
editInLegacyMacroBrowser: editInLegacyMacroBrowser
|
|
177
|
+
editInLegacyMacroBrowser: editInLegacyMacroBrowser,
|
|
178
|
+
applyChange: applyChangeToContextPanel
|
|
177
179
|
});
|
|
178
180
|
updateExtensionParams(updateMethod, nodeWithPos, actions)(state, dispatch, view);
|
|
179
181
|
return;
|