@atlaskit/editor-plugin-layout 16.0.13 → 16.0.15

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-layout
2
2
 
3
+ ## 16.0.15
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 16.0.14
10
+
11
+ ### Patch Changes
12
+
13
+ - [`343c4a1cca800`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/343c4a1cca800) -
14
+ Fix editing image captions in layout columns behind the
15
+ `platform_editor_fix_edit_media_caption_in_layout` experiment.
16
+ - Updated dependencies
17
+
3
18
  ## 16.0.13
4
19
 
5
20
  ### Patch Changes
@@ -7,6 +7,7 @@ exports.selectIntoLayout = exports.isParagraphBlankSpaceTarget = exports.getMayb
7
7
  var _selection = require("@atlaskit/editor-common/selection");
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _utils = require("@atlaskit/editor-prosemirror/utils");
10
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
10
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
12
13
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
@@ -163,6 +164,14 @@ var getGapCursorTargetForBlankSpaceClick = exports.getGapCursorTargetForBlankSpa
163
164
  var onlyChild = columnNode.firstChild;
164
165
  var shouldHandleAtomicChild = (0, _expValEquals.expValEquals)('platform_editor_layout_column_selection_fix', 'isEnabled', true) ? supportsBlankSpaceGapCursorFallback(onlyChild) : (onlyChild === null || onlyChild === void 0 ? void 0 : onlyChild.type.name) !== 'paragraph' && (onlyChild === null || onlyChild === void 0 ? void 0 : onlyChild.type.name) !== 'panel';
165
166
  if (onlyChild && shouldHandleAtomicChild) {
167
+ // A caption is editable content inside a mediaSingle, not blank layout space. The
168
+ // image bounds below intentionally exclude the caption so clicks beside the image
169
+ // can place a gap cursor; bail out before that check when the click is on a caption.
170
+ var _target = event.target;
171
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_fix_edit_media_caption_in_layout') && _target !== null && _target !== void 0 && _target.closest('[data-caption]')) {
172
+ return undefined;
173
+ }
174
+
166
175
  // Bail when the click is on the child's own content. For media the wrapper is full-width
167
176
  // so test against the <img> rect; resolve it only for a direct mediaSingle child (else
168
177
  // getContentRect could grab an image nested in an expand and break its toggle).
@@ -2,6 +2,7 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
2
  // eslint-disable-next-line @typescript-eslint/consistent-type-imports
3
3
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
5
6
  import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -158,6 +159,14 @@ export const getGapCursorTargetForBlankSpaceClick = (view, event) => {
158
159
  const onlyChild = columnNode.firstChild;
159
160
  const shouldHandleAtomicChild = expValEquals('platform_editor_layout_column_selection_fix', 'isEnabled', true) ? supportsBlankSpaceGapCursorFallback(onlyChild) : (onlyChild === null || onlyChild === void 0 ? void 0 : onlyChild.type.name) !== 'paragraph' && (onlyChild === null || onlyChild === void 0 ? void 0 : onlyChild.type.name) !== 'panel';
160
161
  if (onlyChild && shouldHandleAtomicChild) {
162
+ // A caption is editable content inside a mediaSingle, not blank layout space. The
163
+ // image bounds below intentionally exclude the caption so clicks beside the image
164
+ // can place a gap cursor; bail out before that check when the click is on a caption.
165
+ const target = event.target;
166
+ if (isExperimentEnabled('platform_editor_fix_edit_media_caption_in_layout') && target !== null && target !== void 0 && target.closest('[data-caption]')) {
167
+ return undefined;
168
+ }
169
+
161
170
  // Bail when the click is on the child's own content. For media the wrapper is full-width
162
171
  // so test against the <img> rect; resolve it only for a direct mediaSingle child (else
163
172
  // getContentRect could grab an image nested in an expand and break its toggle).
@@ -2,6 +2,7 @@ import { GapCursorSelection } from '@atlaskit/editor-common/selection';
2
2
  // eslint-disable-next-line @typescript-eslint/consistent-type-imports
3
3
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
5
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
5
6
  import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -156,6 +157,14 @@ export var getGapCursorTargetForBlankSpaceClick = function getGapCursorTargetFor
156
157
  var onlyChild = columnNode.firstChild;
157
158
  var shouldHandleAtomicChild = expValEquals('platform_editor_layout_column_selection_fix', 'isEnabled', true) ? supportsBlankSpaceGapCursorFallback(onlyChild) : (onlyChild === null || onlyChild === void 0 ? void 0 : onlyChild.type.name) !== 'paragraph' && (onlyChild === null || onlyChild === void 0 ? void 0 : onlyChild.type.name) !== 'panel';
158
159
  if (onlyChild && shouldHandleAtomicChild) {
160
+ // A caption is editable content inside a mediaSingle, not blank layout space. The
161
+ // image bounds below intentionally exclude the caption so clicks beside the image
162
+ // can place a gap cursor; bail out before that check when the click is on a caption.
163
+ var _target = event.target;
164
+ if (isExperimentEnabled('platform_editor_fix_edit_media_caption_in_layout') && _target !== null && _target !== void 0 && _target.closest('[data-caption]')) {
165
+ return undefined;
166
+ }
167
+
159
168
  // Bail when the click is on the child's own content. For media the wrapper is full-width
160
169
  // so test against the <img> rect; resolve it only for a direct mediaSingle child (else
161
170
  // getContentRect could grab an image nested in an expand and break its toggle).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-layout",
3
- "version": "16.0.13",
3
+ "version": "16.0.15",
4
4
  "description": "Layout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,19 +38,19 @@
38
38
  "@atlaskit/editor-prosemirror": "^8.0.0",
39
39
  "@atlaskit/editor-shared-styles": "^4.0.0",
40
40
  "@atlaskit/editor-toolbar": "^2.6.0",
41
- "@atlaskit/editor-ui-control-model": "^2.7.0",
41
+ "@atlaskit/editor-ui-control-model": "^2.8.0",
42
42
  "@atlaskit/icon": "^37.5.0",
43
43
  "@atlaskit/icon-lab": "^7.7.0",
44
44
  "@atlaskit/platform-feature-experiments": "^0.3.0",
45
45
  "@atlaskit/platform-feature-flags": "^2.1.0",
46
- "@atlaskit/tmp-editor-statsig": "^157.0.0",
46
+ "@atlaskit/tmp-editor-statsig": "^159.0.0",
47
47
  "@atlaskit/tokens": "^16.8.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1",
50
50
  "bind-event-listener": "^3.0.0"
51
51
  },
52
52
  "peerDependencies": {
53
- "@atlaskit/editor-common": "^119.13.0",
53
+ "@atlaskit/editor-common": "^119.16.0",
54
54
  "react": "^18.2.0 || ^19.2.0",
55
55
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
56
56
  },