@atlaskit/editor-plugin-media 0.11.8 → 0.11.10
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/utils/media-inline.js +1 -1
- package/dist/cjs/utils/media-single.js +15 -1
- package/dist/es2019/utils/media-inline.js +1 -1
- package/dist/es2019/utils/media-single.js +13 -1
- package/dist/esm/utils/media-inline.js +1 -1
- package/dist/esm/utils/media-single.js +15 -1
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-media
|
|
2
2
|
|
|
3
|
+
## 0.11.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 0.11.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#67290](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67290) [`3029264a82c3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3029264a82c3) - [ux] Fixes the bug where, adding media to empty panel replaces the panel
|
|
14
|
+
|
|
3
15
|
## 0.11.8
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -13,7 +13,7 @@ var _mediaSingle = require("../utils/media-single");
|
|
|
13
13
|
var _isType = require("./is-type");
|
|
14
14
|
var _mediaCommon2 = require("./media-common");
|
|
15
15
|
var isInSupportedInlineImageParent = exports.isInSupportedInlineImageParent = function isInSupportedInlineImageParent(state) {
|
|
16
|
-
return (0, _utils2.hasParentNodeOfType)([state.schema.nodes.listItem
|
|
16
|
+
return (0, _utils2.hasParentNodeOfType)([state.schema.nodes.listItem])(state.selection);
|
|
17
17
|
};
|
|
18
18
|
var getMediaNodeInsertionType = exports.getMediaNodeInsertionType = function getMediaNodeInsertionType(state, mediaFeatureFlags, fileMimeType) {
|
|
19
19
|
var canInsertInlineNode = (0, _mediaCommon.getMediaFeatureFlag)('mediaInline', mediaFeatureFlags) && !(0, _utils.isInEmptyLine)(state) && (!(0, _mediaCommon2.isInsidePotentialEmptyParagraph)(state) || isInSupportedInlineImageParent(state)) && (0, _mediaFiles.canInsertMediaInline)(state);
|
|
@@ -15,6 +15,7 @@ var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
|
15
15
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
16
16
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
17
17
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
18
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
18
19
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
19
20
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
21
|
var _mediaCommon = require("../utils/media-common");
|
|
@@ -54,7 +55,20 @@ function insertNodesWithOptionalParagraph(nodes) {
|
|
|
54
55
|
nodes.push(paragraph.create());
|
|
55
56
|
openEnd = 1;
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-extended-panel')) {
|
|
59
|
+
if (state.selection.empty) {
|
|
60
|
+
tr.insert(state.selection.from, nodes);
|
|
61
|
+
// Set the cursor position at the end of the insertion
|
|
62
|
+
var endPos = state.selection.from + nodes.reduce(function (totalSize, currNode) {
|
|
63
|
+
return totalSize + currNode.nodeSize;
|
|
64
|
+
}, 0);
|
|
65
|
+
tr.setSelection(new _state.TextSelection(tr.doc.resolve(endPos), tr.doc.resolve(endPos)));
|
|
66
|
+
} else {
|
|
67
|
+
tr.replaceSelection(new _model.Slice(_model.Fragment.from(nodes), 0, openEnd));
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
tr.replaceSelection(new _model.Slice(_model.Fragment.from(nodes), 0, openEnd));
|
|
71
|
+
}
|
|
58
72
|
if (inputMethod) {
|
|
59
73
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
60
74
|
}
|
|
@@ -7,7 +7,7 @@ import { isMediaSingle } from '../utils/media-single';
|
|
|
7
7
|
import { isVideo } from './is-type';
|
|
8
8
|
import { isInsidePotentialEmptyParagraph } from './media-common';
|
|
9
9
|
export const isInSupportedInlineImageParent = state => {
|
|
10
|
-
return hasParentNodeOfType([state.schema.nodes.listItem
|
|
10
|
+
return hasParentNodeOfType([state.schema.nodes.listItem])(state.selection);
|
|
11
11
|
};
|
|
12
12
|
export const getMediaNodeInsertionType = (state, mediaFeatureFlags, fileMimeType) => {
|
|
13
13
|
const canInsertInlineNode = getMediaFeatureFlag('mediaInline', mediaFeatureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInSupportedInlineImageParent(state)) && canInsertMediaInline(state);
|
|
@@ -5,6 +5,7 @@ import { getMaxWidthForNestedNodeNext, getMediaSingleInitialWidth, MEDIA_SINGLE_
|
|
|
5
5
|
import { atTheBeginningOfBlock } from '@atlaskit/editor-common/selection';
|
|
6
6
|
import { checkNodeDown, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
8
|
+
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
9
|
import { safeInsert as pmSafeInsert, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
9
10
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
|
|
@@ -44,7 +45,18 @@ function insertNodesWithOptionalParagraph(nodes, analyticsAttributes = {}, edito
|
|
|
44
45
|
nodes.push(paragraph.create());
|
|
45
46
|
openEnd = 1;
|
|
46
47
|
}
|
|
47
|
-
|
|
48
|
+
if (getBooleanFF('platform.editor.allow-extended-panel')) {
|
|
49
|
+
if (state.selection.empty) {
|
|
50
|
+
tr.insert(state.selection.from, nodes);
|
|
51
|
+
// Set the cursor position at the end of the insertion
|
|
52
|
+
const endPos = state.selection.from + nodes.reduce((totalSize, currNode) => totalSize + currNode.nodeSize, 0);
|
|
53
|
+
tr.setSelection(new TextSelection(tr.doc.resolve(endPos), tr.doc.resolve(endPos)));
|
|
54
|
+
} else {
|
|
55
|
+
tr.replaceSelection(new Slice(Fragment.from(nodes), 0, openEnd));
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
tr.replaceSelection(new Slice(Fragment.from(nodes), 0, openEnd));
|
|
59
|
+
}
|
|
48
60
|
if (inputMethod) {
|
|
49
61
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
50
62
|
}
|
|
@@ -7,7 +7,7 @@ import { isMediaSingle } from '../utils/media-single';
|
|
|
7
7
|
import { isVideo } from './is-type';
|
|
8
8
|
import { isInsidePotentialEmptyParagraph } from './media-common';
|
|
9
9
|
export var isInSupportedInlineImageParent = function isInSupportedInlineImageParent(state) {
|
|
10
|
-
return hasParentNodeOfType([state.schema.nodes.listItem
|
|
10
|
+
return hasParentNodeOfType([state.schema.nodes.listItem])(state.selection);
|
|
11
11
|
};
|
|
12
12
|
export var getMediaNodeInsertionType = function getMediaNodeInsertionType(state, mediaFeatureFlags, fileMimeType) {
|
|
13
13
|
var canInsertInlineNode = getMediaFeatureFlag('mediaInline', mediaFeatureFlags) && !isInEmptyLine(state) && (!isInsidePotentialEmptyParagraph(state) || isInSupportedInlineImageParent(state)) && canInsertMediaInline(state);
|
|
@@ -8,6 +8,7 @@ import { getMaxWidthForNestedNodeNext, getMediaSingleInitialWidth, MEDIA_SINGLE_
|
|
|
8
8
|
import { atTheBeginningOfBlock } from '@atlaskit/editor-common/selection';
|
|
9
9
|
import { checkNodeDown, isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
11
|
+
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
11
12
|
import { safeInsert as pmSafeInsert, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
|
|
12
13
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { copyOptionalAttrsFromMediaState } from '../utils/media-common';
|
|
@@ -45,7 +46,20 @@ function insertNodesWithOptionalParagraph(nodes) {
|
|
|
45
46
|
nodes.push(paragraph.create());
|
|
46
47
|
openEnd = 1;
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
if (getBooleanFF('platform.editor.allow-extended-panel')) {
|
|
50
|
+
if (state.selection.empty) {
|
|
51
|
+
tr.insert(state.selection.from, nodes);
|
|
52
|
+
// Set the cursor position at the end of the insertion
|
|
53
|
+
var endPos = state.selection.from + nodes.reduce(function (totalSize, currNode) {
|
|
54
|
+
return totalSize + currNode.nodeSize;
|
|
55
|
+
}, 0);
|
|
56
|
+
tr.setSelection(new TextSelection(tr.doc.resolve(endPos), tr.doc.resolve(endPos)));
|
|
57
|
+
} else {
|
|
58
|
+
tr.replaceSelection(new Slice(Fragment.from(nodes), 0, openEnd));
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
tr.replaceSelection(new Slice(Fragment.from(nodes), 0, openEnd));
|
|
62
|
+
}
|
|
49
63
|
if (inputMethod) {
|
|
50
64
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(getInsertMediaAnalytics(inputMethod, fileExtension))(tr);
|
|
51
65
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-media",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.10",
|
|
4
4
|
"description": "Media plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/editor-plugin-decorations": "^0.2.0",
|
|
44
44
|
"@atlaskit/editor-plugin-editor-disabled": "^0.2.0",
|
|
45
45
|
"@atlaskit/editor-plugin-feature-flags": "^1.0.0",
|
|
46
|
-
"@atlaskit/editor-plugin-floating-toolbar": "^0.
|
|
46
|
+
"@atlaskit/editor-plugin-floating-toolbar": "^0.8.0",
|
|
47
47
|
"@atlaskit/editor-plugin-focus": "^0.2.0",
|
|
48
48
|
"@atlaskit/editor-plugin-grid": "^0.3.0",
|
|
49
49
|
"@atlaskit/editor-plugin-guideline": "^0.5.0",
|
|
@@ -147,6 +147,9 @@
|
|
|
147
147
|
},
|
|
148
148
|
"platform.editor.ally-media-file-dropdown_1kxo8": {
|
|
149
149
|
"type": "boolean"
|
|
150
|
+
},
|
|
151
|
+
"platform.editor.allow-extended-panel": {
|
|
152
|
+
"type": "boolean"
|
|
150
153
|
}
|
|
151
154
|
},
|
|
152
155
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|