@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
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
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; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
-
import { PluginKey } from 'prosemirror-state';
|
|
6
|
-
export var pluginKey = new PluginKey('contextPanelPluginKey');
|
|
7
|
-
function contextPanelPluginFactory(contextPanels, dispatch) {
|
|
8
|
-
return new SafePlugin({
|
|
9
|
-
key: pluginKey,
|
|
10
|
-
state: {
|
|
11
|
-
init: function init(_config, state) {
|
|
12
|
-
return {
|
|
13
|
-
handlers: contextPanels,
|
|
14
|
-
contents: contextPanels.map(function (panelContent) {
|
|
15
|
-
return panelContent(state);
|
|
16
|
-
})
|
|
17
|
-
};
|
|
18
|
-
},
|
|
19
|
-
apply: function apply(tr, pluginState, _oldState, newState) {
|
|
20
|
-
var newPluginState = pluginState;
|
|
21
|
-
var meta = tr.getMeta(pluginKey);
|
|
22
|
-
if (tr.docChanged || tr.selectionSet || meta && meta.changed) {
|
|
23
|
-
var newContents = pluginState.handlers.map(function (panelContent) {
|
|
24
|
-
return panelContent(newState);
|
|
25
|
-
});
|
|
26
|
-
if (newContents.length !== newPluginState.contents.length || newContents.some(function (node) {
|
|
27
|
-
return newPluginState.contents.indexOf(node) < 0;
|
|
28
|
-
})) {
|
|
29
|
-
newPluginState = _objectSpread(_objectSpread({}, newPluginState), {}, {
|
|
30
|
-
contents: newContents
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (newPluginState !== pluginState) {
|
|
35
|
-
dispatch(pluginKey, newPluginState);
|
|
36
|
-
}
|
|
37
|
-
return newPluginState;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
var contextPanelPlugin = function contextPanelPlugin() {
|
|
43
|
-
return {
|
|
44
|
-
name: 'contextPanel',
|
|
45
|
-
pmPlugins: function pmPlugins() {
|
|
46
|
-
var contextPanels = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
47
|
-
return [{
|
|
48
|
-
name: 'contextPanel',
|
|
49
|
-
plugin: function plugin(_ref) {
|
|
50
|
-
var dispatch = _ref.dispatch;
|
|
51
|
-
return contextPanelPluginFactory(contextPanels.filter(Boolean), dispatch);
|
|
52
|
-
}
|
|
53
|
-
}];
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
export default contextPanelPlugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import AtlaskitTheme from '@atlaskit/theme/components';
|
|
4
|
-
import { CHANNEL } from '@atlaskit/theme/constants';
|
|
5
|
-
import { ThemeProvider } from '@emotion/react';
|
|
6
|
-
export function PortalProviderThemeProviders(props) {
|
|
7
|
-
var children = props.children,
|
|
8
|
-
mode = props.mode;
|
|
9
|
-
var styledComponentsAndEmotionTheme = React.useMemo(
|
|
10
|
-
// This return value should only be one of the following
|
|
11
|
-
// - { [CHANNEL]: { mode },
|
|
12
|
-
// - { theme: { [CHANNEL]: { mode } }
|
|
13
|
-
// However, it appears that consumers have inconsistent expectations
|
|
14
|
-
// regarding the shape.
|
|
15
|
-
// This can be revisited in future work, and for the purposes of
|
|
16
|
-
// fixing https://product-fabric.atlassian.net/browse/ED-14956
|
|
17
|
-
// we are merging the two shapes consumers expect.
|
|
18
|
-
function () {
|
|
19
|
-
var _ref;
|
|
20
|
-
return _ref = {}, _defineProperty(_ref, CHANNEL, {
|
|
21
|
-
mode: mode
|
|
22
|
-
}), _defineProperty(_ref, "theme", _defineProperty({}, CHANNEL, {
|
|
23
|
-
mode: mode
|
|
24
|
-
})), _ref;
|
|
25
|
-
}, [mode]);
|
|
26
|
-
var atlaskitTheme = React.useCallback(function () {
|
|
27
|
-
return {
|
|
28
|
-
mode: mode
|
|
29
|
-
};
|
|
30
|
-
}, [mode]);
|
|
31
|
-
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
32
|
-
theme: styledComponentsAndEmotionTheme
|
|
33
|
-
}, /*#__PURE__*/React.createElement(AtlaskitTheme.Provider, {
|
|
34
|
-
value: atlaskitTheme
|
|
35
|
-
}, children));
|
|
36
|
-
}
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
var _class;
|
|
10
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
|
-
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; } }
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { createPortal, unstable_renderSubtreeIntoContainer, unmountComponentAtNode } from 'react-dom';
|
|
14
|
-
import PropTypes from 'prop-types';
|
|
15
|
-
import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stable-react-context';
|
|
16
|
-
import { EventDispatcher } from '../../event-dispatcher';
|
|
17
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
18
|
-
import { useIntl, RawIntlProvider, injectIntl } from 'react-intl-next';
|
|
19
|
-
import { useGlobalTheme } from '@atlaskit/theme/components';
|
|
20
|
-
import { PortalProviderThemeProviders } from './PortalProviderThemesProvider';
|
|
21
|
-
import { IntlProviderIfMissingWrapper } from '@atlaskit/editor-common/ui';
|
|
22
|
-
export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
|
|
23
|
-
_inherits(PortalProviderAPI, _EventDispatcher);
|
|
24
|
-
var _super = _createSuper(PortalProviderAPI);
|
|
25
|
-
function PortalProviderAPI(intl, onAnalyticsEvent, analyticsContext, themeMode) {
|
|
26
|
-
var _this;
|
|
27
|
-
_classCallCheck(this, PortalProviderAPI);
|
|
28
|
-
_this = _super.call(this);
|
|
29
|
-
_defineProperty(_assertThisInitialized(_this), "portals", new Map());
|
|
30
|
-
_defineProperty(_assertThisInitialized(_this), "setContext", function (context) {
|
|
31
|
-
_this.context = context;
|
|
32
|
-
});
|
|
33
|
-
_this.intl = intl;
|
|
34
|
-
_this.onAnalyticsEvent = onAnalyticsEvent;
|
|
35
|
-
_this.useAnalyticsContext = analyticsContext;
|
|
36
|
-
_this.themeMode = themeMode;
|
|
37
|
-
return _this;
|
|
38
|
-
}
|
|
39
|
-
_createClass(PortalProviderAPI, [{
|
|
40
|
-
key: "render",
|
|
41
|
-
value: function render(children, container) {
|
|
42
|
-
var hasAnalyticsContext = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
43
|
-
var hasIntlContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
44
|
-
this.portals.set(container, {
|
|
45
|
-
children: children,
|
|
46
|
-
hasAnalyticsContext: hasAnalyticsContext,
|
|
47
|
-
hasIntlContext: hasIntlContext
|
|
48
|
-
});
|
|
49
|
-
var childrenWithThemeProviders = /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
|
|
50
|
-
mode: this.themeMode
|
|
51
|
-
}, children());
|
|
52
|
-
var wrappedChildren = this.useAnalyticsContext ? /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders) : childrenWithThemeProviders;
|
|
53
|
-
if (hasIntlContext) {
|
|
54
|
-
wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
55
|
-
value: this.intl
|
|
56
|
-
}, wrappedChildren);
|
|
57
|
-
}
|
|
58
|
-
unstable_renderSubtreeIntoContainer(this.context, wrappedChildren, container);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// TODO: until https://product-fabric.atlassian.net/browse/ED-5013
|
|
62
|
-
// we (unfortunately) need to re-render to pass down any updated context.
|
|
63
|
-
// selectively do this for nodeviews that opt-in via `hasAnalyticsContext`
|
|
64
|
-
}, {
|
|
65
|
-
key: "forceUpdate",
|
|
66
|
-
value: function forceUpdate(_ref) {
|
|
67
|
-
var _this2 = this;
|
|
68
|
-
var intl = _ref.intl,
|
|
69
|
-
themeMode = _ref.themeMode;
|
|
70
|
-
this.intl = intl;
|
|
71
|
-
this.themeMode = themeMode;
|
|
72
|
-
this.portals.forEach(function (portal, container) {
|
|
73
|
-
if (!portal.hasAnalyticsContext && !_this2.useAnalyticsContext && !portal.hasIntlContext) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
var wrappedChildren = portal.children();
|
|
77
|
-
var childrenWithThemeProviders = /*#__PURE__*/React.createElement(PortalProviderThemeProviders, {
|
|
78
|
-
mode: themeMode
|
|
79
|
-
}, wrappedChildren);
|
|
80
|
-
if (portal.hasAnalyticsContext && _this2.useAnalyticsContext) {
|
|
81
|
-
wrappedChildren = /*#__PURE__*/React.createElement(AnalyticsContextWrapper, null, childrenWithThemeProviders);
|
|
82
|
-
}
|
|
83
|
-
if (portal.hasIntlContext) {
|
|
84
|
-
wrappedChildren = /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
85
|
-
value: _this2.intl
|
|
86
|
-
}, childrenWithThemeProviders);
|
|
87
|
-
}
|
|
88
|
-
unstable_renderSubtreeIntoContainer(_this2.context, wrappedChildren, container);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
}, {
|
|
92
|
-
key: "remove",
|
|
93
|
-
value: function remove(container) {
|
|
94
|
-
this.portals.delete(container);
|
|
95
|
-
|
|
96
|
-
// There is a race condition that can happen caused by Prosemirror vs React,
|
|
97
|
-
// where Prosemirror removes the container from the DOM before React gets
|
|
98
|
-
// around to removing the child from the container
|
|
99
|
-
// This will throw a NotFoundError: The node to be removed is not a child of this node
|
|
100
|
-
// Both Prosemirror and React remove the elements asynchronously, and in edge
|
|
101
|
-
// cases Prosemirror beats React
|
|
102
|
-
try {
|
|
103
|
-
unmountComponentAtNode(container);
|
|
104
|
-
} catch (error) {
|
|
105
|
-
if (this.onAnalyticsEvent) {
|
|
106
|
-
this.onAnalyticsEvent({
|
|
107
|
-
payload: {
|
|
108
|
-
action: ACTION.FAILED_TO_UNMOUNT,
|
|
109
|
-
actionSubject: ACTION_SUBJECT.EDITOR,
|
|
110
|
-
actionSubjectId: ACTION_SUBJECT_ID.REACT_NODE_VIEW,
|
|
111
|
-
attributes: {
|
|
112
|
-
error: error,
|
|
113
|
-
domNodes: {
|
|
114
|
-
container: container ? container.className : undefined,
|
|
115
|
-
child: container.firstElementChild ? container.firstElementChild.className : undefined
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
eventType: EVENT_TYPE.OPERATIONAL
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}]);
|
|
125
|
-
return PortalProviderAPI;
|
|
126
|
-
}(EventDispatcher);
|
|
127
|
-
var BasePortalProvider = /*#__PURE__*/function (_React$Component) {
|
|
128
|
-
_inherits(BasePortalProvider, _React$Component);
|
|
129
|
-
var _super2 = _createSuper(BasePortalProvider);
|
|
130
|
-
function BasePortalProvider(props) {
|
|
131
|
-
var _this3;
|
|
132
|
-
_classCallCheck(this, BasePortalProvider);
|
|
133
|
-
_this3 = _super2.call(this, props);
|
|
134
|
-
_this3.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext, props.themeMode);
|
|
135
|
-
return _this3;
|
|
136
|
-
}
|
|
137
|
-
_createClass(BasePortalProvider, [{
|
|
138
|
-
key: "render",
|
|
139
|
-
value: function render() {
|
|
140
|
-
return this.props.render(this.portalProviderAPI);
|
|
141
|
-
}
|
|
142
|
-
}, {
|
|
143
|
-
key: "componentDidUpdate",
|
|
144
|
-
value: function componentDidUpdate() {
|
|
145
|
-
this.portalProviderAPI.forceUpdate({
|
|
146
|
-
intl: this.props.intl,
|
|
147
|
-
themeMode: this.props.themeMode
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}]);
|
|
151
|
-
return BasePortalProvider;
|
|
152
|
-
}(React.Component);
|
|
153
|
-
_defineProperty(BasePortalProvider, "displayName", 'PortalProvider');
|
|
154
|
-
export var PortalProvider = injectIntl(BasePortalProvider);
|
|
155
|
-
export var PortalProviderWithThemeProviders = function PortalProviderWithThemeProviders(_ref2) {
|
|
156
|
-
var onAnalyticsEvent = _ref2.onAnalyticsEvent,
|
|
157
|
-
useAnalyticsContext = _ref2.useAnalyticsContext,
|
|
158
|
-
render = _ref2.render;
|
|
159
|
-
return /*#__PURE__*/React.createElement(IntlProviderIfMissingWrapper, null, /*#__PURE__*/React.createElement(PortalProviderWithThemeAndIntlProviders, {
|
|
160
|
-
onAnalyticsEvent: onAnalyticsEvent,
|
|
161
|
-
useAnalyticsContext: useAnalyticsContext,
|
|
162
|
-
render: render
|
|
163
|
-
}));
|
|
164
|
-
};
|
|
165
|
-
var PortalProviderWithThemeAndIntlProviders = function PortalProviderWithThemeAndIntlProviders(_ref3) {
|
|
166
|
-
var onAnalyticsEvent = _ref3.onAnalyticsEvent,
|
|
167
|
-
useAnalyticsContext = _ref3.useAnalyticsContext,
|
|
168
|
-
render = _ref3.render;
|
|
169
|
-
var intl = useIntl();
|
|
170
|
-
var globalTheme = useGlobalTheme();
|
|
171
|
-
return /*#__PURE__*/React.createElement(BasePortalProvider, {
|
|
172
|
-
intl: intl,
|
|
173
|
-
themeMode: globalTheme.mode,
|
|
174
|
-
onAnalyticsEvent: onAnalyticsEvent,
|
|
175
|
-
useAnalyticsContext: useAnalyticsContext,
|
|
176
|
-
render: render
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
export var PortalRenderer = /*#__PURE__*/function (_React$Component2) {
|
|
180
|
-
_inherits(PortalRenderer, _React$Component2);
|
|
181
|
-
var _super3 = _createSuper(PortalRenderer);
|
|
182
|
-
function PortalRenderer(props) {
|
|
183
|
-
var _this4;
|
|
184
|
-
_classCallCheck(this, PortalRenderer);
|
|
185
|
-
_this4 = _super3.call(this, props);
|
|
186
|
-
_defineProperty(_assertThisInitialized(_this4), "handleUpdate", function (portals) {
|
|
187
|
-
return _this4.setState({
|
|
188
|
-
portals: portals
|
|
189
|
-
});
|
|
190
|
-
});
|
|
191
|
-
props.portalProviderAPI.setContext(_assertThisInitialized(_this4));
|
|
192
|
-
props.portalProviderAPI.on('update', _this4.handleUpdate);
|
|
193
|
-
_this4.state = {
|
|
194
|
-
portals: new Map()
|
|
195
|
-
};
|
|
196
|
-
return _this4;
|
|
197
|
-
}
|
|
198
|
-
_createClass(PortalRenderer, [{
|
|
199
|
-
key: "render",
|
|
200
|
-
value: function render() {
|
|
201
|
-
var portals = this.state.portals;
|
|
202
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, Array.from(portals.entries()).map(function (_ref4) {
|
|
203
|
-
var _ref5 = _slicedToArray(_ref4, 2),
|
|
204
|
-
container = _ref5[0],
|
|
205
|
-
children = _ref5[1];
|
|
206
|
-
return /*#__PURE__*/createPortal(children, container);
|
|
207
|
-
}));
|
|
208
|
-
}
|
|
209
|
-
}]);
|
|
210
|
-
return PortalRenderer;
|
|
211
|
-
}(React.Component);
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Wrapper to re-provide modern analytics context to ReactNodeViews.
|
|
215
|
-
*/
|
|
216
|
-
var dummyAnalyticsContext = {
|
|
217
|
-
getAtlaskitAnalyticsContext: function getAtlaskitAnalyticsContext() {},
|
|
218
|
-
getAtlaskitAnalyticsEventHandlers: function getAtlaskitAnalyticsEventHandlers() {}
|
|
219
|
-
};
|
|
220
|
-
var AnalyticsContextWrapper = (_class = /*#__PURE__*/function (_React$Component3) {
|
|
221
|
-
_inherits(AnalyticsContextWrapper, _React$Component3);
|
|
222
|
-
var _super4 = _createSuper(AnalyticsContextWrapper);
|
|
223
|
-
function AnalyticsContextWrapper() {
|
|
224
|
-
_classCallCheck(this, AnalyticsContextWrapper);
|
|
225
|
-
return _super4.apply(this, arguments);
|
|
226
|
-
}
|
|
227
|
-
_createClass(AnalyticsContextWrapper, [{
|
|
228
|
-
key: "render",
|
|
229
|
-
value: function render() {
|
|
230
|
-
var _ref6 = this.context.contextAdapter.analytics || {
|
|
231
|
-
value: dummyAnalyticsContext
|
|
232
|
-
},
|
|
233
|
-
value = _ref6.value;
|
|
234
|
-
return /*#__PURE__*/React.createElement(AnalyticsReactContext.Provider, {
|
|
235
|
-
value: value
|
|
236
|
-
}, this.props.children);
|
|
237
|
-
}
|
|
238
|
-
}]);
|
|
239
|
-
return AnalyticsContextWrapper;
|
|
240
|
-
}(React.Component), _defineProperty(_class, "contextTypes", {
|
|
241
|
-
contextAdapter: PropTypes.object
|
|
242
|
-
}), _class);
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { NodeView, EditorView, Decoration } from 'prosemirror-view';
|
|
3
|
-
import { Node as PMNode } from 'prosemirror-model';
|
|
4
|
-
import { PortalProviderAPI } from '../ui/PortalProvider';
|
|
5
|
-
import { EventDispatcher } from '../event-dispatcher';
|
|
6
|
-
import { ReactComponentProps, shouldUpdate, getPosHandler, ForwardRef } from './types';
|
|
7
|
-
export default class ReactNodeView<P = ReactComponentProps> implements NodeView {
|
|
8
|
-
private domRef?;
|
|
9
|
-
private contentDOMWrapper?;
|
|
10
|
-
private reactComponent?;
|
|
11
|
-
private portalProviderAPI;
|
|
12
|
-
private hasAnalyticsContext;
|
|
13
|
-
private _viewShouldUpdate?;
|
|
14
|
-
protected eventDispatcher?: EventDispatcher;
|
|
15
|
-
private hasIntlContext;
|
|
16
|
-
reactComponentProps: P;
|
|
17
|
-
view: EditorView;
|
|
18
|
-
getPos: getPosHandler;
|
|
19
|
-
contentDOM: Node | undefined;
|
|
20
|
-
node: PMNode;
|
|
21
|
-
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps?: P, reactComponent?: React.ComponentType<any>, hasAnalyticsContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
|
|
22
|
-
/**
|
|
23
|
-
* This method exists to move initialization logic out of the constructor,
|
|
24
|
-
* so object can be initialized properly before calling render first time.
|
|
25
|
-
*
|
|
26
|
-
* Example:
|
|
27
|
-
* Instance properties get added to an object only after super call in
|
|
28
|
-
* constructor, which leads to some methods being undefined during the
|
|
29
|
-
* first render.
|
|
30
|
-
*/
|
|
31
|
-
init(): this;
|
|
32
|
-
private renderReactComponent;
|
|
33
|
-
createDomRef(): HTMLElement;
|
|
34
|
-
getContentDOM(): {
|
|
35
|
-
dom: Node;
|
|
36
|
-
contentDOM?: Node | null | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
handleRef: (node: HTMLElement | null) => void;
|
|
39
|
-
private _handleRef;
|
|
40
|
-
render(props: P, forwardRef?: ForwardRef): React.ReactElement<any> | null;
|
|
41
|
-
update(node: PMNode, _decorations: Array<Decoration>, _innerDecorations?: Array<Decoration>, validUpdate?: (currentNode: PMNode, newNode: PMNode) => boolean): boolean;
|
|
42
|
-
viewShouldUpdate(nextNode: PMNode): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Copies the attributes from a ProseMirror Node to a DOM node.
|
|
45
|
-
* @param node The Prosemirror Node from which to source the attributes
|
|
46
|
-
*/
|
|
47
|
-
setDomAttrs(node: PMNode, element: HTMLElement): void;
|
|
48
|
-
get dom(): HTMLElement | undefined;
|
|
49
|
-
destroy(): void;
|
|
50
|
-
private dispatchAnalyticsEvent;
|
|
51
|
-
static fromComponent(component: React.ComponentType<any>, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, props?: ReactComponentProps, viewShouldUpdate?: (nextNode: PMNode) => boolean, hasIntlContext?: boolean): (node: PMNode, view: EditorView, getPos: getPosHandler) => ReactNodeView<ReactComponentProps>;
|
|
52
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { EditorView } from 'prosemirror-view';
|
|
3
|
-
import { Node as PMNode } from 'prosemirror-model';
|
|
4
|
-
import { PortalProviderAPI } from '../ui/PortalProvider';
|
|
5
|
-
import { EventDispatcher } from '../event-dispatcher';
|
|
6
|
-
import { ReactComponentProps, shouldUpdate, getPosHandler } from './types';
|
|
7
|
-
import ReactNodeView from './ReactNodeView';
|
|
8
|
-
/**
|
|
9
|
-
* A ReactNodeView that handles React components sensitive
|
|
10
|
-
* to selection changes.
|
|
11
|
-
*
|
|
12
|
-
* If the selection changes, it will attempt to re-render the
|
|
13
|
-
* React component. Otherwise it does nothing.
|
|
14
|
-
*
|
|
15
|
-
* You can subclass `viewShouldUpdate` to include other
|
|
16
|
-
* props that your component might want to consider before
|
|
17
|
-
* entering the React lifecycle. These are usually props you
|
|
18
|
-
* compare in `shouldComponentUpdate`.
|
|
19
|
-
*
|
|
20
|
-
* An example:
|
|
21
|
-
*
|
|
22
|
-
* ```
|
|
23
|
-
* viewShouldUpdate(nextNode) {
|
|
24
|
-
* if (nextNode.attrs !== this.node.attrs) {
|
|
25
|
-
* return true;
|
|
26
|
-
* }
|
|
27
|
-
*
|
|
28
|
-
* return super.viewShouldUpdate(nextNode);
|
|
29
|
-
* }```
|
|
30
|
-
*/
|
|
31
|
-
export declare class SelectionBasedNodeView<P = ReactComponentProps> extends ReactNodeView<P> {
|
|
32
|
-
private oldSelection;
|
|
33
|
-
private selectionChangeState;
|
|
34
|
-
pos: number | undefined;
|
|
35
|
-
posEnd: number | undefined;
|
|
36
|
-
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: P, reactComponent?: React.ComponentType<any>, hasContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
|
|
37
|
-
/**
|
|
38
|
-
* Update current node's start and end positions.
|
|
39
|
-
*
|
|
40
|
-
* Prefer `this.pos` rather than getPos(), because calling getPos is
|
|
41
|
-
* expensive, unless you know you're definitely going to render.
|
|
42
|
-
*/
|
|
43
|
-
private updatePos;
|
|
44
|
-
private getPositionsWithDefault;
|
|
45
|
-
isNodeInsideSelection: (from: number, to: number, pos?: number, posEnd?: number) => boolean;
|
|
46
|
-
isSelectionInsideNode: (from: number, to: number, pos?: number, posEnd?: number) => boolean;
|
|
47
|
-
private isSelectedNode;
|
|
48
|
-
insideSelection: () => boolean;
|
|
49
|
-
nodeInsideSelection: () => boolean;
|
|
50
|
-
viewShouldUpdate(_nextNode: PMNode): boolean;
|
|
51
|
-
destroy(): void;
|
|
52
|
-
private onSelectionChange;
|
|
53
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey } from 'prosemirror-state';
|
|
3
|
-
type StateChangeHandler = (fromPos: number, toPos: number) => any;
|
|
4
|
-
export declare class ReactNodeViewState {
|
|
5
|
-
private changeHandlers;
|
|
6
|
-
constructor();
|
|
7
|
-
subscribe(cb: StateChangeHandler): void;
|
|
8
|
-
unsubscribe(cb: StateChangeHandler): void;
|
|
9
|
-
notifyNewSelection(fromPos: number, toPos: number): void;
|
|
10
|
-
}
|
|
11
|
-
export declare const stateKey: PluginKey<ReactNodeViewState, any>;
|
|
12
|
-
export declare const plugin: SafePlugin<ReactNodeViewState, any>;
|
|
13
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PluginKey } from 'prosemirror-state';
|
|
3
|
-
import { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
4
|
-
import { ContextPanelHandler } from './types';
|
|
5
|
-
export declare const pluginKey: PluginKey<ContextPanelPluginState, any>;
|
|
6
|
-
type ContextPanelPluginState = {
|
|
7
|
-
handlers: ContextPanelHandler[];
|
|
8
|
-
contents: React.ReactNode[];
|
|
9
|
-
};
|
|
10
|
-
declare const contextPanelPlugin: NextEditorPlugin<'contextPanel'>;
|
|
11
|
-
export default contextPanelPlugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { ContextPanelHandler } from '@atlaskit/editor-common/types';
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { EventDispatcher } from '../../event-dispatcher';
|
|
3
|
-
import { FireAnalyticsCallback } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { IntlShape, WrappedComponentProps } from 'react-intl-next';
|
|
5
|
-
import type { ThemeModes } from '@atlaskit/theme/types';
|
|
6
|
-
export type BasePortalProviderProps = {
|
|
7
|
-
render: (portalProviderAPI: PortalProviderAPI) => React.ReactChild | JSX.Element | null;
|
|
8
|
-
onAnalyticsEvent?: FireAnalyticsCallback;
|
|
9
|
-
useAnalyticsContext?: boolean;
|
|
10
|
-
themeMode?: ThemeModes;
|
|
11
|
-
} & WrappedComponentProps;
|
|
12
|
-
export type Portals = Map<HTMLElement, React.ReactChild>;
|
|
13
|
-
export type PortalRendererState = {
|
|
14
|
-
portals: Portals;
|
|
15
|
-
};
|
|
16
|
-
type MountedPortal = {
|
|
17
|
-
children: () => React.ReactChild | null;
|
|
18
|
-
hasAnalyticsContext: boolean;
|
|
19
|
-
hasIntlContext: boolean;
|
|
20
|
-
};
|
|
21
|
-
export declare class PortalProviderAPI extends EventDispatcher {
|
|
22
|
-
portals: Map<HTMLElement, MountedPortal>;
|
|
23
|
-
context: any;
|
|
24
|
-
intl: IntlShape;
|
|
25
|
-
onAnalyticsEvent?: FireAnalyticsCallback;
|
|
26
|
-
useAnalyticsContext?: boolean;
|
|
27
|
-
themeMode?: ThemeModes;
|
|
28
|
-
constructor(intl: IntlShape, onAnalyticsEvent?: FireAnalyticsCallback, analyticsContext?: boolean, themeMode?: ThemeModes);
|
|
29
|
-
setContext: (context: any) => void;
|
|
30
|
-
render(children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, hasAnalyticsContext?: boolean, hasIntlContext?: boolean): void;
|
|
31
|
-
forceUpdate({ intl, themeMode, }: {
|
|
32
|
-
intl: IntlShape;
|
|
33
|
-
themeMode: ThemeModes | undefined;
|
|
34
|
-
}): void;
|
|
35
|
-
remove(container: HTMLElement): void;
|
|
36
|
-
}
|
|
37
|
-
export declare const PortalProvider: React.FC<import("react-intl-next").WithIntlProps<BasePortalProviderProps>> & {
|
|
38
|
-
WrappedComponent: React.ComponentType<BasePortalProviderProps>;
|
|
39
|
-
};
|
|
40
|
-
type PortalProviderWithThemeProvidersProps = Omit<BasePortalProviderProps, 'intl' | 'themeMode'>;
|
|
41
|
-
export declare const PortalProviderWithThemeProviders: ({ onAnalyticsEvent, useAnalyticsContext, render, }: PortalProviderWithThemeProvidersProps) => JSX.Element;
|
|
42
|
-
export declare class PortalRenderer extends React.Component<{
|
|
43
|
-
portalProviderAPI: PortalProviderAPI;
|
|
44
|
-
}, PortalRendererState> {
|
|
45
|
-
constructor(props: {
|
|
46
|
-
portalProviderAPI: PortalProviderAPI;
|
|
47
|
-
});
|
|
48
|
-
handleUpdate: (portals: Portals) => void;
|
|
49
|
-
render(): JSX.Element;
|
|
50
|
-
}
|
|
51
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { NodeView, EditorView, Decoration } from 'prosemirror-view';
|
|
3
|
-
import { Node as PMNode } from 'prosemirror-model';
|
|
4
|
-
import { PortalProviderAPI } from '../ui/PortalProvider';
|
|
5
|
-
import { EventDispatcher } from '../event-dispatcher';
|
|
6
|
-
import { ReactComponentProps, shouldUpdate, getPosHandler, ForwardRef } from './types';
|
|
7
|
-
export default class ReactNodeView<P = ReactComponentProps> implements NodeView {
|
|
8
|
-
private domRef?;
|
|
9
|
-
private contentDOMWrapper?;
|
|
10
|
-
private reactComponent?;
|
|
11
|
-
private portalProviderAPI;
|
|
12
|
-
private hasAnalyticsContext;
|
|
13
|
-
private _viewShouldUpdate?;
|
|
14
|
-
protected eventDispatcher?: EventDispatcher;
|
|
15
|
-
private hasIntlContext;
|
|
16
|
-
reactComponentProps: P;
|
|
17
|
-
view: EditorView;
|
|
18
|
-
getPos: getPosHandler;
|
|
19
|
-
contentDOM: Node | undefined;
|
|
20
|
-
node: PMNode;
|
|
21
|
-
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps?: P, reactComponent?: React.ComponentType<any>, hasAnalyticsContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
|
|
22
|
-
/**
|
|
23
|
-
* This method exists to move initialization logic out of the constructor,
|
|
24
|
-
* so object can be initialized properly before calling render first time.
|
|
25
|
-
*
|
|
26
|
-
* Example:
|
|
27
|
-
* Instance properties get added to an object only after super call in
|
|
28
|
-
* constructor, which leads to some methods being undefined during the
|
|
29
|
-
* first render.
|
|
30
|
-
*/
|
|
31
|
-
init(): this;
|
|
32
|
-
private renderReactComponent;
|
|
33
|
-
createDomRef(): HTMLElement;
|
|
34
|
-
getContentDOM(): {
|
|
35
|
-
dom: Node;
|
|
36
|
-
contentDOM?: Node | null | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
handleRef: (node: HTMLElement | null) => void;
|
|
39
|
-
private _handleRef;
|
|
40
|
-
render(props: P, forwardRef?: ForwardRef): React.ReactElement<any> | null;
|
|
41
|
-
update(node: PMNode, _decorations: Array<Decoration>, _innerDecorations?: Array<Decoration>, validUpdate?: (currentNode: PMNode, newNode: PMNode) => boolean): boolean;
|
|
42
|
-
viewShouldUpdate(nextNode: PMNode): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Copies the attributes from a ProseMirror Node to a DOM node.
|
|
45
|
-
* @param node The Prosemirror Node from which to source the attributes
|
|
46
|
-
*/
|
|
47
|
-
setDomAttrs(node: PMNode, element: HTMLElement): void;
|
|
48
|
-
get dom(): HTMLElement | undefined;
|
|
49
|
-
destroy(): void;
|
|
50
|
-
private dispatchAnalyticsEvent;
|
|
51
|
-
static fromComponent(component: React.ComponentType<any>, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, props?: ReactComponentProps, viewShouldUpdate?: (nextNode: PMNode) => boolean, hasIntlContext?: boolean): (node: PMNode, view: EditorView, getPos: getPosHandler) => ReactNodeView<ReactComponentProps>;
|
|
52
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { EditorView } from 'prosemirror-view';
|
|
3
|
-
import { Node as PMNode } from 'prosemirror-model';
|
|
4
|
-
import { PortalProviderAPI } from '../ui/PortalProvider';
|
|
5
|
-
import { EventDispatcher } from '../event-dispatcher';
|
|
6
|
-
import { ReactComponentProps, shouldUpdate, getPosHandler } from './types';
|
|
7
|
-
import ReactNodeView from './ReactNodeView';
|
|
8
|
-
/**
|
|
9
|
-
* A ReactNodeView that handles React components sensitive
|
|
10
|
-
* to selection changes.
|
|
11
|
-
*
|
|
12
|
-
* If the selection changes, it will attempt to re-render the
|
|
13
|
-
* React component. Otherwise it does nothing.
|
|
14
|
-
*
|
|
15
|
-
* You can subclass `viewShouldUpdate` to include other
|
|
16
|
-
* props that your component might want to consider before
|
|
17
|
-
* entering the React lifecycle. These are usually props you
|
|
18
|
-
* compare in `shouldComponentUpdate`.
|
|
19
|
-
*
|
|
20
|
-
* An example:
|
|
21
|
-
*
|
|
22
|
-
* ```
|
|
23
|
-
* viewShouldUpdate(nextNode) {
|
|
24
|
-
* if (nextNode.attrs !== this.node.attrs) {
|
|
25
|
-
* return true;
|
|
26
|
-
* }
|
|
27
|
-
*
|
|
28
|
-
* return super.viewShouldUpdate(nextNode);
|
|
29
|
-
* }```
|
|
30
|
-
*/
|
|
31
|
-
export declare class SelectionBasedNodeView<P = ReactComponentProps> extends ReactNodeView<P> {
|
|
32
|
-
private oldSelection;
|
|
33
|
-
private selectionChangeState;
|
|
34
|
-
pos: number | undefined;
|
|
35
|
-
posEnd: number | undefined;
|
|
36
|
-
constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: P, reactComponent?: React.ComponentType<any>, hasContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
|
|
37
|
-
/**
|
|
38
|
-
* Update current node's start and end positions.
|
|
39
|
-
*
|
|
40
|
-
* Prefer `this.pos` rather than getPos(), because calling getPos is
|
|
41
|
-
* expensive, unless you know you're definitely going to render.
|
|
42
|
-
*/
|
|
43
|
-
private updatePos;
|
|
44
|
-
private getPositionsWithDefault;
|
|
45
|
-
isNodeInsideSelection: (from: number, to: number, pos?: number, posEnd?: number) => boolean;
|
|
46
|
-
isSelectionInsideNode: (from: number, to: number, pos?: number, posEnd?: number) => boolean;
|
|
47
|
-
private isSelectedNode;
|
|
48
|
-
insideSelection: () => boolean;
|
|
49
|
-
nodeInsideSelection: () => boolean;
|
|
50
|
-
viewShouldUpdate(_nextNode: PMNode): boolean;
|
|
51
|
-
destroy(): void;
|
|
52
|
-
private onSelectionChange;
|
|
53
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import { PluginKey } from 'prosemirror-state';
|
|
3
|
-
type StateChangeHandler = (fromPos: number, toPos: number) => any;
|
|
4
|
-
export declare class ReactNodeViewState {
|
|
5
|
-
private changeHandlers;
|
|
6
|
-
constructor();
|
|
7
|
-
subscribe(cb: StateChangeHandler): void;
|
|
8
|
-
unsubscribe(cb: StateChangeHandler): void;
|
|
9
|
-
notifyNewSelection(fromPos: number, toPos: number): void;
|
|
10
|
-
}
|
|
11
|
-
export declare const stateKey: PluginKey<ReactNodeViewState, any>;
|
|
12
|
-
export declare const plugin: SafePlugin<ReactNodeViewState, any>;
|
|
13
|
-
export {};
|