@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
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
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
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
4
|
import { removeSelectedNode, removeParentNodeOfType } from 'prosemirror-utils';
|
|
5
|
-
import { applyChange } from '../context-panel/transforms';
|
|
6
5
|
import { createCommand } from './plugin-factory';
|
|
7
6
|
import { getSelectedExtension } from './utils';
|
|
8
7
|
import { removeConnectedNodes } from '@atlaskit/editor-common/utils';
|
|
@@ -14,7 +13,7 @@ export function updateState(state) {
|
|
|
14
13
|
data: state
|
|
15
14
|
});
|
|
16
15
|
}
|
|
17
|
-
export function setEditingContextToContextPanel(processParametersBefore, processParametersAfter) {
|
|
16
|
+
export function setEditingContextToContextPanel(processParametersBefore, processParametersAfter, applyChangeToContextPanel) {
|
|
18
17
|
return createCommand({
|
|
19
18
|
type: 'UPDATE_STATE',
|
|
20
19
|
data: {
|
|
@@ -22,24 +21,28 @@ export function setEditingContextToContextPanel(processParametersBefore, process
|
|
|
22
21
|
processParametersBefore: processParametersBefore,
|
|
23
22
|
processParametersAfter: processParametersAfter
|
|
24
23
|
}
|
|
25
|
-
},
|
|
24
|
+
}, applyChangeToContextPanel);
|
|
26
25
|
}
|
|
27
|
-
export var clearEditingContext =
|
|
28
|
-
type: 'UPDATE_STATE',
|
|
29
|
-
data: {
|
|
30
|
-
showContextPanel: false,
|
|
31
|
-
processParametersBefore: undefined,
|
|
32
|
-
processParametersAfter: undefined
|
|
33
|
-
}
|
|
34
|
-
}, applyChange);
|
|
35
|
-
export var forceAutoSave = function forceAutoSave(resolve, reject) {
|
|
26
|
+
export var clearEditingContext = function clearEditingContext(applyChangeToContextPanel) {
|
|
36
27
|
return createCommand({
|
|
37
28
|
type: 'UPDATE_STATE',
|
|
38
29
|
data: {
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
showContextPanel: false,
|
|
31
|
+
processParametersBefore: undefined,
|
|
32
|
+
processParametersAfter: undefined
|
|
41
33
|
}
|
|
42
|
-
},
|
|
34
|
+
}, applyChangeToContextPanel);
|
|
35
|
+
};
|
|
36
|
+
export var forceAutoSave = function forceAutoSave(applyChangeToContextPanel) {
|
|
37
|
+
return function (resolve, reject) {
|
|
38
|
+
return createCommand({
|
|
39
|
+
type: 'UPDATE_STATE',
|
|
40
|
+
data: {
|
|
41
|
+
autoSaveResolve: resolve,
|
|
42
|
+
autoSaveReject: reject
|
|
43
|
+
}
|
|
44
|
+
}, applyChangeToContextPanel);
|
|
45
|
+
};
|
|
43
46
|
};
|
|
44
47
|
export var updateExtensionLayout = function updateExtensionLayout(layout) {
|
|
45
48
|
return createCommand({
|
|
@@ -25,7 +25,7 @@ var areParametersEqual = function areParametersEqual(firstParameters, secondPara
|
|
|
25
25
|
}
|
|
26
26
|
return firstParameters === secondParameters;
|
|
27
27
|
};
|
|
28
|
-
export var getContextPanel = function getContextPanel(allowAutoSave, featureFlags) {
|
|
28
|
+
export var getContextPanel = function getContextPanel(allowAutoSave, featureFlags, applyChange) {
|
|
29
29
|
return function (state) {
|
|
30
30
|
var nodeWithPos = getSelectedExtension(state, true);
|
|
31
31
|
|
|
@@ -87,7 +87,7 @@ export var getContextPanel = function getContextPanel(allowAutoSave, featureFlag
|
|
|
87
87
|
autoSaveResolve();
|
|
88
88
|
}
|
|
89
89
|
if (!allowAutoSave) {
|
|
90
|
-
clearEditingContext(editorView.state, editorView.dispatch);
|
|
90
|
+
clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
|
|
91
91
|
}
|
|
92
92
|
case 5:
|
|
93
93
|
case "end":
|
|
@@ -110,7 +110,7 @@ export var getContextPanel = function getContextPanel(allowAutoSave, featureFlag
|
|
|
110
110
|
_context2.prev = 1;
|
|
111
111
|
_context2.next = 4;
|
|
112
112
|
return new Promise(function (resolve, reject) {
|
|
113
|
-
forceAutoSave(resolve, reject)(editorView.state, editorView.dispatch);
|
|
113
|
+
forceAutoSave(applyChange)(resolve, reject)(editorView.state, editorView.dispatch);
|
|
114
114
|
});
|
|
115
115
|
case 4:
|
|
116
116
|
_context2.next = 9;
|
|
@@ -122,7 +122,7 @@ export var getContextPanel = function getContextPanel(allowAutoSave, featureFlag
|
|
|
122
122
|
// eslint-disable-next-line no-console
|
|
123
123
|
console.error("Autosave failed with error", _context2.t0);
|
|
124
124
|
case 9:
|
|
125
|
-
clearEditingContext(editorView.state, editorView.dispatch);
|
|
125
|
+
clearEditingContext(applyChange)(editorView.state, editorView.dispatch);
|
|
126
126
|
case 10:
|
|
127
127
|
case "end":
|
|
128
128
|
return _context2.stop();
|
|
@@ -237,7 +237,7 @@ export var createExtensionAPI = function createExtensionAPI(options) {
|
|
|
237
237
|
return {
|
|
238
238
|
editInContextPanel: function editInContextPanel(transformBefore, transformAfter) {
|
|
239
239
|
var editorView = options.editorView;
|
|
240
|
-
setEditingContextToContextPanel(transformBefore, transformAfter)(editorView.state, editorView.dispatch, editorView);
|
|
240
|
+
setEditingContextToContextPanel(transformBefore, transformAfter, options.applyChange)(editorView.state, editorView.dispatch, editorView);
|
|
241
241
|
},
|
|
242
242
|
_editInLegacyMacroBrowser: function _editInLegacyMacroBrowser() {
|
|
243
243
|
var editorView = options.editorView;
|
|
@@ -5,7 +5,7 @@ import { createPlugin as createUniqueIdPlugin } from './pm-plugins/unique-id';
|
|
|
5
5
|
import { getToolbarConfig } from './toolbar';
|
|
6
6
|
import { getContextPanel } from './context-panel';
|
|
7
7
|
var extensionPlugin = function extensionPlugin() {
|
|
8
|
-
var _api$dependencies, _api$dependencies$fea;
|
|
8
|
+
var _api$dependencies, _api$dependencies$fea, _api$dependencies$con2, _api$dependencies$con3;
|
|
9
9
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10
10
|
var api = arguments.length > 1 ? arguments[1] : undefined;
|
|
11
11
|
var featureFlags = (api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$fea = _api$dependencies.featureFlags) === null || _api$dependencies$fea === void 0 ? void 0 : _api$dependencies$fea.sharedState.currentState()) || {};
|
|
@@ -38,7 +38,10 @@ var extensionPlugin = function extensionPlugin() {
|
|
|
38
38
|
}
|
|
39
39
|
}, {
|
|
40
40
|
name: 'extensionKeymap',
|
|
41
|
-
plugin:
|
|
41
|
+
plugin: function plugin() {
|
|
42
|
+
var _api$dependencies$con;
|
|
43
|
+
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$dependencies$con = api.dependencies.contextPanel) === null || _api$dependencies$con === void 0 ? void 0 : _api$dependencies$con.actions.applyChange);
|
|
44
|
+
}
|
|
42
45
|
}, {
|
|
43
46
|
name: 'extensionUniqueId',
|
|
44
47
|
plugin: function plugin() {
|
|
@@ -47,8 +50,12 @@ var extensionPlugin = function extensionPlugin() {
|
|
|
47
50
|
}];
|
|
48
51
|
},
|
|
49
52
|
pluginsOptions: {
|
|
50
|
-
floatingToolbar: getToolbarConfig(
|
|
51
|
-
|
|
53
|
+
floatingToolbar: getToolbarConfig({
|
|
54
|
+
breakoutEnabled: options.breakoutEnabled,
|
|
55
|
+
hoverDecoration: api === null || api === void 0 ? void 0 : api.dependencies.decorations.actions.hoverDecoration,
|
|
56
|
+
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$dependencies$con2 = api.dependencies.contextPanel) === null || _api$dependencies$con2 === void 0 ? void 0 : _api$dependencies$con2.actions.applyChange
|
|
57
|
+
}),
|
|
58
|
+
contextPanel: getContextPanel(options.allowAutoSave, featureFlags, api === null || api === void 0 ? void 0 : (_api$dependencies$con3 = api.dependencies.contextPanel) === null || _api$dependencies$con3 === void 0 ? void 0 : _api$dependencies$con3.actions.applyChange)
|
|
52
59
|
}
|
|
53
60
|
};
|
|
54
61
|
};
|
|
@@ -6,7 +6,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
|
6
6
|
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); }; }
|
|
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
|
-
import
|
|
9
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
10
10
|
import Extension from '../ui/Extension';
|
|
11
11
|
import ExtensionNodeWrapper from '../ui/Extension/ExtensionNodeWrapper';
|
|
12
12
|
// getInlineNodeViewProducer is a new api to use instead of ReactNodeView
|
|
@@ -2,14 +2,14 @@ import { keymap } from 'prosemirror-keymap';
|
|
|
2
2
|
import { getPluginState } from './main';
|
|
3
3
|
import * as keymaps from '../../../keymaps';
|
|
4
4
|
import { clearEditingContext } from '../commands';
|
|
5
|
-
export default function keymapPlugin() {
|
|
5
|
+
export default function keymapPlugin(applyChange) {
|
|
6
6
|
var list = {};
|
|
7
7
|
keymaps.bindKeymapWithCommand(keymaps.escape.common, function (state, dispatch) {
|
|
8
8
|
var extensionState = getPluginState(state);
|
|
9
9
|
if (!extensionState.showContextPanel) {
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
12
|
-
return clearEditingContext(state, dispatch);
|
|
12
|
+
return clearEditingContext(applyChange)(state, dispatch);
|
|
13
13
|
}, list);
|
|
14
14
|
return keymap(list);
|
|
15
15
|
}
|
|
@@ -137,7 +137,8 @@ export var handleUpdate = function handleUpdate(_ref4) {
|
|
|
137
137
|
var view = _ref4.view,
|
|
138
138
|
prevState = _ref4.prevState,
|
|
139
139
|
domAtPos = _ref4.domAtPos,
|
|
140
|
-
extensionHandlers = _ref4.extensionHandlers
|
|
140
|
+
extensionHandlers = _ref4.extensionHandlers,
|
|
141
|
+
applyChange = _ref4.applyChange;
|
|
141
142
|
var state = view.state,
|
|
142
143
|
dispatch = view.dispatch;
|
|
143
144
|
var _getPluginState = getPluginState(state),
|
|
@@ -151,7 +152,7 @@ export var handleUpdate = function handleUpdate(_ref4) {
|
|
|
151
152
|
var selectedExtension = getSelectedExtension(state, true);
|
|
152
153
|
if (!selectedExtension) {
|
|
153
154
|
if (showContextPanel) {
|
|
154
|
-
clearEditingContext(state, dispatch);
|
|
155
|
+
clearEditingContext(applyChange)(state, dispatch);
|
|
155
156
|
}
|
|
156
157
|
return;
|
|
157
158
|
}
|
|
@@ -167,7 +168,7 @@ export var handleUpdate = function handleUpdate(_ref4) {
|
|
|
167
168
|
element !== newElement;
|
|
168
169
|
if (isNewNodeSelected || shouldUpdateEditButton) {
|
|
169
170
|
if (showContextPanel) {
|
|
170
|
-
clearEditingContext(state, dispatch);
|
|
171
|
+
clearEditingContext(applyChange)(state, dispatch);
|
|
171
172
|
return;
|
|
172
173
|
}
|
|
173
174
|
var extensionType = node.attrs.extensionType;
|
|
@@ -195,11 +196,13 @@ export var handleUpdate = function handleUpdate(_ref4) {
|
|
|
195
196
|
return true;
|
|
196
197
|
};
|
|
197
198
|
var createPlugin = function createPlugin(dispatch, providerFactory, extensionHandlers, portalProviderAPI, eventDispatcher, pluginInjectionApi) {
|
|
199
|
+
var _pluginInjectionApi$d;
|
|
198
200
|
var useLongPressSelection = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
199
201
|
var options = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : {};
|
|
200
202
|
var state = createPluginState(dispatch, {
|
|
201
203
|
showEditButton: false,
|
|
202
|
-
showContextPanel: false
|
|
204
|
+
showContextPanel: false,
|
|
205
|
+
applyChangeToContextPanel: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d = pluginInjectionApi.dependencies.contextPanel) === null || _pluginInjectionApi$d === void 0 ? void 0 : _pluginInjectionApi$d.actions.applyChange
|
|
203
206
|
});
|
|
204
207
|
var extensionNodeViewOptions = {
|
|
205
208
|
appearance: options.appearance
|
|
@@ -214,11 +217,13 @@ var createPlugin = function createPlugin(dispatch, providerFactory, extensionHan
|
|
|
214
217
|
providerFactory.subscribe('contextIdentificationProvider', contextIdentificationProviderHandler);
|
|
215
218
|
return {
|
|
216
219
|
update: function update(view, prevState) {
|
|
220
|
+
var _pluginInjectionApi$d2;
|
|
217
221
|
handleUpdate({
|
|
218
222
|
view: view,
|
|
219
223
|
prevState: prevState,
|
|
220
224
|
domAtPos: domAtPos,
|
|
221
|
-
extensionHandlers: extensionHandlers
|
|
225
|
+
extensionHandlers: extensionHandlers,
|
|
226
|
+
applyChange: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies.contextPanel) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions.applyChange
|
|
222
227
|
});
|
|
223
228
|
},
|
|
224
229
|
destroy: function destroy() {
|
|
@@ -89,7 +89,7 @@ var breakoutOptions = function breakoutOptions(state, formatMessage, extensionSt
|
|
|
89
89
|
}
|
|
90
90
|
return [];
|
|
91
91
|
};
|
|
92
|
-
var editButton = function editButton(formatMessage, extensionState) {
|
|
92
|
+
var editButton = function editButton(formatMessage, extensionState, applyChangeToContextPanel) {
|
|
93
93
|
if (!extensionState.showEditButton) {
|
|
94
94
|
return [];
|
|
95
95
|
}
|
|
@@ -103,7 +103,7 @@ var editButton = function editButton(formatMessage, extensionState) {
|
|
|
103
103
|
var macroState = macroPluginKey.getState(state);
|
|
104
104
|
var _getPluginState = getPluginState(state),
|
|
105
105
|
updateExtension = _getPluginState.updateExtension;
|
|
106
|
-
editExtension(macroState && macroState.macroProvider, updateExtension)(state, dispatch, view);
|
|
106
|
+
editExtension(macroState && macroState.macroProvider, applyChangeToContextPanel, updateExtension)(state, dispatch, view);
|
|
107
107
|
return true;
|
|
108
108
|
},
|
|
109
109
|
title: formatMessage(messages.edit),
|
|
@@ -111,15 +111,17 @@ var editButton = function editButton(formatMessage, extensionState) {
|
|
|
111
111
|
focusEditoronEnter: true
|
|
112
112
|
}];
|
|
113
113
|
};
|
|
114
|
-
export var getToolbarConfig = function getToolbarConfig() {
|
|
115
|
-
var breakoutEnabled =
|
|
116
|
-
|
|
114
|
+
export var getToolbarConfig = function getToolbarConfig(_ref) {
|
|
115
|
+
var _ref$breakoutEnabled = _ref.breakoutEnabled,
|
|
116
|
+
breakoutEnabled = _ref$breakoutEnabled === void 0 ? true : _ref$breakoutEnabled,
|
|
117
|
+
hoverDecoration = _ref.hoverDecoration,
|
|
118
|
+
applyChangeToContextPanel = _ref.applyChangeToContextPanel;
|
|
117
119
|
return function (state, intl) {
|
|
118
120
|
var formatMessage = intl.formatMessage;
|
|
119
121
|
var extensionState = getPluginState(state);
|
|
120
122
|
if (extensionState && !extensionState.showContextPanel && extensionState.element) {
|
|
121
123
|
var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension];
|
|
122
|
-
var editButtonArray = editButton(formatMessage, extensionState);
|
|
124
|
+
var editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel);
|
|
123
125
|
var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled);
|
|
124
126
|
var extensionObj = getSelectedExtension(state, true);
|
|
125
127
|
|
|
@@ -45,7 +45,8 @@ var resolveExtensionIcon = /*#__PURE__*/function () {
|
|
|
45
45
|
var ExtensionButton = function ExtensionButton(props) {
|
|
46
46
|
var item = props.item,
|
|
47
47
|
node = props.node,
|
|
48
|
-
editorView = props.editorView
|
|
48
|
+
editorView = props.editorView,
|
|
49
|
+
applyChangeToContextPanel = props.applyChangeToContextPanel;
|
|
49
50
|
var ButtonIcon = React.useMemo(function () {
|
|
50
51
|
return item.icon ? Loadable({
|
|
51
52
|
loader: function () {
|
|
@@ -74,7 +75,8 @@ var ExtensionButton = function ExtensionButton(props) {
|
|
|
74
75
|
}
|
|
75
76
|
var targetNodeAdf = nodeToJSON(node);
|
|
76
77
|
var api = createExtensionAPI({
|
|
77
|
-
editorView: editorView
|
|
78
|
+
editorView: editorView,
|
|
79
|
+
applyChange: applyChangeToContextPanel
|
|
78
80
|
});
|
|
79
81
|
item.action(targetNodeAdf, api);
|
|
80
82
|
};
|
|
@@ -93,7 +95,8 @@ export var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
93
95
|
var node = props.node,
|
|
94
96
|
editorView = props.editorView,
|
|
95
97
|
extensionProvider = props.extensionProvider,
|
|
96
|
-
separator = props.separator
|
|
98
|
+
separator = props.separator,
|
|
99
|
+
applyChangeToContextPanel = props.applyChangeToContextPanel;
|
|
97
100
|
var _useState = useState([]),
|
|
98
101
|
_useState2 = _slicedToArray(_useState, 2),
|
|
99
102
|
extensions = _useState2[0],
|
|
@@ -131,9 +134,10 @@ export var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
131
134
|
}, [node]);
|
|
132
135
|
var extensionItems = React.useMemo(function () {
|
|
133
136
|
return getContextualToolbarItemsFromModule(extensions, nodeAdf, createExtensionAPI({
|
|
134
|
-
editorView: editorView
|
|
137
|
+
editorView: editorView,
|
|
138
|
+
applyChange: applyChangeToContextPanel
|
|
135
139
|
}));
|
|
136
|
-
}, [extensions, nodeAdf, editorView]);
|
|
140
|
+
}, [extensions, nodeAdf, editorView, applyChangeToContextPanel]);
|
|
137
141
|
if (!extensionItems.length) {
|
|
138
142
|
return null;
|
|
139
143
|
}
|
|
@@ -148,7 +152,8 @@ export var ExtensionsPlaceholder = function ExtensionsPlaceholder(props) {
|
|
|
148
152
|
children.push( /*#__PURE__*/React.createElement(ExtensionButton, {
|
|
149
153
|
node: node,
|
|
150
154
|
item: item,
|
|
151
|
-
editorView: editorView
|
|
155
|
+
editorView: editorView,
|
|
156
|
+
applyChangeToContextPanel: applyChangeToContextPanel
|
|
152
157
|
}));
|
|
153
158
|
if (index < extensionItems.length - 1) {
|
|
154
159
|
children.push( /*#__PURE__*/React.createElement(Separator, null));
|
|
@@ -51,7 +51,8 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
51
51
|
node = _ref.node,
|
|
52
52
|
setDisableScroll = _ref.setDisableScroll,
|
|
53
53
|
mountRef = _ref.mountRef,
|
|
54
|
-
featureFlags = _ref.featureFlags
|
|
54
|
+
featureFlags = _ref.featureFlags,
|
|
55
|
+
api = _ref.api;
|
|
55
56
|
var emojiAndColourPickerMountPoint = scrollable ? popupsMountPoint || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.fabric-editor-popup-scroll-parent')) || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.ak-editor-content-area')) || undefined : popupsMountPoint;
|
|
56
57
|
var _ref2 = featureFlags || {
|
|
57
58
|
useSomewhatSemanticTextColorNames: false
|
|
@@ -60,6 +61,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
60
61
|
return jsx(ButtonGroup, null, items.filter(function (item) {
|
|
61
62
|
return !item.hidden;
|
|
62
63
|
}).map(function (item, idx) {
|
|
64
|
+
var _api$dependencies$con;
|
|
63
65
|
switch (item.type) {
|
|
64
66
|
case 'button':
|
|
65
67
|
var ButtonIcon = item.icon;
|
|
@@ -230,7 +232,8 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
230
232
|
node: node,
|
|
231
233
|
editorView: editorView,
|
|
232
234
|
extensionProvider: extensionsProvider,
|
|
233
|
-
separator: item.separator
|
|
235
|
+
separator: item.separator,
|
|
236
|
+
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$dependencies$con = api.dependencies.contextPanel) === null || _api$dependencies$con === void 0 ? void 0 : _api$dependencies$con.actions.applyChange
|
|
234
237
|
});
|
|
235
238
|
case 'separator':
|
|
236
239
|
return jsx(Separator, {
|
|
@@ -52,7 +52,6 @@ export { default as expandPlugin, isExpandInsertionEnabled } from './expand';
|
|
|
52
52
|
export { default as scrollIntoViewPlugin } from './scroll-into-view';
|
|
53
53
|
export { default as mobileDimensionsPlugin } from './mobile-dimensions';
|
|
54
54
|
export { default as findReplacePlugin } from './find-replace';
|
|
55
|
-
export { default as contextPanelPlugin } from './context-panel';
|
|
56
55
|
export { default as selectionPlugin } from './selection';
|
|
57
56
|
export { default as mobileSelectionPlugin } from './mobile-selection';
|
|
58
57
|
export { default as clipboardPlugin } from './clipboard';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
2
|
import { PluginKey } from 'prosemirror-state';
|
|
3
3
|
import { confluenceJiraIssue } from '@atlaskit/adf-schema';
|
|
4
|
-
import
|
|
4
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
5
5
|
import ReactJIRAIssueNode from './nodeviews/jira-issue';
|
|
6
6
|
export var pluginKey = new PluginKey('jiraIssuePlugin');
|
|
7
7
|
var createPlugin = function createPlugin(_ref) {
|
|
@@ -87,10 +87,10 @@ var mediaPlugin = function mediaPlugin() {
|
|
|
87
87
|
return createPlugin(schema, {
|
|
88
88
|
providerFactory: providerFactory,
|
|
89
89
|
nodeViews: {
|
|
90
|
-
mediaGroup: ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options),
|
|
90
|
+
mediaGroup: ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
91
91
|
mediaSingle: ReactMediaSingleNode(portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent, options, api),
|
|
92
92
|
media: ReactMediaNode(portalProviderAPI, eventDispatcher, providerFactory, options, api),
|
|
93
|
-
mediaInline: ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory)
|
|
93
|
+
mediaInline: ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory, api)
|
|
94
94
|
},
|
|
95
95
|
errorReporter: errorReporter,
|
|
96
96
|
uploadErrorHandler: options && options.uploadErrorHandler,
|
|
@@ -15,17 +15,15 @@ import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
|
15
15
|
import EditorCloseIcon from '@atlaskit/icon/glyph/editor/close';
|
|
16
16
|
import { Filmstrip } from '@atlaskit/media-filmstrip';
|
|
17
17
|
import React from 'react';
|
|
18
|
-
import ReactNodeView from '
|
|
19
|
-
import { stateKey as reactNodeViewStateKey } from '../../../plugins/base/pm-plugins/react-nodeview';
|
|
20
|
-
import WithPluginState from '../../../ui/WithPluginState';
|
|
18
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
21
19
|
import { setNodeSelection } from '../../../utils';
|
|
22
20
|
import { isNodeSelectedOrInRange, SelectedState } from '../../../utils/nodes';
|
|
23
|
-
import { pluginKey as editorDisabledPluginKey } from '../../editor-disabled';
|
|
24
21
|
import { stateKey as mediaStateKey } from '../pm-plugins/plugin-key';
|
|
25
22
|
import { MediaNodeUpdater } from './mediaNodeUpdater';
|
|
26
23
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
27
24
|
import { injectIntl } from 'react-intl-next';
|
|
28
25
|
import { messages } from './messages';
|
|
26
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
29
27
|
var isMediaGroupSelectedFromProps = function isMediaGroupSelectedFromProps(props) {
|
|
30
28
|
return isNodeSelectedOrInRange(props.anchorPos, props.headPos, props.getPos(), props.node.nodeSize);
|
|
31
29
|
};
|
|
@@ -251,6 +249,15 @@ var MediaGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
251
249
|
_defineProperty(MediaGroup, "displayName", 'MediaGroup');
|
|
252
250
|
var IntlMediaGroup = injectIntl(MediaGroup);
|
|
253
251
|
export default IntlMediaGroup;
|
|
252
|
+
function MediaGroupNodeViewInternal(_ref2) {
|
|
253
|
+
var renderFn = _ref2.renderFn,
|
|
254
|
+
pluginInjectionApi = _ref2.pluginInjectionApi;
|
|
255
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['editorDisabled']),
|
|
256
|
+
editorDisabledPlugin = _useSharedPluginState.editorDisabledState;
|
|
257
|
+
return renderFn({
|
|
258
|
+
editorDisabledPlugin: editorDisabledPlugin
|
|
259
|
+
});
|
|
260
|
+
}
|
|
254
261
|
var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
255
262
|
_inherits(MediaGroupNodeView, _ReactNodeView);
|
|
256
263
|
var _super2 = _createSuper(MediaGroupNodeView);
|
|
@@ -263,16 +270,17 @@ var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
263
270
|
value: function render(props, forwardRef) {
|
|
264
271
|
var _this3 = this;
|
|
265
272
|
var providerFactory = props.providerFactory,
|
|
266
|
-
mediaOptions = props.mediaOptions
|
|
273
|
+
mediaOptions = props.mediaOptions,
|
|
274
|
+
pluginInjectionApi = props.pluginInjectionApi;
|
|
267
275
|
var getPos = this.getPos;
|
|
268
276
|
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
269
277
|
providers: ['mediaProvider', 'contextIdentifierProvider'],
|
|
270
278
|
providerFactory: providerFactory,
|
|
271
|
-
renderNode: function renderNode(
|
|
272
|
-
var mediaProvider =
|
|
273
|
-
contextIdentifierProvider =
|
|
274
|
-
var renderFn = function renderFn(
|
|
275
|
-
var editorDisabledPlugin =
|
|
279
|
+
renderNode: function renderNode(_ref3) {
|
|
280
|
+
var mediaProvider = _ref3.mediaProvider,
|
|
281
|
+
contextIdentifierProvider = _ref3.contextIdentifierProvider;
|
|
282
|
+
var renderFn = function renderFn(_ref4) {
|
|
283
|
+
var editorDisabledPlugin = _ref4.editorDisabledPlugin;
|
|
276
284
|
if (!mediaProvider) {
|
|
277
285
|
return null;
|
|
278
286
|
}
|
|
@@ -291,13 +299,9 @@ var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
291
299
|
mediaOptions: mediaOptions
|
|
292
300
|
});
|
|
293
301
|
};
|
|
294
|
-
return /*#__PURE__*/React.createElement(
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
reactNodeViewState: reactNodeViewStateKey,
|
|
298
|
-
editorDisabledPlugin: editorDisabledPluginKey
|
|
299
|
-
},
|
|
300
|
-
render: renderFn
|
|
302
|
+
return /*#__PURE__*/React.createElement(MediaGroupNodeViewInternal, {
|
|
303
|
+
renderFn: renderFn,
|
|
304
|
+
pluginInjectionApi: pluginInjectionApi
|
|
301
305
|
});
|
|
302
306
|
}
|
|
303
307
|
});
|
|
@@ -307,11 +311,13 @@ var MediaGroupNodeView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
307
311
|
}(ReactNodeView);
|
|
308
312
|
export var ReactMediaGroupNode = function ReactMediaGroupNode(portalProviderAPI, eventDispatcher, providerFactory) {
|
|
309
313
|
var mediaOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
314
|
+
var pluginInjectionApi = arguments.length > 4 ? arguments[4] : undefined;
|
|
310
315
|
return function (node, view, getPos) {
|
|
311
316
|
var hasIntlContext = true;
|
|
312
317
|
return new MediaGroupNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
313
318
|
providerFactory: providerFactory,
|
|
314
|
-
mediaOptions: mediaOptions
|
|
319
|
+
mediaOptions: mediaOptions,
|
|
320
|
+
pluginInjectionApi: pluginInjectionApi
|
|
315
321
|
}, undefined, undefined, undefined, hasIntlContext).init();
|
|
316
322
|
};
|
|
317
323
|
};
|
|
@@ -13,7 +13,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
15
15
|
import React, { useEffect, useState } from 'react';
|
|
16
|
-
import { SelectionBasedNodeView } from '
|
|
16
|
+
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
17
17
|
import WithPluginState from '../../../ui/WithPluginState';
|
|
18
18
|
import { MediaInlineCard } from '@atlaskit/media-card';
|
|
19
19
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
@@ -253,7 +253,7 @@ export var MediaInlineNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
253
253
|
}]);
|
|
254
254
|
return MediaInlineNodeView;
|
|
255
255
|
}(SelectionBasedNodeView);
|
|
256
|
-
export var ReactMediaInlineNode = function ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory, dispatchAnalyticsEvent) {
|
|
256
|
+
export var ReactMediaInlineNode = function ReactMediaInlineNode(portalProviderAPI, eventDispatcher, providerFactory, pluginInjectionApi, dispatchAnalyticsEvent) {
|
|
257
257
|
return function (node, view, getPos) {
|
|
258
258
|
return new MediaInlineNodeView(node, view, getPos, portalProviderAPI, eventDispatcher, {
|
|
259
259
|
providerFactory: providerFactory,
|
|
@@ -10,9 +10,8 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
10
10
|
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; } }
|
|
11
11
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
12
12
|
import { DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH } from '@atlaskit/editor-common/ui';
|
|
13
|
-
import { NodeSelection } from 'prosemirror-state';
|
|
14
13
|
import React from 'react';
|
|
15
|
-
import { SelectionBasedNodeView } from '
|
|
14
|
+
import { SelectionBasedNodeView } from '@atlaskit/editor-common/selection-based-node-view';
|
|
16
15
|
import MediaNode from './media';
|
|
17
16
|
import { getAttrsFromUrl } from '@atlaskit/media-client';
|
|
18
17
|
import { isMediaBlobUrlFromAttrs } from '../../utils/media-common';
|
|
@@ -26,6 +25,9 @@ var MediaNodeWithProviders = function MediaNodeWithProviders(_ref) {
|
|
|
26
25
|
width: widthState
|
|
27
26
|
});
|
|
28
27
|
};
|
|
28
|
+
function isMediaDecorationSpec(decoration) {
|
|
29
|
+
return decoration.spec.type !== undefined && decoration.spec.selected !== undefined;
|
|
30
|
+
}
|
|
29
31
|
var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
30
32
|
_inherits(MediaNodeView, _SelectionBasedNodeVi);
|
|
31
33
|
var _super = _createSuper(MediaNodeView);
|
|
@@ -36,15 +38,12 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
36
38
|
args[_key] = arguments[_key];
|
|
37
39
|
}
|
|
38
40
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "isSelected", false);
|
|
39
42
|
_defineProperty(_assertThisInitialized(_this), "renderMediaNodeWithState", function (mediaProvider, contextIdentifierProvider) {
|
|
40
43
|
return function (_ref2) {
|
|
41
44
|
var editorWidth = _ref2.width;
|
|
42
45
|
var getPos = _this.getPos;
|
|
43
46
|
var mediaOptions = _this.reactComponentProps.mediaOptions;
|
|
44
|
-
var selection = _this.view.state.selection;
|
|
45
|
-
var isSelected = function isSelected() {
|
|
46
|
-
return _this.isNodeInsideSelection(selection.from, selection.to) || selection instanceof NodeSelection && selection.from === getPos();
|
|
47
|
-
};
|
|
48
47
|
var attrs = _this.getAttrs();
|
|
49
48
|
var url = attrs.type === 'external' ? attrs.url : '';
|
|
50
49
|
var width = attrs.width,
|
|
@@ -72,7 +71,7 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
72
71
|
view: _this.view,
|
|
73
72
|
node: _this.node,
|
|
74
73
|
getPos: getPos,
|
|
75
|
-
selected:
|
|
74
|
+
selected: _this.nodeInsideSelection(),
|
|
76
75
|
originalDimensions: originalDimensions,
|
|
77
76
|
maxDimensions: maxDimensions,
|
|
78
77
|
url: url,
|
|
@@ -106,11 +105,18 @@ var MediaNodeView = /*#__PURE__*/function (_SelectionBasedNodeVi) {
|
|
|
106
105
|
}
|
|
107
106
|
}, {
|
|
108
107
|
key: "viewShouldUpdate",
|
|
109
|
-
value: function viewShouldUpdate(nextNode) {
|
|
108
|
+
value: function viewShouldUpdate(nextNode, decorations) {
|
|
109
|
+
var hasMediaNodeSelectedDecoration = decorations.some(function (decoration) {
|
|
110
|
+
return isMediaDecorationSpec(decoration) && decoration.spec.type === 'media' && decoration.spec.selected;
|
|
111
|
+
});
|
|
112
|
+
if (this.isSelected !== hasMediaNodeSelectedDecoration) {
|
|
113
|
+
this.isSelected = hasMediaNodeSelectedDecoration;
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
110
116
|
if (this.node.attrs !== nextNode.attrs) {
|
|
111
117
|
return true;
|
|
112
118
|
}
|
|
113
|
-
return _get(_getPrototypeOf(MediaNodeView.prototype), "viewShouldUpdate", this).call(this, nextNode);
|
|
119
|
+
return _get(_getPrototypeOf(MediaNodeView.prototype), "viewShouldUpdate", this).call(this, nextNode, decorations);
|
|
114
120
|
}
|
|
115
121
|
}, {
|
|
116
122
|
key: "stopEvent",
|
|
@@ -31,7 +31,7 @@ import { floatingLayouts, isRichMediaInsideOfBlockNode } from '@atlaskit/editor-
|
|
|
31
31
|
import { getAttrsFromUrl } from '@atlaskit/media-client';
|
|
32
32
|
import { isMediaBlobUrlFromAttrs } from '../utils/media-common';
|
|
33
33
|
import { getMediaFeatureFlag } from '@atlaskit/media-common';
|
|
34
|
-
import ReactNodeView from '
|
|
34
|
+
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
35
35
|
import CaptionPlaceholder from '../ui/CaptionPlaceholder';
|
|
36
36
|
import { NodeSelection } from 'prosemirror-state';
|
|
37
37
|
import { insertAndSelectCaptionFromMediaSinglePos } from '../commands/captions';
|