@atlaskit/editor-common 111.7.3 → 111.8.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 +27 -0
- package/dist/cjs/analytics/types/enums.js +1 -0
- package/dist/cjs/block-menu/index.js +18 -0
- package/dist/cjs/block-menu/key.js +7 -1
- package/dist/cjs/block-menu/placement.js +1 -0
- package/dist/cjs/block-menu/rank.js +3 -2
- package/dist/cjs/messages/syncBlock.js +4 -4
- package/dist/cjs/messages/text-color.js +1 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/calculate-toolbar-position.js +147 -14
- package/dist/es2019/analytics/types/enums.js +1 -0
- package/dist/es2019/block-menu/index.js +2 -2
- package/dist/es2019/block-menu/key.js +6 -0
- package/dist/es2019/block-menu/placement.js +0 -0
- package/dist/es2019/block-menu/rank.js +6 -2
- package/dist/es2019/messages/syncBlock.js +4 -4
- package/dist/es2019/messages/text-color.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/calculate-toolbar-position.js +149 -13
- package/dist/esm/analytics/types/enums.js +1 -0
- package/dist/esm/block-menu/index.js +2 -2
- package/dist/esm/block-menu/key.js +6 -0
- package/dist/esm/block-menu/placement.js +0 -0
- package/dist/esm/block-menu/rank.js +3 -2
- package/dist/esm/messages/syncBlock.js +4 -4
- package/dist/esm/messages/text-color.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/calculate-toolbar-position.js +146 -13
- package/dist/types/analytics/types/enums.d.ts +1 -0
- package/dist/types/analytics/types/sync-block-events.d.ts +3 -2
- package/dist/types/block-menu/index.d.ts +3 -2
- package/dist/types/block-menu/key.d.ts +6 -0
- package/dist/types/block-menu/placement.d.ts +6 -0
- package/dist/types/block-menu/rank.d.ts +5 -1
- package/dist/types/experiences/types.d.ts +1 -1
- package/dist/types/messages/syncBlock.d.ts +1 -1
- package/dist/types/utils/calculate-toolbar-position.d.ts +7 -0
- package/dist/types-ts4.5/analytics/types/enums.d.ts +1 -0
- package/dist/types-ts4.5/analytics/types/sync-block-events.d.ts +3 -2
- package/dist/types-ts4.5/block-menu/index.d.ts +3 -2
- package/dist/types-ts4.5/block-menu/key.d.ts +6 -0
- package/dist/types-ts4.5/block-menu/placement.d.ts +6 -0
- package/dist/types-ts4.5/block-menu/rank.d.ts +5 -1
- package/dist/types-ts4.5/experiences/types.d.ts +1 -1
- package/dist/types-ts4.5/messages/syncBlock.d.ts +1 -1
- package/dist/types-ts4.5/utils/calculate-toolbar-position.d.ts +7 -0
- package/package.json +4 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
2
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
const MAXIMUM_BROWSER_SCROLLBAR_WIDTH = 20;
|
|
5
6
|
|
|
6
7
|
/*
|
|
@@ -79,19 +80,36 @@ export const calculateToolbarPositionAboveSelection = toolbarTitle => (editorVie
|
|
|
79
80
|
left: Math.max(0, left - wrapperBounds.left)
|
|
80
81
|
};
|
|
81
82
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
const findContainingElement = editorView => {
|
|
84
|
+
// First, try to find .fabric-editor-popup-scroll-parent
|
|
85
|
+
const scrollParent = editorView.dom.closest('.fabric-editor-popup-scroll-parent');
|
|
86
|
+
if (scrollParent) {
|
|
87
|
+
return {
|
|
88
|
+
container: scrollParent,
|
|
89
|
+
isFixed: false
|
|
90
|
+
};
|
|
91
|
+
} else {
|
|
92
|
+
// If no scroll parent, look for a fixed positioned parent
|
|
93
|
+
let fixedParent = editorView.dom.parentElement;
|
|
94
|
+
while (fixedParent && fixedParent !== document.body) {
|
|
95
|
+
const computedStyle = window.getComputedStyle(fixedParent);
|
|
96
|
+
if (computedStyle.position === 'fixed') {
|
|
97
|
+
return {
|
|
98
|
+
container: fixedParent,
|
|
99
|
+
isFixed: true
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
fixedParent = fixedParent.parentElement;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Fall back to document.body if no fixed parent found
|
|
107
|
+
return {
|
|
108
|
+
container: document.body,
|
|
109
|
+
isFixed: false
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
export const calculateToolbarPositionTrackHeadOld = toolbarTitle => (editorView, nextPos) => {
|
|
95
113
|
const toolbar = document.querySelector(`div[aria-label="${toolbarTitle}"]`);
|
|
96
114
|
if (!toolbar) {
|
|
97
115
|
return nextPos;
|
|
@@ -161,6 +179,124 @@ export const calculateToolbarPositionTrackHead = toolbarTitle => (editorView, ne
|
|
|
161
179
|
};
|
|
162
180
|
};
|
|
163
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Same logic as calculateToolbarPositionTrackHeadOld, but with the following changes:
|
|
184
|
+
* - Uses a cached container to avoid repeated DOM traversal and getComputedStyle calls
|
|
185
|
+
* - Works when editor is nested within a fixed positioned parent, such as within a modal or sidebar
|
|
186
|
+
*/
|
|
187
|
+
export const calculateToolbarPositionTrackHeadNew = toolbarTitle => {
|
|
188
|
+
// Cache the container to avoid repeated DOM traversal and getComputedStyle calls
|
|
189
|
+
let cachedContainer = null;
|
|
190
|
+
let isFixedContainer = false;
|
|
191
|
+
let cachedEditorDom = null;
|
|
192
|
+
return (editorView, nextPos) => {
|
|
193
|
+
const toolbar = document.querySelector(`div[aria-label="${toolbarTitle}"]`);
|
|
194
|
+
if (!toolbar) {
|
|
195
|
+
return nextPos;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Find and cache the container (only recalculates if editor DOM changed)
|
|
199
|
+
if (cachedEditorDom !== editorView.dom) {
|
|
200
|
+
cachedEditorDom = editorView.dom;
|
|
201
|
+
const {
|
|
202
|
+
container,
|
|
203
|
+
isFixed
|
|
204
|
+
} = findContainingElement(editorView);
|
|
205
|
+
cachedContainer = container;
|
|
206
|
+
isFixedContainer = isFixed;
|
|
207
|
+
}
|
|
208
|
+
if (!cachedContainer) {
|
|
209
|
+
return nextPos;
|
|
210
|
+
}
|
|
211
|
+
const container = cachedContainer;
|
|
212
|
+
const containerBounds = container.getBoundingClientRect();
|
|
213
|
+
const selection = window && window.getSelection();
|
|
214
|
+
const moreRovoOptionsButton = document.querySelector('button[aria-label="More Rovo options"], [aria-label="More Rovo options"]');
|
|
215
|
+
const isMoreRovoOptionsButtonVisible = !!moreRovoOptionsButton && moreRovoOptionsButton instanceof HTMLElement && !!moreRovoOptionsButton.offsetParent;
|
|
216
|
+
let range = null;
|
|
217
|
+
if (isMoreRovoOptionsButtonVisible && fg('platform_editor_ai_generic_prep_for_aifc')) {
|
|
218
|
+
if (selection && selection.getRangeAt && selection.rangeCount > 0) {
|
|
219
|
+
const maybeRange = selection.getRangeAt(0);
|
|
220
|
+
if (maybeRange instanceof Range) {
|
|
221
|
+
range = maybeRange;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
} else {
|
|
225
|
+
if (selection && !selection.isCollapsed && selection.getRangeAt && selection.rangeCount > 0) {
|
|
226
|
+
const maybeRange = selection.getRangeAt(0);
|
|
227
|
+
if (maybeRange instanceof Range) {
|
|
228
|
+
range = maybeRange;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (!range) {
|
|
233
|
+
return nextPos;
|
|
234
|
+
}
|
|
235
|
+
const toolbarRect = toolbar.getBoundingClientRect();
|
|
236
|
+
const {
|
|
237
|
+
head,
|
|
238
|
+
anchor
|
|
239
|
+
} = editorView.state.selection;
|
|
240
|
+
const topCoords = editorView.coordsAtPos(Math.min(head, anchor));
|
|
241
|
+
const bottomCoords = editorView.coordsAtPos(Math.max(head, anchor) - Math.min(range.endOffset, 1));
|
|
242
|
+
let top;
|
|
243
|
+
// If not the same line AND we are selecting downwards, display toolbar below.
|
|
244
|
+
if (head > anchor && topCoords.top !== bottomCoords.top) {
|
|
245
|
+
// We are taking the previous pos to the maxium, so avoid end of line positions
|
|
246
|
+
// returning the next line's rect.
|
|
247
|
+
top = (bottomCoords.top || 0) + toolbarRect.height / 1.15;
|
|
248
|
+
} else {
|
|
249
|
+
top = (topCoords.top || 0) - toolbarRect.height * 1.5;
|
|
250
|
+
}
|
|
251
|
+
let left = (head > anchor ? bottomCoords.right : topCoords.left) - toolbarRect.width / 2;
|
|
252
|
+
|
|
253
|
+
// Place toolbar below selection if not sufficient space above
|
|
254
|
+
if (top < containerBounds.top) {
|
|
255
|
+
({
|
|
256
|
+
top,
|
|
257
|
+
left
|
|
258
|
+
} = getCoordsBelowSelection(bottomCoords, toolbarRect));
|
|
259
|
+
}
|
|
260
|
+
let leftCoord = Math.max(0, left - containerBounds.left);
|
|
261
|
+
if (leftCoord + toolbarRect.width > containerBounds.width) {
|
|
262
|
+
const scrollbarWidth = MAXIMUM_BROWSER_SCROLLBAR_WIDTH;
|
|
263
|
+
leftCoord = Math.max(0, containerBounds.width - (toolbarRect.width + scrollbarWidth));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Apply scroll offset only for non-fixed containers
|
|
267
|
+
// Fixed positioned elements don't scroll with the page
|
|
268
|
+
const scrollOffset = isFixedContainer ? 0 : container.scrollTop;
|
|
269
|
+
return {
|
|
270
|
+
top: top - containerBounds.top + scrollOffset,
|
|
271
|
+
left: leftCoord
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
/*
|
|
277
|
+
Calculates the position of the floating toolbar relative to the selection.
|
|
278
|
+
This implementation works in multiple scenarios:
|
|
279
|
+
- Standard scrollable containers with .fabric-editor-popup-scroll-parent
|
|
280
|
+
- Fixed positioned parent containers
|
|
281
|
+
- Falls back to document.body
|
|
282
|
+
|
|
283
|
+
The function automatically detects the container type and applies the appropriate
|
|
284
|
+
positioning logic and scroll offset handling.
|
|
285
|
+
|
|
286
|
+
Things to consider:
|
|
287
|
+
- stick as close to the head X release coordinates as possible
|
|
288
|
+
- coordinates of head X and getBoundingClientRect() are absolute in client viewport
|
|
289
|
+
- popup may appear in '.fabric-editor-popup-scroll-parent', fixed parent, or body
|
|
290
|
+
- we use the toolbarRect to center align toolbar
|
|
291
|
+
- use container bounds to clamp values
|
|
292
|
+
- for fixed positioning, no scroll offsets are applied
|
|
293
|
+
- for scrollable containers, scroll offsets are included
|
|
294
|
+
*/
|
|
295
|
+
export const calculateToolbarPositionTrackHead = toolbarTitle => {
|
|
296
|
+
const isSelToolbarFixEnabled = expValEquals('platform_editor_sel_toolbar_fix', 'isEnabled', true);
|
|
297
|
+
return isSelToolbarFixEnabled ? calculateToolbarPositionTrackHeadNew(toolbarTitle) : calculateToolbarPositionTrackHeadOld(toolbarTitle);
|
|
298
|
+
};
|
|
299
|
+
|
|
164
300
|
/**
|
|
165
301
|
* Returns the coordintes at the bottom the selection.
|
|
166
302
|
*/
|
|
@@ -528,6 +528,7 @@ export var ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
|
528
528
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_CREATE"] = "syncedBlockCreate";
|
|
529
529
|
ACTION_SUBJECT_ID["REFERENCE_SYNCED_BLOCK_CREATE"] = "referenceSyncedBlockCreate";
|
|
530
530
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_DELETE"] = "syncedBlockDelete";
|
|
531
|
+
ACTION_SUBJECT_ID["REFERENCE_SYNCED_BLOCK_DELETE"] = "referenceSyncedBlockDelete";
|
|
531
532
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_GET_SOURCE_INFO"] = "syncedBlockGetSourceInfo";
|
|
532
533
|
ACTION_SUBJECT_ID["SYNCED_BLOCK_FETCH"] = "syncedBlockFetch";
|
|
533
534
|
ACTION_SUBJECT_ID["TABLE_STICKY_HEADER"] = "tableStickyHeader";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
2
2
|
export { messages } from './messages';
|
|
3
|
-
export { BLOCK_ACTIONS_MENU_SECTION, BLOCK_ACTIONS_CREATE_SYNCED_BLOCK_MENU_ITEM, BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM, DELETE_MENU_SECTION, DELETE_MENU_ITEM, POSITION_MENU_SECTION, POSITION_MOVE_UP_MENU_ITEM, POSITION_MOVE_DOWN_MENU_ITEM, TRANSFORM_MENU_SECTION, TRANSFORM_MENU_ITEM, TRANSFORM_CLEAR_MENU_SECTION, TRANSFORM_CLEAR_MENU_ITEM, TRANSFORM_CREATE_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM, TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_DECISION_MENU_ITEM, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_ITEM } from './key';
|
|
3
|
+
export { BLOCK_ACTIONS_MENU_SECTION, BLOCK_ACTIONS_FEATURED_EXTENSION_SLOT_MENU_ITEM, BLOCK_ACTIONS_CREATE_SYNCED_BLOCK_MENU_ITEM, BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM, DELETE_MENU_SECTION, DELETE_MENU_ITEM, POSITION_MENU_SECTION, POSITION_MOVE_UP_MENU_ITEM, POSITION_MOVE_DOWN_MENU_ITEM, TRANSFORM_MENU_SECTION, TRANSFORM_MENU_ITEM, TRANSFORM_CLEAR_MENU_SECTION, TRANSFORM_CLEAR_MENU_ITEM, TRANSFORM_CREATE_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM, TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_DECISION_MENU_ITEM, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_ITEM, TRANSFORM_DEFAULT_EXTENSION_SLOT_MENU_ITEM } from './key';
|
|
4
4
|
export { FORMAT_HEADING_1_MENU_ITEM, FORMAT_HEADING_2_MENU_ITEM, FORMAT_HEADING_3_MENU_ITEM, FORMAT_HEADING_4_MENU_ITEM, FORMAT_HEADING_5_MENU_ITEM, FORMAT_HEADING_6_MENU_ITEM, FORMAT_PARAGRAPH_MENU_ITEM, FORMAT_QUOTE_MENU_ITEM, FORMAT_EXPAND_MENU_ITEM, FORMAT_LAYOUT_MENU_ITEM, FORMAT_PANEL_MENU_ITEM, FORMAT_CODE_BLOCK_MENU_ITEM, FORMAT_BULLETED_LIST_MENU_ITEM, FORMAT_NUMBERED_LIST_MENU_ITEM, FORMAT_TASK_LIST_MENU_ITEM, COPY_MENU_SECTION, MOVE_UP_DOWN_MENU_SECTION, COPY_BLOCK_MENU_ITEM, COPY_LINK_MENU_ITEM, MOVE_UP_MENU_ITEM, MOVE_DOWN_MENU_ITEM, NESTED_FORMAT_MENU_SECTION, FORMAT_MENU_ITEM, NESTED_FORMAT_MENU, PRIMARY_MENU_SECTION, ADD_BLOCKS_MENU_SECTION, CREATE_SYNCED_BLOCK_MENU_ITEM } from './key-deprecated';
|
|
5
|
-
export { MAIN_BLOCK_MENU_SECTION_RANK, TRANSFORM_MENU_SECTION_RANK, TRANSFORM_MENU_ITEM_RANK, TRANSFORM_HEADINGS_MENU_SECTION_RANK, TRANSFORM_STRUCTURE_MENU_SECTION_RANK, TRANSFORM_CLEAR_MENU_SECTION_RANK, BLOCK_ACTIONS_MENU_SECTION_RANK, POSITION_MENU_SECTION_RANK, DELETE_MENU_SECTION_RANK, TRANSFORM_SUGGESTED_MENU_SECTION_RANK } from './rank';
|
|
5
|
+
export { MAIN_BLOCK_MENU_SECTION_RANK, TRANSFORM_MENU_SECTION_RANK, TRANSFORM_MENU_ITEM_RANK, TRANSFORM_HEADINGS_MENU_SECTION_RANK, TRANSFORM_STRUCTURE_MENU_SECTION_RANK, TRANSFORM_CLEAR_MENU_SECTION_RANK, BLOCK_ACTIONS_MENU_SECTION_RANK, POSITION_MENU_SECTION_RANK, DELETE_MENU_SECTION_RANK, TRANSFORM_SUGGESTED_MENU_SECTION_RANK, TRANSFORM_CREATE_MENU_SECTION_RANK } from './rank';
|
|
6
6
|
export { FORMAT_NESTED_MENU_RANK, FORMAT_NESTED_MENU_RANK_REVISED, BLOCK_MENU_SECTION_RANK, PRIMARY_MENU_SECTION_RANK, COPY_MENU_SECTION_RANK, DELETE_SECTION_RANK, MOVE_BLOCK_SECTION_RANK, ADD_BLOCKS_MENU_SECTION_RANK } from './rank-deprecated';
|
|
7
7
|
export { createBlockLinkHashValue, DEFAULT_BLOCK_LINK_HASH_PREFIX, extractBlockIdFromLinkHash, isBlockLinkHash } from './block-link';
|
|
@@ -75,9 +75,15 @@ export var TRANSFORM_CLEAR_MENU_SECTION = {
|
|
|
75
75
|
export var TRANSFORM_CLEAR_MENU_ITEM = {
|
|
76
76
|
key: 'transform-clear-menu-item'
|
|
77
77
|
};
|
|
78
|
+
export var TRANSFORM_DEFAULT_EXTENSION_SLOT_MENU_ITEM = {
|
|
79
|
+
key: 'transform-default-extension-slot-menu-item'
|
|
80
|
+
};
|
|
78
81
|
|
|
79
82
|
// Block actions
|
|
80
83
|
|
|
84
|
+
export var BLOCK_ACTIONS_FEATURED_EXTENSION_SLOT_MENU_ITEM = {
|
|
85
|
+
key: 'block-actions-featured-extension-slot-menu-item'
|
|
86
|
+
};
|
|
81
87
|
export var BLOCK_ACTIONS_MENU_SECTION = {
|
|
82
88
|
key: 'block-actions-menu-section'
|
|
83
89
|
};
|
|
File without changes
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import { BLOCK_ACTIONS_MENU_SECTION, BLOCK_ACTIONS_CREATE_SYNCED_BLOCK_MENU_ITEM, BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM, DELETE_MENU_SECTION, DELETE_MENU_ITEM, POSITION_MENU_SECTION, POSITION_MOVE_UP_MENU_ITEM, POSITION_MOVE_DOWN_MENU_ITEM, TRANSFORM_MENU_SECTION, TRANSFORM_MENU_ITEM, TRANSFORM_CLEAR_MENU_SECTION, TRANSFORM_CLEAR_MENU_ITEM, TRANSFORM_CREATE_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM, TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_DECISION_MENU_ITEM, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_ITEM } from './key';
|
|
2
|
+
import { BLOCK_ACTIONS_FEATURED_EXTENSION_SLOT_MENU_ITEM, BLOCK_ACTIONS_MENU_SECTION, BLOCK_ACTIONS_CREATE_SYNCED_BLOCK_MENU_ITEM, BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM, DELETE_MENU_SECTION, DELETE_MENU_ITEM, POSITION_MENU_SECTION, POSITION_MOVE_UP_MENU_ITEM, POSITION_MOVE_DOWN_MENU_ITEM, TRANSFORM_MENU_SECTION, TRANSFORM_MENU_ITEM, TRANSFORM_CLEAR_MENU_SECTION, TRANSFORM_CLEAR_MENU_ITEM, TRANSFORM_CREATE_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM, TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_DECISION_MENU_ITEM, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_ITEM, TRANSFORM_DEFAULT_EXTENSION_SLOT_MENU_ITEM } from './key';
|
|
3
3
|
export var MAIN_BLOCK_MENU_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_MENU_SECTION.key, 200), BLOCK_ACTIONS_MENU_SECTION.key, 300), POSITION_MENU_SECTION.key, 400), DELETE_MENU_SECTION.key, 500);
|
|
4
4
|
export var TRANSFORM_MENU_SECTION_RANK = _defineProperty({}, TRANSFORM_MENU_ITEM.key, 100);
|
|
5
5
|
export var TRANSFORM_SUGGESTED_MENU_SECTION_RANK = _defineProperty({}, TRANSFORM_SUGGESTED_MENU_ITEM.key, 100);
|
|
6
6
|
export var TRANSFORM_MENU_ITEM_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_SUGGESTED_MENU_SECTION.key, 100), TRANSFORM_CREATE_MENU_SECTION.key, 200), TRANSFORM_STRUCTURE_MENU_SECTION.key, 300), TRANSFORM_HEADINGS_MENU_SECTION.key, 400), TRANSFORM_CLEAR_MENU_SECTION.key, 500);
|
|
7
|
+
export var TRANSFORM_CREATE_MENU_SECTION_RANK = _defineProperty({}, TRANSFORM_DEFAULT_EXTENSION_SLOT_MENU_ITEM.key, 1000);
|
|
7
8
|
export var TRANSFORM_HEADINGS_MENU_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_HEADINGS_H1_MENU_ITEM.key, 100), TRANSFORM_HEADINGS_H2_MENU_ITEM.key, 200), TRANSFORM_HEADINGS_H3_MENU_ITEM.key, 300), TRANSFORM_HEADINGS_H4_MENU_ITEM.key, 400), TRANSFORM_HEADINGS_H5_MENU_ITEM.key, 500), TRANSFORM_HEADINGS_H6_MENU_ITEM.key, 600);
|
|
8
9
|
export var TRANSFORM_STRUCTURE_MENU_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM.key, 100), TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM.key, 200), TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM.key, 300), TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM.key, 400), TRANSFORM_STRUCTURE_PANEL_MENU_ITEM.key, 500), TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM.key, 600), TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM.key, 700), TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM.key, 800), TRANSFORM_STRUCTURE_DECISION_MENU_ITEM.key, 900), TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM.key, 1000);
|
|
9
10
|
export var TRANSFORM_CLEAR_MENU_SECTION_RANK = _defineProperty({}, TRANSFORM_CLEAR_MENU_ITEM.key, 100);
|
|
10
|
-
export var BLOCK_ACTIONS_MENU_SECTION_RANK = _defineProperty(_defineProperty({}, BLOCK_ACTIONS_CREATE_SYNCED_BLOCK_MENU_ITEM.key, 100),
|
|
11
|
+
export var BLOCK_ACTIONS_MENU_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty({}, BLOCK_ACTIONS_CREATE_SYNCED_BLOCK_MENU_ITEM.key, 100), BLOCK_ACTIONS_FEATURED_EXTENSION_SLOT_MENU_ITEM.key, 200), BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM.key, 300);
|
|
11
12
|
export var POSITION_MENU_SECTION_RANK = _defineProperty(_defineProperty({}, POSITION_MOVE_UP_MENU_ITEM.key, 100), POSITION_MOVE_DOWN_MENU_ITEM.key, 200);
|
|
12
13
|
export var DELETE_MENU_SECTION_RANK = _defineProperty({}, DELETE_MENU_ITEM.key, 100);
|
|
@@ -5,10 +5,10 @@ export var syncBlockMessages = defineMessages({
|
|
|
5
5
|
defaultMessage: 'Copy',
|
|
6
6
|
description: 'Button label for copying the reference of sync block element to your clipboard'
|
|
7
7
|
},
|
|
8
|
-
|
|
9
|
-
id: 'fabric.editor.
|
|
10
|
-
defaultMessage: 'Copy
|
|
11
|
-
description: 'Tooltip for the button to copy
|
|
8
|
+
copySyncedBlockTooltip: {
|
|
9
|
+
id: 'fabric.editor.copySyncedBlockTooltip',
|
|
10
|
+
defaultMessage: 'Copy synced block',
|
|
11
|
+
description: 'Tooltip for the button to copy synced block element '
|
|
12
12
|
},
|
|
13
13
|
editSourceLabel: {
|
|
14
14
|
id: 'fabric.editor.editSourceLabel',
|
|
@@ -12,7 +12,7 @@ export var textColorMessages = defineMessages({
|
|
|
12
12
|
},
|
|
13
13
|
textColorHighlightTooltip: {
|
|
14
14
|
id: 'fabric.editor.textColorHighlightTooltip',
|
|
15
|
-
defaultMessage: 'Text and
|
|
15
|
+
defaultMessage: 'Text and highlight color',
|
|
16
16
|
description: 'Tooltip of menu that provides access to various colors of highlight.'
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
|
|
|
10
10
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
11
11
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
12
12
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
13
|
-
var packageVersion = "111.7.
|
|
13
|
+
var packageVersion = "111.7.4";
|
|
14
14
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
15
15
|
// Remove URL as it has UGC
|
|
16
16
|
// Ignored via go/ees007
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "111.7.
|
|
24
|
+
var packageVersion = "111.7.4";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
2
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
var MAXIMUM_BROWSER_SCROLLBAR_WIDTH = 20;
|
|
5
6
|
|
|
6
7
|
/*
|
|
@@ -79,19 +80,36 @@ export var calculateToolbarPositionAboveSelection = function calculateToolbarPos
|
|
|
79
80
|
};
|
|
80
81
|
};
|
|
81
82
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
var findContainingElement = function findContainingElement(editorView) {
|
|
84
|
+
// First, try to find .fabric-editor-popup-scroll-parent
|
|
85
|
+
var scrollParent = editorView.dom.closest('.fabric-editor-popup-scroll-parent');
|
|
86
|
+
if (scrollParent) {
|
|
87
|
+
return {
|
|
88
|
+
container: scrollParent,
|
|
89
|
+
isFixed: false
|
|
90
|
+
};
|
|
91
|
+
} else {
|
|
92
|
+
// If no scroll parent, look for a fixed positioned parent
|
|
93
|
+
var fixedParent = editorView.dom.parentElement;
|
|
94
|
+
while (fixedParent && fixedParent !== document.body) {
|
|
95
|
+
var computedStyle = window.getComputedStyle(fixedParent);
|
|
96
|
+
if (computedStyle.position === 'fixed') {
|
|
97
|
+
return {
|
|
98
|
+
container: fixedParent,
|
|
99
|
+
isFixed: true
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
fixedParent = fixedParent.parentElement;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Fall back to document.body if no fixed parent found
|
|
107
|
+
return {
|
|
108
|
+
container: document.body,
|
|
109
|
+
isFixed: false
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
export var calculateToolbarPositionTrackHeadOld = function calculateToolbarPositionTrackHeadOld(toolbarTitle) {
|
|
95
113
|
return function (editorView, nextPos) {
|
|
96
114
|
var toolbar = document.querySelector("div[aria-label=\"".concat(toolbarTitle, "\"]"));
|
|
97
115
|
if (!toolbar) {
|
|
@@ -161,6 +179,121 @@ export var calculateToolbarPositionTrackHead = function calculateToolbarPosition
|
|
|
161
179
|
};
|
|
162
180
|
};
|
|
163
181
|
|
|
182
|
+
/**
|
|
183
|
+
* Same logic as calculateToolbarPositionTrackHeadOld, but with the following changes:
|
|
184
|
+
* - Uses a cached container to avoid repeated DOM traversal and getComputedStyle calls
|
|
185
|
+
* - Works when editor is nested within a fixed positioned parent, such as within a modal or sidebar
|
|
186
|
+
*/
|
|
187
|
+
export var calculateToolbarPositionTrackHeadNew = function calculateToolbarPositionTrackHeadNew(toolbarTitle) {
|
|
188
|
+
// Cache the container to avoid repeated DOM traversal and getComputedStyle calls
|
|
189
|
+
var cachedContainer = null;
|
|
190
|
+
var isFixedContainer = false;
|
|
191
|
+
var cachedEditorDom = null;
|
|
192
|
+
return function (editorView, nextPos) {
|
|
193
|
+
var toolbar = document.querySelector("div[aria-label=\"".concat(toolbarTitle, "\"]"));
|
|
194
|
+
if (!toolbar) {
|
|
195
|
+
return nextPos;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Find and cache the container (only recalculates if editor DOM changed)
|
|
199
|
+
if (cachedEditorDom !== editorView.dom) {
|
|
200
|
+
cachedEditorDom = editorView.dom;
|
|
201
|
+
var _findContainingElemen = findContainingElement(editorView),
|
|
202
|
+
_container = _findContainingElemen.container,
|
|
203
|
+
isFixed = _findContainingElemen.isFixed;
|
|
204
|
+
cachedContainer = _container;
|
|
205
|
+
isFixedContainer = isFixed;
|
|
206
|
+
}
|
|
207
|
+
if (!cachedContainer) {
|
|
208
|
+
return nextPos;
|
|
209
|
+
}
|
|
210
|
+
var container = cachedContainer;
|
|
211
|
+
var containerBounds = container.getBoundingClientRect();
|
|
212
|
+
var selection = window && window.getSelection();
|
|
213
|
+
var moreRovoOptionsButton = document.querySelector('button[aria-label="More Rovo options"], [aria-label="More Rovo options"]');
|
|
214
|
+
var isMoreRovoOptionsButtonVisible = !!moreRovoOptionsButton && moreRovoOptionsButton instanceof HTMLElement && !!moreRovoOptionsButton.offsetParent;
|
|
215
|
+
var range = null;
|
|
216
|
+
if (isMoreRovoOptionsButtonVisible && fg('platform_editor_ai_generic_prep_for_aifc')) {
|
|
217
|
+
if (selection && selection.getRangeAt && selection.rangeCount > 0) {
|
|
218
|
+
var maybeRange = selection.getRangeAt(0);
|
|
219
|
+
if (maybeRange instanceof Range) {
|
|
220
|
+
range = maybeRange;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
} else {
|
|
224
|
+
if (selection && !selection.isCollapsed && selection.getRangeAt && selection.rangeCount > 0) {
|
|
225
|
+
var _maybeRange2 = selection.getRangeAt(0);
|
|
226
|
+
if (_maybeRange2 instanceof Range) {
|
|
227
|
+
range = _maybeRange2;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (!range) {
|
|
232
|
+
return nextPos;
|
|
233
|
+
}
|
|
234
|
+
var toolbarRect = toolbar.getBoundingClientRect();
|
|
235
|
+
var _editorView$state$sel3 = editorView.state.selection,
|
|
236
|
+
head = _editorView$state$sel3.head,
|
|
237
|
+
anchor = _editorView$state$sel3.anchor;
|
|
238
|
+
var topCoords = editorView.coordsAtPos(Math.min(head, anchor));
|
|
239
|
+
var bottomCoords = editorView.coordsAtPos(Math.max(head, anchor) - Math.min(range.endOffset, 1));
|
|
240
|
+
var top;
|
|
241
|
+
// If not the same line AND we are selecting downwards, display toolbar below.
|
|
242
|
+
if (head > anchor && topCoords.top !== bottomCoords.top) {
|
|
243
|
+
// We are taking the previous pos to the maxium, so avoid end of line positions
|
|
244
|
+
// returning the next line's rect.
|
|
245
|
+
top = (bottomCoords.top || 0) + toolbarRect.height / 1.15;
|
|
246
|
+
} else {
|
|
247
|
+
top = (topCoords.top || 0) - toolbarRect.height * 1.5;
|
|
248
|
+
}
|
|
249
|
+
var left = (head > anchor ? bottomCoords.right : topCoords.left) - toolbarRect.width / 2;
|
|
250
|
+
|
|
251
|
+
// Place toolbar below selection if not sufficient space above
|
|
252
|
+
if (top < containerBounds.top) {
|
|
253
|
+
var _getCoordsBelowSelect3 = getCoordsBelowSelection(bottomCoords, toolbarRect);
|
|
254
|
+
top = _getCoordsBelowSelect3.top;
|
|
255
|
+
left = _getCoordsBelowSelect3.left;
|
|
256
|
+
}
|
|
257
|
+
var leftCoord = Math.max(0, left - containerBounds.left);
|
|
258
|
+
if (leftCoord + toolbarRect.width > containerBounds.width) {
|
|
259
|
+
var _scrollbarWidth2 = MAXIMUM_BROWSER_SCROLLBAR_WIDTH;
|
|
260
|
+
leftCoord = Math.max(0, containerBounds.width - (toolbarRect.width + _scrollbarWidth2));
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Apply scroll offset only for non-fixed containers
|
|
264
|
+
// Fixed positioned elements don't scroll with the page
|
|
265
|
+
var scrollOffset = isFixedContainer ? 0 : container.scrollTop;
|
|
266
|
+
return {
|
|
267
|
+
top: top - containerBounds.top + scrollOffset,
|
|
268
|
+
left: leftCoord
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
/*
|
|
274
|
+
Calculates the position of the floating toolbar relative to the selection.
|
|
275
|
+
This implementation works in multiple scenarios:
|
|
276
|
+
- Standard scrollable containers with .fabric-editor-popup-scroll-parent
|
|
277
|
+
- Fixed positioned parent containers
|
|
278
|
+
- Falls back to document.body
|
|
279
|
+
|
|
280
|
+
The function automatically detects the container type and applies the appropriate
|
|
281
|
+
positioning logic and scroll offset handling.
|
|
282
|
+
|
|
283
|
+
Things to consider:
|
|
284
|
+
- stick as close to the head X release coordinates as possible
|
|
285
|
+
- coordinates of head X and getBoundingClientRect() are absolute in client viewport
|
|
286
|
+
- popup may appear in '.fabric-editor-popup-scroll-parent', fixed parent, or body
|
|
287
|
+
- we use the toolbarRect to center align toolbar
|
|
288
|
+
- use container bounds to clamp values
|
|
289
|
+
- for fixed positioning, no scroll offsets are applied
|
|
290
|
+
- for scrollable containers, scroll offsets are included
|
|
291
|
+
*/
|
|
292
|
+
export var calculateToolbarPositionTrackHead = function calculateToolbarPositionTrackHead(toolbarTitle) {
|
|
293
|
+
var isSelToolbarFixEnabled = expValEquals('platform_editor_sel_toolbar_fix', 'isEnabled', true);
|
|
294
|
+
return isSelToolbarFixEnabled ? calculateToolbarPositionTrackHeadNew(toolbarTitle) : calculateToolbarPositionTrackHeadOld(toolbarTitle);
|
|
295
|
+
};
|
|
296
|
+
|
|
164
297
|
/**
|
|
165
298
|
* Returns the coordintes at the bottom the selection.
|
|
166
299
|
*/
|
|
@@ -520,6 +520,7 @@ export declare enum ACTION_SUBJECT_ID {
|
|
|
520
520
|
SYNCED_BLOCK_CREATE = "syncedBlockCreate",
|
|
521
521
|
REFERENCE_SYNCED_BLOCK_CREATE = "referenceSyncedBlockCreate",
|
|
522
522
|
SYNCED_BLOCK_DELETE = "syncedBlockDelete",
|
|
523
|
+
REFERENCE_SYNCED_BLOCK_DELETE = "referenceSyncedBlockDelete",
|
|
523
524
|
SYNCED_BLOCK_GET_SOURCE_INFO = "syncedBlockGetSourceInfo",
|
|
524
525
|
SYNCED_BLOCK_FETCH = "syncedBlockFetch",
|
|
525
526
|
TABLE_STICKY_HEADER = "tableStickyHeader"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID } from './enums';
|
|
2
|
+
import type { ExperienceEventPayload } from './experience-events';
|
|
2
3
|
import type { OperationalAEP } from './utils';
|
|
3
4
|
type SyncedBlockErrorAttributes = {
|
|
4
5
|
error: string;
|
|
@@ -11,6 +12,6 @@ export type SyncedBlockCreateErrorAEP = OperationalAEP<ACTION.ERROR, ACTION_SUBJ
|
|
|
11
12
|
export type SyncedBlockDeleteErrorAEP = OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, ACTION_SUBJECT_ID.SYNCED_BLOCK_DELETE, SyncedBlockErrorAttributes>;
|
|
12
13
|
export type SyncedBlockGetSourceInfoErrorAEP = OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, ACTION_SUBJECT_ID.SYNCED_BLOCK_GET_SOURCE_INFO, SyncedBlockErrorAttributes>;
|
|
13
14
|
export type SyncedBlockFetchErrorAEP = OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH, SyncedBlockErrorAttributes>;
|
|
14
|
-
export type SyncBlockEventPayload = SyncedBlockSourceURLErrorAEP | SyncedBlockUpdateCacheErrorAEP | SyncedBlockUpdateErrorAEP | SyncedBlockCreateErrorAEP | SyncedBlockDeleteErrorAEP | SyncedBlockGetSourceInfoErrorAEP | SyncedBlockFetchErrorAEP | ReferenceSyncedBlockUpdateErrorAEP;
|
|
15
|
-
export type RendererSyncBlockEventPayload = SyncedBlockGetSourceInfoErrorAEP | SyncedBlockFetchErrorAEP | ReferenceSyncedBlockUpdateErrorAEP;
|
|
15
|
+
export type SyncBlockEventPayload = SyncedBlockSourceURLErrorAEP | SyncedBlockUpdateCacheErrorAEP | SyncedBlockUpdateErrorAEP | SyncedBlockCreateErrorAEP | SyncedBlockDeleteErrorAEP | SyncedBlockGetSourceInfoErrorAEP | SyncedBlockFetchErrorAEP | ReferenceSyncedBlockUpdateErrorAEP | ExperienceEventPayload;
|
|
16
|
+
export type RendererSyncBlockEventPayload = SyncedBlockGetSourceInfoErrorAEP | SyncedBlockFetchErrorAEP | ReferenceSyncedBlockUpdateErrorAEP | ExperienceEventPayload;
|
|
16
17
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { messages } from './messages';
|
|
2
|
-
export { BLOCK_ACTIONS_MENU_SECTION, BLOCK_ACTIONS_CREATE_SYNCED_BLOCK_MENU_ITEM, BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM, DELETE_MENU_SECTION, DELETE_MENU_ITEM, POSITION_MENU_SECTION, POSITION_MOVE_UP_MENU_ITEM, POSITION_MOVE_DOWN_MENU_ITEM, TRANSFORM_MENU_SECTION, TRANSFORM_MENU_ITEM, TRANSFORM_CLEAR_MENU_SECTION, TRANSFORM_CLEAR_MENU_ITEM, TRANSFORM_CREATE_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM, TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_DECISION_MENU_ITEM, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_ITEM, } from './key';
|
|
2
|
+
export { BLOCK_ACTIONS_MENU_SECTION, BLOCK_ACTIONS_FEATURED_EXTENSION_SLOT_MENU_ITEM, BLOCK_ACTIONS_CREATE_SYNCED_BLOCK_MENU_ITEM, BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM, DELETE_MENU_SECTION, DELETE_MENU_ITEM, POSITION_MENU_SECTION, POSITION_MOVE_UP_MENU_ITEM, POSITION_MOVE_DOWN_MENU_ITEM, TRANSFORM_MENU_SECTION, TRANSFORM_MENU_ITEM, TRANSFORM_CLEAR_MENU_SECTION, TRANSFORM_CLEAR_MENU_ITEM, TRANSFORM_CREATE_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM, TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_DECISION_MENU_ITEM, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_ITEM, TRANSFORM_DEFAULT_EXTENSION_SLOT_MENU_ITEM, } from './key';
|
|
3
3
|
export { FORMAT_HEADING_1_MENU_ITEM, FORMAT_HEADING_2_MENU_ITEM, FORMAT_HEADING_3_MENU_ITEM, FORMAT_HEADING_4_MENU_ITEM, FORMAT_HEADING_5_MENU_ITEM, FORMAT_HEADING_6_MENU_ITEM, FORMAT_PARAGRAPH_MENU_ITEM, FORMAT_QUOTE_MENU_ITEM, FORMAT_EXPAND_MENU_ITEM, FORMAT_LAYOUT_MENU_ITEM, FORMAT_PANEL_MENU_ITEM, FORMAT_CODE_BLOCK_MENU_ITEM, FORMAT_BULLETED_LIST_MENU_ITEM, FORMAT_NUMBERED_LIST_MENU_ITEM, FORMAT_TASK_LIST_MENU_ITEM, COPY_MENU_SECTION, MOVE_UP_DOWN_MENU_SECTION, COPY_BLOCK_MENU_ITEM, COPY_LINK_MENU_ITEM, MOVE_UP_MENU_ITEM, MOVE_DOWN_MENU_ITEM, NESTED_FORMAT_MENU_SECTION, FORMAT_MENU_ITEM, NESTED_FORMAT_MENU, PRIMARY_MENU_SECTION, ADD_BLOCKS_MENU_SECTION, CREATE_SYNCED_BLOCK_MENU_ITEM, } from './key-deprecated';
|
|
4
|
-
export { MAIN_BLOCK_MENU_SECTION_RANK, TRANSFORM_MENU_SECTION_RANK, TRANSFORM_MENU_ITEM_RANK, TRANSFORM_HEADINGS_MENU_SECTION_RANK, TRANSFORM_STRUCTURE_MENU_SECTION_RANK, TRANSFORM_CLEAR_MENU_SECTION_RANK, BLOCK_ACTIONS_MENU_SECTION_RANK, POSITION_MENU_SECTION_RANK, DELETE_MENU_SECTION_RANK, TRANSFORM_SUGGESTED_MENU_SECTION_RANK, } from './rank';
|
|
4
|
+
export { MAIN_BLOCK_MENU_SECTION_RANK, TRANSFORM_MENU_SECTION_RANK, TRANSFORM_MENU_ITEM_RANK, TRANSFORM_HEADINGS_MENU_SECTION_RANK, TRANSFORM_STRUCTURE_MENU_SECTION_RANK, TRANSFORM_CLEAR_MENU_SECTION_RANK, BLOCK_ACTIONS_MENU_SECTION_RANK, POSITION_MENU_SECTION_RANK, DELETE_MENU_SECTION_RANK, TRANSFORM_SUGGESTED_MENU_SECTION_RANK, TRANSFORM_CREATE_MENU_SECTION_RANK, } from './rank';
|
|
5
5
|
export { FORMAT_NESTED_MENU_RANK, FORMAT_NESTED_MENU_RANK_REVISED, BLOCK_MENU_SECTION_RANK, PRIMARY_MENU_SECTION_RANK, COPY_MENU_SECTION_RANK, DELETE_SECTION_RANK, MOVE_BLOCK_SECTION_RANK, ADD_BLOCKS_MENU_SECTION_RANK, } from './rank-deprecated';
|
|
6
6
|
export { createBlockLinkHashValue, DEFAULT_BLOCK_LINK_HASH_PREFIX, extractBlockIdFromLinkHash, isBlockLinkHash, } from './block-link';
|
|
7
|
+
export type { BlockMenuPlacement } from './placement';
|
|
@@ -73,6 +73,12 @@ export declare const TRANSFORM_CLEAR_MENU_SECTION: {
|
|
|
73
73
|
export declare const TRANSFORM_CLEAR_MENU_ITEM: {
|
|
74
74
|
key: string;
|
|
75
75
|
};
|
|
76
|
+
export declare const TRANSFORM_DEFAULT_EXTENSION_SLOT_MENU_ITEM: {
|
|
77
|
+
key: string;
|
|
78
|
+
};
|
|
79
|
+
export declare const BLOCK_ACTIONS_FEATURED_EXTENSION_SLOT_MENU_ITEM: {
|
|
80
|
+
key: string;
|
|
81
|
+
};
|
|
76
82
|
export declare const BLOCK_ACTIONS_MENU_SECTION: {
|
|
77
83
|
key: string;
|
|
78
84
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Placement determines where a menu item should be rendered within the block menu hierarchy
|
|
3
|
+
* - 'default': Under the TRANSFORM_CREATE_MENU_SECTION (nested within the Turn into submenu)
|
|
4
|
+
* - 'featured': Directly under TRANSFORM_MENU_SECTION as a top-level item in the Turn into submenu
|
|
5
|
+
*/
|
|
6
|
+
export type BlockMenuPlacement = 'default' | 'featured';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BLOCK_ACTIONS_MENU_SECTION, BLOCK_ACTIONS_CREATE_SYNCED_BLOCK_MENU_ITEM, BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM, DELETE_MENU_SECTION, DELETE_MENU_ITEM, POSITION_MENU_SECTION, POSITION_MOVE_UP_MENU_ITEM, POSITION_MOVE_DOWN_MENU_ITEM, TRANSFORM_MENU_SECTION, TRANSFORM_MENU_ITEM, TRANSFORM_CLEAR_MENU_SECTION, TRANSFORM_CLEAR_MENU_ITEM, TRANSFORM_CREATE_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM, TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_DECISION_MENU_ITEM, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_ITEM } from './key';
|
|
1
|
+
import { BLOCK_ACTIONS_FEATURED_EXTENSION_SLOT_MENU_ITEM, BLOCK_ACTIONS_MENU_SECTION, BLOCK_ACTIONS_CREATE_SYNCED_BLOCK_MENU_ITEM, BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM, DELETE_MENU_SECTION, DELETE_MENU_ITEM, POSITION_MENU_SECTION, POSITION_MOVE_UP_MENU_ITEM, POSITION_MOVE_DOWN_MENU_ITEM, TRANSFORM_MENU_SECTION, TRANSFORM_MENU_ITEM, TRANSFORM_CLEAR_MENU_SECTION, TRANSFORM_CLEAR_MENU_ITEM, TRANSFORM_CREATE_MENU_SECTION, TRANSFORM_HEADINGS_MENU_SECTION, TRANSFORM_HEADINGS_H1_MENU_ITEM, TRANSFORM_HEADINGS_H2_MENU_ITEM, TRANSFORM_HEADINGS_H3_MENU_ITEM, TRANSFORM_HEADINGS_H4_MENU_ITEM, TRANSFORM_HEADINGS_H5_MENU_ITEM, TRANSFORM_HEADINGS_H6_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_SECTION, TRANSFORM_STRUCTURE_MENU_SECTION, TRANSFORM_STRUCTURE_BULLETED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_TASK_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_NUMBERED_LIST_MENU_ITEM, TRANSFORM_STRUCTURE_CODE_BLOCK_MENU_ITEM, TRANSFORM_STRUCTURE_PANEL_MENU_ITEM, TRANSFORM_STRUCTURE_EXPAND_MENU_ITEM, TRANSFORM_STRUCTURE_LAYOUT_MENU_ITEM, TRANSFORM_STRUCTURE_QUOTE_MENU_ITEM, TRANSFORM_STRUCTURE_DECISION_MENU_ITEM, TRANSFORM_STRUCTURE_PARAGRAPH_MENU_ITEM, TRANSFORM_SUGGESTED_MENU_ITEM, TRANSFORM_DEFAULT_EXTENSION_SLOT_MENU_ITEM } from './key';
|
|
2
2
|
export declare const MAIN_BLOCK_MENU_SECTION_RANK: {
|
|
3
3
|
[TRANSFORM_MENU_SECTION.key]: number;
|
|
4
4
|
[BLOCK_ACTIONS_MENU_SECTION.key]: number;
|
|
@@ -18,6 +18,9 @@ export declare const TRANSFORM_MENU_ITEM_RANK: {
|
|
|
18
18
|
[TRANSFORM_HEADINGS_MENU_SECTION.key]: number;
|
|
19
19
|
[TRANSFORM_CLEAR_MENU_SECTION.key]: number;
|
|
20
20
|
};
|
|
21
|
+
export declare const TRANSFORM_CREATE_MENU_SECTION_RANK: {
|
|
22
|
+
[TRANSFORM_DEFAULT_EXTENSION_SLOT_MENU_ITEM.key]: number;
|
|
23
|
+
};
|
|
21
24
|
export declare const TRANSFORM_HEADINGS_MENU_SECTION_RANK: {
|
|
22
25
|
[TRANSFORM_HEADINGS_H1_MENU_ITEM.key]: number;
|
|
23
26
|
[TRANSFORM_HEADINGS_H2_MENU_ITEM.key]: number;
|
|
@@ -43,6 +46,7 @@ export declare const TRANSFORM_CLEAR_MENU_SECTION_RANK: {
|
|
|
43
46
|
};
|
|
44
47
|
export declare const BLOCK_ACTIONS_MENU_SECTION_RANK: {
|
|
45
48
|
[BLOCK_ACTIONS_CREATE_SYNCED_BLOCK_MENU_ITEM.key]: number;
|
|
49
|
+
[BLOCK_ACTIONS_FEATURED_EXTENSION_SLOT_MENU_ITEM.key]: number;
|
|
46
50
|
[BLOCK_ACTIONS_COPY_LINK_TO_BLOCK_MENU_ITEM.key]: number;
|
|
47
51
|
};
|
|
48
52
|
export declare const POSITION_MENU_SECTION_RANK: {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Allow any additional custom metadata to be attached to experience events.
|
|
3
3
|
*/
|
|
4
4
|
export type CustomExperienceMetadata = {
|
|
5
|
-
[key: string]: string | number | boolean | CustomExperienceMetadata | undefined;
|
|
5
|
+
[key: string]: string | number | boolean | CustomExperienceMetadata | (string | number | boolean | CustomExperienceMetadata)[] | undefined;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
8
|
* Represents the state of an experience throughout its lifecycle.
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
2
|
import type { PopupPosition as Position } from '../ui';
|
|
3
3
|
export declare const calculateToolbarPositionAboveSelection: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
4
|
+
export declare const calculateToolbarPositionTrackHeadOld: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
5
|
+
/**
|
|
6
|
+
* Same logic as calculateToolbarPositionTrackHeadOld, but with the following changes:
|
|
7
|
+
* - Uses a cached container to avoid repeated DOM traversal and getComputedStyle calls
|
|
8
|
+
* - Works when editor is nested within a fixed positioned parent, such as within a modal or sidebar
|
|
9
|
+
*/
|
|
10
|
+
export declare const calculateToolbarPositionTrackHeadNew: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
4
11
|
export declare const calculateToolbarPositionTrackHead: (toolbarTitle: string) => (editorView: EditorView, nextPos: Position) => Position;
|
|
5
12
|
export type CoordsAtPos = {
|
|
6
13
|
bottom: number;
|
|
@@ -520,6 +520,7 @@ export declare enum ACTION_SUBJECT_ID {
|
|
|
520
520
|
SYNCED_BLOCK_CREATE = "syncedBlockCreate",
|
|
521
521
|
REFERENCE_SYNCED_BLOCK_CREATE = "referenceSyncedBlockCreate",
|
|
522
522
|
SYNCED_BLOCK_DELETE = "syncedBlockDelete",
|
|
523
|
+
REFERENCE_SYNCED_BLOCK_DELETE = "referenceSyncedBlockDelete",
|
|
523
524
|
SYNCED_BLOCK_GET_SOURCE_INFO = "syncedBlockGetSourceInfo",
|
|
524
525
|
SYNCED_BLOCK_FETCH = "syncedBlockFetch",
|
|
525
526
|
TABLE_STICKY_HEADER = "tableStickyHeader"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID } from './enums';
|
|
2
|
+
import type { ExperienceEventPayload } from './experience-events';
|
|
2
3
|
import type { OperationalAEP } from './utils';
|
|
3
4
|
type SyncedBlockErrorAttributes = {
|
|
4
5
|
error: string;
|
|
@@ -11,6 +12,6 @@ export type SyncedBlockCreateErrorAEP = OperationalAEP<ACTION.ERROR, ACTION_SUBJ
|
|
|
11
12
|
export type SyncedBlockDeleteErrorAEP = OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, ACTION_SUBJECT_ID.SYNCED_BLOCK_DELETE, SyncedBlockErrorAttributes>;
|
|
12
13
|
export type SyncedBlockGetSourceInfoErrorAEP = OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, ACTION_SUBJECT_ID.SYNCED_BLOCK_GET_SOURCE_INFO, SyncedBlockErrorAttributes>;
|
|
13
14
|
export type SyncedBlockFetchErrorAEP = OperationalAEP<ACTION.ERROR, ACTION_SUBJECT.SYNCED_BLOCK, ACTION_SUBJECT_ID.SYNCED_BLOCK_FETCH, SyncedBlockErrorAttributes>;
|
|
14
|
-
export type SyncBlockEventPayload = SyncedBlockSourceURLErrorAEP | SyncedBlockUpdateCacheErrorAEP | SyncedBlockUpdateErrorAEP | SyncedBlockCreateErrorAEP | SyncedBlockDeleteErrorAEP | SyncedBlockGetSourceInfoErrorAEP | SyncedBlockFetchErrorAEP | ReferenceSyncedBlockUpdateErrorAEP;
|
|
15
|
-
export type RendererSyncBlockEventPayload = SyncedBlockGetSourceInfoErrorAEP | SyncedBlockFetchErrorAEP | ReferenceSyncedBlockUpdateErrorAEP;
|
|
15
|
+
export type SyncBlockEventPayload = SyncedBlockSourceURLErrorAEP | SyncedBlockUpdateCacheErrorAEP | SyncedBlockUpdateErrorAEP | SyncedBlockCreateErrorAEP | SyncedBlockDeleteErrorAEP | SyncedBlockGetSourceInfoErrorAEP | SyncedBlockFetchErrorAEP | ReferenceSyncedBlockUpdateErrorAEP | ExperienceEventPayload;
|
|
16
|
+
export type RendererSyncBlockEventPayload = SyncedBlockGetSourceInfoErrorAEP | SyncedBlockFetchErrorAEP | ReferenceSyncedBlockUpdateErrorAEP | ExperienceEventPayload;
|
|
16
17
|
export {};
|