@atlaskit/editor-common 102.13.11 → 102.15.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/cjs/ai-messages/ai-config-items.js +0 -116
  3. package/dist/cjs/analytics/types/enums.js +21 -0
  4. package/dist/cjs/analytics/types/table-events.js +5 -0
  5. package/dist/cjs/monitoring/error.js +1 -1
  6. package/dist/cjs/resizer/BreakoutResizer.js +46 -16
  7. package/dist/cjs/resizer/index.js +8 -1
  8. package/dist/cjs/resizer/useBreakoutGuidelines.js +135 -0
  9. package/dist/cjs/styles/shared/smartCard.js +2 -1
  10. package/dist/cjs/ui/DropList/index.js +1 -1
  11. package/dist/es2019/ai-messages/ai-config-items.js +0 -116
  12. package/dist/es2019/analytics/types/enums.js +21 -0
  13. package/dist/es2019/analytics/types/table-events.js +5 -0
  14. package/dist/es2019/monitoring/error.js +1 -1
  15. package/dist/es2019/resizer/BreakoutResizer.js +48 -17
  16. package/dist/es2019/resizer/index.js +2 -1
  17. package/dist/es2019/resizer/useBreakoutGuidelines.js +122 -0
  18. package/dist/es2019/styles/shared/smartCard.js +5 -0
  19. package/dist/es2019/ui/DropList/index.js +1 -1
  20. package/dist/esm/ai-messages/ai-config-items.js +0 -116
  21. package/dist/esm/analytics/types/enums.js +21 -0
  22. package/dist/esm/analytics/types/table-events.js +5 -0
  23. package/dist/esm/monitoring/error.js +1 -1
  24. package/dist/esm/resizer/BreakoutResizer.js +47 -17
  25. package/dist/esm/resizer/index.js +2 -1
  26. package/dist/esm/resizer/useBreakoutGuidelines.js +127 -0
  27. package/dist/esm/styles/shared/smartCard.js +2 -1
  28. package/dist/esm/ui/DropList/index.js +1 -1
  29. package/dist/types/ai-messages/ai-config-items.d.ts +0 -115
  30. package/dist/types/analytics/types/config-panel-events.d.ts +8 -2
  31. package/dist/types/analytics/types/mention-events.d.ts +1 -1
  32. package/dist/types/analytics/types/utils.d.ts +5 -2
  33. package/dist/types/resizer/BreakoutResizer.d.ts +3 -1
  34. package/dist/types/resizer/index.d.ts +1 -0
  35. package/dist/types/resizer/useBreakoutGuidelines.d.ts +10 -0
  36. package/dist/types-ts4.5/ai-messages/ai-config-items.d.ts +0 -115
  37. package/dist/types-ts4.5/analytics/types/config-panel-events.d.ts +8 -2
  38. package/dist/types-ts4.5/analytics/types/mention-events.d.ts +1 -1
  39. package/dist/types-ts4.5/analytics/types/utils.d.ts +5 -2
  40. package/dist/types-ts4.5/resizer/BreakoutResizer.d.ts +3 -1
  41. package/dist/types-ts4.5/resizer/index.d.ts +1 -0
  42. package/dist/types-ts4.5/resizer/useBreakoutGuidelines.d.ts +10 -0
  43. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 102.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#133497](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/133497)
