@atlaskit/editor-plugin-media 8.4.9 → 8.4.12
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 +25 -0
- package/dist/cjs/mediaPlugin.js +2 -0
- package/dist/cjs/nodeviews/toDOM-fixes/mediaSingle.js +11 -2
- package/dist/cjs/pm-plugins/main.js +66 -7
- package/dist/cjs/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -1
- package/dist/es2019/mediaPlugin.js +2 -0
- package/dist/es2019/nodeviews/toDOM-fixes/mediaSingle.js +11 -2
- package/dist/es2019/pm-plugins/main.js +59 -2
- package/dist/es2019/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -1
- package/dist/esm/mediaPlugin.js +2 -0
- package/dist/esm/nodeviews/toDOM-fixes/mediaSingle.js +11 -2
- package/dist/esm/pm-plugins/main.js +66 -7
- package/dist/esm/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +4 -1
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 8.4.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`4d676bbdb3ce6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d676bbdb3ce6) -
|
|
8
|
+
ts-ignore added temporarily to unblock local consumption for help-center, will be removed once
|
|
9
|
+
project refs are setup
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 8.4.11
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [`a05464ea42678`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a05464ea42678) -
|
|
17
|
+
EDITOR-2791 bump adf-schema
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
20
|
+
## 8.4.10
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- [`98517a05bfada`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/98517a05bfada) -
|
|
25
|
+
fix styling for full-width and wide media single
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
|
|
3
28
|
## 8.4.9
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/dist/cjs/mediaPlugin.js
CHANGED
|
@@ -290,6 +290,8 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
290
290
|
var mediaSelectionHandlerPlugin = new _safePlugin.SafePlugin({
|
|
291
291
|
key: new _state.PluginKey('mediaSelectionHandlerPlugin'),
|
|
292
292
|
props: {
|
|
293
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
294
|
+
|
|
293
295
|
handleScrollToSelection: function handleScrollToSelection(view) {
|
|
294
296
|
var selection = view.state.selection;
|
|
295
297
|
if (!(selection instanceof _state.NodeSelection) || selection.node.type.name !== 'media') {
|
|
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
10
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
11
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
13
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
13
14
|
var _toDOMAttrs = require("./toDOMAttrs");
|
|
14
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -55,9 +56,17 @@ var mediaWidthCSSCalc = exports.mediaWidthCSSCalc = function mediaWidthCSSCalc(_
|
|
|
55
56
|
} else if (shouldHardCodePixelWidth) {
|
|
56
57
|
cssCalc = "min(".concat(mediaSingleDimensionWidth, "px, ").concat(fullContainerWidth, ")");
|
|
57
58
|
} else if (shouldUseBreakoutWideLogic) {
|
|
58
|
-
|
|
59
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_media_vc_fixes', 'isEnabled', true)) {
|
|
60
|
+
cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--breakout-wide-layout-width), var(--ak-editor-max-container-width)))";
|
|
61
|
+
} else {
|
|
62
|
+
cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--breakout-wide-layout-width), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))";
|
|
63
|
+
}
|
|
59
64
|
} else if (shouldUseBreakoutFullWidthLogic) {
|
|
60
|
-
|
|
65
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_media_vc_fixes', 'isEnabled', true)) {
|
|
66
|
+
cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--full-width-layout-width), var(--ak-editor-max-container-width)))";
|
|
67
|
+
} else {
|
|
68
|
+
cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--full-width-layout-width), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))";
|
|
69
|
+
}
|
|
61
70
|
} else {
|
|
62
71
|
cssCalc = "max(min(".concat(baseWidth, "px, min(100cqw, 100%)), ").concat(GUTTER_SIZE, ")");
|
|
63
72
|
}
|
|
@@ -148,6 +148,8 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
if (_this.uploadInProgressSubscriptions.length > 0 && !_this.uploadInProgressSubscriptionsNotified) {
|
|
151
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
152
|
+
|
|
151
153
|
_this.uploadInProgressSubscriptions.forEach(function (fn) {
|
|
152
154
|
return fn(true);
|
|
153
155
|
});
|
|
@@ -197,6 +199,8 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
197
199
|
}
|
|
198
200
|
_this.waitForPendingTasks().then(function () {
|
|
199
201
|
if (_this.uploadInProgressSubscriptions.length > 0 && _this.uploadInProgressSubscriptionsNotified) {
|
|
202
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
203
|
+
|
|
200
204
|
_this.uploadInProgressSubscriptions.forEach(function (fn) {
|
|
201
205
|
return fn(false);
|
|
202
206
|
});
|
|
@@ -323,25 +327,46 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
323
327
|
*/
|
|
324
328
|
(0, _defineProperty2.default)(this, "handleMediaNodeUnmount", function (oldNode) {
|
|
325
329
|
_this.trackMediaNodeRemoval(oldNode);
|
|
330
|
+
|
|
331
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
332
|
+
|
|
326
333
|
_this.mediaNodes = _this.mediaNodes.filter(function (_ref4) {
|
|
327
334
|
var node = _ref4.node;
|
|
328
335
|
return oldNode !== node;
|
|
329
336
|
});
|
|
330
337
|
});
|
|
331
338
|
(0, _defineProperty2.default)(this, "handleMediaGroupUpdate", function (oldNodes, newNodes) {
|
|
339
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
340
|
+
|
|
332
341
|
var addedNodes = newNodes.filter(function (node) {
|
|
333
|
-
return
|
|
334
|
-
|
|
335
|
-
|
|
342
|
+
return (
|
|
343
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
344
|
+
|
|
345
|
+
oldNodes.every(function (oldNode) {
|
|
346
|
+
return oldNode.attrs.id !== node.attrs.id;
|
|
347
|
+
})
|
|
348
|
+
);
|
|
336
349
|
});
|
|
350
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
351
|
+
|
|
337
352
|
var removedNodes = oldNodes.filter(function (node) {
|
|
338
|
-
return
|
|
339
|
-
|
|
340
|
-
|
|
353
|
+
return (
|
|
354
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
355
|
+
|
|
356
|
+
newNodes.every(function (newNode) {
|
|
357
|
+
return newNode.attrs.id !== node.attrs.id;
|
|
358
|
+
})
|
|
359
|
+
);
|
|
341
360
|
});
|
|
361
|
+
|
|
362
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
363
|
+
|
|
342
364
|
addedNodes.forEach(function (node) {
|
|
343
365
|
_this.trackMediaNodeAddition(node);
|
|
344
366
|
});
|
|
367
|
+
|
|
368
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
369
|
+
|
|
345
370
|
removedNodes.forEach(function (oldNode) {
|
|
346
371
|
_this.trackMediaNodeRemoval(oldNode);
|
|
347
372
|
});
|
|
@@ -350,6 +375,8 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
350
375
|
return helpers.findMediaNode(_this, id);
|
|
351
376
|
});
|
|
352
377
|
(0, _defineProperty2.default)(this, "destroyAllPickers", function (pickers) {
|
|
378
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
379
|
+
|
|
353
380
|
pickers.forEach(function (picker) {
|
|
354
381
|
return picker.destroy();
|
|
355
382
|
});
|
|
@@ -517,6 +544,8 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
517
544
|
}, {
|
|
518
545
|
key: "unsubscribeFromUploadInProgressState",
|
|
519
546
|
value: function unsubscribeFromUploadInProgressState(fn) {
|
|
547
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
548
|
+
|
|
520
549
|
this.uploadInProgressSubscriptions = this.uploadInProgressSubscriptions.filter(function (subscribedFn) {
|
|
521
550
|
return subscribedFn !== fn;
|
|
522
551
|
});
|
|
@@ -701,6 +730,8 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
701
730
|
var lastTrackedAddedNode = _this2.lastAddedMediaSingleFileIds[0];
|
|
702
731
|
// execute selection only if selection did not change after the node has been inserted
|
|
703
732
|
if ((lastTrackedAddedNode === null || lastTrackedAddedNode === void 0 ? void 0 : lastTrackedAddedNode.selectionPosition) === _this2.view.state.selection.from) {
|
|
733
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
734
|
+
|
|
704
735
|
var lastAddedNode = _this2.mediaNodes.find(function (node) {
|
|
705
736
|
return node.node.attrs.id === lastTrackedAddedNode.id;
|
|
706
737
|
});
|
|
@@ -728,7 +759,10 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
728
759
|
}
|
|
729
760
|
}, {
|
|
730
761
|
key: "destroy",
|
|
731
|
-
value:
|
|
762
|
+
value:
|
|
763
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
764
|
+
|
|
765
|
+
function destroy() {
|
|
732
766
|
if (this.destroyed) {
|
|
733
767
|
return;
|
|
734
768
|
}
|
|
@@ -775,11 +809,15 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
775
809
|
_context2.t1 = this.customPicker = _context2.sent;
|
|
776
810
|
_context2.t0.push.call(_context2.t0, _context2.t1);
|
|
777
811
|
case 13:
|
|
812
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
813
|
+
|
|
778
814
|
pickers.forEach(function (picker) {
|
|
779
815
|
picker.onNewMedia(_this3.insertFile);
|
|
780
816
|
});
|
|
781
817
|
case 14:
|
|
782
818
|
// set new upload params for the pickers
|
|
819
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
820
|
+
|
|
783
821
|
pickers.forEach(function (picker) {
|
|
784
822
|
return picker.setUploadParams(uploadParams);
|
|
785
823
|
});
|
|
@@ -804,6 +842,8 @@ var MediaPluginStateImplementation = exports.MediaPluginStateImplementation = /*
|
|
|
804
842
|
value: function updateAndDispatch(props) {
|
|
805
843
|
var _this4 = this;
|
|
806
844
|
// update plugin state
|
|
845
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
846
|
+
|
|
807
847
|
Object.keys(props).forEach(function (_key) {
|
|
808
848
|
var key = _key;
|
|
809
849
|
var value = props[key];
|
|
@@ -824,9 +864,11 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
824
864
|
var intl = getIntl();
|
|
825
865
|
return new _safePlugin.SafePlugin({
|
|
826
866
|
state: {
|
|
867
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
827
868
|
init: function init(_config, state) {
|
|
828
869
|
return new MediaPluginStateImplementation(state, options, mediaOptions, dispatch, pluginInjectionApi);
|
|
829
870
|
},
|
|
871
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
830
872
|
apply: function apply(tr, pluginState) {
|
|
831
873
|
var _tr$getMeta;
|
|
832
874
|
var isResizing = tr.getMeta(MEDIA_PLUGIN_IS_RESIZING_KEY);
|
|
@@ -851,6 +893,8 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
851
893
|
|
|
852
894
|
// remap editing media single position if we're in collab
|
|
853
895
|
if (typeof pluginState.editingMediaSinglePos === 'number') {
|
|
896
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
897
|
+
|
|
854
898
|
pluginState.editingMediaSinglePos = tr.mapping.map(pluginState.editingMediaSinglePos);
|
|
855
899
|
nextPluginState = nextPluginState.clone();
|
|
856
900
|
}
|
|
@@ -891,6 +935,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
891
935
|
return nextPluginState;
|
|
892
936
|
}
|
|
893
937
|
},
|
|
938
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
894
939
|
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
895
940
|
var _iterator = _createForOfIteratorHelper(transactions),
|
|
896
941
|
_step;
|
|
@@ -917,6 +962,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
917
962
|
return;
|
|
918
963
|
},
|
|
919
964
|
key: _pluginKey.stateKey,
|
|
965
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
920
966
|
view: function view(_view) {
|
|
921
967
|
var pluginState = getMediaPluginState(_view.state);
|
|
922
968
|
pluginState.setView(_view);
|
|
@@ -928,6 +974,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
928
974
|
};
|
|
929
975
|
},
|
|
930
976
|
props: {
|
|
977
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
931
978
|
decorations: function decorations(state) {
|
|
932
979
|
// Use this to indicate that the media node is selected
|
|
933
980
|
var mediaNodes = [];
|
|
@@ -937,6 +984,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
937
984
|
|
|
938
985
|
// Find any media nodes in the current selection
|
|
939
986
|
if (state.selection instanceof _state2.TextSelection || state.selection instanceof _state2.AllSelection || state.selection instanceof _state2.NodeSelection || state.selection instanceof _cellSelection.CellSelection) {
|
|
987
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
940
988
|
doc.nodesBetween(state.selection.from, state.selection.to, function (node, pos) {
|
|
941
989
|
if (node.type === schema.nodes.media) {
|
|
942
990
|
mediaNodes.push(_view2.Decoration.node(pos, pos + node.nodeSize, {}, {
|
|
@@ -966,6 +1014,8 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
966
1014
|
}
|
|
967
1015
|
var pos = $anchor.pos;
|
|
968
1016
|
if ($anchor.parent.type !== schema.nodes.paragraph && $anchor.parent.type !== schema.nodes.codeBlock) {
|
|
1017
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1018
|
+
|
|
969
1019
|
pos = (0, _transform.insertPoint)(state.doc, pos, schema.nodes.mediaGroup);
|
|
970
1020
|
}
|
|
971
1021
|
if (pos === null || pos === undefined) {
|
|
@@ -986,6 +1036,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
986
1036
|
return _view2.DecorationSet.create(state.doc, dropPlaceholders);
|
|
987
1037
|
},
|
|
988
1038
|
nodeViews: options.nodeViews,
|
|
1039
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
989
1040
|
handleTextInput: function handleTextInput(view, from, to, text) {
|
|
990
1041
|
var selection = view.state.selection;
|
|
991
1042
|
if (text === ' ' && selection instanceof _state2.NodeSelection && selection.node.type.name === 'mediaSingle') {
|
|
@@ -993,6 +1044,8 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
993
1044
|
var videoControlsWrapperRef = (_stateKey$getState = _pluginKey.stateKey.getState(view.state)) === null || _stateKey$getState === void 0 ? void 0 : _stateKey$getState.element;
|
|
994
1045
|
var videoControls = videoControlsWrapperRef === null || videoControlsWrapperRef === void 0 ? void 0 : videoControlsWrapperRef.querySelectorAll('button, [tabindex]:not([tabindex="-1"])');
|
|
995
1046
|
if (videoControls) {
|
|
1047
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1048
|
+
|
|
996
1049
|
var isVideoControl = Array.from(videoControls).some(function (videoControl) {
|
|
997
1050
|
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
998
1051
|
return document.activeElement === videoControl;
|
|
@@ -1005,6 +1058,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
1005
1058
|
getMediaPluginState(view.state).splitMediaGroup();
|
|
1006
1059
|
return false;
|
|
1007
1060
|
},
|
|
1061
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1008
1062
|
handleClick: function handleClick(_editorView, _pos, event) {
|
|
1009
1063
|
var _event$target;
|
|
1010
1064
|
// Ignored via go/ees005
|
|
@@ -1028,6 +1082,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
1028
1082
|
}
|
|
1029
1083
|
return false;
|
|
1030
1084
|
},
|
|
1085
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1031
1086
|
handleDoubleClickOn: function handleDoubleClickOn(view) {
|
|
1032
1087
|
var _pluginState$mediaOpt, _pluginInjectionApi$e;
|
|
1033
1088
|
// Check if media viewer is enabled
|
|
@@ -1063,7 +1118,11 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
|
|
|
1063
1118
|
}
|
|
1064
1119
|
return false;
|
|
1065
1120
|
},
|
|
1121
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1122
|
+
|
|
1066
1123
|
handleDOMEvents: {
|
|
1124
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1125
|
+
|
|
1067
1126
|
keydown: function keydown(view, event) {
|
|
1068
1127
|
var selection = view.state.selection;
|
|
1069
1128
|
if (selection instanceof _state2.NodeSelection && selection.node.type.name === 'mediaSingle') {
|
|
@@ -343,7 +343,10 @@ var ResizableMediaSingleNextFunctional = exports.ResizableMediaSingleNextFunctio
|
|
|
343
343
|
if (!guidelineSnapsReference.snaps.x) {
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
-
var _findClosestSnap = (0, _guideline.findClosestSnap)(
|
|
346
|
+
var _findClosestSnap = (0, _guideline.findClosestSnap)(
|
|
347
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
348
|
+
|
|
349
|
+
width, guidelineSnapsReference.snaps.x, guidelineSnapsReference.guidelineReference, _mediaSingle.MEDIA_SINGLE_SNAP_GAP),
|
|
347
350
|
gap = _findClosestSnap.gap,
|
|
348
351
|
activeGuidelineKeys = _findClosestSnap.keys;
|
|
349
352
|
var relativeGuidelines = activeGuidelineKeys.length ? [] : getRelativeGuides();
|
|
@@ -282,6 +282,8 @@ export const mediaPlugin = ({
|
|
|
282
282
|
const mediaSelectionHandlerPlugin = new SafePlugin({
|
|
283
283
|
key: new PluginKey('mediaSelectionHandlerPlugin'),
|
|
284
284
|
props: {
|
|
285
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
286
|
+
|
|
285
287
|
handleScrollToSelection: view => {
|
|
286
288
|
const {
|
|
287
289
|
state: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { mediaSingleSpec } from '@atlaskit/adf-schema';
|
|
2
2
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
3
3
|
import { N20, N50 } from '@atlaskit/theme/colors';
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
6
|
import { getAttrsFromNodeMediaSingle } from './toDOMAttrs';
|
|
6
7
|
const WRAPPED_LAYOUTS = ['wrap-left', 'wrap-right'];
|
|
@@ -46,9 +47,17 @@ export const mediaWidthCSSCalc = ({
|
|
|
46
47
|
} else if (shouldHardCodePixelWidth) {
|
|
47
48
|
cssCalc = `min(${mediaSingleDimensionWidth}px, ${fullContainerWidth})`;
|
|
48
49
|
} else if (shouldUseBreakoutWideLogic) {
|
|
49
|
-
|
|
50
|
+
if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
|
|
51
|
+
cssCalc = `max(var(--ak-editor--line-length), min(var(--ak-editor--breakout-wide-layout-width), var(--ak-editor-max-container-width)))`;
|
|
52
|
+
} else {
|
|
53
|
+
cssCalc = `max(var(--ak-editor--line-length), min(var(--ak-editor--breakout-wide-layout-width), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))`;
|
|
54
|
+
}
|
|
50
55
|
} else if (shouldUseBreakoutFullWidthLogic) {
|
|
51
|
-
|
|
56
|
+
if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
|
|
57
|
+
cssCalc = `max(var(--ak-editor--line-length), min(var(--ak-editor--full-width-layout-width), var(--ak-editor-max-container-width)))`;
|
|
58
|
+
} else {
|
|
59
|
+
cssCalc = `max(var(--ak-editor--line-length), min(var(--ak-editor--full-width-layout-width), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))`;
|
|
60
|
+
}
|
|
52
61
|
} else {
|
|
53
62
|
cssCalc = `max(min(${baseWidth}px, min(100cqw, 100%)), ${GUTTER_SIZE})`;
|
|
54
63
|
}
|
|
@@ -128,6 +128,8 @@ export class MediaPluginStateImplementation {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
if (this.uploadInProgressSubscriptions.length > 0 && !this.uploadInProgressSubscriptionsNotified) {
|
|
131
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
132
|
+
|
|
131
133
|
this.uploadInProgressSubscriptions.forEach(fn => fn(true));
|
|
132
134
|
this.uploadInProgressSubscriptionsNotified = true;
|
|
133
135
|
}
|
|
@@ -175,6 +177,8 @@ export class MediaPluginStateImplementation {
|
|
|
175
177
|
}
|
|
176
178
|
this.waitForPendingTasks().then(() => {
|
|
177
179
|
if (this.uploadInProgressSubscriptions.length > 0 && this.uploadInProgressSubscriptionsNotified) {
|
|
180
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
181
|
+
|
|
178
182
|
this.uploadInProgressSubscriptions.forEach(fn => fn(false));
|
|
179
183
|
this.uploadInProgressSubscriptionsNotified = false;
|
|
180
184
|
}
|
|
@@ -299,16 +303,35 @@ export class MediaPluginStateImplementation {
|
|
|
299
303
|
*/
|
|
300
304
|
_defineProperty(this, "handleMediaNodeUnmount", oldNode => {
|
|
301
305
|
this.trackMediaNodeRemoval(oldNode);
|
|
306
|
+
|
|
307
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
308
|
+
|
|
302
309
|
this.mediaNodes = this.mediaNodes.filter(({
|
|
303
310
|
node
|
|
304
311
|
}) => oldNode !== node);
|
|
305
312
|
});
|
|
306
313
|
_defineProperty(this, "handleMediaGroupUpdate", (oldNodes, newNodes) => {
|
|
307
|
-
|
|
308
|
-
|
|
314
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
315
|
+
|
|
316
|
+
const addedNodes = newNodes.filter(node =>
|
|
317
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
318
|
+
|
|
319
|
+
oldNodes.every(oldNode => oldNode.attrs.id !== node.attrs.id));
|
|
320
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
321
|
+
|
|
322
|
+
const removedNodes = oldNodes.filter(node =>
|
|
323
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
324
|
+
|
|
325
|
+
newNodes.every(newNode => newNode.attrs.id !== node.attrs.id));
|
|
326
|
+
|
|
327
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
328
|
+
|
|
309
329
|
addedNodes.forEach(node => {
|
|
310
330
|
this.trackMediaNodeAddition(node);
|
|
311
331
|
});
|
|
332
|
+
|
|
333
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
334
|
+
|
|
312
335
|
removedNodes.forEach(oldNode => {
|
|
313
336
|
this.trackMediaNodeRemoval(oldNode);
|
|
314
337
|
});
|
|
@@ -317,6 +340,8 @@ export class MediaPluginStateImplementation {
|
|
|
317
340
|
return helpers.findMediaNode(this, id);
|
|
318
341
|
});
|
|
319
342
|
_defineProperty(this, "destroyAllPickers", pickers => {
|
|
343
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
344
|
+
|
|
320
345
|
pickers.forEach(picker => picker.destroy());
|
|
321
346
|
this.pickers.splice(0, this.pickers.length);
|
|
322
347
|
});
|
|
@@ -490,6 +515,8 @@ export class MediaPluginStateImplementation {
|
|
|
490
515
|
this.uploadInProgressSubscriptions.push(fn);
|
|
491
516
|
}
|
|
492
517
|
unsubscribeFromUploadInProgressState(fn) {
|
|
518
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
519
|
+
|
|
493
520
|
this.uploadInProgressSubscriptions = this.uploadInProgressSubscriptions.filter(subscribedFn => subscribedFn !== fn);
|
|
494
521
|
}
|
|
495
522
|
async setMediaProvider(mediaProvider) {
|
|
@@ -625,6 +652,8 @@ export class MediaPluginStateImplementation {
|
|
|
625
652
|
const lastTrackedAddedNode = this.lastAddedMediaSingleFileIds[0];
|
|
626
653
|
// execute selection only if selection did not change after the node has been inserted
|
|
627
654
|
if ((lastTrackedAddedNode === null || lastTrackedAddedNode === void 0 ? void 0 : lastTrackedAddedNode.selectionPosition) === this.view.state.selection.from) {
|
|
655
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
656
|
+
|
|
628
657
|
const lastAddedNode = this.mediaNodes.find(node => {
|
|
629
658
|
return node.node.attrs.id === lastTrackedAddedNode.id;
|
|
630
659
|
});
|
|
@@ -649,6 +678,8 @@ export class MediaPluginStateImplementation {
|
|
|
649
678
|
setView(view) {
|
|
650
679
|
this.view = view;
|
|
651
680
|
}
|
|
681
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
682
|
+
|
|
652
683
|
destroy() {
|
|
653
684
|
if (this.destroyed) {
|
|
654
685
|
return;
|
|
@@ -681,12 +712,17 @@ export class MediaPluginStateImplementation {
|
|
|
681
712
|
pickerPromises.push(customPicker);
|
|
682
713
|
pickers.push(this.customPicker = await customPicker);
|
|
683
714
|
}
|
|
715
|
+
|
|
716
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
717
|
+
|
|
684
718
|
pickers.forEach(picker => {
|
|
685
719
|
picker.onNewMedia(this.insertFile);
|
|
686
720
|
});
|
|
687
721
|
}
|
|
688
722
|
|
|
689
723
|
// set new upload params for the pickers
|
|
724
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
725
|
+
|
|
690
726
|
pickers.forEach(picker => picker.setUploadParams(uploadParams));
|
|
691
727
|
}
|
|
692
728
|
collectionFromProvider() {
|
|
@@ -694,6 +730,8 @@ export class MediaPluginStateImplementation {
|
|
|
694
730
|
}
|
|
695
731
|
updateAndDispatch(props) {
|
|
696
732
|
// update plugin state
|
|
733
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
734
|
+
|
|
697
735
|
Object.keys(props).forEach(_key => {
|
|
698
736
|
const key = _key;
|
|
699
737
|
const value = props[key];
|
|
@@ -713,9 +751,11 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
713
751
|
const intl = getIntl();
|
|
714
752
|
return new SafePlugin({
|
|
715
753
|
state: {
|
|
754
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
716
755
|
init(_config, state) {
|
|
717
756
|
return new MediaPluginStateImplementation(state, options, mediaOptions, dispatch, pluginInjectionApi);
|
|
718
757
|
},
|
|
758
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
719
759
|
apply(tr, pluginState) {
|
|
720
760
|
var _tr$getMeta;
|
|
721
761
|
const isResizing = tr.getMeta(MEDIA_PLUGIN_IS_RESIZING_KEY);
|
|
@@ -740,6 +780,8 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
740
780
|
|
|
741
781
|
// remap editing media single position if we're in collab
|
|
742
782
|
if (typeof pluginState.editingMediaSinglePos === 'number') {
|
|
783
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
784
|
+
|
|
743
785
|
pluginState.editingMediaSinglePos = tr.mapping.map(pluginState.editingMediaSinglePos);
|
|
744
786
|
nextPluginState = nextPluginState.clone();
|
|
745
787
|
}
|
|
@@ -784,6 +826,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
784
826
|
return nextPluginState;
|
|
785
827
|
}
|
|
786
828
|
},
|
|
829
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
787
830
|
appendTransaction(transactions, _oldState, newState) {
|
|
788
831
|
for (const transaction of transactions) {
|
|
789
832
|
const isSelectionOnMediaInsideMediaSingle = transaction.selectionSet && isNodeSelection(transaction.selection) && transaction.selection.node.type === newState.schema.nodes.media && transaction.selection.$anchor.parent.type === newState.schema.nodes.mediaSingle;
|
|
@@ -801,6 +844,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
801
844
|
return;
|
|
802
845
|
},
|
|
803
846
|
key: stateKey,
|
|
847
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
804
848
|
view: view => {
|
|
805
849
|
const pluginState = getMediaPluginState(view.state);
|
|
806
850
|
pluginState.setView(view);
|
|
@@ -812,6 +856,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
812
856
|
};
|
|
813
857
|
},
|
|
814
858
|
props: {
|
|
859
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
815
860
|
decorations: state => {
|
|
816
861
|
// Use this to indicate that the media node is selected
|
|
817
862
|
const mediaNodes = [];
|
|
@@ -825,6 +870,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
825
870
|
|
|
826
871
|
// Find any media nodes in the current selection
|
|
827
872
|
if (state.selection instanceof TextSelection || state.selection instanceof AllSelection || state.selection instanceof NodeSelection || state.selection instanceof CellSelection) {
|
|
873
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
828
874
|
doc.nodesBetween(state.selection.from, state.selection.to, (node, pos) => {
|
|
829
875
|
if (node.type === schema.nodes.media) {
|
|
830
876
|
mediaNodes.push(Decoration.node(pos, pos + node.nodeSize, {}, {
|
|
@@ -854,6 +900,8 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
854
900
|
}
|
|
855
901
|
let pos = $anchor.pos;
|
|
856
902
|
if ($anchor.parent.type !== schema.nodes.paragraph && $anchor.parent.type !== schema.nodes.codeBlock) {
|
|
903
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
904
|
+
|
|
857
905
|
pos = insertPoint(state.doc, pos, schema.nodes.mediaGroup);
|
|
858
906
|
}
|
|
859
907
|
if (pos === null || pos === undefined) {
|
|
@@ -874,6 +922,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
874
922
|
return DecorationSet.create(state.doc, dropPlaceholders);
|
|
875
923
|
},
|
|
876
924
|
nodeViews: options.nodeViews,
|
|
925
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
877
926
|
handleTextInput(view, from, to, text) {
|
|
878
927
|
const {
|
|
879
928
|
selection
|
|
@@ -883,6 +932,8 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
883
932
|
const videoControlsWrapperRef = (_stateKey$getState = stateKey.getState(view.state)) === null || _stateKey$getState === void 0 ? void 0 : _stateKey$getState.element;
|
|
884
933
|
const videoControls = videoControlsWrapperRef === null || videoControlsWrapperRef === void 0 ? void 0 : videoControlsWrapperRef.querySelectorAll('button, [tabindex]:not([tabindex="-1"])');
|
|
885
934
|
if (videoControls) {
|
|
935
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
936
|
+
|
|
886
937
|
const isVideoControl = Array.from(videoControls).some(videoControl => {
|
|
887
938
|
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
888
939
|
return document.activeElement === videoControl;
|
|
@@ -895,6 +946,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
895
946
|
getMediaPluginState(view.state).splitMediaGroup();
|
|
896
947
|
return false;
|
|
897
948
|
},
|
|
949
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
898
950
|
handleClick: (_editorView, _pos, event) => {
|
|
899
951
|
var _event$target;
|
|
900
952
|
// Ignored via go/ees005
|
|
@@ -918,6 +970,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
918
970
|
}
|
|
919
971
|
return false;
|
|
920
972
|
},
|
|
973
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
921
974
|
handleDoubleClickOn: view => {
|
|
922
975
|
var _pluginState$mediaOpt, _pluginInjectionApi$e, _pluginInjectionApi$e2;
|
|
923
976
|
// Check if media viewer is enabled
|
|
@@ -953,7 +1006,11 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
|
|
|
953
1006
|
}
|
|
954
1007
|
return false;
|
|
955
1008
|
},
|
|
1009
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1010
|
+
|
|
956
1011
|
handleDOMEvents: {
|
|
1012
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1013
|
+
|
|
957
1014
|
keydown: (view, event) => {
|
|
958
1015
|
const {
|
|
959
1016
|
selection
|
|
@@ -327,7 +327,10 @@ export const ResizableMediaSingleNextFunctional = props => {
|
|
|
327
327
|
const {
|
|
328
328
|
gap,
|
|
329
329
|
keys: activeGuidelineKeys
|
|
330
|
-
} = findClosestSnap(
|
|
330
|
+
} = findClosestSnap(
|
|
331
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
332
|
+
|
|
333
|
+
width, guidelineSnapsReference.snaps.x, guidelineSnapsReference.guidelineReference, MEDIA_SINGLE_SNAP_GAP);
|
|
331
334
|
const relativeGuidelines = activeGuidelineKeys.length ? [] : getRelativeGuides();
|
|
332
335
|
lastSnappedGuidelineKeysRef.current = activeGuidelineKeys.length ? activeGuidelineKeys : relativeGuidelines.map(rg => rg.key);
|
|
333
336
|
const nextGuideLines = [...getGuidelinesWithHighlights(gap, MEDIA_SINGLE_SNAP_GAP, activeGuidelineKeys, guidelines), ...relativeGuidelines];
|
package/dist/esm/mediaPlugin.js
CHANGED
|
@@ -281,6 +281,8 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
281
281
|
var mediaSelectionHandlerPlugin = new SafePlugin({
|
|
282
282
|
key: new PluginKey('mediaSelectionHandlerPlugin'),
|
|
283
283
|
props: {
|
|
284
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
285
|
+
|
|
284
286
|
handleScrollToSelection: function handleScrollToSelection(view) {
|
|
285
287
|
var selection = view.state.selection;
|
|
286
288
|
if (!(selection instanceof NodeSelection) || selection.node.type.name !== 'media') {
|
|
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { mediaSingleSpec } from '@atlaskit/adf-schema';
|
|
5
5
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
6
6
|
import { N20, N50 } from '@atlaskit/theme/colors';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
9
|
import { getAttrsFromNodeMediaSingle } from './toDOMAttrs';
|
|
9
10
|
var WRAPPED_LAYOUTS = ['wrap-left', 'wrap-right'];
|
|
@@ -48,9 +49,17 @@ export var mediaWidthCSSCalc = function mediaWidthCSSCalc(_ref) {
|
|
|
48
49
|
} else if (shouldHardCodePixelWidth) {
|
|
49
50
|
cssCalc = "min(".concat(mediaSingleDimensionWidth, "px, ").concat(fullContainerWidth, ")");
|
|
50
51
|
} else if (shouldUseBreakoutWideLogic) {
|
|
51
|
-
|
|
52
|
+
if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
|
|
53
|
+
cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--breakout-wide-layout-width), var(--ak-editor-max-container-width)))";
|
|
54
|
+
} else {
|
|
55
|
+
cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--breakout-wide-layout-width), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))";
|
|
56
|
+
}
|
|
52
57
|
} else if (shouldUseBreakoutFullWidthLogic) {
|
|
53
|
-
|
|
58
|
+
if (expValEquals('platform_editor_media_vc_fixes', 'isEnabled', true)) {
|
|
59
|
+
cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--full-width-layout-width), var(--ak-editor-max-container-width)))";
|
|
60
|
+
} else {
|
|
61
|
+
cssCalc = "max(var(--ak-editor--line-length), min(var(--ak-editor--full-width-layout-width), calc(100cqw - var(--ak-editor--breakout-full-page-guttering-padding))))";
|
|
62
|
+
}
|
|
54
63
|
} else {
|
|
55
64
|
cssCalc = "max(min(".concat(baseWidth, "px, min(100cqw, 100%)), ").concat(GUTTER_SIZE, ")");
|
|
56
65
|
}
|
|
@@ -140,6 +140,8 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
if (_this.uploadInProgressSubscriptions.length > 0 && !_this.uploadInProgressSubscriptionsNotified) {
|
|
143
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
144
|
+
|
|
143
145
|
_this.uploadInProgressSubscriptions.forEach(function (fn) {
|
|
144
146
|
return fn(true);
|
|
145
147
|
});
|
|
@@ -189,6 +191,8 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
189
191
|
}
|
|
190
192
|
_this.waitForPendingTasks().then(function () {
|
|
191
193
|
if (_this.uploadInProgressSubscriptions.length > 0 && _this.uploadInProgressSubscriptionsNotified) {
|
|
194
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
195
|
+
|
|
192
196
|
_this.uploadInProgressSubscriptions.forEach(function (fn) {
|
|
193
197
|
return fn(false);
|
|
194
198
|
});
|
|
@@ -315,25 +319,46 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
315
319
|
*/
|
|
316
320
|
_defineProperty(this, "handleMediaNodeUnmount", function (oldNode) {
|
|
317
321
|
_this.trackMediaNodeRemoval(oldNode);
|
|
322
|
+
|
|
323
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
324
|
+
|
|
318
325
|
_this.mediaNodes = _this.mediaNodes.filter(function (_ref4) {
|
|
319
326
|
var node = _ref4.node;
|
|
320
327
|
return oldNode !== node;
|
|
321
328
|
});
|
|
322
329
|
});
|
|
323
330
|
_defineProperty(this, "handleMediaGroupUpdate", function (oldNodes, newNodes) {
|
|
331
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
332
|
+
|
|
324
333
|
var addedNodes = newNodes.filter(function (node) {
|
|
325
|
-
return
|
|
326
|
-
|
|
327
|
-
|
|
334
|
+
return (
|
|
335
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
336
|
+
|
|
337
|
+
oldNodes.every(function (oldNode) {
|
|
338
|
+
return oldNode.attrs.id !== node.attrs.id;
|
|
339
|
+
})
|
|
340
|
+
);
|
|
328
341
|
});
|
|
342
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
343
|
+
|
|
329
344
|
var removedNodes = oldNodes.filter(function (node) {
|
|
330
|
-
return
|
|
331
|
-
|
|
332
|
-
|
|
345
|
+
return (
|
|
346
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
347
|
+
|
|
348
|
+
newNodes.every(function (newNode) {
|
|
349
|
+
return newNode.attrs.id !== node.attrs.id;
|
|
350
|
+
})
|
|
351
|
+
);
|
|
333
352
|
});
|
|
353
|
+
|
|
354
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
355
|
+
|
|
334
356
|
addedNodes.forEach(function (node) {
|
|
335
357
|
_this.trackMediaNodeAddition(node);
|
|
336
358
|
});
|
|
359
|
+
|
|
360
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
361
|
+
|
|
337
362
|
removedNodes.forEach(function (oldNode) {
|
|
338
363
|
_this.trackMediaNodeRemoval(oldNode);
|
|
339
364
|
});
|
|
@@ -342,6 +367,8 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
342
367
|
return helpers.findMediaNode(_this, id);
|
|
343
368
|
});
|
|
344
369
|
_defineProperty(this, "destroyAllPickers", function (pickers) {
|
|
370
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
371
|
+
|
|
345
372
|
pickers.forEach(function (picker) {
|
|
346
373
|
return picker.destroy();
|
|
347
374
|
});
|
|
@@ -509,6 +536,8 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
509
536
|
}, {
|
|
510
537
|
key: "unsubscribeFromUploadInProgressState",
|
|
511
538
|
value: function unsubscribeFromUploadInProgressState(fn) {
|
|
539
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
540
|
+
|
|
512
541
|
this.uploadInProgressSubscriptions = this.uploadInProgressSubscriptions.filter(function (subscribedFn) {
|
|
513
542
|
return subscribedFn !== fn;
|
|
514
543
|
});
|
|
@@ -693,6 +722,8 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
693
722
|
var lastTrackedAddedNode = _this2.lastAddedMediaSingleFileIds[0];
|
|
694
723
|
// execute selection only if selection did not change after the node has been inserted
|
|
695
724
|
if ((lastTrackedAddedNode === null || lastTrackedAddedNode === void 0 ? void 0 : lastTrackedAddedNode.selectionPosition) === _this2.view.state.selection.from) {
|
|
725
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
726
|
+
|
|
696
727
|
var lastAddedNode = _this2.mediaNodes.find(function (node) {
|
|
697
728
|
return node.node.attrs.id === lastTrackedAddedNode.id;
|
|
698
729
|
});
|
|
@@ -720,7 +751,10 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
720
751
|
}
|
|
721
752
|
}, {
|
|
722
753
|
key: "destroy",
|
|
723
|
-
value:
|
|
754
|
+
value:
|
|
755
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
756
|
+
|
|
757
|
+
function destroy() {
|
|
724
758
|
if (this.destroyed) {
|
|
725
759
|
return;
|
|
726
760
|
}
|
|
@@ -767,11 +801,15 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
767
801
|
_context2.t1 = this.customPicker = _context2.sent;
|
|
768
802
|
_context2.t0.push.call(_context2.t0, _context2.t1);
|
|
769
803
|
case 13:
|
|
804
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
805
|
+
|
|
770
806
|
pickers.forEach(function (picker) {
|
|
771
807
|
picker.onNewMedia(_this3.insertFile);
|
|
772
808
|
});
|
|
773
809
|
case 14:
|
|
774
810
|
// set new upload params for the pickers
|
|
811
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
812
|
+
|
|
775
813
|
pickers.forEach(function (picker) {
|
|
776
814
|
return picker.setUploadParams(uploadParams);
|
|
777
815
|
});
|
|
@@ -796,6 +834,8 @@ export var MediaPluginStateImplementation = /*#__PURE__*/function () {
|
|
|
796
834
|
value: function updateAndDispatch(props) {
|
|
797
835
|
var _this4 = this;
|
|
798
836
|
// update plugin state
|
|
837
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
838
|
+
|
|
799
839
|
Object.keys(props).forEach(function (_key) {
|
|
800
840
|
var key = _key;
|
|
801
841
|
var value = props[key];
|
|
@@ -816,9 +856,11 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
816
856
|
var intl = getIntl();
|
|
817
857
|
return new SafePlugin({
|
|
818
858
|
state: {
|
|
859
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
819
860
|
init: function init(_config, state) {
|
|
820
861
|
return new MediaPluginStateImplementation(state, options, mediaOptions, dispatch, pluginInjectionApi);
|
|
821
862
|
},
|
|
863
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
822
864
|
apply: function apply(tr, pluginState) {
|
|
823
865
|
var _tr$getMeta;
|
|
824
866
|
var isResizing = tr.getMeta(MEDIA_PLUGIN_IS_RESIZING_KEY);
|
|
@@ -843,6 +885,8 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
843
885
|
|
|
844
886
|
// remap editing media single position if we're in collab
|
|
845
887
|
if (typeof pluginState.editingMediaSinglePos === 'number') {
|
|
888
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
889
|
+
|
|
846
890
|
pluginState.editingMediaSinglePos = tr.mapping.map(pluginState.editingMediaSinglePos);
|
|
847
891
|
nextPluginState = nextPluginState.clone();
|
|
848
892
|
}
|
|
@@ -883,6 +927,7 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
883
927
|
return nextPluginState;
|
|
884
928
|
}
|
|
885
929
|
},
|
|
930
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
886
931
|
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
887
932
|
var _iterator = _createForOfIteratorHelper(transactions),
|
|
888
933
|
_step;
|
|
@@ -909,6 +954,7 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
909
954
|
return;
|
|
910
955
|
},
|
|
911
956
|
key: stateKey,
|
|
957
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
912
958
|
view: function view(_view) {
|
|
913
959
|
var pluginState = getMediaPluginState(_view.state);
|
|
914
960
|
pluginState.setView(_view);
|
|
@@ -920,6 +966,7 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
920
966
|
};
|
|
921
967
|
},
|
|
922
968
|
props: {
|
|
969
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
923
970
|
decorations: function decorations(state) {
|
|
924
971
|
// Use this to indicate that the media node is selected
|
|
925
972
|
var mediaNodes = [];
|
|
@@ -929,6 +976,7 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
929
976
|
|
|
930
977
|
// Find any media nodes in the current selection
|
|
931
978
|
if (state.selection instanceof TextSelection || state.selection instanceof AllSelection || state.selection instanceof NodeSelection || state.selection instanceof CellSelection) {
|
|
979
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
932
980
|
doc.nodesBetween(state.selection.from, state.selection.to, function (node, pos) {
|
|
933
981
|
if (node.type === schema.nodes.media) {
|
|
934
982
|
mediaNodes.push(Decoration.node(pos, pos + node.nodeSize, {}, {
|
|
@@ -958,6 +1006,8 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
958
1006
|
}
|
|
959
1007
|
var pos = $anchor.pos;
|
|
960
1008
|
if ($anchor.parent.type !== schema.nodes.paragraph && $anchor.parent.type !== schema.nodes.codeBlock) {
|
|
1009
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1010
|
+
|
|
961
1011
|
pos = insertPoint(state.doc, pos, schema.nodes.mediaGroup);
|
|
962
1012
|
}
|
|
963
1013
|
if (pos === null || pos === undefined) {
|
|
@@ -978,6 +1028,7 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
978
1028
|
return DecorationSet.create(state.doc, dropPlaceholders);
|
|
979
1029
|
},
|
|
980
1030
|
nodeViews: options.nodeViews,
|
|
1031
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
981
1032
|
handleTextInput: function handleTextInput(view, from, to, text) {
|
|
982
1033
|
var selection = view.state.selection;
|
|
983
1034
|
if (text === ' ' && selection instanceof NodeSelection && selection.node.type.name === 'mediaSingle') {
|
|
@@ -985,6 +1036,8 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
985
1036
|
var videoControlsWrapperRef = (_stateKey$getState = stateKey.getState(view.state)) === null || _stateKey$getState === void 0 ? void 0 : _stateKey$getState.element;
|
|
986
1037
|
var videoControls = videoControlsWrapperRef === null || videoControlsWrapperRef === void 0 ? void 0 : videoControlsWrapperRef.querySelectorAll('button, [tabindex]:not([tabindex="-1"])');
|
|
987
1038
|
if (videoControls) {
|
|
1039
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1040
|
+
|
|
988
1041
|
var isVideoControl = Array.from(videoControls).some(function (videoControl) {
|
|
989
1042
|
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
990
1043
|
return document.activeElement === videoControl;
|
|
@@ -997,6 +1050,7 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
997
1050
|
getMediaPluginState(view.state).splitMediaGroup();
|
|
998
1051
|
return false;
|
|
999
1052
|
},
|
|
1053
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1000
1054
|
handleClick: function handleClick(_editorView, _pos, event) {
|
|
1001
1055
|
var _event$target;
|
|
1002
1056
|
// Ignored via go/ees005
|
|
@@ -1020,6 +1074,7 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
1020
1074
|
}
|
|
1021
1075
|
return false;
|
|
1022
1076
|
},
|
|
1077
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1023
1078
|
handleDoubleClickOn: function handleDoubleClickOn(view) {
|
|
1024
1079
|
var _pluginState$mediaOpt, _pluginInjectionApi$e;
|
|
1025
1080
|
// Check if media viewer is enabled
|
|
@@ -1055,7 +1110,11 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
|
|
|
1055
1110
|
}
|
|
1056
1111
|
return false;
|
|
1057
1112
|
},
|
|
1113
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1114
|
+
|
|
1058
1115
|
handleDOMEvents: {
|
|
1116
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
1117
|
+
|
|
1059
1118
|
keydown: function keydown(view, event) {
|
|
1060
1119
|
var selection = view.state.selection;
|
|
1061
1120
|
if (selection instanceof NodeSelection && selection.node.type.name === 'mediaSingle') {
|
|
@@ -333,7 +333,10 @@ export var ResizableMediaSingleNextFunctional = function ResizableMediaSingleNex
|
|
|
333
333
|
if (!guidelineSnapsReference.snaps.x) {
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
|
-
var _findClosestSnap = findClosestSnap(
|
|
336
|
+
var _findClosestSnap = findClosestSnap(
|
|
337
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
338
|
+
|
|
339
|
+
width, guidelineSnapsReference.snaps.x, guidelineSnapsReference.guidelineReference, MEDIA_SINGLE_SNAP_GAP),
|
|
337
340
|
gap = _findClosestSnap.gap,
|
|
338
341
|
activeGuidelineKeys = _findClosestSnap.keys;
|
|
339
342
|
var relativeGuidelines = activeGuidelineKeys.length ? [] : getRelativeGuides();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.12",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^51.
|
|
33
|
-
"@atlaskit/analytics-namespaced-context": "^7.
|
|
32
|
+
"@atlaskit/adf-schema": "^51.4.0",
|
|
33
|
+
"@atlaskit/analytics-namespaced-context": "^7.2.0",
|
|
34
34
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
35
35
|
"@atlaskit/button": "^23.6.0",
|
|
36
36
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
@@ -49,26 +49,26 @@
|
|
|
49
49
|
"@atlaskit/editor-plugin-toolbar": "^3.4.0",
|
|
50
50
|
"@atlaskit/editor-plugin-width": "^7.0.0",
|
|
51
51
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
52
|
-
"@atlaskit/editor-shared-styles": "^3.
|
|
52
|
+
"@atlaskit/editor-shared-styles": "^3.10.0",
|
|
53
53
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
54
|
-
"@atlaskit/form": "^14.
|
|
54
|
+
"@atlaskit/form": "^14.3.0",
|
|
55
55
|
"@atlaskit/icon": "^29.0.0",
|
|
56
56
|
"@atlaskit/icon-lab": "^5.12.0",
|
|
57
|
-
"@atlaskit/media-card": "^79.
|
|
57
|
+
"@atlaskit/media-card": "^79.8.0",
|
|
58
58
|
"@atlaskit/media-client": "^35.6.0",
|
|
59
59
|
"@atlaskit/media-client-react": "^4.1.0",
|
|
60
60
|
"@atlaskit/media-common": "^12.3.0",
|
|
61
61
|
"@atlaskit/media-filmstrip": "^51.1.0",
|
|
62
|
-
"@atlaskit/media-picker": "^70.
|
|
62
|
+
"@atlaskit/media-picker": "^70.1.0",
|
|
63
63
|
"@atlaskit/media-ui": "^28.7.0",
|
|
64
64
|
"@atlaskit/media-viewer": "^52.4.0",
|
|
65
65
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
66
|
-
"@atlaskit/primitives": "^16.
|
|
66
|
+
"@atlaskit/primitives": "^16.3.0",
|
|
67
67
|
"@atlaskit/textfield": "^8.1.0",
|
|
68
68
|
"@atlaskit/theme": "^21.0.0",
|
|
69
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
70
|
-
"@atlaskit/tokens": "^8.
|
|
71
|
-
"@atlaskit/tooltip": "^20.
|
|
69
|
+
"@atlaskit/tmp-editor-statsig": "^13.42.0",
|
|
70
|
+
"@atlaskit/tokens": "^8.3.0",
|
|
71
|
+
"@atlaskit/tooltip": "^20.10.0",
|
|
72
72
|
"@babel/runtime": "^7.0.0",
|
|
73
73
|
"@emotion/react": "^11.7.1",
|
|
74
74
|
"bind-event-listener": "^3.0.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"uuid": "^3.1.0"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
|
-
"@atlaskit/editor-common": "^110.
|
|
81
|
+
"@atlaskit/editor-common": "^110.34.0",
|
|
82
82
|
"@atlaskit/media-core": "^37.0.0",
|
|
83
83
|
"react": "^18.2.0",
|
|
84
84
|
"react-dom": "^18.2.0",
|