@atlaskit/editor-plugin-media 1.41.0 → 1.42.0
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 +12 -0
- package/dist/cjs/plugin.js +3 -2
- package/dist/cjs/pm-plugins/main.js +42 -15
- package/dist/es2019/plugin.js +3 -2
- package/dist/es2019/pm-plugins/main.js +38 -15
- package/dist/esm/plugin.js +3 -2
- package/dist/esm/pm-plugins/main.js +42 -15
- package/dist/types/pm-plugins/main.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/main.d.ts +3 -2
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 1.42.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#164938](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/164938)
|
|
8
|
+
[`c41c3a71e1f68`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c41c3a71e1f68) -
|
|
9
|
+
Replaced ReactDOM.render with nodeViewPortalProviderAPI.render
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 1.41.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -177,7 +177,8 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
177
177
|
providerFactory = _ref6.providerFactory,
|
|
178
178
|
errorReporter = _ref6.errorReporter,
|
|
179
179
|
portalProviderAPI = _ref6.portalProviderAPI,
|
|
180
|
-
dispatchAnalyticsEvent = _ref6.dispatchAnalyticsEvent
|
|
180
|
+
dispatchAnalyticsEvent = _ref6.dispatchAnalyticsEvent,
|
|
181
|
+
nodeViewPortalProviderAPI = _ref6.nodeViewPortalProviderAPI;
|
|
181
182
|
return (0, _main.createPlugin)(schema, {
|
|
182
183
|
providerFactory: providerFactory,
|
|
183
184
|
nodeViews: {
|
|
@@ -192,7 +193,7 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
192
193
|
customDropzoneContainer: options && options.customDropzoneContainer,
|
|
193
194
|
customMediaPicker: options && options.customMediaPicker,
|
|
194
195
|
allowResizing: !!(options && options.allowResizing)
|
|
195
|
-
}, getIntl, api, dispatch, options);
|
|
196
|
+
}, getIntl, api, nodeViewPortalProviderAPI, dispatch, options);
|
|
196
197
|
}
|
|
197
198
|
}, {
|
|
198
199
|
name: 'mediaKeymap',
|
|
@@ -21,6 +21,7 @@ var _assert = _interopRequireDefault(require("assert"));
|
|
|
21
21
|
var _react = _interopRequireDefault(require("react"));
|
|
22
22
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
23
23
|
var _reactIntlNext = require("react-intl-next");
|
|
24
|
+
var _uuid = _interopRequireDefault(require("uuid"));
|
|
24
25
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
25
26
|
var _mediaInline = require("@atlaskit/editor-common/media-inline");
|
|
26
27
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
@@ -55,25 +56,45 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
55
56
|
var MEDIA_CONTENT_WRAP_CLASS_NAME = exports.MEDIA_CONTENT_WRAP_CLASS_NAME = 'media-content-wrap';
|
|
56
57
|
var MEDIA_PLUGIN_IS_RESIZING_KEY = exports.MEDIA_PLUGIN_IS_RESIZING_KEY = 'mediaSinglePlugin.isResizing';
|
|
57
58
|
var MEDIA_PLUGIN_RESIZING_WIDTH_KEY = exports.MEDIA_PLUGIN_RESIZING_WIDTH_KEY = 'mediaSinglePlugin.resizing-width';
|
|
58
|
-
var createDropPlaceholder = function createDropPlaceholder(intl, allowDropLine) {
|
|
59
|
+
var createDropPlaceholder = function createDropPlaceholder(intl, nodeViewPortalProviderAPI, dropPlaceholderKey, allowDropLine) {
|
|
59
60
|
var dropPlaceholder = document.createElement('div');
|
|
60
61
|
var createElement = _react.default.createElement;
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_react18_plugin_portalprovider')) {
|
|
63
|
+
if (allowDropLine) {
|
|
64
|
+
nodeViewPortalProviderAPI.render(function () {
|
|
65
|
+
return createElement(_reactIntlNext.RawIntlProvider, {
|
|
66
|
+
value: intl
|
|
67
|
+
}, createElement(_DropPlaceholder.default, {
|
|
68
|
+
type: 'single'
|
|
69
|
+
}));
|
|
70
|
+
}, dropPlaceholder, dropPlaceholderKey);
|
|
71
|
+
} else {
|
|
72
|
+
nodeViewPortalProviderAPI.render(function () {
|
|
73
|
+
return createElement(_reactIntlNext.RawIntlProvider, {
|
|
74
|
+
value: intl
|
|
75
|
+
}, createElement(_DropPlaceholder.default));
|
|
76
|
+
}, dropPlaceholder, dropPlaceholderKey);
|
|
77
|
+
}
|
|
67
78
|
} else {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
79
|
+
if (allowDropLine) {
|
|
80
|
+
//eslint-disable-next-line react/no-deprecated
|
|
81
|
+
_reactDom.default.render(createElement(_reactIntlNext.RawIntlProvider, {
|
|
82
|
+
value: intl
|
|
83
|
+
}, createElement(_DropPlaceholder.default, {
|
|
84
|
+
type: 'single'
|
|
85
|
+
})), dropPlaceholder);
|
|
86
|
+
} else {
|
|
87
|
+
//eslint-disable-next-line react/no-deprecated
|
|
88
|
+
_reactDom.default.render(createElement(_reactIntlNext.RawIntlProvider, {
|
|
89
|
+
value: intl
|
|
90
|
+
}, createElement(_DropPlaceholder.default)), dropPlaceholder);
|
|
91
|
+
}
|
|
71
92
|
}
|
|
72
93
|
return dropPlaceholder;
|
|
73
94
|
};
|
|
74
95
|
var MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
|
|
75
96
|
var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
76
|
-
function MediaPluginStateImplementation(_state, options, mediaOptions,
|
|
97
|
+
function MediaPluginStateImplementation(_state, options, mediaOptions, _dispatch, pluginInjectionApi) {
|
|
77
98
|
var _this = this,
|
|
78
99
|
_this$mediaOptions2,
|
|
79
100
|
_this$mediaOptions3;
|
|
@@ -738,12 +759,12 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
738
759
|
var getMediaPluginState = exports.getMediaPluginState = function getMediaPluginState(state) {
|
|
739
760
|
return _pluginKey.stateKey.getState(state);
|
|
740
761
|
};
|
|
741
|
-
var createPlugin = exports.createPlugin = function createPlugin(_schema, options, getIntl, pluginInjectionApi, dispatch, mediaOptions
|
|
762
|
+
var createPlugin = exports.createPlugin = function createPlugin(_schema, options, getIntl, pluginInjectionApi, nodeViewPortalProviderAPI, dispatch, mediaOptions) {
|
|
742
763
|
var intl = getIntl();
|
|
743
764
|
return new _safePlugin.SafePlugin({
|
|
744
765
|
state: {
|
|
745
766
|
init: function init(_config, state) {
|
|
746
|
-
return new MediaPluginStateImplementation(state, options, mediaOptions,
|
|
767
|
+
return new MediaPluginStateImplementation(state, options, mediaOptions, dispatch, pluginInjectionApi);
|
|
747
768
|
},
|
|
748
769
|
apply: function apply(tr, pluginState) {
|
|
749
770
|
var _tr$getMeta;
|
|
@@ -881,13 +902,19 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
881
902
|
if (pos === null || pos === undefined) {
|
|
882
903
|
return _view2.DecorationSet.create(state.doc, mediaNodes);
|
|
883
904
|
}
|
|
905
|
+
var dropPlaceholderKey = (0, _uuid.default)();
|
|
884
906
|
var dropPlaceholders = [_view2.Decoration.widget(pos, function () {
|
|
885
|
-
return createDropPlaceholder(intl, mediaOptions && mediaOptions.allowDropzoneDropLine);
|
|
907
|
+
return createDropPlaceholder(intl, nodeViewPortalProviderAPI, dropPlaceholderKey, mediaOptions && mediaOptions.allowDropzoneDropLine);
|
|
886
908
|
}, {
|
|
887
909
|
key: 'drop-placeholder',
|
|
888
910
|
destroy: function destroy(elem) {
|
|
889
911
|
if (elem instanceof HTMLElement) {
|
|
890
|
-
|
|
912
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_react18_plugin_portalprovider')) {
|
|
913
|
+
nodeViewPortalProviderAPI.remove(dropPlaceholderKey);
|
|
914
|
+
} else {
|
|
915
|
+
//eslint-disable-next-line react/no-deprecated
|
|
916
|
+
_reactDom.default.unmountComponentAtNode(elem);
|
|
917
|
+
}
|
|
891
918
|
}
|
|
892
919
|
}
|
|
893
920
|
})].concat(mediaNodes);
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -169,7 +169,8 @@ export const mediaPlugin = ({
|
|
|
169
169
|
providerFactory,
|
|
170
170
|
errorReporter,
|
|
171
171
|
portalProviderAPI,
|
|
172
|
-
dispatchAnalyticsEvent
|
|
172
|
+
dispatchAnalyticsEvent,
|
|
173
|
+
nodeViewPortalProviderAPI
|
|
173
174
|
}) => {
|
|
174
175
|
return createPlugin(schema, {
|
|
175
176
|
providerFactory,
|
|
@@ -185,7 +186,7 @@ export const mediaPlugin = ({
|
|
|
185
186
|
customDropzoneContainer: options && options.customDropzoneContainer,
|
|
186
187
|
customMediaPicker: options && options.customMediaPicker,
|
|
187
188
|
allowResizing: !!(options && options.allowResizing)
|
|
188
|
-
}, getIntl, api, dispatch, options);
|
|
189
|
+
}, getIntl, api, nodeViewPortalProviderAPI, dispatch, options);
|
|
189
190
|
}
|
|
190
191
|
}, {
|
|
191
192
|
name: 'mediaKeymap',
|
|
@@ -3,6 +3,7 @@ import assert from 'assert';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
5
|
import { RawIntlProvider } from 'react-intl-next';
|
|
6
|
+
import uuid from 'uuid';
|
|
6
7
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
7
8
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
8
9
|
import { mediaInlineImagesEnabled } from '@atlaskit/editor-common/media-inline';
|
|
@@ -32,25 +33,41 @@ export { stateKey } from './plugin-key';
|
|
|
32
33
|
export const MEDIA_CONTENT_WRAP_CLASS_NAME = 'media-content-wrap';
|
|
33
34
|
export const MEDIA_PLUGIN_IS_RESIZING_KEY = 'mediaSinglePlugin.isResizing';
|
|
34
35
|
export const MEDIA_PLUGIN_RESIZING_WIDTH_KEY = 'mediaSinglePlugin.resizing-width';
|
|
35
|
-
const createDropPlaceholder = (intl, allowDropLine) => {
|
|
36
|
+
const createDropPlaceholder = (intl, nodeViewPortalProviderAPI, dropPlaceholderKey, allowDropLine) => {
|
|
36
37
|
const dropPlaceholder = document.createElement('div');
|
|
37
38
|
const createElement = React.createElement;
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
40
|
+
if (allowDropLine) {
|
|
41
|
+
nodeViewPortalProviderAPI.render(() => createElement(RawIntlProvider, {
|
|
42
|
+
value: intl
|
|
43
|
+
}, createElement(DropPlaceholder, {
|
|
44
|
+
type: 'single'
|
|
45
|
+
})), dropPlaceholder, dropPlaceholderKey);
|
|
46
|
+
} else {
|
|
47
|
+
nodeViewPortalProviderAPI.render(() => createElement(RawIntlProvider, {
|
|
48
|
+
value: intl
|
|
49
|
+
}, createElement(DropPlaceholder)), dropPlaceholder, dropPlaceholderKey);
|
|
50
|
+
}
|
|
44
51
|
} else {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
if (allowDropLine) {
|
|
53
|
+
//eslint-disable-next-line react/no-deprecated
|
|
54
|
+
ReactDOM.render(createElement(RawIntlProvider, {
|
|
55
|
+
value: intl
|
|
56
|
+
}, createElement(DropPlaceholder, {
|
|
57
|
+
type: 'single'
|
|
58
|
+
})), dropPlaceholder);
|
|
59
|
+
} else {
|
|
60
|
+
//eslint-disable-next-line react/no-deprecated
|
|
61
|
+
ReactDOM.render(createElement(RawIntlProvider, {
|
|
62
|
+
value: intl
|
|
63
|
+
}, createElement(DropPlaceholder)), dropPlaceholder);
|
|
64
|
+
}
|
|
48
65
|
}
|
|
49
66
|
return dropPlaceholder;
|
|
50
67
|
};
|
|
51
68
|
const MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
|
|
52
69
|
export class MediaPluginStateImplementation {
|
|
53
|
-
constructor(_state, options, mediaOptions,
|
|
70
|
+
constructor(_state, options, mediaOptions, _dispatch, pluginInjectionApi) {
|
|
54
71
|
var _this$mediaOptions2, _this$mediaOptions3;
|
|
55
72
|
_defineProperty(this, "allowsUploads", false);
|
|
56
73
|
_defineProperty(this, "ignoreLinks", false);
|
|
@@ -624,12 +641,12 @@ export class MediaPluginStateImplementation {
|
|
|
624
641
|
}
|
|
625
642
|
}
|
|
626
643
|
export const getMediaPluginState = state => stateKey.getState(state);
|
|
627
|
-
export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, dispatch, mediaOptions
|
|
644
|
+
export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, nodeViewPortalProviderAPI, dispatch, mediaOptions) => {
|
|
628
645
|
const intl = getIntl();
|
|
629
646
|
return new SafePlugin({
|
|
630
647
|
state: {
|
|
631
648
|
init(_config, state) {
|
|
632
|
-
return new MediaPluginStateImplementation(state, options, mediaOptions,
|
|
649
|
+
return new MediaPluginStateImplementation(state, options, mediaOptions, dispatch, pluginInjectionApi);
|
|
633
650
|
},
|
|
634
651
|
apply(tr, pluginState) {
|
|
635
652
|
var _tr$getMeta;
|
|
@@ -764,13 +781,19 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, disp
|
|
|
764
781
|
if (pos === null || pos === undefined) {
|
|
765
782
|
return DecorationSet.create(state.doc, mediaNodes);
|
|
766
783
|
}
|
|
784
|
+
const dropPlaceholderKey = uuid();
|
|
767
785
|
const dropPlaceholders = [Decoration.widget(pos, () => {
|
|
768
|
-
return createDropPlaceholder(intl, mediaOptions && mediaOptions.allowDropzoneDropLine);
|
|
786
|
+
return createDropPlaceholder(intl, nodeViewPortalProviderAPI, dropPlaceholderKey, mediaOptions && mediaOptions.allowDropzoneDropLine);
|
|
769
787
|
}, {
|
|
770
788
|
key: 'drop-placeholder',
|
|
771
789
|
destroy: elem => {
|
|
772
790
|
if (elem instanceof HTMLElement) {
|
|
773
|
-
|
|
791
|
+
if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
792
|
+
nodeViewPortalProviderAPI.remove(dropPlaceholderKey);
|
|
793
|
+
} else {
|
|
794
|
+
//eslint-disable-next-line react/no-deprecated
|
|
795
|
+
ReactDOM.unmountComponentAtNode(elem);
|
|
796
|
+
}
|
|
774
797
|
}
|
|
775
798
|
}
|
|
776
799
|
}), ...mediaNodes];
|
package/dist/esm/plugin.js
CHANGED
|
@@ -167,7 +167,8 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
167
167
|
providerFactory = _ref6.providerFactory,
|
|
168
168
|
errorReporter = _ref6.errorReporter,
|
|
169
169
|
portalProviderAPI = _ref6.portalProviderAPI,
|
|
170
|
-
dispatchAnalyticsEvent = _ref6.dispatchAnalyticsEvent
|
|
170
|
+
dispatchAnalyticsEvent = _ref6.dispatchAnalyticsEvent,
|
|
171
|
+
nodeViewPortalProviderAPI = _ref6.nodeViewPortalProviderAPI;
|
|
171
172
|
return createPlugin(schema, {
|
|
172
173
|
providerFactory: providerFactory,
|
|
173
174
|
nodeViews: {
|
|
@@ -182,7 +183,7 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
182
183
|
customDropzoneContainer: options && options.customDropzoneContainer,
|
|
183
184
|
customMediaPicker: options && options.customMediaPicker,
|
|
184
185
|
allowResizing: !!(options && options.allowResizing)
|
|
185
|
-
}, getIntl, api, dispatch, options);
|
|
186
|
+
}, getIntl, api, nodeViewPortalProviderAPI, dispatch, options);
|
|
186
187
|
}
|
|
187
188
|
}, {
|
|
188
189
|
name: 'mediaKeymap',
|
|
@@ -12,6 +12,7 @@ import assert from 'assert';
|
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import ReactDOM from 'react-dom';
|
|
14
14
|
import { RawIntlProvider } from 'react-intl-next';
|
|
15
|
+
import uuid from 'uuid';
|
|
15
16
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
16
17
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
17
18
|
import { mediaInlineImagesEnabled } from '@atlaskit/editor-common/media-inline';
|
|
@@ -41,25 +42,45 @@ export { stateKey } from './plugin-key';
|
|
|
41
42
|
export var MEDIA_CONTENT_WRAP_CLASS_NAME = 'media-content-wrap';
|
|
42
43
|
export var MEDIA_PLUGIN_IS_RESIZING_KEY = 'mediaSinglePlugin.isResizing';
|
|
43
44
|
export var MEDIA_PLUGIN_RESIZING_WIDTH_KEY = 'mediaSinglePlugin.resizing-width';
|
|
44
|
-
var createDropPlaceholder = function createDropPlaceholder(intl, allowDropLine) {
|
|
45
|
+
var createDropPlaceholder = function createDropPlaceholder(intl, nodeViewPortalProviderAPI, dropPlaceholderKey, allowDropLine) {
|
|
45
46
|
var dropPlaceholder = document.createElement('div');
|
|
46
47
|
var createElement = React.createElement;
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
49
|
+
if (allowDropLine) {
|
|
50
|
+
nodeViewPortalProviderAPI.render(function () {
|
|
51
|
+
return createElement(RawIntlProvider, {
|
|
52
|
+
value: intl
|
|
53
|
+
}, createElement(DropPlaceholder, {
|
|
54
|
+
type: 'single'
|
|
55
|
+
}));
|
|
56
|
+
}, dropPlaceholder, dropPlaceholderKey);
|
|
57
|
+
} else {
|
|
58
|
+
nodeViewPortalProviderAPI.render(function () {
|
|
59
|
+
return createElement(RawIntlProvider, {
|
|
60
|
+
value: intl
|
|
61
|
+
}, createElement(DropPlaceholder));
|
|
62
|
+
}, dropPlaceholder, dropPlaceholderKey);
|
|
63
|
+
}
|
|
53
64
|
} else {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
if (allowDropLine) {
|
|
66
|
+
//eslint-disable-next-line react/no-deprecated
|
|
67
|
+
ReactDOM.render(createElement(RawIntlProvider, {
|
|
68
|
+
value: intl
|
|
69
|
+
}, createElement(DropPlaceholder, {
|
|
70
|
+
type: 'single'
|
|
71
|
+
})), dropPlaceholder);
|
|
72
|
+
} else {
|
|
73
|
+
//eslint-disable-next-line react/no-deprecated
|
|
74
|
+
ReactDOM.render(createElement(RawIntlProvider, {
|
|
75
|
+
value: intl
|
|
76
|
+
}, createElement(DropPlaceholder)), dropPlaceholder);
|
|
77
|
+
}
|
|
57
78
|
}
|
|
58
79
|
return dropPlaceholder;
|
|
59
80
|
};
|
|
60
81
|
var MEDIA_RESOLVED_STATES = ['ready', 'error', 'cancelled'];
|
|
61
82
|
export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
62
|
-
function MediaPluginStateImplementation(_state, options, mediaOptions,
|
|
83
|
+
function MediaPluginStateImplementation(_state, options, mediaOptions, _dispatch, pluginInjectionApi) {
|
|
63
84
|
var _this = this,
|
|
64
85
|
_this$mediaOptions2,
|
|
65
86
|
_this$mediaOptions3;
|
|
@@ -724,12 +745,12 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
724
745
|
export var getMediaPluginState = function getMediaPluginState(state) {
|
|
725
746
|
return stateKey.getState(state);
|
|
726
747
|
};
|
|
727
|
-
export var createPlugin = function createPlugin(_schema, options, getIntl, pluginInjectionApi, dispatch, mediaOptions
|
|
748
|
+
export var createPlugin = function createPlugin(_schema, options, getIntl, pluginInjectionApi, nodeViewPortalProviderAPI, dispatch, mediaOptions) {
|
|
728
749
|
var intl = getIntl();
|
|
729
750
|
return new SafePlugin({
|
|
730
751
|
state: {
|
|
731
752
|
init: function init(_config, state) {
|
|
732
|
-
return new MediaPluginStateImplementation(state, options, mediaOptions,
|
|
753
|
+
return new MediaPluginStateImplementation(state, options, mediaOptions, dispatch, pluginInjectionApi);
|
|
733
754
|
},
|
|
734
755
|
apply: function apply(tr, pluginState) {
|
|
735
756
|
var _tr$getMeta;
|
|
@@ -867,13 +888,19 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
867
888
|
if (pos === null || pos === undefined) {
|
|
868
889
|
return DecorationSet.create(state.doc, mediaNodes);
|
|
869
890
|
}
|
|
891
|
+
var dropPlaceholderKey = uuid();
|
|
870
892
|
var dropPlaceholders = [Decoration.widget(pos, function () {
|
|
871
|
-
return createDropPlaceholder(intl, mediaOptions && mediaOptions.allowDropzoneDropLine);
|
|
893
|
+
return createDropPlaceholder(intl, nodeViewPortalProviderAPI, dropPlaceholderKey, mediaOptions && mediaOptions.allowDropzoneDropLine);
|
|
872
894
|
}, {
|
|
873
895
|
key: 'drop-placeholder',
|
|
874
896
|
destroy: function destroy(elem) {
|
|
875
897
|
if (elem instanceof HTMLElement) {
|
|
876
|
-
|
|
898
|
+
if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
899
|
+
nodeViewPortalProviderAPI.remove(dropPlaceholderKey);
|
|
900
|
+
} else {
|
|
901
|
+
//eslint-disable-next-line react/no-deprecated
|
|
902
|
+
ReactDOM.unmountComponentAtNode(elem);
|
|
903
|
+
}
|
|
877
904
|
}
|
|
878
905
|
}
|
|
879
906
|
})].concat(mediaNodes);
|
|
@@ -4,6 +4,7 @@ import type { InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
5
5
|
import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
+
import { type PortalProviderAPI } from '@atlaskit/editor-common/src/portal';
|
|
7
8
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
9
|
import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
9
10
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -62,7 +63,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
|
|
|
62
63
|
dispatch?: Dispatch;
|
|
63
64
|
pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
64
65
|
singletonCreatedAt: number;
|
|
65
|
-
constructor(state: EditorState, options: MediaPluginOptions, mediaOptions: MediaOptions | undefined,
|
|
66
|
+
constructor(state: EditorState, options: MediaPluginOptions, mediaOptions: MediaOptions | undefined, dispatch: Dispatch | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined);
|
|
66
67
|
clone(): this;
|
|
67
68
|
subscribeToUploadInProgressState(fn: (isUploading: boolean) => void): void;
|
|
68
69
|
unsubscribeFromUploadInProgressState(fn: (isUploading: boolean) => void): void;
|
|
@@ -129,4 +130,4 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
|
|
|
129
130
|
updateAndDispatch(props: Partial<Pick<this, 'allowsUploads' | 'allUploadsFinished' | 'isFullscreen'>>): void;
|
|
130
131
|
}
|
|
131
132
|
export declare const getMediaPluginState: (state: EditorState) => MediaPluginState;
|
|
132
|
-
export declare const createPlugin: (_schema: Schema, options: MediaPluginOptions, getIntl: () => IntlShape, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, dispatch?: Dispatch, mediaOptions?: MediaOptions
|
|
133
|
+
export declare const createPlugin: (_schema: Schema, options: MediaPluginOptions, getIntl: () => IntlShape, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, dispatch?: Dispatch, mediaOptions?: MediaOptions) => SafePlugin<MediaPluginState>;
|
|
@@ -4,6 +4,7 @@ import type { InsertMediaVia } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
5
5
|
import type { MediaProvider } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
|
+
import { type PortalProviderAPI } from '@atlaskit/editor-common/src/portal';
|
|
7
8
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
8
9
|
import type { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
9
10
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -62,7 +63,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
|
|
|
62
63
|
dispatch?: Dispatch;
|
|
63
64
|
pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined;
|
|
64
65
|
singletonCreatedAt: number;
|
|
65
|
-
constructor(state: EditorState, options: MediaPluginOptions, mediaOptions: MediaOptions | undefined,
|
|
66
|
+
constructor(state: EditorState, options: MediaPluginOptions, mediaOptions: MediaOptions | undefined, dispatch: Dispatch | undefined, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined);
|
|
66
67
|
clone(): this;
|
|
67
68
|
subscribeToUploadInProgressState(fn: (isUploading: boolean) => void): void;
|
|
68
69
|
unsubscribeFromUploadInProgressState(fn: (isUploading: boolean) => void): void;
|
|
@@ -129,4 +130,4 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
|
|
|
129
130
|
updateAndDispatch(props: Partial<Pick<this, 'allowsUploads' | 'allUploadsFinished' | 'isFullscreen'>>): void;
|
|
130
131
|
}
|
|
131
132
|
export declare const getMediaPluginState: (state: EditorState) => MediaPluginState;
|
|
132
|
-
export declare const createPlugin: (_schema: Schema, options: MediaPluginOptions, getIntl: () => IntlShape, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, dispatch?: Dispatch, mediaOptions?: MediaOptions
|
|
133
|
+
export declare const createPlugin: (_schema: Schema, options: MediaPluginOptions, getIntl: () => IntlShape, pluginInjectionApi: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI, dispatch?: Dispatch, mediaOptions?: MediaOptions) => SafePlugin<MediaPluginState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.0",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@atlaskit/analytics-namespaced-context": "^6.12.0",
|
|
37
37
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
38
38
|
"@atlaskit/button": "^20.3.0",
|
|
39
|
-
"@atlaskit/editor-common": "^94.
|
|
39
|
+
"@atlaskit/editor-common": "^94.23.0",
|
|
40
40
|
"@atlaskit/editor-palette": "1.6.3",
|
|
41
41
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
42
42
|
"@atlaskit/editor-plugin-annotation": "1.24.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@atlaskit/primitives": "^13.2.0",
|
|
67
67
|
"@atlaskit/textfield": "^6.5.0",
|
|
68
68
|
"@atlaskit/theme": "^14.0.0",
|
|
69
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
69
|
+
"@atlaskit/tmp-editor-statsig": "^2.18.0",
|
|
70
70
|
"@atlaskit/tokens": "^2.2.0",
|
|
71
71
|
"@atlaskit/tooltip": "^18.9.0",
|
|
72
72
|
"@babel/runtime": "^7.0.0",
|
|
@@ -152,6 +152,9 @@
|
|
|
152
152
|
},
|
|
153
153
|
"confluence_frontend_media_scroll_fix": {
|
|
154
154
|
"type": "boolean"
|
|
155
|
+
},
|
|
156
|
+
"platform_editor_react18_plugin_portalprovider": {
|
|
157
|
+
"type": "boolean"
|
|
155
158
|
}
|
|
156
159
|
},
|
|
157
160
|
"stricter": {
|