@atlaskit/editor-plugin-media 6.2.0 → 7.0.0

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,24 @@
1
1
  # @atlaskit/editor-plugin-media
2
2
 
3
+ ## 7.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - [`0d0fe7a300841`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0d0fe7a300841) -
8
+ Cleanup platform_editor_usesharedpluginstatewithselector experiment
9
+
10
+ - BREAKING CHANGE: sharedPluginStateHookMigratorFactory is deleted from @atlaskit/editor-common
11
+
12
+ - Updated dependencies
13
+
14
+ ## 6.2.1
15
+
16
+ ### Patch Changes
17
+
18
+ - [`8c22cc3a06ba9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8c22cc3a06ba9) -
19
+ FD-85117 clean up fg platform_editor_axe_leading_paragraph_from_media
20
+ - Updated dependencies
21
+
3
22
  ## 6.2.0
4
23
 
5
24
  ### Minor Changes
@@ -13,7 +13,6 @@ var _mediaSingle = require("@atlaskit/editor-common/media-single");
13
13
  var _selection = require("@atlaskit/editor-common/selection");
14
14
  var _utils = require("@atlaskit/editor-common/utils");
15
15
  var _model = require("@atlaskit/editor-prosemirror/model");
16
- var _state = require("@atlaskit/editor-prosemirror/state");
17
16
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
18
17
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
18
  var _mediaCommon = require("../utils/media-common");
@@ -45,43 +44,27 @@ function insertNodesWithOptionalParagraph(_ref) {
45
44
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
46
45
  insertMediaVia = _ref.insertMediaVia;
47
46
  return function (state, dispatch) {
48
- var tr = state.tr,
49
- schema = state.schema;
50
- var paragraph = schema.nodes.paragraph;
47
+ var tr = state.tr;
51
48
  var inputMethod = analyticsAttributes.inputMethod,
52
49
  fileExtension = analyticsAttributes.fileExtension,
53
50
  newType = analyticsAttributes.newType,
54
51
  previousType = analyticsAttributes.previousType;
55
52
  var updatedTr = tr;
56
53
  var openEnd = 0;
57
- if (shouldAddParagraph(state) && !(0, _platformFeatureFlags.fg)('platform_editor_axe_leading_paragraph_from_media')) {
58
- nodes.push(paragraph.create());
59
- openEnd = 1;
60
- }
61
54
  if (state.selection.empty) {
62
- var insertFrom = (0, _selection.atTheBeginningOfBlock)(state) && (0, _platformFeatureFlags.fg)('platform_editor_axe_leading_paragraph_from_media') ? state.selection.$from.before() : state.selection.from;
63
- if ((0, _platformFeatureFlags.fg)('platform_editor_axe_leading_paragraph_from_media')) {
64
- if ((0, _platformFeatureFlags.fg)('platform_editor_multi_images_overridden_upload_fix')) {
65
- // the use of pmSafeInsert causes the node selection to media single node.
66
- // It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
67
- // When multiple images are uploaded, the node selection is set to the previous node
68
- // and got overridden by the next node inserted.
69
- // It also causes the images position shifted when the images are uploaded.
70
- // E.g the images are uploaded after a table, the images will be inserted inside the table.
71
- // so we revert to use tr.insert instead. No extra paragraph is added.
72
- updatedTr = updatedTr.insert(insertFrom, nodes);
73
- } else {
74
- var shouldInsertFrom = !(0, _mediaCommon.isInsidePotentialEmptyParagraph)(state);
75
- updatedTr = (0, _selection.atTheBeginningOfBlock)(state) ? (0, _utils2.safeInsert)(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
76
- }
55
+ var insertFrom = (0, _selection.atTheBeginningOfBlock)(state) ? state.selection.$from.before() : state.selection.from;
56
+ if ((0, _platformFeatureFlags.fg)('platform_editor_multi_images_overridden_upload_fix')) {
57
+ // the use of pmSafeInsert causes the node selection to media single node.
58
+ // It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
59
+ // When multiple images are uploaded, the node selection is set to the previous node
60
+ // and got overridden by the next node inserted.
61
+ // It also causes the images position shifted when the images are uploaded.
62
+ // E.g the images are uploaded after a table, the images will be inserted inside the table.
63
+ // so we revert to use tr.insert instead. No extra paragraph is added.
64
+ updatedTr = updatedTr.insert(insertFrom, nodes);
77
65
  } else {
78
- updatedTr.insert(insertFrom, nodes);
79
- }
80
- var endPos = state.selection.from + nodes.reduce(function (totalSize, currNode) {
81
- return totalSize + currNode.nodeSize;
82
- }, 0);
83
- if (!(0, _platformFeatureFlags.fg)('platform_editor_axe_leading_paragraph_from_media')) {
84
- updatedTr.setSelection(new _state.TextSelection(updatedTr.doc.resolve(endPos), updatedTr.doc.resolve(endPos)));
66
+ var shouldInsertFrom = !(0, _mediaCommon.isInsidePotentialEmptyParagraph)(state);
67
+ updatedTr = (0, _selection.atTheBeginningOfBlock)(state) ? (0, _utils2.safeInsert)(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
85
68
  }
86
69
  } else {
87
70
  updatedTr.replaceSelection(new _model.Slice(_model.Fragment.from(nodes), 0, openEnd));
@@ -5,7 +5,6 @@ import { DEFAULT_IMAGE_WIDTH, getMaxWidthForNestedNodeNext, getMediaSingleInitia
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';
9
8
  import { safeInsert as pmSafeInsert, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
10
9
  import { fg } from '@atlaskit/platform-feature-flags';
11
10
  import { copyOptionalAttrsFromMediaState, isInsidePotentialEmptyParagraph } from '../utils/media-common';
@@ -34,12 +33,8 @@ function insertNodesWithOptionalParagraph({
34
33
  }) {
35
34
  return function (state, dispatch) {
36
35
  const {
37
- tr,
38
- schema
36
+ tr
39
37
  } = state;
40
- const {
41
- paragraph
42
- } = schema.nodes;
43
38
  const {
44
39
  inputMethod,
45
40
  fileExtension,
@@ -47,33 +42,21 @@ function insertNodesWithOptionalParagraph({
47
42
  previousType
48
43
  } = analyticsAttributes;
49
44
  let updatedTr = tr;
50
- let openEnd = 0;
51
- if (shouldAddParagraph(state) && !fg('platform_editor_axe_leading_paragraph_from_media')) {
52
- nodes.push(paragraph.create());
53
- openEnd = 1;
54
- }
45
+ const openEnd = 0;
55
46
  if (state.selection.empty) {
56
- const insertFrom = atTheBeginningOfBlock(state) && fg('platform_editor_axe_leading_paragraph_from_media') ? state.selection.$from.before() : state.selection.from;
57
- if (fg('platform_editor_axe_leading_paragraph_from_media')) {
58
- if (fg('platform_editor_multi_images_overridden_upload_fix')) {
59
- // the use of pmSafeInsert causes the node selection to media single node.
60
- // It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
61
- // When multiple images are uploaded, the node selection is set to the previous node
62
- // and got overridden by the next node inserted.
63
- // It also causes the images position shifted when the images are uploaded.
64
- // E.g the images are uploaded after a table, the images will be inserted inside the table.
65
- // so we revert to use tr.insert instead. No extra paragraph is added.
66
- updatedTr = updatedTr.insert(insertFrom, nodes);
67
- } else {
68
- const shouldInsertFrom = !isInsidePotentialEmptyParagraph(state);
69
- updatedTr = atTheBeginningOfBlock(state) ? pmSafeInsert(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
70
- }
47
+ const insertFrom = atTheBeginningOfBlock(state) ? state.selection.$from.before() : state.selection.from;
48
+ if (fg('platform_editor_multi_images_overridden_upload_fix')) {
49
+ // the use of pmSafeInsert causes the node selection to media single node.
50
+ // It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
51
+ // When multiple images are uploaded, the node selection is set to the previous node
52
+ // and got overridden by the next node inserted.
53
+ // It also causes the images position shifted when the images are uploaded.
54
+ // E.g the images are uploaded after a table, the images will be inserted inside the table.
55
+ // so we revert to use tr.insert instead. No extra paragraph is added.
56
+ updatedTr = updatedTr.insert(insertFrom, nodes);
71
57
  } else {
72
- updatedTr.insert(insertFrom, nodes);
73
- }
74
- const endPos = state.selection.from + nodes.reduce((totalSize, currNode) => totalSize + currNode.nodeSize, 0);
75
- if (!fg('platform_editor_axe_leading_paragraph_from_media')) {
76
- updatedTr.setSelection(new TextSelection(updatedTr.doc.resolve(endPos), updatedTr.doc.resolve(endPos)));
58
+ const shouldInsertFrom = !isInsidePotentialEmptyParagraph(state);
59
+ updatedTr = atTheBeginningOfBlock(state) ? pmSafeInsert(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
77
60
  }
78
61
  } else {
79
62
  updatedTr.replaceSelection(new Slice(Fragment.from(nodes), 0, openEnd));
@@ -8,7 +8,6 @@ import { DEFAULT_IMAGE_WIDTH, getMaxWidthForNestedNodeNext, getMediaSingleInitia
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';
12
11
  import { safeInsert as pmSafeInsert, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
13
12
  import { fg } from '@atlaskit/platform-feature-flags';
14
13
  import { copyOptionalAttrsFromMediaState, isInsidePotentialEmptyParagraph } from '../utils/media-common';
@@ -38,43 +37,27 @@ function insertNodesWithOptionalParagraph(_ref) {
38
37
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
39
38
  insertMediaVia = _ref.insertMediaVia;
40
39
  return function (state, dispatch) {
41
- var tr = state.tr,
42
- schema = state.schema;
43
- var paragraph = schema.nodes.paragraph;
40
+ var tr = state.tr;
44
41
  var inputMethod = analyticsAttributes.inputMethod,
45
42
  fileExtension = analyticsAttributes.fileExtension,
46
43
  newType = analyticsAttributes.newType,
47
44
  previousType = analyticsAttributes.previousType;
48
45
  var updatedTr = tr;
49
46
  var openEnd = 0;
50
- if (shouldAddParagraph(state) && !fg('platform_editor_axe_leading_paragraph_from_media')) {
51
- nodes.push(paragraph.create());
52
- openEnd = 1;
53
- }
54
47
  if (state.selection.empty) {
55
- var insertFrom = atTheBeginningOfBlock(state) && fg('platform_editor_axe_leading_paragraph_from_media') ? state.selection.$from.before() : state.selection.from;
56
- if (fg('platform_editor_axe_leading_paragraph_from_media')) {
57
- if (fg('platform_editor_multi_images_overridden_upload_fix')) {
58
- // the use of pmSafeInsert causes the node selection to media single node.
59
- // It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
60
- // When multiple images are uploaded, the node selection is set to the previous node
61
- // and got overridden by the next node inserted.
62
- // It also causes the images position shifted when the images are uploaded.
63
- // E.g the images are uploaded after a table, the images will be inserted inside the table.
64
- // so we revert to use tr.insert instead. No extra paragraph is added.
65
- updatedTr = updatedTr.insert(insertFrom, nodes);
66
- } else {
67
- var shouldInsertFrom = !isInsidePotentialEmptyParagraph(state);
68
- updatedTr = atTheBeginningOfBlock(state) ? pmSafeInsert(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
69
- }
48
+ var insertFrom = atTheBeginningOfBlock(state) ? state.selection.$from.before() : state.selection.from;
49
+ if (fg('platform_editor_multi_images_overridden_upload_fix')) {
50
+ // the use of pmSafeInsert causes the node selection to media single node.
51
+ // It leads to discrepancy between the full-page and comment editor - not sure why :shrug:
52
+ // When multiple images are uploaded, the node selection is set to the previous node
53
+ // and got overridden by the next node inserted.
54
+ // It also causes the images position shifted when the images are uploaded.
55
+ // E.g the images are uploaded after a table, the images will be inserted inside the table.
56
+ // so we revert to use tr.insert instead. No extra paragraph is added.
57
+ updatedTr = updatedTr.insert(insertFrom, nodes);
70
58
  } else {
71
- updatedTr.insert(insertFrom, nodes);
72
- }
73
- var endPos = state.selection.from + nodes.reduce(function (totalSize, currNode) {
74
- return totalSize + currNode.nodeSize;
75
- }, 0);
76
- if (!fg('platform_editor_axe_leading_paragraph_from_media')) {
77
- updatedTr.setSelection(new TextSelection(updatedTr.doc.resolve(endPos), updatedTr.doc.resolve(endPos)));
59
+ var shouldInsertFrom = !isInsidePotentialEmptyParagraph(state);
60
+ updatedTr = atTheBeginningOfBlock(state) ? pmSafeInsert(nodes[0], shouldInsertFrom ? insertFrom : undefined, false)(updatedTr) : updatedTr.insert(insertFrom, nodes);
78
61
  }
79
62
  } else {
80
63
  updatedTr.replaceSelection(new Slice(Fragment.from(nodes), 0, openEnd));
@@ -10,5 +10,5 @@ type Props = {
10
10
  hide: () => void;
11
11
  layoutButtons: FloatingToolbarItem<Command>[];
12
12
  };
13
- export declare const LayoutGroup: ({ layoutButtons, dispatchCommand, hide, areAnyNewToolbarFlagsEnabled }: Props) => jsx.JSX.Element;
13
+ export declare const LayoutGroup: ({ layoutButtons, dispatchCommand, hide, areAnyNewToolbarFlagsEnabled, }: Props) => jsx.JSX.Element;
14
14
  export {};
@@ -18,4 +18,4 @@ export interface LinkingToolbarProps {
18
18
  onEditLink: React.MouseEventHandler;
19
19
  onOpenLink: React.MouseEventHandler;
20
20
  }
21
- export declare const LinkToolbarAppearance: ({ editorState, mediaLinkingState, intl, onAddLink, onEditLink, onOpenLink, isInlineNode, isViewOnly, areAnyNewToolbarFlagsEnabled }: LinkingToolbarProps) => jsx.JSX.Element | null;
21
+ export declare const LinkToolbarAppearance: ({ editorState, mediaLinkingState, intl, onAddLink, onEditLink, onOpenLink, isInlineNode, isViewOnly, areAnyNewToolbarFlagsEnabled, }: LinkingToolbarProps) => jsx.JSX.Element | null;
@@ -10,5 +10,5 @@ type Props = {
10
10
  hide: () => void;
11
11
  layoutButtons: FloatingToolbarItem<Command>[];
12
12
  };
13
- export declare const LayoutGroup: ({ layoutButtons, dispatchCommand, hide, areAnyNewToolbarFlagsEnabled }: Props) => jsx.JSX.Element;
13
+ export declare const LayoutGroup: ({ layoutButtons, dispatchCommand, hide, areAnyNewToolbarFlagsEnabled, }: Props) => jsx.JSX.Element;
14
14
  export {};
@@ -18,4 +18,4 @@ export interface LinkingToolbarProps {
18
18
  onEditLink: React.MouseEventHandler;
19
19
  onOpenLink: React.MouseEventHandler;
20
20
  }
21
- export declare const LinkToolbarAppearance: ({ editorState, mediaLinkingState, intl, onAddLink, onEditLink, onOpenLink, isInlineNode, isViewOnly, areAnyNewToolbarFlagsEnabled }: LinkingToolbarProps) => jsx.JSX.Element | null;
21
+ export declare const LinkToolbarAppearance: ({ editorState, mediaLinkingState, intl, onAddLink, onEditLink, onOpenLink, isInlineNode, isViewOnly, areAnyNewToolbarFlagsEnabled, }: LinkingToolbarProps) => jsx.JSX.Element | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media",
3
- "version": "6.2.0",
3
+ "version": "7.0.0",
4
4
  "description": "Media plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -29,25 +29,25 @@
29
29
  ],
30
30
  "atlaskit:src": "src/index.ts",
31
31
  "dependencies": {
32
- "@atlaskit/adf-schema": "^50.2.3",
32
+ "@atlaskit/adf-schema": "^51.0.0",
33
33
  "@atlaskit/analytics-namespaced-context": "^7.0.0",
34
34
  "@atlaskit/analytics-next": "^11.1.0",
35
35
  "@atlaskit/button": "^23.4.0",
36
36
  "@atlaskit/editor-palette": "^2.1.0",
37
- "@atlaskit/editor-plugin-analytics": "^4.0.0",
38
- "@atlaskit/editor-plugin-annotation": "^4.0.0",
39
- "@atlaskit/editor-plugin-connectivity": "^4.0.0",
40
- "@atlaskit/editor-plugin-decorations": "^4.0.0",
41
- "@atlaskit/editor-plugin-editor-disabled": "^4.0.0",
42
- "@atlaskit/editor-plugin-editor-viewmode": "^6.0.0",
43
- "@atlaskit/editor-plugin-floating-toolbar": "^6.1.0",
44
- "@atlaskit/editor-plugin-focus": "^3.0.0",
45
- "@atlaskit/editor-plugin-grid": "^4.0.0",
46
- "@atlaskit/editor-plugin-guideline": "^4.0.0",
47
- "@atlaskit/editor-plugin-interaction": "^6.0.0",
48
- "@atlaskit/editor-plugin-selection": "^4.0.0",
49
- "@atlaskit/editor-plugin-toolbar": "^1.2.0",
50
- "@atlaskit/editor-plugin-width": "^5.0.0",
37
+ "@atlaskit/editor-plugin-analytics": "^5.0.0",
38
+ "@atlaskit/editor-plugin-annotation": "^5.0.0",
39
+ "@atlaskit/editor-plugin-connectivity": "^5.0.0",
40
+ "@atlaskit/editor-plugin-decorations": "^5.0.0",
41
+ "@atlaskit/editor-plugin-editor-disabled": "^5.0.0",
42
+ "@atlaskit/editor-plugin-editor-viewmode": "^7.0.0",
43
+ "@atlaskit/editor-plugin-floating-toolbar": "^7.0.0",
44
+ "@atlaskit/editor-plugin-focus": "^4.0.0",
45
+ "@atlaskit/editor-plugin-grid": "^5.0.0",
46
+ "@atlaskit/editor-plugin-guideline": "^5.0.0",
47
+ "@atlaskit/editor-plugin-interaction": "^7.0.0",
48
+ "@atlaskit/editor-plugin-selection": "^5.0.0",
49
+ "@atlaskit/editor-plugin-toolbar": "^2.0.0",
50
+ "@atlaskit/editor-plugin-width": "^6.0.0",
51
51
  "@atlaskit/editor-prosemirror": "7.0.0",
52
52
  "@atlaskit/editor-shared-styles": "^3.6.0",
53
53
  "@atlaskit/editor-tables": "^2.9.0",
@@ -66,7 +66,7 @@
66
66
  "@atlaskit/primitives": "^14.14.0",
67
67
  "@atlaskit/textfield": "^8.0.0",
68
68
  "@atlaskit/theme": "^20.0.0",
69
- "@atlaskit/tmp-editor-statsig": "^12.8.0",
69
+ "@atlaskit/tmp-editor-statsig": "^12.9.0",
70
70
  "@atlaskit/tokens": "^6.3.0",
71
71
  "@atlaskit/tooltip": "^20.4.0",
72
72
  "@babel/runtime": "^7.0.0",
@@ -78,7 +78,7 @@
78
78
  "uuid": "^3.1.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atlaskit/editor-common": "^108.6.0",
81
+ "@atlaskit/editor-common": "^109.0.0",
82
82
  "@atlaskit/media-core": "^37.0.0",
83
83
  "react": "^18.2.0",
84
84
  "react-dom": "^18.2.0",
@@ -142,9 +142,6 @@
142
142
  "platform_editor_fix_edit_caption_on_edge": {
143
143
  "type": "boolean"
144
144
  },
145
- "platform_editor_axe_leading_paragraph_from_media": {
146
- "type": "boolean"
147
- },
148
145
  "platform_editor_safari_media_clipboard_fix": {
149
146
  "type": "boolean"
150
147
  },