@atlaskit/editor-plugin-media 3.0.1 → 3.0.2
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 +6 -0
- package/dist/cjs/mediaPlugin.js +2 -1
- package/dist/cjs/ui/toolbar/comments.js +7 -2
- package/dist/cjs/ui/toolbar/index.js +4 -3
- package/dist/es2019/mediaPlugin.js +2 -1
- package/dist/es2019/ui/toolbar/comments.js +7 -2
- package/dist/es2019/ui/toolbar/index.js +4 -3
- package/dist/esm/mediaPlugin.js +2 -1
- package/dist/esm/ui/toolbar/comments.js +7 -2
- package/dist/esm/ui/toolbar/index.js +4 -3
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/ui/toolbar/comments.d.ts +1 -1
- package/dist/types-ts4.5/types/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/toolbar/comments.d.ts +1 -1
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
package/dist/cjs/mediaPlugin.js
CHANGED
|
@@ -366,7 +366,8 @@ var mediaPlugin = exports.mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
366
366
|
fullWidthEnabled: options && options.fullWidthEnabled,
|
|
367
367
|
allowMediaInlineImages: options && options.allowMediaInlineImages,
|
|
368
368
|
isViewOnly: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view',
|
|
369
|
-
allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing
|
|
369
|
+
allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing,
|
|
370
|
+
onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount
|
|
370
371
|
}, api);
|
|
371
372
|
}
|
|
372
373
|
}
|
|
@@ -15,7 +15,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
15
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
16
|
var _commentWithDotIcon = require("./assets/commentWithDotIcon");
|
|
17
17
|
var _utils = require("./utils");
|
|
18
|
-
var commentButton = exports.commentButton = function commentButton(intl, state, api) {
|
|
18
|
+
var commentButton = exports.commentButton = function commentButton(intl, state, api, onCommentButtonMount) {
|
|
19
19
|
var _getSelectedMediaSing, _api$annotation, _api$connectivity;
|
|
20
20
|
var selectMediaNode = (_getSelectedMediaSing = (0, _utils.getSelectedMediaSingle)(state)) === null || _getSelectedMediaSing === void 0 ? void 0 : _getSelectedMediaSing.node.firstChild;
|
|
21
21
|
var hasActiveComments = false;
|
|
@@ -54,6 +54,11 @@ var commentButton = exports.commentButton = function commentButton(intl, state,
|
|
|
54
54
|
description: title
|
|
55
55
|
}),
|
|
56
56
|
supportsViewMode: true,
|
|
57
|
-
disabled: (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline'
|
|
57
|
+
disabled: (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline',
|
|
58
|
+
onMount: function onMount() {
|
|
59
|
+
if ((0, _platformFeatureFlags.fg)('confluence_frontend_preload_inline_comment_editor')) {
|
|
60
|
+
onCommentButtonMount && onCommentButtonMount();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
58
63
|
};
|
|
59
64
|
};
|
|
@@ -279,7 +279,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
279
279
|
allowMediaInlineImages = options.allowMediaInlineImages,
|
|
280
280
|
allowImagePreview = options.allowImagePreview,
|
|
281
281
|
isViewOnly = options.isViewOnly,
|
|
282
|
-
allowPixelResizing = options.allowPixelResizing
|
|
282
|
+
allowPixelResizing = options.allowPixelResizing,
|
|
283
|
+
onCommentButtonMount = options.onCommentButtonMount;
|
|
283
284
|
var toolbarButtons = [];
|
|
284
285
|
var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
|
|
285
286
|
hoverDecoration = _ref2.hoverDecoration;
|
|
@@ -549,7 +550,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
549
550
|
}
|
|
550
551
|
if (!isEditorControlsEnabled) {
|
|
551
552
|
if (allowCommentsOnMedia) {
|
|
552
|
-
toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi), {
|
|
553
|
+
toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi, onCommentButtonMount), {
|
|
553
554
|
type: 'separator',
|
|
554
555
|
supportsViewMode: true
|
|
555
556
|
});
|
|
@@ -736,7 +737,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
736
737
|
});
|
|
737
738
|
if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
|
|
738
739
|
(0, _utils2.updateToFullHeightSeparator)(toolbarButtons);
|
|
739
|
-
toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi));
|
|
740
|
+
toolbarButtons.push((0, _comments.commentButton)(intl, state, pluginInjectionApi, onCommentButtonMount));
|
|
740
741
|
}
|
|
741
742
|
return toolbarButtons;
|
|
742
743
|
}
|
|
@@ -361,7 +361,8 @@ export const mediaPlugin = ({
|
|
|
361
361
|
fullWidthEnabled: options && options.fullWidthEnabled,
|
|
362
362
|
allowMediaInlineImages: options && options.allowMediaInlineImages,
|
|
363
363
|
isViewOnly: (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view',
|
|
364
|
-
allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing
|
|
364
|
+
allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing,
|
|
365
|
+
onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount
|
|
365
366
|
}, api);
|
|
366
367
|
}
|
|
367
368
|
}
|
|
@@ -8,7 +8,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
9
|
import { CommentWithDotIcon } from './assets/commentWithDotIcon';
|
|
10
10
|
import { getSelectedMediaSingle } from './utils';
|
|
11
|
-
export const commentButton = (intl, state, api) => {
|
|
11
|
+
export const commentButton = (intl, state, api, onCommentButtonMount) => {
|
|
12
12
|
var _getSelectedMediaSing, _api$annotation, _api$annotation$share, _api$connectivity, _api$connectivity$sha, _api$connectivity$sha2;
|
|
13
13
|
const selectMediaNode = (_getSelectedMediaSing = getSelectedMediaSingle(state)) === null || _getSelectedMediaSing === void 0 ? void 0 : _getSelectedMediaSing.node.firstChild;
|
|
14
14
|
let hasActiveComments = false;
|
|
@@ -46,6 +46,11 @@ export const commentButton = (intl, state, api) => {
|
|
|
46
46
|
description: title
|
|
47
47
|
}),
|
|
48
48
|
supportsViewMode: true,
|
|
49
|
-
disabled: (api === null || api === void 0 ? void 0 : (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 ? void 0 : (_api$connectivity$sha = _api$connectivity.sharedState) === null || _api$connectivity$sha === void 0 ? void 0 : (_api$connectivity$sha2 = _api$connectivity$sha.currentState()) === null || _api$connectivity$sha2 === void 0 ? void 0 : _api$connectivity$sha2.mode) === 'offline'
|
|
49
|
+
disabled: (api === null || api === void 0 ? void 0 : (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 ? void 0 : (_api$connectivity$sha = _api$connectivity.sharedState) === null || _api$connectivity$sha === void 0 ? void 0 : (_api$connectivity$sha2 = _api$connectivity$sha.currentState()) === null || _api$connectivity$sha2 === void 0 ? void 0 : _api$connectivity$sha2.mode) === 'offline',
|
|
50
|
+
onMount: () => {
|
|
51
|
+
if (fg('confluence_frontend_preload_inline_comment_editor')) {
|
|
52
|
+
onCommentButtonMount && onCommentButtonMount();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
50
55
|
};
|
|
51
56
|
};
|
|
@@ -266,7 +266,8 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
266
266
|
allowMediaInlineImages,
|
|
267
267
|
allowImagePreview,
|
|
268
268
|
isViewOnly,
|
|
269
|
-
allowPixelResizing
|
|
269
|
+
allowPixelResizing,
|
|
270
|
+
onCommentButtonMount
|
|
270
271
|
} = options;
|
|
271
272
|
let toolbarButtons = [];
|
|
272
273
|
const {
|
|
@@ -538,7 +539,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
538
539
|
}
|
|
539
540
|
if (!isEditorControlsEnabled) {
|
|
540
541
|
if (allowCommentsOnMedia) {
|
|
541
|
-
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi), {
|
|
542
|
+
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount), {
|
|
542
543
|
type: 'separator',
|
|
543
544
|
supportsViewMode: true
|
|
544
545
|
});
|
|
@@ -731,7 +732,7 @@ const generateMediaSingleFloatingToolbar = (state, intl, options, pluginState, m
|
|
|
731
732
|
});
|
|
732
733
|
if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
|
|
733
734
|
updateToFullHeightSeparator(toolbarButtons);
|
|
734
|
-
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi));
|
|
735
|
+
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount));
|
|
735
736
|
}
|
|
736
737
|
return toolbarButtons;
|
|
737
738
|
}
|
package/dist/esm/mediaPlugin.js
CHANGED
|
@@ -356,7 +356,8 @@ export var mediaPlugin = function mediaPlugin(_ref3) {
|
|
|
356
356
|
fullWidthEnabled: options && options.fullWidthEnabled,
|
|
357
357
|
allowMediaInlineImages: options && options.allowMediaInlineImages,
|
|
358
358
|
isViewOnly: (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view',
|
|
359
|
-
allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing
|
|
359
|
+
allowPixelResizing: options === null || options === void 0 ? void 0 : options.allowPixelResizing,
|
|
360
|
+
onCommentButtonMount: options === null || options === void 0 ? void 0 : options.onCommentButtonMount
|
|
360
361
|
}, api);
|
|
361
362
|
}
|
|
362
363
|
}
|
|
@@ -8,7 +8,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
9
|
import { CommentWithDotIcon } from './assets/commentWithDotIcon';
|
|
10
10
|
import { getSelectedMediaSingle } from './utils';
|
|
11
|
-
export var commentButton = function commentButton(intl, state, api) {
|
|
11
|
+
export var commentButton = function commentButton(intl, state, api, onCommentButtonMount) {
|
|
12
12
|
var _getSelectedMediaSing, _api$annotation, _api$connectivity;
|
|
13
13
|
var selectMediaNode = (_getSelectedMediaSing = getSelectedMediaSingle(state)) === null || _getSelectedMediaSing === void 0 ? void 0 : _getSelectedMediaSing.node.firstChild;
|
|
14
14
|
var hasActiveComments = false;
|
|
@@ -47,6 +47,11 @@ export var commentButton = function commentButton(intl, state, api) {
|
|
|
47
47
|
description: title
|
|
48
48
|
}),
|
|
49
49
|
supportsViewMode: true,
|
|
50
|
-
disabled: (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline'
|
|
50
|
+
disabled: (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline',
|
|
51
|
+
onMount: function onMount() {
|
|
52
|
+
if (fg('confluence_frontend_preload_inline_comment_editor')) {
|
|
53
|
+
onCommentButtonMount && onCommentButtonMount();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
51
56
|
};
|
|
52
57
|
};
|
|
@@ -269,7 +269,8 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
269
269
|
allowMediaInlineImages = options.allowMediaInlineImages,
|
|
270
270
|
allowImagePreview = options.allowImagePreview,
|
|
271
271
|
isViewOnly = options.isViewOnly,
|
|
272
|
-
allowPixelResizing = options.allowPixelResizing
|
|
272
|
+
allowPixelResizing = options.allowPixelResizing,
|
|
273
|
+
onCommentButtonMount = options.onCommentButtonMount;
|
|
273
274
|
var toolbarButtons = [];
|
|
274
275
|
var _ref2 = (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$d2 = pluginInjectionApi.decorations) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : _pluginInjectionApi$d2.actions) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : {},
|
|
275
276
|
hoverDecoration = _ref2.hoverDecoration;
|
|
@@ -539,7 +540,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
539
540
|
}
|
|
540
541
|
if (!isEditorControlsEnabled) {
|
|
541
542
|
if (allowCommentsOnMedia) {
|
|
542
|
-
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi), {
|
|
543
|
+
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount), {
|
|
543
544
|
type: 'separator',
|
|
544
545
|
supportsViewMode: true
|
|
545
546
|
});
|
|
@@ -726,7 +727,7 @@ var generateMediaSingleFloatingToolbar = function generateMediaSingleFloatingToo
|
|
|
726
727
|
});
|
|
727
728
|
if (allowAdvancedToolBarOptions && allowCommentsOnMedia) {
|
|
728
729
|
updateToFullHeightSeparator(toolbarButtons);
|
|
729
|
-
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi));
|
|
730
|
+
toolbarButtons.push(commentButton(intl, state, pluginInjectionApi, onCommentButtonMount));
|
|
730
731
|
}
|
|
731
732
|
return toolbarButtons;
|
|
732
733
|
}
|
|
@@ -74,6 +74,7 @@ export interface MediaPluginOptions {
|
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
76
|
isExternalMediaUploadDisabled?: boolean;
|
|
77
|
+
onCommentButtonMount?: () => void;
|
|
77
78
|
}
|
|
78
79
|
/**
|
|
79
80
|
* @private
|
|
@@ -145,6 +146,7 @@ export type MediaFloatingToolbarOptions = {
|
|
|
145
146
|
allowCommentsOnMedia?: boolean;
|
|
146
147
|
isViewOnly?: boolean;
|
|
147
148
|
allowPixelResizing?: boolean;
|
|
149
|
+
onCommentButtonMount?: () => void;
|
|
148
150
|
};
|
|
149
151
|
export type MediaDecorationSpec = {
|
|
150
152
|
type: 'media';
|
|
@@ -2,4 +2,4 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { Command, ExtractInjectionAPI, FloatingToolbarButton } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { MediaNextEditorPluginType } from '../../mediaPluginType';
|
|
5
|
-
export declare const commentButton: (intl: IntlShape, state: EditorState, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => FloatingToolbarButton<Command>;
|
|
5
|
+
export declare const commentButton: (intl: IntlShape, state: EditorState, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, onCommentButtonMount?: () => void) => FloatingToolbarButton<Command>;
|
|
@@ -74,6 +74,7 @@ export interface MediaPluginOptions {
|
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
76
|
isExternalMediaUploadDisabled?: boolean;
|
|
77
|
+
onCommentButtonMount?: () => void;
|
|
77
78
|
}
|
|
78
79
|
/**
|
|
79
80
|
* @private
|
|
@@ -145,6 +146,7 @@ export type MediaFloatingToolbarOptions = {
|
|
|
145
146
|
allowCommentsOnMedia?: boolean;
|
|
146
147
|
isViewOnly?: boolean;
|
|
147
148
|
allowPixelResizing?: boolean;
|
|
149
|
+
onCommentButtonMount?: () => void;
|
|
148
150
|
};
|
|
149
151
|
export type MediaDecorationSpec = {
|
|
150
152
|
type: 'media';
|
|
@@ -2,4 +2,4 @@ import type { IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { Command, ExtractInjectionAPI, FloatingToolbarButton } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { MediaNextEditorPluginType } from '../../mediaPluginType';
|
|
5
|
-
export declare const commentButton: (intl: IntlShape, state: EditorState, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined) => FloatingToolbarButton<Command>;
|
|
5
|
+
export declare const commentButton: (intl: IntlShape, state: EditorState, api: ExtractInjectionAPI<MediaNextEditorPluginType> | undefined, onCommentButtonMount?: () => void) => FloatingToolbarButton<Command>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
58
58
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
59
59
|
"@atlaskit/form": "^12.0.0",
|
|
60
|
-
"@atlaskit/icon": "^
|
|
60
|
+
"@atlaskit/icon": "^26.0.0",
|
|
61
61
|
"@atlaskit/media-card": "^79.2.0",
|
|
62
62
|
"@atlaskit/media-client": "^33.0.0",
|
|
63
63
|
"@atlaskit/media-client-react": "^4.0.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@atlaskit/primitives": "^14.7.0",
|
|
71
71
|
"@atlaskit/textfield": "^8.0.0",
|
|
72
72
|
"@atlaskit/theme": "^18.0.0",
|
|
73
|
-
"@atlaskit/tmp-editor-statsig": "^4.
|
|
73
|
+
"@atlaskit/tmp-editor-statsig": "^4.19.0",
|
|
74
74
|
"@atlaskit/tokens": "^4.8.0",
|
|
75
75
|
"@atlaskit/tooltip": "^20.0.0",
|
|
76
76
|
"@babel/runtime": "^7.0.0",
|
|
@@ -195,6 +195,9 @@
|
|
|
195
195
|
},
|
|
196
196
|
"platform_editor_controls_patch_analytics_2": {
|
|
197
197
|
"type": "boolean"
|
|
198
|
+
},
|
|
199
|
+
"confluence_frontend_preload_inline_comment_editor": {
|
|
200
|
+
"type": "boolean"
|
|
198
201
|
}
|
|
199
202
|
},
|
|
200
203
|
"stricter": {
|