@atlaskit/editor-plugin-media 1.37.2 → 1.37.3

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 1.37.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#156556](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/156556)
8
+ [`fa4db989cfa70`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fa4db989cfa70) -
9
+ [HOT-112603] Reduce memory leak footage by using WeakRef to store HTML element
10
+
3
11
  ## 1.37.2
4
12
 
5
13
  ### Patch Changes
@@ -740,7 +740,6 @@ var getMediaPluginState = exports.getMediaPluginState = function getMediaPluginS
740
740
  };
741
741
  var createPlugin = exports.createPlugin = function createPlugin(_schema, options, getIntl, pluginInjectionApi, dispatch, mediaOptions, newInsertionBehaviour) {
742
742
  var intl = getIntl();
743
- var dropPlaceholder = createDropPlaceholder(intl, mediaOptions && mediaOptions.allowDropzoneDropLine);
744
743
  return new _safePlugin.SafePlugin({
745
744
  state: {
746
745
  init: function init(_config, state) {
@@ -882,8 +881,15 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
882
881
  if (pos === null || pos === undefined) {
883
882
  return _view2.DecorationSet.create(state.doc, mediaNodes);
884
883
  }
885
- var dropPlaceholders = [_view2.Decoration.widget(pos, dropPlaceholder, {
886
- key: 'drop-placeholder'
884
+ var dropPlaceholders = [_view2.Decoration.widget(pos, function () {
885
+ return createDropPlaceholder(intl, mediaOptions && mediaOptions.allowDropzoneDropLine);
886
+ }, {
887
+ key: 'drop-placeholder',
888
+ destroy: function destroy(elem) {
889
+ if (elem instanceof HTMLElement) {
890
+ _reactDom.default.unmountComponentAtNode(elem);
891
+ }
892
+ }
887
893
  })].concat(mediaNodes);
888
894
  return _view2.DecorationSet.create(state.doc, dropPlaceholders);
889
895
  },
@@ -625,7 +625,6 @@ export class MediaPluginStateImplementation {
625
625
  export const getMediaPluginState = state => stateKey.getState(state);
626
626
  export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, dispatch, mediaOptions, newInsertionBehaviour) => {
627
627
  const intl = getIntl();
628
- const dropPlaceholder = createDropPlaceholder(intl, mediaOptions && mediaOptions.allowDropzoneDropLine);
629
628
  return new SafePlugin({
630
629
  state: {
631
630
  init(_config, state) {
@@ -764,8 +763,15 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, disp
764
763
  if (pos === null || pos === undefined) {
765
764
  return DecorationSet.create(state.doc, mediaNodes);
766
765
  }
767
- const dropPlaceholders = [Decoration.widget(pos, dropPlaceholder, {
768
- key: 'drop-placeholder'
766
+ const dropPlaceholders = [Decoration.widget(pos, () => {
767
+ return createDropPlaceholder(intl, mediaOptions && mediaOptions.allowDropzoneDropLine);
768
+ }, {
769
+ key: 'drop-placeholder',
770
+ destroy: elem => {
771
+ if (elem instanceof HTMLElement) {
772
+ ReactDOM.unmountComponentAtNode(elem);
773
+ }
774
+ }
769
775
  }), ...mediaNodes];
770
776
  return DecorationSet.create(state.doc, dropPlaceholders);
771
777
  },
@@ -725,7 +725,6 @@ export var getMediaPluginState = function getMediaPluginState(state) {
725
725
  };
726
726
  export var createPlugin = function createPlugin(_schema, options, getIntl, pluginInjectionApi, dispatch, mediaOptions, newInsertionBehaviour) {
727
727
  var intl = getIntl();
728
- var dropPlaceholder = createDropPlaceholder(intl, mediaOptions && mediaOptions.allowDropzoneDropLine);
729
728
  return new SafePlugin({
730
729
  state: {
731
730
  init: function init(_config, state) {
@@ -867,8 +866,15 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
867
866
  if (pos === null || pos === undefined) {
868
867
  return DecorationSet.create(state.doc, mediaNodes);
869
868
  }
870
- var dropPlaceholders = [Decoration.widget(pos, dropPlaceholder, {
871
- key: 'drop-placeholder'
869
+ var dropPlaceholders = [Decoration.widget(pos, function () {
870
+ return createDropPlaceholder(intl, mediaOptions && mediaOptions.allowDropzoneDropLine);
871
+ }, {
872
+ key: 'drop-placeholder',
873
+ destroy: function destroy(elem) {
874
+ if (elem instanceof HTMLElement) {
875
+ ReactDOM.unmountComponentAtNode(elem);
876
+ }
877
+ }
872
878
  })].concat(mediaNodes);
873
879
  return DecorationSet.create(state.doc, dropPlaceholders);
874
880
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "1.37.2",
3
+ "version": "1.37.3",
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.2.0",
39
+ "@atlaskit/editor-common": "^94.3.0",
40
40
  "@atlaskit/editor-palette": "1.6.2",
41
41
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
42
42
  "@atlaskit/editor-plugin-annotation": "1.21.3",
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/media-card": "^78.8.0",
58
58
  "@atlaskit/media-client": "^28.0.0",
59
59
  "@atlaskit/media-client-react": "^2.2.0",
60
- "@atlaskit/media-common": "^11.6.0",
60
+ "@atlaskit/media-common": "^11.7.0",
61
61
  "@atlaskit/media-filmstrip": "^47.4.0",
62
62
  "@atlaskit/media-picker": "^66.7.0",
63
63
  "@atlaskit/media-ui": "^25.16.0",
@@ -66,7 +66,7 @@
66
66
  "@atlaskit/primitives": "^12.2.0",
67
67
  "@atlaskit/textfield": "^6.5.0",
68
68
  "@atlaskit/theme": "^14.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^2.8.0",
69
+ "@atlaskit/tmp-editor-statsig": "^2.9.0",
70
70
  "@atlaskit/tokens": "^2.0.0",
71
71
  "@atlaskit/tooltip": "^18.8.0",
72
72
  "@babel/runtime": "^7.0.0",