@atlaskit/editor-plugin-table 23.3.0 → 23.3.1
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 +11 -0
- package/dist/cjs/nodeviews/TableContainer.js +3 -7
- package/dist/cjs/nodeviews/TableResizer.js +11 -14
- package/dist/es2019/nodeviews/TableContainer.js +3 -7
- package/dist/es2019/nodeviews/TableResizer.js +11 -14
- package/dist/esm/nodeviews/TableContainer.js +3 -7
- package/dist/esm/nodeviews/TableResizer.js +11 -14
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 23.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f7faa21a01fc7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f7faa21a01fc7) -
|
|
8
|
+
Cleanup stale feature gates and experiments now that they have shipped. The following
|
|
9
|
+
gates/experiments have been removed and their enabled paths kept as the permanent behaviour:
|
|
10
|
+
platform_editor_fix_scrolling_popup_position, platform_editor_table_resize_chromeless,
|
|
11
|
+
platform_editor_chromeless_akeditor_class, create_work_item_modernization_exp.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 23.3.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -237,7 +237,7 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
237
237
|
}
|
|
238
238
|
} else if (isCommentEditor) {
|
|
239
239
|
responsiveContainerWidth = containerWidth - _consts.TABLE_OFFSET_IN_COMMENT_EDITOR;
|
|
240
|
-
} else if (isChromelessEditor
|
|
240
|
+
} else if (isChromelessEditor) {
|
|
241
241
|
// there's no padding included in chromeless appearance, so we need to reduce table
|
|
242
242
|
// width to ensure all controls are visible.
|
|
243
243
|
// use lineLength as the value is updated by scrollbar visibility changes
|
|
@@ -252,15 +252,11 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
252
252
|
|
|
253
253
|
// Fix for HOT-119925: Ensure table width is properly constrained and responsive
|
|
254
254
|
// For wide tables, ensure they don't exceed container width and can be scrolled
|
|
255
|
-
var calculatedWidth =
|
|
256
|
-
// remove isCommentEditor check if platform_editor_table_resize_chromeless is cleaned up
|
|
257
|
-
!node.attrs.width && (((0, _expValEquals.expValEquals)('platform_editor_table_resize_chromeless', 'isEnabled', true) || (0, _expValEquals.expValEquals)('create_work_item_modernization_exp', 'isEnabled', true)) && !isFullPageAppearance || isCommentEditor) ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
255
|
+
var calculatedWidth = !node.attrs.width && !isFullPageAppearance ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
258
256
|
|
|
259
257
|
// Ensure minimum width for usability while respecting container constraints
|
|
260
258
|
var width = Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300));
|
|
261
|
-
|
|
262
|
-
// remove isCommentEditor check if platform_editor_table_resize_chromeless is cleaned up
|
|
263
|
-
var maxResizerWidth = ((0, _expValEquals.expValEquals)('platform_editor_table_resize_chromeless', 'isEnabled', true) || (0, _expValEquals.expValEquals)('create_work_item_modernization_exp', 'isEnabled', true)) && !isFullPageAppearance || isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, (0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true) ? _consts.TABLE_MAX_WIDTH : _consts.TABLE_FULL_WIDTH);
|
|
259
|
+
var maxResizerWidth = !isFullPageAppearance ? responsiveContainerWidth : Math.min(responsiveContainerWidth, (0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true) ? _consts.TABLE_MAX_WIDTH : _consts.TABLE_FULL_WIDTH);
|
|
264
260
|
return {
|
|
265
261
|
width: width,
|
|
266
262
|
maxResizerWidth: maxResizerWidth
|
|
@@ -303,9 +303,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
303
303
|
return;
|
|
304
304
|
}
|
|
305
305
|
var editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth;
|
|
306
|
-
var closestSnap =
|
|
307
|
-
// remove isCommentEditor check if platform_editor_table_resize_chromeless is cleaned up
|
|
308
|
-
(((0, _expValEquals.expValEquals)('platform_editor_table_resize_chromeless', 'isEnabled', true) || (0, _expValEquals.expValEquals)('create_work_item_modernization_exp', 'isEnabled', true)) && isFullPageAppearance || !isCommentEditor) && (0, _snapping.findClosestSnap)(newWidth, isTableScalingEnabled ? (0, _snapping.defaultTablePreserveSnappingWidths)(_snapping.PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : _snapping.defaultSnappingWidths, isTableScalingEnabled ? (0, _guidelines.defaultGuidelinesForPreserveTable)(_guidelines.PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : _guidelines.defaultGuidelines, _consts2.TABLE_HIGHLIGHT_GAP, _consts2.TABLE_HIGHLIGHT_TOLERANCE);
|
|
306
|
+
var closestSnap = isFullPageAppearance && (0, _snapping.findClosestSnap)(newWidth, isTableScalingEnabled ? (0, _snapping.defaultTablePreserveSnappingWidths)(_snapping.PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : _snapping.defaultSnappingWidths, isTableScalingEnabled ? (0, _guidelines.defaultGuidelinesForPreserveTable)(_guidelines.PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : _guidelines.defaultGuidelines, _consts2.TABLE_HIGHLIGHT_GAP, _consts2.TABLE_HIGHLIGHT_TOLERANCE);
|
|
309
307
|
closestSnap && updateActiveGuidelines(closestSnap);
|
|
310
308
|
|
|
311
309
|
// When snapping to the full width guideline, resize the table to be 1800px
|
|
@@ -316,15 +314,15 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
316
314
|
return guideline.isFullWidth;
|
|
317
315
|
})[0];
|
|
318
316
|
var isFullWidthGuidelineActive = (0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true) ? closestSnap && fullWidthGuideline && closestSnap.keys.includes(fullWidthGuideline.key) : closestSnap && closestSnap.keys.includes(fullWidthGuideline.key);
|
|
319
|
-
var tableMaxWidth =
|
|
320
|
-
var shouldUpdateWidthToWidest =
|
|
321
|
-
var previewParentWidth =
|
|
317
|
+
var tableMaxWidth = getTableMaxWidth(containerWidth, lineLength, isCommentEditor, isChromelessEditor);
|
|
318
|
+
var shouldUpdateWidthToWidest = !isFullPageAppearance ? tableMaxWidth <= newWidth : !!isTableScalingEnabled && isFullWidthGuidelineActive;
|
|
319
|
+
var previewParentWidth = !isFullPageAppearance && shouldUpdateWidthToWidest ? tableMaxWidth : newWidth;
|
|
322
320
|
(0, _scaleTable.previewScaleTable)(tableRef, {
|
|
323
321
|
node: node,
|
|
324
322
|
prevNode: node,
|
|
325
323
|
start: pos + 1,
|
|
326
324
|
parentWidth: previewParentWidth
|
|
327
|
-
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, allowFixedColumnWidthOption,
|
|
325
|
+
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, allowFixedColumnWidthOption, !isFullPageAppearance);
|
|
328
326
|
(0, _commands.chainCommands)(function (state, dispatch) {
|
|
329
327
|
return switchToCenterAlignment(pos, node, newWidth, state, dispatch);
|
|
330
328
|
}, (0, _misc.updateWidthToWidest)((0, _defineProperty2.default)({}, currentTableNodeLocalId, shouldUpdateWidthToWidest)))(state, dispatch);
|
|
@@ -343,7 +341,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
343
341
|
dispatch = editorView.dispatch;
|
|
344
342
|
var pos = getPos();
|
|
345
343
|
var currentTableNodeLocalId = (_node$attrs$localId2 = node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) !== null && _node$attrs$localId2 !== void 0 ? _node$attrs$localId2 : '';
|
|
346
|
-
var tableMaxWidth =
|
|
344
|
+
var tableMaxWidth = !isFullPageAppearance ? undefined // Table's full-width in comment appearance inherit the width of the Editor/Renderer
|
|
347
345
|
: (0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true) ? _consts.TABLE_MAX_WIDTH : _consts.TABLE_FULL_WIDTH;
|
|
348
346
|
newWidth = widthToWidest && currentTableNodeLocalId && widthToWidest[currentTableNodeLocalId] ? tableMaxWidth : newWidth;
|
|
349
347
|
var tr = state.tr.setMeta(_tableWidth.pluginKey, {
|
|
@@ -381,12 +379,11 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
381
379
|
node: newNode,
|
|
382
380
|
prevNode: node,
|
|
383
381
|
start: pos + 1,
|
|
384
|
-
// We use originalNewWidth in comment
|
|
385
|
-
// newWidth can be
|
|
382
|
+
// We use originalNewWidth in comment and chromeless editors, because
|
|
383
|
+
// newWidth can be undefined when table is resized to 'full-width'
|
|
386
384
|
// scaleTable function needs number value to work correctly.
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}, editorView.domAtPos.bind(editorView), pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent || false, (0, _expValEquals.expValEquals)('platform_editor_table_resize_chromeless', 'isEnabled', true) || (0, _expValEquals.expValEquals)('create_work_item_modernization_exp', 'isEnabled', true) ? !isFullPageAppearance : isCommentEditor)(tr);
|
|
385
|
+
parentWidth: !isFullPageAppearance ? originalNewWidth : newWidth
|
|
386
|
+
}, editorView.domAtPos.bind(editorView), pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent || false, !isFullPageAppearance)(tr);
|
|
390
387
|
|
|
391
388
|
// Ignored via go/ees005
|
|
392
389
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -422,7 +419,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
422
419
|
(_insm$session2 = _insm.insm.session) === null || _insm$session2 === void 0 || _insm$session2.endFeature('tableResize');
|
|
423
420
|
}
|
|
424
421
|
return newWidth;
|
|
425
|
-
}, [editorView, getPos, node,
|
|
422
|
+
}, [editorView, getPos, node, widthToWidest, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, pluginInjectionApi, attachAnalyticsEvent, tableRef, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage, isFullPageAppearance]);
|
|
426
423
|
var handleTableSizeChangeOnKeypress = (0, _react.useCallback)(function (step) {
|
|
427
424
|
var newWidth = width + step;
|
|
428
425
|
if (newWidth < resizerMinWidth) {
|
|
@@ -233,7 +233,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
233
233
|
}
|
|
234
234
|
} else if (isCommentEditor) {
|
|
235
235
|
responsiveContainerWidth = containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR;
|
|
236
|
-
} else if (isChromelessEditor
|
|
236
|
+
} else if (isChromelessEditor) {
|
|
237
237
|
// there's no padding included in chromeless appearance, so we need to reduce table
|
|
238
238
|
// width to ensure all controls are visible.
|
|
239
239
|
// use lineLength as the value is updated by scrollbar visibility changes
|
|
@@ -248,15 +248,11 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
248
248
|
|
|
249
249
|
// Fix for HOT-119925: Ensure table width is properly constrained and responsive
|
|
250
250
|
// For wide tables, ensure they don't exceed container width and can be scrolled
|
|
251
|
-
const calculatedWidth =
|
|
252
|
-
// remove isCommentEditor check if platform_editor_table_resize_chromeless is cleaned up
|
|
253
|
-
!node.attrs.width && ((expValEquals('platform_editor_table_resize_chromeless', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) && !isFullPageAppearance || isCommentEditor) ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
251
|
+
const calculatedWidth = !node.attrs.width && !isFullPageAppearance ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
254
252
|
|
|
255
253
|
// Ensure minimum width for usability while respecting container constraints
|
|
256
254
|
const width = Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300));
|
|
257
|
-
|
|
258
|
-
// remove isCommentEditor check if platform_editor_table_resize_chromeless is cleaned up
|
|
259
|
-
const maxResizerWidth = (expValEquals('platform_editor_table_resize_chromeless', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) && !isFullPageAppearance || isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH);
|
|
255
|
+
const maxResizerWidth = !isFullPageAppearance ? responsiveContainerWidth : Math.min(responsiveContainerWidth, expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH);
|
|
260
256
|
return {
|
|
261
257
|
width,
|
|
262
258
|
maxResizerWidth
|
|
@@ -296,9 +296,7 @@ export const TableResizer = ({
|
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
298
|
const editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth;
|
|
299
|
-
const closestSnap =
|
|
300
|
-
// remove isCommentEditor check if platform_editor_table_resize_chromeless is cleaned up
|
|
301
|
-
((expValEquals('platform_editor_table_resize_chromeless', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) && isFullPageAppearance || !isCommentEditor) && findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultSnappingWidths, isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE);
|
|
299
|
+
const closestSnap = isFullPageAppearance && findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultSnappingWidths, isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE);
|
|
302
300
|
closestSnap && updateActiveGuidelines(closestSnap);
|
|
303
301
|
|
|
304
302
|
// When snapping to the full width guideline, resize the table to be 1800px
|
|
@@ -309,15 +307,15 @@ export const TableResizer = ({
|
|
|
309
307
|
const currentTableNodeLocalId = (_node$attrs$localId = node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== null && _node$attrs$localId !== void 0 ? _node$attrs$localId : '';
|
|
310
308
|
const fullWidthGuideline = defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig).filter(guideline => guideline.isFullWidth)[0];
|
|
311
309
|
const isFullWidthGuidelineActive = expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true) ? closestSnap && fullWidthGuideline && closestSnap.keys.includes(fullWidthGuideline.key) : closestSnap && closestSnap.keys.includes(fullWidthGuideline.key);
|
|
312
|
-
const tableMaxWidth =
|
|
313
|
-
const shouldUpdateWidthToWidest =
|
|
314
|
-
const previewParentWidth =
|
|
310
|
+
const tableMaxWidth = getTableMaxWidth(containerWidth, lineLength, isCommentEditor, isChromelessEditor);
|
|
311
|
+
const shouldUpdateWidthToWidest = !isFullPageAppearance ? tableMaxWidth <= newWidth : !!isTableScalingEnabled && isFullWidthGuidelineActive;
|
|
312
|
+
const previewParentWidth = !isFullPageAppearance && shouldUpdateWidthToWidest ? tableMaxWidth : newWidth;
|
|
315
313
|
previewScaleTable(tableRef, {
|
|
316
314
|
node,
|
|
317
315
|
prevNode: node,
|
|
318
316
|
start: pos + 1,
|
|
319
317
|
parentWidth: previewParentWidth
|
|
320
|
-
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, allowFixedColumnWidthOption,
|
|
318
|
+
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, allowFixedColumnWidthOption, !isFullPageAppearance);
|
|
321
319
|
chainCommands((state, dispatch) => {
|
|
322
320
|
return switchToCenterAlignment(pos, node, newWidth, state, dispatch);
|
|
323
321
|
}, updateWidthToWidest({
|
|
@@ -338,7 +336,7 @@ export const TableResizer = ({
|
|
|
338
336
|
} = editorView;
|
|
339
337
|
const pos = getPos();
|
|
340
338
|
const currentTableNodeLocalId = (_node$attrs$localId2 = node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) !== null && _node$attrs$localId2 !== void 0 ? _node$attrs$localId2 : '';
|
|
341
|
-
const tableMaxWidth =
|
|
339
|
+
const tableMaxWidth = !isFullPageAppearance ? undefined // Table's full-width in comment appearance inherit the width of the Editor/Renderer
|
|
342
340
|
: expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH;
|
|
343
341
|
newWidth = widthToWidest && currentTableNodeLocalId && widthToWidest[currentTableNodeLocalId] ? tableMaxWidth : newWidth;
|
|
344
342
|
let tr = state.tr.setMeta(tableWidthPluginKey, {
|
|
@@ -377,12 +375,11 @@ export const TableResizer = ({
|
|
|
377
375
|
node: newNode,
|
|
378
376
|
prevNode: node,
|
|
379
377
|
start: pos + 1,
|
|
380
|
-
// We use originalNewWidth in comment
|
|
381
|
-
// newWidth can be
|
|
378
|
+
// We use originalNewWidth in comment and chromeless editors, because
|
|
379
|
+
// newWidth can be undefined when table is resized to 'full-width'
|
|
382
380
|
// scaleTable function needs number value to work correctly.
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}, editorView.domAtPos.bind(editorView), pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent || false, expValEquals('platform_editor_table_resize_chromeless', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true) ? !isFullPageAppearance : isCommentEditor)(tr);
|
|
381
|
+
parentWidth: !isFullPageAppearance ? originalNewWidth : newWidth
|
|
382
|
+
}, editorView.domAtPos.bind(editorView), pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent || false, !isFullPageAppearance)(tr);
|
|
386
383
|
|
|
387
384
|
// Ignored via go/ees005
|
|
388
385
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -418,7 +415,7 @@ export const TableResizer = ({
|
|
|
418
415
|
(_insm$session2 = insm.session) === null || _insm$session2 === void 0 ? void 0 : _insm$session2.endFeature('tableResize');
|
|
419
416
|
}
|
|
420
417
|
return newWidth;
|
|
421
|
-
}, [editorView, getPos, node,
|
|
418
|
+
}, [editorView, getPos, node, widthToWidest, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, pluginInjectionApi, attachAnalyticsEvent, tableRef, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage, isFullPageAppearance]);
|
|
422
419
|
const handleTableSizeChangeOnKeypress = useCallback(step => {
|
|
423
420
|
const newWidth = width + step;
|
|
424
421
|
if (newWidth < resizerMinWidth) {
|
|
@@ -228,7 +228,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
228
228
|
}
|
|
229
229
|
} else if (isCommentEditor) {
|
|
230
230
|
responsiveContainerWidth = containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR;
|
|
231
|
-
} else if (isChromelessEditor
|
|
231
|
+
} else if (isChromelessEditor) {
|
|
232
232
|
// there's no padding included in chromeless appearance, so we need to reduce table
|
|
233
233
|
// width to ensure all controls are visible.
|
|
234
234
|
// use lineLength as the value is updated by scrollbar visibility changes
|
|
@@ -243,15 +243,11 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
243
243
|
|
|
244
244
|
// Fix for HOT-119925: Ensure table width is properly constrained and responsive
|
|
245
245
|
// For wide tables, ensure they don't exceed container width and can be scrolled
|
|
246
|
-
var calculatedWidth =
|
|
247
|
-
// remove isCommentEditor check if platform_editor_table_resize_chromeless is cleaned up
|
|
248
|
-
!node.attrs.width && ((expValEquals('platform_editor_table_resize_chromeless', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) && !isFullPageAppearance || isCommentEditor) ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
246
|
+
var calculatedWidth = !node.attrs.width && !isFullPageAppearance ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
249
247
|
|
|
250
248
|
// Ensure minimum width for usability while respecting container constraints
|
|
251
249
|
var width = Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300));
|
|
252
|
-
|
|
253
|
-
// remove isCommentEditor check if platform_editor_table_resize_chromeless is cleaned up
|
|
254
|
-
var maxResizerWidth = (expValEquals('platform_editor_table_resize_chromeless', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) && !isFullPageAppearance || isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH);
|
|
250
|
+
var maxResizerWidth = !isFullPageAppearance ? responsiveContainerWidth : Math.min(responsiveContainerWidth, expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH);
|
|
255
251
|
return {
|
|
256
252
|
width: width,
|
|
257
253
|
maxResizerWidth: maxResizerWidth
|
|
@@ -294,9 +294,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
296
|
var editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth;
|
|
297
|
-
var closestSnap =
|
|
298
|
-
// remove isCommentEditor check if platform_editor_table_resize_chromeless is cleaned up
|
|
299
|
-
((expValEquals('platform_editor_table_resize_chromeless', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true)) && isFullPageAppearance || !isCommentEditor) && findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultSnappingWidths, isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE);
|
|
297
|
+
var closestSnap = isFullPageAppearance && findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultSnappingWidths, isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE);
|
|
300
298
|
closestSnap && updateActiveGuidelines(closestSnap);
|
|
301
299
|
|
|
302
300
|
// When snapping to the full width guideline, resize the table to be 1800px
|
|
@@ -307,15 +305,15 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
307
305
|
return guideline.isFullWidth;
|
|
308
306
|
})[0];
|
|
309
307
|
var isFullWidthGuidelineActive = expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true) ? closestSnap && fullWidthGuideline && closestSnap.keys.includes(fullWidthGuideline.key) : closestSnap && closestSnap.keys.includes(fullWidthGuideline.key);
|
|
310
|
-
var tableMaxWidth =
|
|
311
|
-
var shouldUpdateWidthToWidest =
|
|
312
|
-
var previewParentWidth =
|
|
308
|
+
var tableMaxWidth = getTableMaxWidth(containerWidth, lineLength, isCommentEditor, isChromelessEditor);
|
|
309
|
+
var shouldUpdateWidthToWidest = !isFullPageAppearance ? tableMaxWidth <= newWidth : !!isTableScalingEnabled && isFullWidthGuidelineActive;
|
|
310
|
+
var previewParentWidth = !isFullPageAppearance && shouldUpdateWidthToWidest ? tableMaxWidth : newWidth;
|
|
313
311
|
previewScaleTable(tableRef, {
|
|
314
312
|
node: node,
|
|
315
313
|
prevNode: node,
|
|
316
314
|
start: pos + 1,
|
|
317
315
|
parentWidth: previewParentWidth
|
|
318
|
-
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, allowFixedColumnWidthOption,
|
|
316
|
+
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, allowFixedColumnWidthOption, !isFullPageAppearance);
|
|
319
317
|
chainCommands(function (state, dispatch) {
|
|
320
318
|
return switchToCenterAlignment(pos, node, newWidth, state, dispatch);
|
|
321
319
|
}, updateWidthToWidest(_defineProperty({}, currentTableNodeLocalId, shouldUpdateWidthToWidest)))(state, dispatch);
|
|
@@ -334,7 +332,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
334
332
|
dispatch = editorView.dispatch;
|
|
335
333
|
var pos = getPos();
|
|
336
334
|
var currentTableNodeLocalId = (_node$attrs$localId2 = node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) !== null && _node$attrs$localId2 !== void 0 ? _node$attrs$localId2 : '';
|
|
337
|
-
var tableMaxWidth =
|
|
335
|
+
var tableMaxWidth = !isFullPageAppearance ? undefined // Table's full-width in comment appearance inherit the width of the Editor/Renderer
|
|
338
336
|
: expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH;
|
|
339
337
|
newWidth = widthToWidest && currentTableNodeLocalId && widthToWidest[currentTableNodeLocalId] ? tableMaxWidth : newWidth;
|
|
340
338
|
var tr = state.tr.setMeta(tableWidthPluginKey, {
|
|
@@ -372,12 +370,11 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
372
370
|
node: newNode,
|
|
373
371
|
prevNode: node,
|
|
374
372
|
start: pos + 1,
|
|
375
|
-
// We use originalNewWidth in comment
|
|
376
|
-
// newWidth can be
|
|
373
|
+
// We use originalNewWidth in comment and chromeless editors, because
|
|
374
|
+
// newWidth can be undefined when table is resized to 'full-width'
|
|
377
375
|
// scaleTable function needs number value to work correctly.
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
}, editorView.domAtPos.bind(editorView), pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent || false, expValEquals('platform_editor_table_resize_chromeless', 'isEnabled', true) || expValEquals('create_work_item_modernization_exp', 'isEnabled', true) ? !isFullPageAppearance : isCommentEditor)(tr);
|
|
376
|
+
parentWidth: !isFullPageAppearance ? originalNewWidth : newWidth
|
|
377
|
+
}, editorView.domAtPos.bind(editorView), pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent || false, !isFullPageAppearance)(tr);
|
|
381
378
|
|
|
382
379
|
// Ignored via go/ees005
|
|
383
380
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -413,7 +410,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
413
410
|
(_insm$session2 = insm.session) === null || _insm$session2 === void 0 || _insm$session2.endFeature('tableResize');
|
|
414
411
|
}
|
|
415
412
|
return newWidth;
|
|
416
|
-
}, [editorView, getPos, node,
|
|
413
|
+
}, [editorView, getPos, node, widthToWidest, endMeasure, displayGapCursor, displayGuideline, updateWidth, scheduleResize, onResizeStop, pluginInjectionApi, attachAnalyticsEvent, tableRef, isTableScalingEnabled, shouldUseIncreasedScalingPercent, formatMessage, isFullPageAppearance]);
|
|
417
414
|
var handleTableSizeChangeOnKeypress = useCallback(function (step) {
|
|
418
415
|
var newWidth = width + step;
|
|
419
416
|
if (newWidth < resizerMinWidth) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "23.3.
|
|
3
|
+
"version": "23.3.1",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-batch-attribute-updates": "^11.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-content-insertion": "^11.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^13.0.0",
|
|
40
|
-
"@atlaskit/editor-plugin-extension": "14.1.
|
|
40
|
+
"@atlaskit/editor-plugin-extension": "14.1.2",
|
|
41
41
|
"@atlaskit/editor-plugin-guideline": "^11.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-interaction": "^20.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-limited-mode": "^8.0.0",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
61
61
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.2.0",
|
|
62
62
|
"@atlaskit/primitives": "^19.0.0",
|
|
63
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
63
|
+
"@atlaskit/tmp-editor-statsig": "^91.0.0",
|
|
64
64
|
"@atlaskit/toggle": "^16.1.0",
|
|
65
65
|
"@atlaskit/tokens": "^13.3.0",
|
|
66
66
|
"@atlaskit/tooltip": "^22.6.0",
|