@atlaskit/editor-plugin-media 8.4.16 → 8.4.18

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,20 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 8.4.18
4
+
5
+ ### Patch Changes
6
+
7
+ - [`840338033507a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/840338033507a) -
8
+ Migrating custom icons behind feature flag.
9
+
10
+ ## 8.4.17
11
+
12
+ ### Patch Changes
13
+
14
+ - [`1083b6f1f8eb2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1083b6f1f8eb2) -
15
+ [ux] Fix issues where media is selected when a parent node is selected
16
+ - Updated dependencies
17
+
3
18
  ## 8.4.16
4
19
 
5
20
  ### Patch Changes
@@ -936,7 +936,7 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
936
936
  doc = state.doc;
937
937
 
938
938
  // Find any media nodes in the current selection
939
- if (state.selection instanceof _state2.TextSelection || state.selection instanceof _state2.AllSelection || state.selection instanceof _state2.NodeSelection || state.selection instanceof _cellSelection.CellSelection) {
939
+ if (state.selection instanceof _state2.TextSelection || state.selection instanceof _state2.AllSelection || !(0, _expValEquals.expValEquals)('platform_editor_nested_media_selection_fix', 'isEnabled', true) && state.selection instanceof _state2.NodeSelection || state.selection instanceof _cellSelection.CellSelection) {
940
940
  doc.nodesBetween(state.selection.from, state.selection.to, function (node, pos) {
941
941
  if (node.type === schema.nodes.media) {
942
942
  mediaNodes.push(_view2.Decoration.node(pos, pos + node.nodeSize, {}, {
@@ -947,6 +947,22 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
947
947
  }
948
948
  return true;
949
949
  });
950
+ } else if ((0, _expValEquals.expValEquals)('platform_editor_nested_media_selection_fix', 'isEnabled', true) && state.selection instanceof _state2.NodeSelection) {
951
+ var _state$selection = state.selection,
952
+ node = _state$selection.node,
953
+ $from = _state$selection.$from;
954
+ if (node.type === schema.nodes.mediaSingle || node.type === schema.nodes.mediaGroup) {
955
+ doc.nodesBetween($from.pos, $from.pos + node.nodeSize, function (mediaNode, mediaPos) {
956
+ if (mediaNode.type === schema.nodes.media) {
957
+ mediaNodes.push(_view2.Decoration.node(mediaPos, mediaPos + mediaNode.nodeSize, {}, {
958
+ type: 'media',
959
+ selected: true
960
+ }));
961
+ return false;
962
+ }
963
+ return true;
964
+ });
965
+ }
950
966
  }
951
967
  var pluginState = getMediaPluginState(state);
952
968
  if (!pluginState.showDropzone) {
@@ -955,8 +971,8 @@ var createPlugin = exports.createPlugin = function createPlugin(_schema, options
955
971
 
956
972
  // When a media is already selected
957
973
  if (state.selection instanceof _state2.NodeSelection) {
958
- var node = state.selection.node;
959
- if (node.type === schema.nodes.mediaSingle) {
974
+ var _node = state.selection.node;
975
+ if (_node.type === schema.nodes.mediaSingle) {
960
976
  var deco = _view2.Decoration.node(state.selection.from, state.selection.to, {
961
977
  class: 'richMedia-selected'
962
978
  });
@@ -824,7 +824,7 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
824
824
  } = state;
825
825
 
826
826
  // Find any media nodes in the current selection
827
- if (state.selection instanceof TextSelection || state.selection instanceof AllSelection || state.selection instanceof NodeSelection || state.selection instanceof CellSelection) {
827
+ if (state.selection instanceof TextSelection || state.selection instanceof AllSelection || !expValEquals('platform_editor_nested_media_selection_fix', 'isEnabled', true) && state.selection instanceof NodeSelection || state.selection instanceof CellSelection) {
828
828
  doc.nodesBetween(state.selection.from, state.selection.to, (node, pos) => {
829
829
  if (node.type === schema.nodes.media) {
830
830
  mediaNodes.push(Decoration.node(pos, pos + node.nodeSize, {}, {
@@ -835,6 +835,23 @@ export const createPlugin = (_schema, options, getIntl, pluginInjectionApi, node
835
835
  }
836
836
  return true;
837
837
  });
838
+ } else if (expValEquals('platform_editor_nested_media_selection_fix', 'isEnabled', true) && state.selection instanceof NodeSelection) {
839
+ const {
840
+ node,
841
+ $from
842
+ } = state.selection;
843
+ if (node.type === schema.nodes.mediaSingle || node.type === schema.nodes.mediaGroup) {
844
+ doc.nodesBetween($from.pos, $from.pos + node.nodeSize, (mediaNode, mediaPos) => {
845
+ if (mediaNode.type === schema.nodes.media) {
846
+ mediaNodes.push(Decoration.node(mediaPos, mediaPos + mediaNode.nodeSize, {}, {
847
+ type: 'media',
848
+ selected: true
849
+ }));
850
+ return false;
851
+ }
852
+ return true;
853
+ });
854
+ }
838
855
  }
839
856
  const pluginState = getMediaPluginState(state);
840
857
  if (!pluginState.showDropzone) {
@@ -928,7 +928,7 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
928
928
  doc = state.doc;
929
929
 
930
930
  // Find any media nodes in the current selection
931
- if (state.selection instanceof TextSelection || state.selection instanceof AllSelection || state.selection instanceof NodeSelection || state.selection instanceof CellSelection) {
931
+ if (state.selection instanceof TextSelection || state.selection instanceof AllSelection || !expValEquals('platform_editor_nested_media_selection_fix', 'isEnabled', true) && state.selection instanceof NodeSelection || state.selection instanceof CellSelection) {
932
932
  doc.nodesBetween(state.selection.from, state.selection.to, function (node, pos) {
933
933
  if (node.type === schema.nodes.media) {
934
934
  mediaNodes.push(Decoration.node(pos, pos + node.nodeSize, {}, {
@@ -939,6 +939,22 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
939
939
  }
940
940
  return true;
941
941
  });
942
+ } else if (expValEquals('platform_editor_nested_media_selection_fix', 'isEnabled', true) && state.selection instanceof NodeSelection) {
943
+ var _state$selection = state.selection,
944
+ node = _state$selection.node,
945
+ $from = _state$selection.$from;
946
+ if (node.type === schema.nodes.mediaSingle || node.type === schema.nodes.mediaGroup) {
947
+ doc.nodesBetween($from.pos, $from.pos + node.nodeSize, function (mediaNode, mediaPos) {
948
+ if (mediaNode.type === schema.nodes.media) {
949
+ mediaNodes.push(Decoration.node(mediaPos, mediaPos + mediaNode.nodeSize, {}, {
950
+ type: 'media',
951
+ selected: true
952
+ }));
953
+ return false;
954
+ }
955
+ return true;
956
+ });
957
+ }
942
958
  }
943
959
  var pluginState = getMediaPluginState(state);
944
960
  if (!pluginState.showDropzone) {
@@ -947,8 +963,8 @@ export var createPlugin = function createPlugin(_schema, options, getIntl, plugi
947
963
 
948
964
  // When a media is already selected
949
965
  if (state.selection instanceof NodeSelection) {
950
- var node = state.selection.node;
951
- if (node.type === schema.nodes.mediaSingle) {
966
+ var _node = state.selection.node;
967
+ if (_node.type === schema.nodes.mediaSingle) {
952
968
  var deco = Decoration.node(state.selection.from, state.selection.to, {
953
969
  class: 'richMedia-selected'
954
970
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "8.4.16",
3
+ "version": "8.4.18",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -66,7 +66,7 @@
66
66
  "@atlaskit/primitives": "^16.4.0",
67
67
  "@atlaskit/textfield": "^8.1.0",
68
68
  "@atlaskit/theme": "^21.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^14.5.0",
69
+ "@atlaskit/tmp-editor-statsig": "^14.6.0",
70
70
  "@atlaskit/tokens": "^8.4.0",
71
71
  "@atlaskit/tooltip": "^20.10.0",
72
72
  "@babel/runtime": "^7.0.0",
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.CommentWithDotIcon = void 0;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _react = _interopRequireDefault(require("react"));
10
- var _icon = _interopRequireDefault(require("@atlaskit/icon"));
11
- var _colors = require("@atlaskit/theme/colors");
12
- var IconCommentConfluenceTypeWithDotGlyph = function IconCommentConfluenceTypeWithDotGlyph() {
13
- return /*#__PURE__*/_react.default.createElement("svg", {
14
- width: "24",
15
- height: "24",
16
- viewBox: "0 0 24 24",
17
- fill: "none",
18
- xmlns: "http://www.w3.org/2000/svg"
19
- }, /*#__PURE__*/_react.default.createElement("path", {
20
- fillRule: "evenodd",
21
- clipRule: "evenodd",
22
- d: "M4.998 11.513C4.998 8.475 8.139 6.003 12 6.003C15.861 6.003 19.002 8.475 19.002 11.513C19.002 14.552 15.861 17.023 12 17.023C8.139 17.023 4.998 14.552 4.998 11.513ZM19.838 19.284V19.282C19.838 19.282 18.274 17.022 19.071 16.166L19.034 16.186C20.261 14.902 21 13.279 21 11.513C21 7.371 16.963 4 12 4C7.037 4 3 7.37 3 11.513C3 15.656 7.037 19.027 12 19.027C13.42 19.027 14.76 18.742 15.957 18.251C16.96 19.273 18.244 19.823 19.197 19.97L19.199 19.967C19.2515 19.9867 19.3069 19.9979 19.363 20C19.448 20 19.5317 19.9789 19.6067 19.9386C19.6816 19.8984 19.7453 19.8402 19.7923 19.7693C19.8392 19.6984 19.8679 19.6169 19.8757 19.5323C19.8835 19.4476 19.8712 19.3623 19.838 19.284Z",
23
- fill: "currentColor"
24
- }), /*#__PURE__*/_react.default.createElement("path", {
25
- d: "M16 9H8C7.44772 9 7 9.44772 7 10C7 10.5523 7.44772 11 8 11H16C16.5523 11 17 10.5523 17 10C17 9.44772 16.5523 9 16 9Z",
26
- fill: "currentColor"
27
- }), /*#__PURE__*/_react.default.createElement("path", {
28
- d: "M11 12H8C7.44772 12 7 12.4477 7 13C7 13.5523 7.44772 14 8 14H11C11.5523 14 12 13.5523 12 13C12 12.4477 11.5523 12 11 12Z",
29
- fill: "currentColor"
30
- }), /*#__PURE__*/_react.default.createElement("rect", {
31
- x: "13",
32
- y: "1",
33
- width: "8",
34
- height: "8",
35
- rx: "4",
36
- stroke: "var(--ds-border-inverse, ".concat(_colors.N0, ")"),
37
- strokeWidth: 2,
38
- fill: "var(--ds-icon-brand, #0052CC)"
39
- }));
40
- };
41
- var CommentWithDotIcon = exports.CommentWithDotIcon = function CommentWithDotIcon(props) {
42
- return /*#__PURE__*/_react.default.createElement(_icon.default, (0, _extends2.default)({
43
- glyph: IconCommentConfluenceTypeWithDotGlyph
44
- // Ignored via go/ees005
45
- // eslint-disable-next-line react/jsx-props-no-spreading
46
- }, props));
47
- };
@@ -1,40 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
3
- import Icon from '@atlaskit/icon';
4
- import { N0 } from '@atlaskit/theme/colors';
5
- const IconCommentConfluenceTypeWithDotGlyph = () => {
6
- return /*#__PURE__*/React.createElement("svg", {
7
- width: "24",
8
- height: "24",
9
- viewBox: "0 0 24 24",
10
- fill: "none",
11
- xmlns: "http://www.w3.org/2000/svg"
12
- }, /*#__PURE__*/React.createElement("path", {
13
- fillRule: "evenodd",
14
- clipRule: "evenodd",
15
- d: "M4.998 11.513C4.998 8.475 8.139 6.003 12 6.003C15.861 6.003 19.002 8.475 19.002 11.513C19.002 14.552 15.861 17.023 12 17.023C8.139 17.023 4.998 14.552 4.998 11.513ZM19.838 19.284V19.282C19.838 19.282 18.274 17.022 19.071 16.166L19.034 16.186C20.261 14.902 21 13.279 21 11.513C21 7.371 16.963 4 12 4C7.037 4 3 7.37 3 11.513C3 15.656 7.037 19.027 12 19.027C13.42 19.027 14.76 18.742 15.957 18.251C16.96 19.273 18.244 19.823 19.197 19.97L19.199 19.967C19.2515 19.9867 19.3069 19.9979 19.363 20C19.448 20 19.5317 19.9789 19.6067 19.9386C19.6816 19.8984 19.7453 19.8402 19.7923 19.7693C19.8392 19.6984 19.8679 19.6169 19.8757 19.5323C19.8835 19.4476 19.8712 19.3623 19.838 19.284Z",
16
- fill: "currentColor"
17
- }), /*#__PURE__*/React.createElement("path", {
18
- d: "M16 9H8C7.44772 9 7 9.44772 7 10C7 10.5523 7.44772 11 8 11H16C16.5523 11 17 10.5523 17 10C17 9.44772 16.5523 9 16 9Z",
19
- fill: "currentColor"
20
- }), /*#__PURE__*/React.createElement("path", {
21
- d: "M11 12H8C7.44772 12 7 12.4477 7 13C7 13.5523 7.44772 14 8 14H11C11.5523 14 12 13.5523 12 13C12 12.4477 11.5523 12 11 12Z",
22
- fill: "currentColor"
23
- }), /*#__PURE__*/React.createElement("rect", {
24
- x: "13",
25
- y: "1",
26
- width: "8",
27
- height: "8",
28
- rx: "4",
29
- stroke: `var(--ds-border-inverse, ${N0})`,
30
- strokeWidth: 2,
31
- fill: "var(--ds-icon-brand, #0052CC)"
32
- }));
33
- };
34
- export const CommentWithDotIcon = props => {
35
- return /*#__PURE__*/React.createElement(Icon, _extends({
36
- glyph: IconCommentConfluenceTypeWithDotGlyph
37
- // Ignored via go/ees005
38
- // eslint-disable-next-line react/jsx-props-no-spreading
39
- }, props));
40
- };
@@ -1,40 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import React from 'react';
3
- import Icon from '@atlaskit/icon';
4
- import { N0 } from '@atlaskit/theme/colors';
5
- var IconCommentConfluenceTypeWithDotGlyph = function IconCommentConfluenceTypeWithDotGlyph() {
6
- return /*#__PURE__*/React.createElement("svg", {
7
- width: "24",
8
- height: "24",
9
- viewBox: "0 0 24 24",
10
- fill: "none",
11
- xmlns: "http://www.w3.org/2000/svg"
12
- }, /*#__PURE__*/React.createElement("path", {
13
- fillRule: "evenodd",
14
- clipRule: "evenodd",
15
- d: "M4.998 11.513C4.998 8.475 8.139 6.003 12 6.003C15.861 6.003 19.002 8.475 19.002 11.513C19.002 14.552 15.861 17.023 12 17.023C8.139 17.023 4.998 14.552 4.998 11.513ZM19.838 19.284V19.282C19.838 19.282 18.274 17.022 19.071 16.166L19.034 16.186C20.261 14.902 21 13.279 21 11.513C21 7.371 16.963 4 12 4C7.037 4 3 7.37 3 11.513C3 15.656 7.037 19.027 12 19.027C13.42 19.027 14.76 18.742 15.957 18.251C16.96 19.273 18.244 19.823 19.197 19.97L19.199 19.967C19.2515 19.9867 19.3069 19.9979 19.363 20C19.448 20 19.5317 19.9789 19.6067 19.9386C19.6816 19.8984 19.7453 19.8402 19.7923 19.7693C19.8392 19.6984 19.8679 19.6169 19.8757 19.5323C19.8835 19.4476 19.8712 19.3623 19.838 19.284Z",
16
- fill: "currentColor"
17
- }), /*#__PURE__*/React.createElement("path", {
18
- d: "M16 9H8C7.44772 9 7 9.44772 7 10C7 10.5523 7.44772 11 8 11H16C16.5523 11 17 10.5523 17 10C17 9.44772 16.5523 9 16 9Z",
19
- fill: "currentColor"
20
- }), /*#__PURE__*/React.createElement("path", {
21
- d: "M11 12H8C7.44772 12 7 12.4477 7 13C7 13.5523 7.44772 14 8 14H11C11.5523 14 12 13.5523 12 13C12 12.4477 11.5523 12 11 12Z",
22
- fill: "currentColor"
23
- }), /*#__PURE__*/React.createElement("rect", {
24
- x: "13",
25
- y: "1",
26
- width: "8",
27
- height: "8",
28
- rx: "4",
29
- stroke: "var(--ds-border-inverse, ".concat(N0, ")"),
30
- strokeWidth: 2,
31
- fill: "var(--ds-icon-brand, #0052CC)"
32
- }));
33
- };
34
- export var CommentWithDotIcon = function CommentWithDotIcon(props) {
35
- return /*#__PURE__*/React.createElement(Icon, _extends({
36
- glyph: IconCommentConfluenceTypeWithDotGlyph
37
- // Ignored via go/ees005
38
- // eslint-disable-next-line react/jsx-props-no-spreading
39
- }, props));
40
- };
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import type { GlyphProps } from '@atlaskit/icon/types';
3
- export declare const CommentWithDotIcon: (props: GlyphProps) => React.JSX.Element;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import type { GlyphProps } from '@atlaskit/icon/types';
3
- export declare const CommentWithDotIcon: (props: GlyphProps) => React.JSX.Element;