8
+ [`dccd8bcdef0a3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dccd8bcdef0a3) -
9
+ [ED-23460] Adding the objectId, containerId and childObjectId to the mention typeahead inserted
10
+ events
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 102.14.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [#132381](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132381)
21
+ [`19e52e77d3cfc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/19e52e77d3cfc) -
22
+ ED-27195 enable guildeline for breakout resizer
23
+
24
+ ### Patch Changes
25
+
26
+ - [#132269](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132269)
27
+ [`f6984f0b31c02`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f6984f0b31c02) -
28
+ [ux] Fixed alignment of the icon in OpenButtonOverlay on header link.
29
+ - Updated dependencies
30
+
3
31
  ## 102.13.11
4
32
 
5
33
  ### Patch Changes
@@ -58,122 +58,6 @@ var aiConfigItemMessages = exports.aiConfigItemMessages = (0, _reactIntlNext.def
58
58
  defaultMessage: 'Open in Chat',
59
59
  description: 'Tooltip and label for Open in Chat button'
60
60
  },
61
- // Advanced prompt messages
62
- advancedPromptTitle: {
63
- id: 'fabric.editor.ai.config.item.advancedPrompt.title',
64
- defaultMessage: 'Build an advanced prompt',
65
- description: 'Describes an option to use Atlassian Intelligence to show a more advanced prompt'
66
- },
67
- advancedPromptDescription: {
68
- id: 'fabric.editor.ai.config.item.advancedPrompt.description',
69
- defaultMessage: 'Specify task, instructions and rules',
70
- description: 'Description for the the Atlassian Intelligence "Build an advanced prompt".'
71
- },
72
- advancedPromptLabel: {
73
- id: 'fabric.editor.ai.config.item.advancedPrompt.promptLabel',
74
- defaultMessage: 'Build an advanced prompt',
75
- description: 'Label text in the prompt input.'
76
- },
77
- advancedPromptTaskLabel: {
78
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.task.label',
79
- defaultMessage: 'Task',
80
- description: 'Label for the Task input in the prompt builder.'
81
- },
82
- advancedPromptTaskPlaceholder: {
83
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.task.placeholder',
84
- defaultMessage: 'Describe the task that needs completing.',
85
- description: 'Placeholder for the Task input in the prompt builder.'
86
- },
87
- advancedPromptTaskHelperMessage: {
88
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.task.helperMessage',
89
- defaultMessage: 'For example: Create an onboarding documentation for new employees joining the team.',
90
- description: 'Helper message for the Task input in the prompt builder.'
91
- },
92
- advancedPromptTaskRequired: {
93
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.task.error.required',
94
- defaultMessage: 'Please provide task',
95
- description: 'Error message for the Task input in the prompt builder.'
96
- },
97
- advancedPromptInstructionsLabel: {
98
- id: 'fabric.editor.ai.config.item.advanced-prompt.form.instructions.label',
99
- defaultMessage: 'Instructions',
100
- description: 'Label for the Instructions input in the prompt builder.'
101
- },
102
- advancedPromptInstructionsPlaceholder: {
103
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.instructions.placeholder',
104
- defaultMessage: 'Provide task instructions to help generate specific outputs.',
105
- description: 'Placeholder for the Instructions input in the prompt builder.'
106
- },
107
- advancedPromptInstructionsHelperMessage: {
108
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.instructions.helperMessage',
109
- defaultMessage: 'For example: 1. Start the document with a brief overview of our company goals. 2. Create a list of key team members to meet in their first week.',
110
- description: 'Helper message for the Instructions input in the prompt builder.'
111
- },
112
- advancedPromptRulesLabel: {
113
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.rules.label',
114
- defaultMessage: 'Rules',
115
- description: 'Label for the Rules input in the prompt builder.'
116
- },
117
- advancedPromptRulesPlaceholder: {
118
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.rules.placeholder',
119
- defaultMessage: 'Outline any rules you want followed.',
120
- description: 'Placeholder for the Rules input in the prompt builder.'
121
- },
122
- advancedPromptRulesHelperMessage: {
123
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.rules.helperMessage',
124
- defaultMessage: 'For example: The output must follow the company style guidelines and not use unverified data.',
125
- description: 'Helper message for the Rules input in the prompt builder.'
126
- },
127
- advancedPromptToneLabel: {
128
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.tone.label',
129
- defaultMessage: 'Tone',
130
- description: 'Label for the Tone input in the prompt builder.'
131
- },
132
- advancedPromptToneProfessional: {
133
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.tone.option.professional',
134
- defaultMessage: 'Professional',
135
- description: 'Option for the Tone input in the prompt builder.'
136
- },
137
- advancedPromptToneEmpathetic: {
138
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.tone.option.empathetic',
139
- defaultMessage: 'Empathetic',
140
- description: 'Option for the Tone input in the prompt builder.'
141
- },
142
- advancedPromptToneCasual: {
143
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.tone.option.casual',
144
- defaultMessage: 'Casual',
145
- description: 'Option for the Tone input in the prompt builder.'
146
- },
147
- advancedPromptToneNeutral: {
148
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.tone.option.neutral',
149
- defaultMessage: 'Neutral',
150
- description: 'Option for the Tone input in the prompt builder.'
151
- },
152
- advancedPromptToneEducational: {
153
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.tone.option.educational',
154
- defaultMessage: 'Educational',
155
- description: 'Option for the Tone input in the prompt builder.'
156
- },
157
- advancedPromptCreativityLabel: {
158
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.creativity.label',
159
- defaultMessage: 'Creativity',
160
- description: 'Label for the Creativity input in the prompt builder.'
161
- },
162
- advancedPromptCreativityLow: {
163
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.creativity.option.low',
164
- defaultMessage: 'Low',
165
- description: 'Option for the Creativity input in the prompt builder.'
166
- },
167
- advancedPromptCreativityMedium: {
168
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.creativity.option.medium',
169
- defaultMessage: 'Medium',
170
- description: 'Option for the Creativity input in the prompt builder.'
171
- },
172
- advancedPromptCreativityHigh: {
173
- id: 'fabric.editor.ai.config.item.advancedPrompt.form.creativity.option.high',
174
- defaultMessage: 'High',
175
- description: 'Option for the Creativity input in the prompt builder.'
176
- },
177
61
  // Atlas shorten update messages
178
62
  atlasShortenUpdatetitle: {
179
63
  id: 'fabric.editor.ai.config.item.atlas-shorten-update.title',
@@ -33,6 +33,7 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
33
33
  ACTION["CLICKED"] = "clicked";
34
34
  ACTION["CLOSED"] = "closed";
35
35
  ACTION["COMMITTED"] = "committed";
36
+ /** used in @atlassian/editor-referentiality */
36
37
  ACTION["CONNECTED_NODES"] = "connectedNodes";
37
38
  ACTION["CONVERTED"] = "converted";
38
39
  ACTION["COPIED"] = "copied";
@@ -41,7 +42,9 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
41
42
  ACTION["DECREMENTED"] = "decremented";
42
43
  ACTION["DELETED"] = "deleted";
43
44
  ACTION["DISCARDED_INVALID_STEPS_FROM_TRANSACTION"] = "discardedInvalidStepsFromTransaction";
45
+ /** used in @atlassian/editor-referentiality */
44
46
  ACTION["DISCONNECTED_SOURCE"] = "disconnectedSource";
47
+ /** used in @atlassian/editor-referentiality */
45
48
  ACTION["DISCONNECTED_TARGET"] = "disconnectedTarget";
46
49
  ACTION["DISMISSED"] = "dismissed";
47
50
  ACTION["DISPATCHED_INVALID_TRANSACTION"] = "dispatchedInvalidTransaction";
@@ -71,6 +74,7 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
71
74
  ACTION["INDENTED"] = "indented";
72
75
  ACTION["INITIALISED"] = "initialised";
73
76
  ACTION["INITIATED"] = "initiated";
77
+ /** used in @atlassian/editor-referentiality */
74
78
  ACTION["INITIALISED_FRAGMENT_MARK"] = "initialisedFragmentMark";
75
79
  ACTION["INPUT_PERF_SAMPLING"] = "inputPerfSampling";
76
80
  ACTION["INPUT_PERF_SAMPLING_AVG"] = "inputPerfSamplingAvg";
@@ -81,6 +85,7 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
81
85
  ACTION["INSERTED"] = "inserted";
82
86
  ACTION["INVALID_DOCUMENT_ENCOUNTERED"] = "invalidDocumentEncountered";
83
87
  ACTION["INVOKED"] = "invoked";
88
+ /** used in @atlassian/editor-referentiality */
84
89
  ACTION["GOT_CONNECTIONS"] = "gotConnections";
85
90
  ACTION["LANGUAGE_SELECTED"] = "languageSelected";
86
91
  ACTION["LIST_ITEM_JOINED"] = "listItemJoined";
@@ -125,8 +130,11 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
125
130
  ACTION["UNLINK"] = "unlinked";
126
131
  ACTION["UNSUPPORTED_CONTENT_ENCOUNTERED"] = "unsupportedContentEncounteredV2";
127
132
  ACTION["UPDATED"] = "updated";
133
+ /** used in @atlassian/editor-referentiality */
128
134
  ACTION["UPDATED_FRAGMENT_MARK_NAME"] = "updatedFragmentMarkName";
135
+ /** used in @atlassian/editor-referentiality */
129
136
  ACTION["UPDATED_SOURCE"] = "updatedSource";
137
+ /** used in @atlassian/editor-referentiality */
130
138
  ACTION["UPDATED_TARGET"] = "updatedTarget";
131
139
  ACTION["UPLOAD_EXTERNAL_FAIL"] = "uploadExternalFailed";
132
140
  ACTION["VIEWED"] = "viewed";
@@ -134,6 +142,12 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
134
142
  ACTION["WITH_PLUGIN_STATE_CALLED"] = "withPluginStateCalled";
135
143
  ACTION["RENDERED"] = "rendered";
136
144
  ACTION["ON_EDITOR_READY_CALLBACK"] = "onEditorReadyCallback";
145
+ /**
146
+ * @private
147
+ * @deprecated
148
+ *
149
+ * This is no longer used and can be removed at a later date
150
+ */
137
151
  ACTION["ON_CHANGE_CALLBACK"] = "onChangeCalled";
138
152
  ACTION["NESTED_TABLE_TRANSFORMED"] = "nestedTableTransformed";
139
153
  ACTION["NEW_COLLAB_SYNC_UP_ERROR_NO_STEPS"] = "newCollabSyncUpErrorNoSteps";
@@ -169,6 +183,11 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
169
183
  ACTION["RESIZED"] = "resized";
170
184
  ACTION["BLOCKS_DRAG_INIT"] = "blocksDragInit";
171
185
  ACTION["SINGLE_COL_LAYOUT_DETECTED"] = "singleColumLayoutDetected";
186
+ /**
187
+ * used in Editor AI inline suggestion for a track event when a suggestion is inserted
188
+ * previously tracked events being used by Editor AI proactive suggestion
189
+ *
190
+ */
172
191
  ACTION["SUGGESTION_INSERTED"] = "suggestionInserted";
173
192
  ACTION["SUGGESTION_DISMISSED"] = "suggestionDismissed";
174
193
  ACTION["SUGGESTION_VIEWED"] = "suggestionViewed";
@@ -220,7 +239,9 @@ var INSERT_MEDIA_VIA = exports.INSERT_MEDIA_VIA = /*#__PURE__*/function (INSERT_
220
239
  var TRIGGER_METHOD = exports.TRIGGER_METHOD = /*#__PURE__*/function (TRIGGER_METHOD) {
221
240
  TRIGGER_METHOD["BUTTON"] = "button";
222
241
  TRIGGER_METHOD["KEYBOARD"] = "keyboard";
242
+ // single key, e.g. Esc, Enter
223
243
  TRIGGER_METHOD["SHORTCUT"] = "shortcut";
244
+ // combination of keys, e.g. Mod + F
224
245
  TRIGGER_METHOD["TOOLBAR"] = "toolbar";
225
246
  TRIGGER_METHOD["EXTERNAL"] = "external";
226
247
  return TRIGGER_METHOD;
@@ -35,9 +35,14 @@ var TABLE_ACTION = exports.TABLE_ACTION = /*#__PURE__*/function (TABLE_ACTION) {
35
35
  TABLE_ACTION["MOVED_COLUMN"] = "movedColumn";
36
36
  TABLE_ACTION["CLONED_ROW"] = "clonedRow";
37
37
  TABLE_ACTION["CLONED_COLUMN"] = "clonedColumn";
38
+ /**
39
+ * This is a unique action that's used to track legacy table move behaviour flow of insert+copy+paste. Please use
40
+ * the MOVED_ROW | MOVED_COLUMN actions if you want to track events which move row/cols in a single step.
41
+ */
38
42
  TABLE_ACTION["ROW_OR_COLUMN_MOVED"] = "rowOrColumnMoved";
39
43
  TABLE_ACTION["CHANGED_DISPLAY_MODE"] = "changedDisplayMode";
40
44
  TABLE_ACTION["CHANGED_ALIGNMENT"] = "changedAlignment";
45
+ // Temporary to track usage of CONFCLOUD-78239 bug
41
46
  TABLE_ACTION["TABLE_CELL_BACKGROUND_FIXED"] = "tableCellBackgroundFixed";
42
47
  return TABLE_ACTION;
43
48
  }({});
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "102.13.11";
20
+ var packageVersion = "102.15.0";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // Ignored via go/ees007
@@ -16,6 +16,7 @@ var _analytics = require("../analytics");
16
16
  var _styles = require("../styles");
17
17
  var _browser = require("../utils/browser");
18
18
  var _Resizer = _interopRequireDefault(require("./Resizer"));
19
+ var _useBreakoutGuidelines = require("./useBreakoutGuidelines");
19
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
21
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
22
  var breakoutSupportedNodes = ['layoutSection', 'expand', 'codeBlock'];
@@ -89,6 +90,7 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
89
90
  disabled = _ref.disabled,
90
91
  getEditorWidth = _ref.getEditorWidth,
91
92
  parentRef = _ref.parentRef,
93
+ displayGuidelines = _ref.displayGuidelines,
92
94
  editorAnalyticsApi = _ref.editorAnalyticsApi,
93
95
  displayGapCursor = _ref.displayGapCursor;
94
96
  var _useState = (0, _react.useState)({
@@ -104,6 +106,16 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
104
106
  setResizingState = _useState2[1];
105
107
  var areResizeMetaKeysPressed = (0, _react.useRef)(false);
106
108
  var resizerRef = (0, _react.useRef)(null);
109
+ var _useBreakoutGuideline = (0, _useBreakoutGuidelines.useBreakoutGuidelines)(getEditorWidth, isResizing && (0, _experiments.editorExperiment)('single_column_layouts', true)),
110
+ snaps = _useBreakoutGuideline.snaps,
111
+ currentLayout = _useBreakoutGuideline.currentLayout,
112
+ guidelines = _useBreakoutGuideline.guidelines,
113
+ setCurrentWidth = _useBreakoutGuideline.setCurrentWidth;
114
+ (0, _react.useEffect)(function () {
115
+ if (displayGuidelines) {
116
+ displayGuidelines(guidelines || []);
117
+ }
118
+ }, [displayGuidelines, guidelines]);
107
119
 
108
120
  // Relying on re-renders caused by selection changes inside/around node
109
121
  var isSelectionInNode = (0, _react.useMemo)(function () {
@@ -140,6 +152,12 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
140
152
  });
141
153
  dispatch(state.tr.setMeta('is-resizer-resizing', true));
142
154
  }, [getEditorWidth, editorView, displayGapCursor]);
155
+ var handleResize = (0, _react.useCallback)(function (originalState, delta) {
156
+ if ((0, _experiments.editorExperiment)('single_column_layouts', true)) {
157
+ var newWidth = originalState.width + delta.width;
158
+ setCurrentWidth(newWidth);
159
+ }
160
+ }, [setCurrentWidth]);
143
161
  var handleResizeStop = (0, _react.useCallback)(function (originalState, delta) {
144
162
  var newWidth = originalState.width + delta.width;
145
163
  var pos = getPos();
@@ -152,21 +170,29 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
152
170
  var node = state.doc.nodeAt(pos);
153
171
  var newTr = state.tr;
154
172
  if (node && breakoutSupportedNodes.includes(node.type.name)) {
155
- var newBreakoutWidth = Math.max(newWidth, _editorSharedStyles.akEditorDefaultLayoutWidth);
156
- newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
157
- width: newBreakoutWidth
158
- })]);
159
- var breakoutResizePayload = {
160
- action: _analytics.ACTION.RESIZED,
161
- actionSubject: _analytics.ACTION_SUBJECT.ELEMENT,
162
- eventType: _analytics.EVENT_TYPE.TRACK,
163
- attributes: {
164
- nodeType: node.type.name,
165
- prevWidth: originalState.width,
166
- newWidth: newBreakoutWidth
167
- }
168
- };
169
- editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(breakoutResizePayload)(newTr);
173
+ if (currentLayout && ['wide', 'full-width'].includes(currentLayout) && (0, _experiments.editorExperiment)('single_column_layouts', true)) {
174
+ newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
175
+ mode: currentLayout,
176
+ width: null
177
+ })]);
178
+ } else {
179
+ var newBreakoutWidth = Math.max(newWidth, _editorSharedStyles.akEditorDefaultLayoutWidth);
180
+ newTr.setNodeMarkup(pos, node.type, node.attrs, [breakout.create({
181
+ width: newBreakoutWidth,
182
+ mode: null
183
+ })]);
184
+ var breakoutResizePayload = {
185
+ action: _analytics.ACTION.RESIZED,
186
+ actionSubject: _analytics.ACTION_SUBJECT.ELEMENT,
187
+ eventType: _analytics.EVENT_TYPE.TRACK,
188
+ attributes: {
189
+ nodeType: node.type.name,
190
+ prevWidth: originalState.width,
191
+ newWidth: newBreakoutWidth
192
+ }
193
+ };
194
+ editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent(breakoutResizePayload)(newTr);
195
+ }
170
196
  }
