@atlaskit/editor-plugin-table 2.10.7 → 2.11.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 +41 -0
- package/dist/cjs/plugins/table/commands/misc.js +58 -5
- package/dist/cjs/plugins/table/event-handlers.js +3 -6
- package/dist/cjs/plugins/table/index.js +66 -63
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +5 -5
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +13 -19
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +18 -5
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/index.js +6 -0
- package/dist/cjs/plugins/table/pm-plugins/main.js +7 -3
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +2 -0
- package/dist/cjs/plugins/table/reducer.js +26 -2
- package/dist/cjs/plugins/table/types.js +1 -0
- package/dist/cjs/plugins/table/ui/ColumnResizeWidget/index.js +44 -0
- package/dist/cjs/plugins/table/ui/messages.js +5 -0
- package/dist/cjs/plugins/table/utils/decoration.js +17 -4
- package/dist/es2019/plugins/table/commands/misc.js +49 -5
- package/dist/es2019/plugins/table/event-handlers.js +3 -6
- package/dist/es2019/plugins/table/index.js +14 -10
- package/dist/es2019/plugins/table/nodeviews/TableContainer.js +5 -5
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +14 -17
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-resizing.js +12 -2
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/index.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/main.js +6 -3
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +2 -0
- package/dist/es2019/plugins/table/reducer.js +29 -2
- package/dist/es2019/plugins/table/types.js +1 -0
- package/dist/es2019/plugins/table/ui/ColumnResizeWidget/index.js +35 -0
- package/dist/es2019/plugins/table/ui/messages.js +5 -0
- package/dist/es2019/plugins/table/utils/decoration.js +16 -5
- package/dist/esm/plugins/table/commands/misc.js +56 -5
- package/dist/esm/plugins/table/event-handlers.js +3 -6
- package/dist/esm/plugins/table/index.js +66 -63
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +5 -5
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +13 -19
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-resizing.js +15 -3
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/index.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/main.js +8 -4
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +2 -0
- package/dist/esm/plugins/table/reducer.js +26 -2
- package/dist/esm/plugins/table/types.js +1 -0
- package/dist/esm/plugins/table/ui/ColumnResizeWidget/index.js +35 -0
- package/dist/esm/plugins/table/ui/messages.js +5 -0
- package/dist/esm/plugins/table/utils/decoration.js +17 -4
- package/dist/types/plugins/table/commands/misc.d.ts +8 -6
- package/dist/types/plugins/table/event-handlers.d.ts +3 -3
- package/dist/types/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +4 -2
- package/dist/types/plugins/table/pm-plugins/decorations/utils/index.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/main.d.ts +2 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/plugin.d.ts +2 -2
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -3
- package/dist/types/plugins/table/reducer.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +18 -0
- package/dist/types/plugins/table/ui/ColumnResizeWidget/index.d.ts +9 -0
- package/dist/types/plugins/table/ui/messages.d.ts +5 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +8 -6
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +3 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +4 -2
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -3
- package/dist/types-ts4.5/plugins/table/reducer.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +18 -0
- package/dist/types-ts4.5/plugins/table/ui/ColumnResizeWidget/index.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +2 -1
- package/package.json +4 -4
- package/src/__tests__/unit/event-handlers.ts +1 -1
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +6 -8
- package/src/__tests__/unit/nodeviews/TableContainer.tsx +22 -15
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +2 -0
- package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +9 -10
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +9 -9
- package/src/plugins/table/commands/misc.ts +84 -7
- package/src/plugins/table/event-handlers.ts +11 -16
- package/src/plugins/table/index.tsx +6 -4
- package/src/plugins/table/nodeviews/TableContainer.tsx +4 -4
- package/src/plugins/table/nodeviews/TableResizer.tsx +12 -20
- package/src/plugins/table/pm-plugins/decorations/utils/column-resizing.ts +34 -7
- package/src/plugins/table/pm-plugins/decorations/utils/index.ts +4 -1
- package/src/plugins/table/pm-plugins/main.ts +7 -1
- package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +5 -0
- package/src/plugins/table/pm-plugins/table-resizing/plugin.ts +3 -5
- package/src/plugins/table/pm-plugins/table-resizing/utils/scale-table.ts +5 -3
- package/src/plugins/table/reducer.ts +51 -3
- package/src/plugins/table/types.ts +19 -0
- package/src/plugins/table/ui/ColumnResizeWidget/index.tsx +53 -0
- package/src/plugins/table/ui/messages.ts +5 -0
- package/src/plugins/table/utils/decoration.ts +27 -5
- package/tmp/api-report-tmp.d.ts +111 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 2.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`b08849ad727`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b08849ad727) - [ux] Added tooltip to table column resize handles, also added a tooltip to the custom table width table resizer handle
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`8b78535f8bd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8b78535f8bd) - Fix sticky header not resize with table
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 2.10.8
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`8467bdcdf4f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8467bdcdf4f) - Removing `dependencies` prop from PluginInjectionAPI and changing
|
|
19
|
+
signature of `NextEditorPlugin`.
|
|
20
|
+
|
|
21
|
+
Previously a `NextEditorPlugin` would be consumed as so:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
const plugin: NextEditorPlugin< ... > = (config, api) => {
|
|
25
|
+
// Can use api like so:
|
|
26
|
+
api.dependencies.core.actions.execute( ... )
|
|
27
|
+
return { ... }
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Now these have become named parameters like so and the `pluginInjectionAPI` is used
|
|
32
|
+
without the `dependencies` prop:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const plugin: NextEditorPlugin< ... > = ({ config, api }) => {
|
|
36
|
+
// Can use api like so:
|
|
37
|
+
api.core.actions.execute( ... )
|
|
38
|
+
return { ... }
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- Updated dependencies
|
|
43
|
+
|
|
3
44
|
## 2.10.7
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.triggerUnlessTableHeader = exports.transformSliceToRemoveColumnsWidths = exports.transformSliceToAddTableHeaders = exports.transformSliceRemoveCellBackgroundColor = exports.showInsertRowButton = exports.showInsertColumnButton = exports.setTableRef = exports.setMultipleCellAttrs = exports.setEditorFocus = exports.setCellAttr = exports.selectRow = exports.selectColumn = exports.moveCursorBackward = exports.hideInsertColumnOrRowButton = exports.deleteTableIfSelected = exports.deleteTable = exports.convertFirstRowToHeader = exports.autoSizeTable = exports.addResizeHandleDecorations = exports.addBoldInEmptyHeaderCells = void 0;
|
|
7
|
+
exports.updateResizeHandleDecorations = exports.triggerUnlessTableHeader = exports.transformSliceToRemoveColumnsWidths = exports.transformSliceToAddTableHeaders = exports.transformSliceRemoveCellBackgroundColor = exports.showInsertRowButton = exports.showInsertColumnButton = exports.setTableRef = exports.setMultipleCellAttrs = exports.setEditorFocus = exports.setCellAttr = exports.selectRow = exports.selectColumn = exports.removeResizeHandleDecorations = exports.moveCursorBackward = exports.hideInsertColumnOrRowButton = exports.deleteTableIfSelected = exports.deleteTable = exports.convertFirstRowToHeader = exports.autoSizeTable = exports.addResizeHandleDecorations = exports.addBoldInEmptyHeaderCells = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
@@ -357,23 +357,25 @@ var hideInsertColumnOrRowButton = function hideInsertColumnOrRowButton() {
|
|
|
357
357
|
});
|
|
358
358
|
};
|
|
359
359
|
exports.hideInsertColumnOrRowButton = hideInsertColumnOrRowButton;
|
|
360
|
-
var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex) {
|
|
360
|
+
var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip) {
|
|
361
361
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
362
362
|
var tableNode = (0, _utils2.findTable)(state.selection);
|
|
363
363
|
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
364
|
-
allowColumnResizing = _getPluginState.pluginConfig.allowColumnResizing
|
|
364
|
+
allowColumnResizing = _getPluginState.pluginConfig.allowColumnResizing,
|
|
365
|
+
getIntl = _getPluginState.getIntl;
|
|
365
366
|
if (!tableNode || !allowColumnResizing) {
|
|
366
367
|
return false;
|
|
367
368
|
}
|
|
368
369
|
return {
|
|
369
370
|
type: 'ADD_RESIZE_HANDLE_DECORATIONS',
|
|
370
371
|
data: {
|
|
371
|
-
decorationSet: (0, _utils3.buildColumnResizingDecorations)(rowIndex, columnIndex)({
|
|
372
|
+
decorationSet: (0, _utils3.buildColumnResizingDecorations)(rowIndex, columnIndex, includeTooltip, getIntl)({
|
|
372
373
|
tr: state.tr,
|
|
373
374
|
decorationSet: (0, _plugin.getDecorations)(state)
|
|
374
375
|
}),
|
|
375
376
|
resizeHandleRowIndex: rowIndex,
|
|
376
|
-
resizeHandleColumnIndex: columnIndex
|
|
377
|
+
resizeHandleColumnIndex: columnIndex,
|
|
378
|
+
resizeHandleIncludeTooltip: includeTooltip
|
|
377
379
|
}
|
|
378
380
|
};
|
|
379
381
|
}, function (tr) {
|
|
@@ -381,6 +383,57 @@ var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, c
|
|
|
381
383
|
});
|
|
382
384
|
};
|
|
383
385
|
exports.addResizeHandleDecorations = addResizeHandleDecorations;
|
|
386
|
+
var updateResizeHandleDecorations = function updateResizeHandleDecorations(rowIndex, columnIndex, includeTooltip) {
|
|
387
|
+
return (0, _pluginFactory.createCommand)(function (state) {
|
|
388
|
+
var tableNode = (0, _utils2.findTable)(state.selection);
|
|
389
|
+
var _getPluginState2 = (0, _pluginFactory.getPluginState)(state),
|
|
390
|
+
resizeHandleRowIndex = _getPluginState2.resizeHandleRowIndex,
|
|
391
|
+
resizeHandleColumnIndex = _getPluginState2.resizeHandleColumnIndex,
|
|
392
|
+
resizeHandleIncludeTooltip = _getPluginState2.resizeHandleIncludeTooltip,
|
|
393
|
+
allowColumnResizing = _getPluginState2.pluginConfig.allowColumnResizing,
|
|
394
|
+
getIntl = _getPluginState2.getIntl;
|
|
395
|
+
if (!tableNode || !allowColumnResizing) {
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
var resolvedRowIndex = rowIndex !== null && rowIndex !== void 0 ? rowIndex : resizeHandleRowIndex;
|
|
399
|
+
var resolvedColumnIndex = columnIndex !== null && columnIndex !== void 0 ? columnIndex : resizeHandleColumnIndex;
|
|
400
|
+
var resolvedIncludeTooltip = includeTooltip !== null && includeTooltip !== void 0 ? includeTooltip : resizeHandleIncludeTooltip;
|
|
401
|
+
if (resolvedRowIndex === undefined || resolvedColumnIndex === undefined || resolvedIncludeTooltip === undefined) {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
return {
|
|
405
|
+
type: 'UPDATE_RESIZE_HANDLE_DECORATIONS',
|
|
406
|
+
data: {
|
|
407
|
+
decorationSet: (0, _utils3.buildColumnResizingDecorations)(resolvedRowIndex, resolvedColumnIndex, resolvedIncludeTooltip, getIntl)({
|
|
408
|
+
tr: state.tr,
|
|
409
|
+
decorationSet: (0, _plugin.getDecorations)(state)
|
|
410
|
+
}),
|
|
411
|
+
resizeHandleRowIndex: rowIndex,
|
|
412
|
+
resizeHandleColumnIndex: columnIndex,
|
|
413
|
+
resizeHandleIncludeTooltip: includeTooltip
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
}, function (tr) {
|
|
417
|
+
return tr.setMeta('addToHistory', false);
|
|
418
|
+
});
|
|
419
|
+
};
|
|
420
|
+
exports.updateResizeHandleDecorations = updateResizeHandleDecorations;
|
|
421
|
+
var removeResizeHandleDecorations = function removeResizeHandleDecorations() {
|
|
422
|
+
return (0, _pluginFactory.createCommand)(function (state) {
|
|
423
|
+
return {
|
|
424
|
+
type: 'REMOVE_RESIZE_HANDLE_DECORATIONS',
|
|
425
|
+
data: {
|
|
426
|
+
decorationSet: (0, _utils3.clearColumnResizingDecorations)()({
|
|
427
|
+
tr: state.tr,
|
|
428
|
+
decorationSet: (0, _plugin.getDecorations)(state)
|
|
429
|
+
})
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
}, function (tr) {
|
|
433
|
+
return tr.setMeta('addToHistory', false);
|
|
434
|
+
});
|
|
435
|
+
};
|
|
436
|
+
exports.removeResizeHandleDecorations = removeResizeHandleDecorations;
|
|
384
437
|
var autoSizeTable = function autoSizeTable(view, node, table, basePos, opts) {
|
|
385
438
|
if (typeof basePos !== 'number') {
|
|
386
439
|
return false;
|
|
@@ -241,7 +241,7 @@ var handleMouseMove = function handleMouseMove(view, event, elementContentRects)
|
|
|
241
241
|
target: element,
|
|
242
242
|
columnEndIndexTarget: columnEndIndexTarget
|
|
243
243
|
})) {
|
|
244
|
-
return (0, _commands.addResizeHandleDecorations)(rowIndexTarget, columnEndIndexTarget)(_state4, _dispatch5);
|
|
244
|
+
return (0, _commands.addResizeHandleDecorations)(rowIndexTarget, columnEndIndexTarget, true)(_state4, _dispatch5);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
}
|
|
@@ -321,11 +321,8 @@ var handleCut = function handleCut(oldTr, oldState, newState, editorAnalyticsAPI
|
|
|
321
321
|
exports.handleCut = handleCut;
|
|
322
322
|
var whenTableInFocus = function whenTableInFocus(eventHandler, elementContentRects) {
|
|
323
323
|
return function (view, mouseEvent) {
|
|
324
|
-
var
|
|
325
|
-
|
|
326
|
-
var isDragging = tableResizePluginState && !!tableResizePluginState.dragging;
|
|
327
|
-
var hasTableNode = tablePluginState && tablePluginState.tableNode;
|
|
328
|
-
if (!hasTableNode || isDragging) {
|
|
324
|
+
var _getPluginState7, _getResizePluginState;
|
|
325
|
+
if (!((_getPluginState7 = (0, _pluginFactory.getPluginState)(view.state)) !== null && _getPluginState7 !== void 0 && _getPluginState7.tableNode) || !!((_getResizePluginState = (0, _pluginFactory2.getPluginState)(view.state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging)) {
|
|
329
326
|
return false;
|
|
330
327
|
}
|
|
331
328
|
return eventHandler(view, mouseEvent, elementContentRects);
|
|
@@ -38,29 +38,31 @@ var _utils3 = require("./utils");
|
|
|
38
38
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
39
39
|
return {};
|
|
40
40
|
};
|
|
41
|
-
var tablesPlugin = function tablesPlugin(
|
|
42
|
-
var _api$
|
|
41
|
+
var tablesPlugin = function tablesPlugin(_ref) {
|
|
42
|
+
var _api$analytics;
|
|
43
|
+
var options = _ref.config,
|
|
44
|
+
api = _ref.api;
|
|
43
45
|
var editorViewRef = {
|
|
44
46
|
current: null
|
|
45
47
|
};
|
|
46
48
|
var defaultGetEditorContainerWidth = function defaultGetEditorContainerWidth() {
|
|
47
|
-
var _document$body$offset, _document, _document$body, _api$
|
|
49
|
+
var _document$body$offset, _document, _document$body, _api$width$sharedStat;
|
|
48
50
|
var defaultState = {
|
|
49
51
|
width: (_document$body$offset = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) !== null && _document$body$offset !== void 0 ? _document$body$offset : 500
|
|
50
52
|
};
|
|
51
|
-
return (_api$
|
|
53
|
+
return (_api$width$sharedStat = api === null || api === void 0 ? void 0 : api.width.sharedState.currentState()) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : defaultState;
|
|
52
54
|
};
|
|
53
|
-
var editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$
|
|
55
|
+
var editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
54
56
|
return {
|
|
55
57
|
name: 'table',
|
|
56
58
|
actions: {
|
|
57
59
|
insertTable: function insertTable(analyticsPayload) {
|
|
58
60
|
return function (state, dispatch) {
|
|
59
|
-
var _api$
|
|
61
|
+
var _api$contentInsertion, _api$contentInsertion2, _api$contentInsertion3;
|
|
60
62
|
var node = (0, _utils2.createTable)({
|
|
61
63
|
schema: state.schema
|
|
62
64
|
});
|
|
63
|
-
return (_api$
|
|
65
|
+
return (_api$contentInsertion = api === null || api === void 0 ? void 0 : (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 ? void 0 : (_api$contentInsertion3 = _api$contentInsertion2.actions) === null || _api$contentInsertion3 === void 0 ? void 0 : _api$contentInsertion3.insert({
|
|
64
66
|
state: state,
|
|
65
67
|
dispatch: dispatch,
|
|
66
68
|
node: node,
|
|
@@ -68,7 +70,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
68
70
|
selectNodeInserted: false,
|
|
69
71
|
analyticsPayload: analyticsPayload
|
|
70
72
|
}
|
|
71
|
-
})) !== null && _api$
|
|
73
|
+
})) !== null && _api$contentInsertion !== void 0 ? _api$contentInsertion : false;
|
|
72
74
|
};
|
|
73
75
|
}
|
|
74
76
|
},
|
|
@@ -91,28 +93,29 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
91
93
|
pmPlugins: function pmPlugins() {
|
|
92
94
|
var plugins = [{
|
|
93
95
|
name: 'table',
|
|
94
|
-
plugin: function plugin(
|
|
95
|
-
var dispatchAnalyticsEvent =
|
|
96
|
-
dispatch =
|
|
97
|
-
portalProviderAPI =
|
|
98
|
-
eventDispatcher =
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
96
|
+
plugin: function plugin(_ref2) {
|
|
97
|
+
var dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
98
|
+
dispatch = _ref2.dispatch,
|
|
99
|
+
portalProviderAPI = _ref2.portalProviderAPI,
|
|
100
|
+
eventDispatcher = _ref2.eventDispatcher,
|
|
101
|
+
getIntl = _ref2.getIntl;
|
|
102
|
+
var _ref3 = options || {},
|
|
103
|
+
fullWidthEnabled = _ref3.fullWidthEnabled,
|
|
104
|
+
wasFullWidthEnabled = _ref3.wasFullWidthEnabled,
|
|
105
|
+
tableResizingEnabled = _ref3.tableResizingEnabled,
|
|
106
|
+
breakoutEnabled = _ref3.breakoutEnabled,
|
|
107
|
+
tableOptions = _ref3.tableOptions,
|
|
108
|
+
getEditorFeatureFlags = _ref3.getEditorFeatureFlags;
|
|
109
|
+
return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api);
|
|
107
110
|
}
|
|
108
111
|
}, {
|
|
109
112
|
name: 'tablePMColResizing',
|
|
110
|
-
plugin: function plugin(
|
|
111
|
-
var dispatch =
|
|
112
|
-
var
|
|
113
|
-
fullWidthEnabled =
|
|
114
|
-
tableOptions =
|
|
115
|
-
getEditorFeatureFlags =
|
|
113
|
+
plugin: function plugin(_ref4) {
|
|
114
|
+
var dispatch = _ref4.dispatch;
|
|
115
|
+
var _ref5 = options || {},
|
|
116
|
+
fullWidthEnabled = _ref5.fullWidthEnabled,
|
|
117
|
+
tableOptions = _ref5.tableOptions,
|
|
118
|
+
getEditorFeatureFlags = _ref5.getEditorFeatureFlags;
|
|
116
119
|
var _pluginConfig = (0, _createPluginConfig.pluginConfig)(tableOptions),
|
|
117
120
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
118
121
|
return allowColumnResizing ? (0, _tableResizing.createPlugin)(dispatch, {
|
|
@@ -141,9 +144,9 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
141
144
|
name: 'tableEditing',
|
|
142
145
|
plugin: function plugin() {
|
|
143
146
|
return (0, _pmPlugins.tableEditing)({
|
|
144
|
-
reportFixedTable: function reportFixedTable(
|
|
145
|
-
var tr =
|
|
146
|
-
reason =
|
|
147
|
+
reportFixedTable: function reportFixedTable(_ref6) {
|
|
148
|
+
var tr = _ref6.tr,
|
|
149
|
+
reason = _ref6.reason;
|
|
147
150
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
148
151
|
action: _analytics.TABLE_ACTION.FIXED,
|
|
149
152
|
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
@@ -158,24 +161,24 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
158
161
|
}
|
|
159
162
|
}, {
|
|
160
163
|
name: 'tableStickyHeaders',
|
|
161
|
-
plugin: function plugin(
|
|
162
|
-
var dispatch =
|
|
163
|
-
eventDispatcher =
|
|
164
|
+
plugin: function plugin(_ref7) {
|
|
165
|
+
var dispatch = _ref7.dispatch,
|
|
166
|
+
eventDispatcher = _ref7.eventDispatcher;
|
|
164
167
|
return options && options.tableOptions.stickyHeaders ? (0, _stickyHeaders.createPlugin)(dispatch, eventDispatcher, function () {
|
|
165
168
|
return [];
|
|
166
169
|
}, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined;
|
|
167
170
|
}
|
|
168
171
|
}, {
|
|
169
172
|
name: 'tableLocalId',
|
|
170
|
-
plugin: function plugin(
|
|
171
|
-
var dispatch =
|
|
173
|
+
plugin: function plugin(_ref8) {
|
|
174
|
+
var dispatch = _ref8.dispatch;
|
|
172
175
|
return (0, _tableLocalId.createPlugin)(dispatch);
|
|
173
176
|
}
|
|
174
177
|
}, {
|
|
175
178
|
name: 'tableWidth',
|
|
176
|
-
plugin: function plugin(
|
|
179
|
+
plugin: function plugin(_ref9) {
|
|
177
180
|
var _options$fullWidthEna;
|
|
178
|
-
var dispatch =
|
|
181
|
+
var dispatch = _ref9.dispatch;
|
|
179
182
|
return options !== null && options !== void 0 && options.tableResizingEnabled ? (0, _tableWidth.createPlugin)(dispatch, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
|
|
180
183
|
}
|
|
181
184
|
}, {
|
|
@@ -206,12 +209,12 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
206
209
|
}
|
|
207
210
|
return plugins;
|
|
208
211
|
},
|
|
209
|
-
contentComponent: function contentComponent(
|
|
210
|
-
var editorView =
|
|
211
|
-
popupsMountPoint =
|
|
212
|
-
popupsBoundariesElement =
|
|
213
|
-
popupsScrollableElement =
|
|
214
|
-
dispatchAnalyticsEvent =
|
|
212
|
+
contentComponent: function contentComponent(_ref10) {
|
|
213
|
+
var editorView = _ref10.editorView,
|
|
214
|
+
popupsMountPoint = _ref10.popupsMountPoint,
|
|
215
|
+
popupsBoundariesElement = _ref10.popupsBoundariesElement,
|
|
216
|
+
popupsScrollableElement = _ref10.popupsScrollableElement,
|
|
217
|
+
dispatchAnalyticsEvent = _ref10.dispatchAnalyticsEvent;
|
|
215
218
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
216
219
|
component: _analytics.ACTION_SUBJECT.TABLES_PLUGIN,
|
|
217
220
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -223,28 +226,28 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
223
226
|
tableResizingPluginState: _tableResizing.pluginKey,
|
|
224
227
|
stickyHeadersState: _stickyHeaders.pluginKey
|
|
225
228
|
},
|
|
226
|
-
render: function render(
|
|
227
|
-
var resizingPluginState =
|
|
228
|
-
stickyHeadersState =
|
|
229
|
-
tablePluginState =
|
|
230
|
-
tableWidthPluginState =
|
|
229
|
+
render: function render(_ref11) {
|
|
230
|
+
var resizingPluginState = _ref11.tableResizingPluginState,
|
|
231
|
+
stickyHeadersState = _ref11.stickyHeadersState,
|
|
232
|
+
tablePluginState = _ref11.tablePluginState,
|
|
233
|
+
tableWidthPluginState = _ref11.tableWidthPluginState;
|
|
231
234
|
var state = editorView.state;
|
|
232
235
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
233
236
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
234
237
|
var isResizing = isColumnResizing || isTableResizing;
|
|
235
|
-
var
|
|
236
|
-
tableNode =
|
|
237
|
-
tablePos =
|
|
238
|
-
targetCellPosition =
|
|
239
|
-
isContextualMenuOpen =
|
|
240
|
-
layout =
|
|
241
|
-
tableRef =
|
|
242
|
-
pluginConfig =
|
|
243
|
-
insertColumnButtonIndex =
|
|
244
|
-
insertRowButtonIndex =
|
|
245
|
-
isHeaderColumnEnabled =
|
|
246
|
-
isHeaderRowEnabled =
|
|
247
|
-
tableWrapperTarget =
|
|
238
|
+
var _ref12 = tablePluginState,
|
|
239
|
+
tableNode = _ref12.tableNode,
|
|
240
|
+
tablePos = _ref12.tablePos,
|
|
241
|
+
targetCellPosition = _ref12.targetCellPosition,
|
|
242
|
+
isContextualMenuOpen = _ref12.isContextualMenuOpen,
|
|
243
|
+
layout = _ref12.layout,
|
|
244
|
+
tableRef = _ref12.tableRef,
|
|
245
|
+
pluginConfig = _ref12.pluginConfig,
|
|
246
|
+
insertColumnButtonIndex = _ref12.insertColumnButtonIndex,
|
|
247
|
+
insertRowButtonIndex = _ref12.insertRowButtonIndex,
|
|
248
|
+
isHeaderColumnEnabled = _ref12.isHeaderColumnEnabled,
|
|
249
|
+
isHeaderRowEnabled = _ref12.isHeaderRowEnabled,
|
|
250
|
+
tableWrapperTarget = _ref12.tableWrapperTarget;
|
|
248
251
|
var allowControls = pluginConfig.allowControls;
|
|
249
252
|
var stickyHeader = stickyHeadersState ? (0, _stickyHeaders.findStickyHeaderForTable)(stickyHeadersState, tablePos) : undefined;
|
|
250
253
|
var LayoutContent = options && !options.tableResizingEnabled && (0, _utils3.isLayoutSupported)(state) && options.breakoutEnabled ? /*#__PURE__*/_react.default.createElement(_LayoutButton.default, {
|
|
@@ -310,8 +313,8 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
310
313
|
}));
|
|
311
314
|
},
|
|
312
315
|
pluginsOptions: {
|
|
313
|
-
quickInsert: function quickInsert(
|
|
314
|
-
var formatMessage =
|
|
316
|
+
quickInsert: function quickInsert(_ref13) {
|
|
317
|
+
var formatMessage = _ref13.formatMessage;
|
|
315
318
|
return [{
|
|
316
319
|
id: 'table',
|
|
317
320
|
title: formatMessage(_messages.toolbarInsertBlockMessages.table),
|
|
@@ -76,14 +76,14 @@ var ResizableTableContainer = function ResizableTableContainer(_ref2) {
|
|
|
76
76
|
}
|
|
77
77
|
}, [lineLength]);
|
|
78
78
|
var displayGuideline = (0, _react.useCallback)(function (guidelines) {
|
|
79
|
-
var _pluginInjectionApi$
|
|
80
|
-
return (_pluginInjectionApi$
|
|
79
|
+
var _pluginInjectionApi$g, _pluginInjectionApi$g2, _pluginInjectionApi$g3;
|
|
80
|
+
return (_pluginInjectionApi$g = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$g2 = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g2 === void 0 ? void 0 : (_pluginInjectionApi$g3 = _pluginInjectionApi$g2.actions) === null || _pluginInjectionApi$g3 === void 0 ? void 0 : _pluginInjectionApi$g3.displayGuideline(editorView)({
|
|
81
81
|
guidelines: guidelines
|
|
82
|
-
})) !== null && _pluginInjectionApi$
|
|
82
|
+
})) !== null && _pluginInjectionApi$g !== void 0 ? _pluginInjectionApi$g : false;
|
|
83
83
|
}, [pluginInjectionApi, editorView]);
|
|
84
84
|
var attachAnalyticsEvent = (0, _react.useCallback)(function (payload) {
|
|
85
|
-
var _pluginInjectionApi$
|
|
86
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
85
|
+
var _pluginInjectionApi$a;
|
|
86
|
+
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.attachAnalyticsEvent(payload);
|
|
87
87
|
}, [pluginInjectionApi]);
|
|
88
88
|
var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
89
89
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
@@ -10,9 +10,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
13
|
+
var _reactIntlNext = require("react-intl-next");
|
|
13
14
|
var _guideline = require("@atlaskit/editor-common/guideline");
|
|
14
15
|
var _resizer = require("@atlaskit/editor-common/resizer");
|
|
15
|
-
var _styles = require("@atlaskit/editor-common/styles");
|
|
16
16
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
17
17
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
18
18
|
var _utils2 = require("../pm-plugins/table-resizing/utils");
|
|
@@ -25,6 +25,13 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
25
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
26
26
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
27
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
28
|
+
var messages = (0, _reactIntlNext.defineMessages)({
|
|
29
|
+
resizeTable: {
|
|
30
|
+
id: 'fabric.editor.tables.resizeTable',
|
|
31
|
+
defaultMessage: 'Resize table',
|
|
32
|
+
description: 'Tooltip displayed on custom table width resize hande'
|
|
33
|
+
}
|
|
34
|
+
});
|
|
28
35
|
var handles = {
|
|
29
36
|
right: true
|
|
30
37
|
};
|
|
@@ -89,6 +96,8 @@ var TableResizer = function TableResizer(_ref) {
|
|
|
89
96
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
90
97
|
snappingEnabled = _useState2[0],
|
|
91
98
|
setSnappingEnabled = _useState2[1];
|
|
99
|
+
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
100
|
+
formatMessage = _useIntl.formatMessage;
|
|
92
101
|
var resizerMinWidth = getResizerMinWidth(node);
|
|
93
102
|
var handleHeightSize = getResizerHandleHeight(tableRef);
|
|
94
103
|
var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
@@ -187,22 +196,6 @@ var TableResizer = function TableResizer(_ref) {
|
|
|
187
196
|
scheduleResize.cancel();
|
|
188
197
|
return newWidth;
|
|
189
198
|
}, [updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure]);
|
|
190
|
-
var handleComponent = (0, _react.useMemo)(function () {
|
|
191
|
-
return {
|
|
192
|
-
left: /*#__PURE__*/_react.default.createElement("div", {
|
|
193
|
-
className: _styles.resizerHandleShadowClassName,
|
|
194
|
-
style: {
|
|
195
|
-
height: 'calc(100% - 24px)'
|
|
196
|
-
}
|
|
197
|
-
}),
|
|
198
|
-
right: /*#__PURE__*/_react.default.createElement("div", {
|
|
199
|
-
className: _styles.resizerHandleShadowClassName,
|
|
200
|
-
style: {
|
|
201
|
-
height: 'calc(100% - 24px)'
|
|
202
|
-
}
|
|
203
|
-
})
|
|
204
|
-
};
|
|
205
|
-
}, []);
|
|
206
199
|
return /*#__PURE__*/_react.default.createElement(_resizer.ResizerNext, {
|
|
207
200
|
enable: handles,
|
|
208
201
|
width: width,
|
|
@@ -220,8 +213,9 @@ var TableResizer = function TableResizer(_ref) {
|
|
|
220
213
|
handlePositioning: "adjacent",
|
|
221
214
|
innerPadding: tableHandlePosition,
|
|
222
215
|
isHandleVisible: ((_findTable = (0, _utils.findTable)((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos(),
|
|
223
|
-
|
|
224
|
-
|
|
216
|
+
appearance: isInDanger ? 'danger' : undefined,
|
|
217
|
+
handleHighlight: "shadow",
|
|
218
|
+
handleTooltipContent: formatMessage(messages.resizeTable)
|
|
225
219
|
}, children);
|
|
226
220
|
};
|
|
227
221
|
exports.TableResizer = TableResizer;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.buildColumnResizingDecorations = void 0;
|
|
7
|
+
exports.clearColumnResizingDecorations = exports.buildColumnResizingDecorations = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _types = require("../../../types");
|
|
10
10
|
var _decoration = require("../../../utils/decoration");
|
|
@@ -14,7 +14,7 @@ var updateColumnResizeHandle = function updateColumnResizeHandle(columnResizesDe
|
|
|
14
14
|
return function (_ref) {
|
|
15
15
|
var decorationSet = _ref.decorationSet,
|
|
16
16
|
tr = _ref.tr;
|
|
17
|
-
return (0, _decoration.updateDecorations)(tr.doc, decorationSet, columnResizesDecorations, _types.TableDecorations.
|
|
17
|
+
return (0, _decoration.updateDecorations)(tr.doc, decorationSet, columnResizesDecorations, _types.TableDecorations.COLUMN_RESIZING_HANDLE_WIDGET);
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
var updateLastCellElement = function updateLastCellElement(lastCellElementsDecorations) {
|
|
@@ -24,13 +24,13 @@ var updateLastCellElement = function updateLastCellElement(lastCellElementsDecor
|
|
|
24
24
|
return (0, _decoration.updateDecorations)(tr.doc, decorationSet, lastCellElementsDecorations, _types.TableDecorations.LAST_CELL_ELEMENT);
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
var buildColumnResizingDecorations = function buildColumnResizingDecorations(rowEndIndex, columnEndIndex) {
|
|
27
|
+
var buildColumnResizingDecorations = function buildColumnResizingDecorations(rowEndIndex, columnEndIndex, includeTooltip, getIntl) {
|
|
28
28
|
return function (_ref3) {
|
|
29
29
|
var tr = _ref3.tr,
|
|
30
30
|
decorationSet = _ref3.decorationSet;
|
|
31
31
|
var _ref4 = columnEndIndex < 0 ? emptyDecorations : (0, _decoration.createResizeHandleDecoration)(tr, rowEndIndex, {
|
|
32
32
|
right: columnEndIndex
|
|
33
|
-
}),
|
|
33
|
+
}, includeTooltip, getIntl),
|
|
34
34
|
_ref5 = (0, _slicedToArray2.default)(_ref4, 2),
|
|
35
35
|
columnResizesDecorations = _ref5[0],
|
|
36
36
|
lastCellElementsDecorations = _ref5[1];
|
|
@@ -40,4 +40,17 @@ var buildColumnResizingDecorations = function buildColumnResizingDecorations(row
|
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
|
-
exports.buildColumnResizingDecorations = buildColumnResizingDecorations;
|
|
43
|
+
exports.buildColumnResizingDecorations = buildColumnResizingDecorations;
|
|
44
|
+
var clearColumnResizingDecorations = function clearColumnResizingDecorations() {
|
|
45
|
+
return function (_ref6) {
|
|
46
|
+
var tr = _ref6.tr,
|
|
47
|
+
decorationSet = _ref6.decorationSet;
|
|
48
|
+
var columnResizesDecorations = emptyDecorations[0],
|
|
49
|
+
lastCellElementsDecorations = emptyDecorations[1];
|
|
50
|
+
return (0, _composeDecorations.composeDecorations)([updateColumnResizeHandle(columnResizesDecorations), updateLastCellElement(lastCellElementsDecorations)])({
|
|
51
|
+
decorationSet: decorationSet,
|
|
52
|
+
tr: tr
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
exports.clearColumnResizingDecorations = clearColumnResizingDecorations;
|
|
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "buildColumnResizingDecorations", {
|
|
|
15
15
|
return _columnResizing.buildColumnResizingDecorations;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "clearColumnResizingDecorations", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _columnResizing.clearColumnResizingDecorations;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "composeDecorations", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function get() {
|
|
@@ -33,20 +33,22 @@ var isBreakoutEnabled;
|
|
|
33
33
|
var isFullWidthModeEnabled;
|
|
34
34
|
var wasFullWidthModeEnabled;
|
|
35
35
|
var isTableResizingEnabled;
|
|
36
|
-
var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, breakoutEnabled, fullWidthModeEnabled, tableResizingEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi) {
|
|
36
|
+
var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthModeEnabled, tableResizingEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi) {
|
|
37
37
|
var _window;
|
|
38
38
|
isBreakoutEnabled = breakoutEnabled;
|
|
39
39
|
isFullWidthModeEnabled = fullWidthModeEnabled;
|
|
40
40
|
wasFullWidthModeEnabled = previousFullWidthModeEnabled;
|
|
41
41
|
isTableResizingEnabled = tableResizingEnabled;
|
|
42
|
-
var state = (0, _pluginFactory.createPluginState)(dispatch, _objectSpread({
|
|
42
|
+
var state = (0, _pluginFactory.createPluginState)(dispatch, _objectSpread(_objectSpread({
|
|
43
43
|
pluginConfig: pluginConfig,
|
|
44
44
|
insertColumnButtonIndex: undefined,
|
|
45
45
|
insertRowButtonIndex: undefined,
|
|
46
46
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
47
47
|
isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
|
|
48
48
|
isHeaderColumnEnabled: false
|
|
49
|
-
}, _defaultTableSelection.defaultTableSelection)
|
|
49
|
+
}, _defaultTableSelection.defaultTableSelection), {}, {
|
|
50
|
+
getIntl: getIntl
|
|
51
|
+
}));
|
|
50
52
|
var elementContentRects = {};
|
|
51
53
|
var observer = (_window = window) !== null && _window !== void 0 && _window.ResizeObserver ? new ResizeObserver(function (entries) {
|
|
52
54
|
entries.forEach(function (entry) {
|
|
@@ -150,6 +152,8 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
|
|
|
150
152
|
(0, _commands.addBoldInEmptyHeaderCells)(tableCellHeader)(state, dispatch);
|
|
151
153
|
}
|
|
152
154
|
}
|
|
155
|
+
} else if (pluginState.isResizeHandleWidgetAdded) {
|
|
156
|
+
(0, _misc.removeResizeHandleDecorations)()(state, dispatch);
|
|
153
157
|
}
|
|
154
158
|
},
|
|
155
159
|
destroy: function destroy() {
|
|
@@ -11,6 +11,7 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
11
11
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
12
12
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
13
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
|
+
var _misc = require("../../commands/misc");
|
|
14
15
|
var _transforms = require("../../transforms");
|
|
15
16
|
var _utils2 = require("../../utils");
|
|
16
17
|
var _commands = require("./commands");
|
|
@@ -64,6 +65,10 @@ var handleMouseDown = function handleMouseDown(view, event, localResizeHandlePos
|
|
|
64
65
|
startX: event.clientX,
|
|
65
66
|
startWidth: width
|
|
66
67
|
})(state, dispatch);
|
|
68
|
+
|
|
69
|
+
// When we start resizing a column we need to ensure the underlying tooltip is removed from the decoration to avoid
|
|
70
|
+
// unnecessary tooltips being displayed during drag.
|
|
71
|
+
(0, _misc.updateResizeHandleDecorations)(undefined, undefined, false)(state, dispatch);
|
|
67
72
|
function finish(event) {
|
|
68
73
|
window.removeEventListener('mouseup', finish);
|
|
69
74
|
window.removeEventListener('mousemove', move);
|
|
@@ -17,6 +17,7 @@ var _misc = require("../utils/misc");
|
|
|
17
17
|
var _resizeLogic = require("../utils/resize-logic");
|
|
18
18
|
var _resizeState = require("../utils/resize-state");
|
|
19
19
|
var _colgroup = require("./colgroup");
|
|
20
|
+
var _dom = require("./dom");
|
|
20
21
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
23
|
// Base function to trigger the actual scale on a table node.
|
|
@@ -123,6 +124,7 @@ var previewScaleTable = function previewScaleTable(tableRef, options, domAtPos)
|
|
|
123
124
|
tableRef.style.width = "".concat(width, "px");
|
|
124
125
|
}
|
|
125
126
|
if (!(0, _colgroup.hasTableBeenResized)(node)) {
|
|
127
|
+
(0, _dom.syncStickyRowToTable)(tableRef);
|
|
126
128
|
return;
|
|
127
129
|
}
|
|
128
130
|
var resizeState = parentWidth ? scaleWithParent(tableRef, parentWidth, node, start, domAtPos) : scale(tableRef, options, domAtPos);
|