@atlaskit/editor-plugin-media-insert 2.6.2 → 2.7.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,14 @@
1
1
  # @atlaskit/editor-plugin-media-insert
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#141109](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141109)
8
+ [`cba4ebf07d83b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cba4ebf07d83b) -
9
+ [ux] [ED-24926] When clicking on media insert from element browser, correctly position the media
10
+ insert popup and scroll into view
11
+
3
12
  ## 2.6.2
4
13
 
5
14
  ### Patch Changes
@@ -29,6 +29,13 @@ var getDomRefFromSelection = function getDomRefFromSelection(view, dispatchAnaly
29
29
  try {
30
30
  var domRef = (0, _utils.findDomRefAtPos)(view.state.selection.from, view.domAtPos.bind(view));
31
31
  if (domRef instanceof HTMLElement) {
32
+ // If element is not a paragraph, we need to find the closest paragraph parent
33
+ if (domRef.nodeName !== 'P') {
34
+ var paragraphRef = domRef.closest('p');
35
+ if (paragraphRef) {
36
+ return paragraphRef;
37
+ }
38
+ }
32
39
  return domRef;
33
40
  } else {
34
41
  throw new Error('Invalid DOM reference');
@@ -19,6 +19,13 @@ const getDomRefFromSelection = (view, dispatchAnalyticsEvent) => {
19
19
  try {
20
20
  const domRef = findDomRefAtPos(view.state.selection.from, view.domAtPos.bind(view));
21
21
  if (domRef instanceof HTMLElement) {
22
+ // If element is not a paragraph, we need to find the closest paragraph parent
23
+ if (domRef.nodeName !== 'P') {
24
+ const paragraphRef = domRef.closest('p');
25
+ if (paragraphRef) {
26
+ return paragraphRef;
27
+ }
28
+ }
22
29
  return domRef;
23
30
  } else {
24
31
  throw new Error('Invalid DOM reference');
@@ -19,6 +19,13 @@ var getDomRefFromSelection = function getDomRefFromSelection(view, dispatchAnaly
19
19
  try {
20
20
  var domRef = findDomRefAtPos(view.state.selection.from, view.domAtPos.bind(view));
21
21
  if (domRef instanceof HTMLElement) {
22
+ // If element is not a paragraph, we need to find the closest paragraph parent
23
+ if (domRef.nodeName !== 'P') {
24
+ var paragraphRef = domRef.closest('p');
25
+ if (paragraphRef) {
26
+ return paragraphRef;
27
+ }
28
+ }
22
29
  return domRef;
23
30
  } else {
24
31
  throw new Error('Invalid DOM reference');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-media-insert",
3
- "version": "2.6.2",
3
+ "version": "2.7.0",
4
4
  "description": "Media Insert plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -43,7 +43,7 @@
43
43
  "react-intl-next": "npm:react-intl@^5.18.1"
44
44
  },
45
45
  "peerDependencies": {
46
- "@atlaskit/tokens": "^1.59.0"
46
+ "@atlaskit/tokens": "^1.60.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "typescript": "~5.4.2"