171
197
  newTr.setMeta('is-resizer-resizing', false).setMeta('scrollIntoView', false);
172
198
  displayGapCursor(true);
@@ -176,7 +202,8 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
176
202
  minWidth: undefined,
177
203
  maxWidth: undefined
178
204
  });
179
- }, [getPos, editorView, displayGapCursor, editorAnalyticsApi]);
205
+ setCurrentWidth(null);
206
+ }, [getPos, editorView, displayGapCursor, setCurrentWidth, currentLayout, editorAnalyticsApi]);
180
207
  var handleEscape = (0, _react.useCallback)(function () {
181
208
  editorView === null || editorView === void 0 || editorView.focus();
182
209
  }, [editorView]);
@@ -282,6 +309,8 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
282
309
  left: true,
283
310
  right: true
284
311
  },
312
+ snap: snaps || undefined,
313
+ snapGap: _useBreakoutGuidelines.SNAP_GAP,
285
314
  handleStyles: getHandleStyle(nodeType),
286
315
  minWidth: minWidth,
287
316
  maxWidth: maxWidth
@@ -290,6 +319,7 @@ var BreakoutResizer = exports.BreakoutResizer = function BreakoutResizer(_ref) {
290
319
  style: isResizing ? resizingStyles : defaultStyles,
291
320
  handleResizeStart: handleResizeStart,
292
321
  handleResizeStop: handleResizeStop,
322
+ handleResize: handleResize,
293
323
  childrenDOMRef: getRef,
294
324
  resizeRatio: 2,
295
325
  isHandleVisible: isSelectionInNode,
@@ -22,5 +22,12 @@ Object.defineProperty(exports, "ignoreResizerMutations", {
22
22
  return _BreakoutResizer.ignoreResizerMutations;
23
23
  }
24
24
  });
25
+ Object.defineProperty(exports, "useBreakoutGuidelines", {
26
+ enumerable: true,
27
+ get: function get() {
28
+ return _useBreakoutGuidelines.useBreakoutGuidelines;
29
+ }
30
+ });
25
31
  var _Resizer = _interopRequireDefault(require("./Resizer"));
26
- var _BreakoutResizer = require("./BreakoutResizer");
32
+ var _BreakoutResizer = require("./BreakoutResizer");
33
+ var _useBreakoutGuidelines = require("./useBreakoutGuidelines");
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.SNAP_GAP = void 0;
8
+ exports.useBreakoutGuidelines = useBreakoutGuidelines;
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _react = require("react");
11
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
+ var SNAP_GAP = exports.SNAP_GAP = 8;
13
+ var roundToNearest = function roundToNearest(value) {
14
+ var interval = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.5;
15
+ return Math.round(value / interval) * interval;
16
+ };
17
+ function useBreakoutGuidelines(getEditorWidth, isResizing) {
18
+ var widthState = getEditorWidth();
19
+ var _useMemo = (0, _react.useMemo)(function () {
20
+ if (!isResizing) {
21
+ return {};
22
+ }
23
+ var _ref = widthState || {},
24
+ width = _ref.width,
25
+ lineLength = _ref.lineLength;
26
+ var wide = lineLength ? Math.round(lineLength * _editorSharedStyles.breakoutWideScaleRatio) : undefined;
27
+ var fullWidth = width ? Math.min(width - (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2) : undefined;
28
+ return {
29
+ wide: wide,
30
+ fullWidth: fullWidth,
31
+ lineLength: lineLength
32
+ };
33
+ }, [widthState, isResizing]),
34
+ lineLength = _useMemo.lineLength,
35
+ wide = _useMemo.wide,
36
+ fullWidth = _useMemo.fullWidth;
37
+ var snaps = (0, _react.useMemo)(function () {
38
+ if (!isResizing) {
39
+ return null;
40
+ }
41
+ var xSnaps = [];
42
+ if (typeof lineLength === 'number') {
43
+ xSnaps.push(lineLength);
44
+ }
45
+ if (typeof wide === 'number') {
46
+ xSnaps.push(wide);
47
+ }
48
+ if (typeof fullWidth === 'number') {
49
+ xSnaps.push(fullWidth - _editorSharedStyles.akEditorGutterPadding);
50
+ }
51
+ return {
52
+ x: xSnaps
53
+ };
54
+ }, [isResizing, wide, fullWidth, lineLength]);
55
+ var _useState = (0, _react.useState)(null),
56
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
57
+ currentLayout = _useState2[0],
58
+ setCurrentLayout = _useState2[1];
59
+ var guidelines = (0, _react.useMemo)(function () {
60
+ var guidelines = [];
61
+ if (!isResizing) {
62
+ return guidelines;
63
+ }
64
+ if (lineLength) {
65
+ guidelines.push({
66
+ key: 'grid_left',
67
+ position: {
68
+ x: -roundToNearest(lineLength / 2)
69
+ },
70
+ active: currentLayout === 'center'
71
+ });
72
+ guidelines.push({
73
+ key: 'grid_right',
74
+ position: {
75
+ x: roundToNearest(lineLength / 2)
76
+ },
77
+ active: currentLayout === 'center'
78
+ });
79
+ }
80
+ if (wide) {
81
+ guidelines.push({
82
+ key: 'wide_left',
83
+ position: {
84
+ x: -roundToNearest(wide / 2)
85
+ },
86
+ active: currentLayout === 'wide'
87
+ });
88
+ guidelines.push({
89
+ key: 'wide_right',
90
+ position: {
91
+ x: roundToNearest(wide / 2)
92
+ },
93
+ active: currentLayout === 'wide'
94
+ });
95
+ }
96
+ if (fullWidth) {
97
+ guidelines.push({
98
+ key: 'full_width_left',
99
+ position: {
100
+ x: -roundToNearest(fullWidth / 2)
101
+ },
102
+ active: currentLayout === 'full-width'
103
+ });
104
+ guidelines.push({
105
+ key: 'full_width_right',
106
+ position: {
107
+ x: roundToNearest(fullWidth) / 2
108
+ },
109
+ active: currentLayout === 'full-width'
110
+ });
111
+ }
112
+ return guidelines;
113
+ }, [isResizing, lineLength, wide, fullWidth, currentLayout]);
114
+ var setCurrentWidth = (0, _react.useCallback)(function (newWidth) {
115
+ if (typeof newWidth !== 'number') {
116
+ setCurrentLayout(null);
117
+ return;
118
+ }
119
+ if (lineLength && Math.abs(newWidth - lineLength) < SNAP_GAP / 2) {
120
+ setCurrentLayout('center');
121
+ } else if (wide && Math.abs(newWidth - wide) < SNAP_GAP / 2) {
122
+ setCurrentLayout('wide');
123
+ } else if (fullWidth && (Math.abs(newWidth - fullWidth + _editorSharedStyles.akEditorGutterPadding) < SNAP_GAP / 2 || newWidth >= fullWidth)) {
124
+ setCurrentLayout('full-width');
125
+ } else {
126
+ setCurrentLayout(null);
127
+ }
128
+ }, [lineLength, wide, fullWidth]);
129
+ return {
130
+ snaps: snaps,
131
+ currentLayout: currentLayout,
132
+ guidelines: guidelines,
133
+ setCurrentWidth: setCurrentWidth
134
+ };
135
+ }
@@ -9,6 +9,7 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
9
9
  var _react = require("@emotion/react");
10
10
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
13
  var _smartCard = require("./smart-card");
13
14
  var _templateObject; // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
14
15
  var DATASOURCE_INNER_CONTAINER_CLASSNAME = exports.DATASOURCE_INNER_CONTAINER_CLASSNAME = 'datasourceView-content-inner-wrap';
@@ -16,7 +17,7 @@ var FLOATING_TOOLBAR_LINKPICKER_CLASSNAME = exports.FLOATING_TOOLBAR_LINKPICKER_
16
17
 
17
18
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
18
19
  var smartCardStyles = exports.smartCardStyles = function smartCardStyles() {
19
- return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tmax-width: calc(100% - 20px);\n\t\tvertical-align: top;\n\t\tword-break: break-all;\n\t\t", "\n\t\t.card {\n\t\t\tpadding-left: ", ";\n\t\t\tpadding-right: ", ";\n\t\t\tpadding-top: 0.5em;\n\t\t\tpadding-bottom: 0.5em;\n\t\t\tmargin-bottom: -0.5em;\n\n\t\t\t.", " > a:focus {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > a {\n\t\t\t", "\n\t\t}\n\t\t.", " > a {\n\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\tz-index: 1;\n\t\t\tposition: relative;\n\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > a {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\t\tz-index: 2;\n\t\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: ", ";\n\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div {\n\t\t\t", "\n\t\t\tborder-radius: ", ";\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > div {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", ".", " {\n\t\tmax-width: 100%;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\n\t\t.", " {\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tborder: 1px solid ", ";\n\t\t\toverflow: hidden;\n\t\t}\n\n\t\t&.", " {\n\t\t\t.", " {\n\t\t\t\t", "\n\n\t\t\t\tinput::selection {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\t\t\t\tinput::-moz-selection {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: pointer;\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t\t&::after {\n\t\t\t\ttransition: box-shadow 0s;\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div::after {\n\t\t\t", "\n\t\t}\n\n\t\t&.danger {\n\t\t\t.media-card-frame::after {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t\tbackground: ", " !important;\n\t\t\t}\n\t\t\t.richMedia-resize-handle-right::after,\n\t\t\t.richMedia-resize-handle-left::after {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tpadding: 0;\n\t}\n"])), _smartCard.SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? ".card-with-comment {\n background: ".concat("var(--ds-background-accent-yellow-subtler, #F8E6A0)", ";\n border-bottom: 2px solid ", "var(--ds-border-accent-yellow, #B38600)", ";\n box-shadow: ", "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)", ";\n }") : '', "var(--ds-space-025, 2px)", "var(--ds-space-025, 2px)", _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _editorSharedStyles.akEditorSelectedNodeClassName, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _smartCard.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER,
20
+ return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\tmax-width: calc(100% - 20px);\n\t\tvertical-align: top;\n\t\tword-break: break-all;\n\t\t", "\n\t\t.card {\n\t\t\tpadding-left: ", ";\n\t\t\tpadding-right: ", ";\n\t\t\tpadding-top: 0.5em;\n\t\t\tpadding-bottom: 0.5em;\n\t\t\tmargin-bottom: -0.5em;\n\n\t\t\t.", " > a:focus {\n\t\t\t\t", "\n\t\t\t}\n\t\t}\n\n\t\t", "\n\n\t\t&.", " .", " > a {\n\t\t\t", "\n\t\t}\n\t\t.", " > a {\n\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\tz-index: 1;\n\t\t\tposition: relative;\n\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > a {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t\t/* EDM-1717: box-shadow Safari fix start */\n\t\t\t\tz-index: 2;\n\t\t\t\t/* EDM-1717: box-shadow Safari fix end */\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: ", ";\n\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div {\n\t\t\t", "\n\t\t\tborder-radius: ", ";\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " > div {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", ".", " {\n\t\tmax-width: 100%;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\n\t\t.", " {\n\t\t\tcursor: pointer;\n\t\t\tbackground-color: ", ";\n\t\t\tborder-radius: ", ";\n\t\t\tborder: 1px solid ", ";\n\t\t\toverflow: hidden;\n\t\t}\n\n\t\t&.", " {\n\t\t\t.", " {\n\t\t\t\t", "\n\n\t\t\t\tinput::selection {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\t\t\t\tinput::-moz-selection {\n\t\t\t\t\tbackground-color: ", ";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t&.danger {\n\t\t\t.", " {\n\t\t\t\tbox-shadow: 0 0 0 1px ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\t.", " > div {\n\t\t\tcursor: pointer;\n\t\t\ta {\n\t\t\t\tcursor: ", ";\n\t\t\t}\n\t\t\t&::after {\n\t\t\t\ttransition: box-shadow 0s;\n\t\t\t}\n\t\t}\n\n\t\t&.", " .", " > div::after {\n\t\t\t", "\n\t\t}\n\n\t\t&.danger {\n\t\t\t.media-card-frame::after {\n\t\t\t\tbox-shadow: 0 0 0 1px ", " !important;\n\t\t\t\tbackground: ", " !important;\n\t\t\t}\n\t\t\t.richMedia-resize-handle-right::after,\n\t\t\t.richMedia-resize-handle-left::after {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tpadding: 0;\n\t}\n"])), _smartCard.SmartCardSharedCssClassName.INLINE_CARD_CONTAINER, (0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? ".card-with-comment {\n background: ".concat("var(--ds-background-accent-yellow-subtler, #F8E6A0)", ";\n border-bottom: 2px solid ", "var(--ds-border-accent-yellow, #B38600)", ";\n box-shadow: ", "var(--ds-shadow-overlay, 0px 8px 12px #091E4226, 0px 0px 1px #091E424f)", ";\n }") : '', "var(--ds-space-025, 2px)", "var(--ds-space-025, 2px)", _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1') ? "[data-inlinecard-button-overlay='icon-wrapper-line-height'] span {\n\t\t\t\tline-height: 0;\n\t\t\t}" : '', _editorSharedStyles.akEditorSelectedNodeClassName, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, (0, _editorSharedStyles.getSelectionStyles)([_editorSharedStyles.SelectionStyle.BoxShadow]), _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER, "var(--ds-border-danger, ".concat(_editorSharedStyles.akEditorDeleteBorder, ")"), _smartCard.SmartCardSharedCssClassName.BLOCK_CARD_CONTAINER, _smartCard.SmartCardSharedCssClassName.LOADER_WRAPPER,
20
21
  // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration
21
22
  (0, _platformFeatureFlags.fg)('linking_platform_smart_links_in_live_pages') ? 'text' : 'pointer',
22
23
  // eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "102.13.11";
26
+ var packageVersion = "102.15.0";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005