@atlaskit/editor-plugin-table 22.4.14 → 22.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/nodeviews/TableComponent.js +2 -2
  3. package/dist/cjs/nodeviews/table.js +2 -2
  4. package/dist/cjs/nodeviews/toDOM.js +2 -2
  5. package/dist/cjs/pm-plugins/main.js +4 -3
  6. package/dist/cjs/pm-plugins/table-width.js +2 -2
  7. package/dist/cjs/pm-plugins/transforms/content-mode.js +3 -2
  8. package/dist/cjs/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.js +70 -0
  9. package/dist/cjs/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.js +41 -0
  10. package/dist/cjs/pm-plugins/utils/tableMode/is-content-mode-supported.js +12 -0
  11. package/dist/cjs/pm-plugins/utils/tableMode/measure-table-with-auto-layout.js +113 -0
  12. package/dist/cjs/pm-plugins/utils/tableMode/smart-adjust/constants.js +10 -0
  13. package/dist/cjs/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.js +83 -0
  14. package/dist/cjs/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.js +56 -0
  15. package/dist/cjs/ui/toolbar.js +4 -3
  16. package/dist/es2019/nodeviews/TableComponent.js +1 -1
  17. package/dist/es2019/nodeviews/table.js +1 -1
  18. package/dist/es2019/nodeviews/toDOM.js +1 -1
  19. package/dist/es2019/pm-plugins/main.js +2 -1
  20. package/dist/es2019/pm-plugins/table-width.js +1 -1
  21. package/dist/es2019/pm-plugins/transforms/content-mode.js +2 -1
  22. package/dist/es2019/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.js +70 -0
  23. package/dist/es2019/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.js +38 -0
  24. package/dist/es2019/pm-plugins/utils/tableMode/is-content-mode-supported.js +7 -0
  25. package/dist/es2019/pm-plugins/utils/tableMode/measure-table-with-auto-layout.js +97 -0
  26. package/dist/es2019/pm-plugins/utils/tableMode/smart-adjust/constants.js +4 -0
  27. package/dist/es2019/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.js +63 -0
  28. package/dist/es2019/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.js +47 -0
  29. package/dist/es2019/ui/toolbar.js +2 -1
  30. package/dist/esm/nodeviews/TableComponent.js +1 -1
  31. package/dist/esm/nodeviews/table.js +1 -1
  32. package/dist/esm/nodeviews/toDOM.js +1 -1
  33. package/dist/esm/pm-plugins/main.js +2 -1
  34. package/dist/esm/pm-plugins/table-width.js +1 -1
  35. package/dist/esm/pm-plugins/transforms/content-mode.js +2 -1
  36. package/dist/esm/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.js +65 -0
  37. package/dist/esm/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.js +36 -0
  38. package/dist/esm/pm-plugins/utils/tableMode/is-content-mode-supported.js +6 -0
  39. package/dist/esm/pm-plugins/utils/tableMode/measure-table-with-auto-layout.js +107 -0
  40. package/dist/esm/pm-plugins/utils/tableMode/smart-adjust/constants.js +4 -0
  41. package/dist/esm/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.js +77 -0
  42. package/dist/esm/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.js +49 -0
  43. package/dist/esm/ui/toolbar.js +2 -1
  44. package/dist/types/pm-plugins/transforms/content-mode.d.ts +1 -0
  45. package/dist/types/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.d.ts +8 -0
  46. package/dist/types/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.d.ts +6 -0
  47. package/dist/types/pm-plugins/utils/tableMode/is-content-mode-supported.d.ts +7 -0
  48. package/dist/types/pm-plugins/utils/tableMode/measure-table-with-auto-layout.d.ts +2 -0
  49. package/dist/types/pm-plugins/utils/tableMode/smart-adjust/constants.d.ts +4 -0
  50. package/dist/types/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.d.ts +8 -0
  51. package/dist/types/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.d.ts +7 -0
  52. package/dist/types/ui/TableMenu/column/getColumnMenuComponents.d.ts +1 -1
  53. package/dist/types/ui/TableMenu/column/items/DistributeColumnsItem.d.ts +1 -1
  54. package/dist/types-ts4.5/pm-plugins/transforms/content-mode.d.ts +1 -0
  55. package/dist/types-ts4.5/pm-plugins/utils/tableMode/apply-measured-width-to-all-tables.d.ts +8 -0
  56. package/dist/types-ts4.5/pm-plugins/utils/tableMode/apply-measured-width-to-selected-table.d.ts +6 -0
  57. package/dist/types-ts4.5/pm-plugins/utils/tableMode/is-content-mode-supported.d.ts +7 -0
  58. package/dist/types-ts4.5/pm-plugins/utils/tableMode/measure-table-with-auto-layout.d.ts +2 -0
  59. package/dist/types-ts4.5/pm-plugins/utils/tableMode/smart-adjust/constants.d.ts +4 -0
  60. package/dist/types-ts4.5/pm-plugins/utils/tableMode/smart-adjust/distribute-column-widths.d.ts +8 -0
  61. package/dist/types-ts4.5/pm-plugins/utils/tableMode/smart-adjust/run-smart-adjust.d.ts +7 -0
  62. package/dist/types-ts4.5/ui/TableMenu/column/getColumnMenuComponents.d.ts +1 -1
  63. package/dist/types-ts4.5/ui/TableMenu/column/items/DistributeColumnsItem.d.ts +1 -1
  64. package/package.json +10 -7
  65. package/dist/cjs/pm-plugins/utils/tableMode.js +0 -162
  66. package/dist/es2019/pm-plugins/utils/tableMode.js +0 -158
  67. package/dist/esm/pm-plugins/utils/tableMode.js +0 -156
  68. package/dist/types/pm-plugins/utils/tableMode.d.ts +0 -26
  69. package/dist/types-ts4.5/pm-plugins/utils/tableMode.d.ts +0 -26
@@ -1,158 +0,0 @@
1
- import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
2
- import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
3
- import { hasTableBeenResized } from '@atlaskit/editor-common/table';
4
- import { findTable } from '@atlaskit/editor-tables/utils';
5
- import { applyTableMeasurement, getTableMeasurement } from '../transforms/content-mode';
6
- export const isContentModeSupported = ({
7
- allowColumnResizing,
8
- allowTableResizing,
9
- isFullPageEditor
10
- }) => {
11
- return allowColumnResizing && allowTableResizing && isFullPageEditor;
12
- };
13
-
14
- /**
15
- * Iterates all top-level tables in the document, and for those in content mode,
16
- * measures rendered column widths and sets colwidth + table width attributes
17
- * in a single batched transaction.
18
- */
19
- export const applyMeasuredWidthToAllTables = (view, pluginInjectionApi) => {
20
- const {
21
- state: {
22
- doc,
23
- schema
24
- }
25
- } = view;
26
- let tr = view.state.tr;
27
- const {
28
- table
29
- } = schema.nodes;
30
- let modified = false;
31
- const measuredTables = [];
32
-
33
- // modify only top-level tables
34
- doc.forEach((node, offset) => {
35
- if (node.type !== table || hasTableBeenResized(node) && node.attrs.layout !== 'align-start') {
36
- return;
37
- }
38
- const domNode = view.domAtPos(offset + 1).node;
39
- const tableWrapper = domNode instanceof HTMLElement ? domNode.closest(`.${TableSharedCssClassName.TABLE_VIEW_CONTENT_WRAP}`) : null;
40
- const tableRef = tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.querySelector('table');
41
- if (!tableRef) {
42
- return;
43
- }
44
- measuredTables.push({
45
- node,
46
- offset,
47
- measurement: getTableMeasurement(tableRef)
48
- });
49
- });
50
- measuredTables.forEach(({
51
- node,
52
- offset,
53
- measurement
54
- }) => {
55
- tr = applyTableMeasurement(tr, node, measurement, offset);
56
- modified = true;
57
- });
58
- if (modified) {
59
- var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$w, _pluginInjectionApi$w2, _pluginInjectionApi$w3;
60
- pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : (_pluginInjectionApi$a2 = _pluginInjectionApi$a.actions) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.attachAnalyticsEvent({
61
- action: TABLE_ACTION.FIT_TO_CONTENT_AUTO_CONVERTED,
62
- actionSubject: ACTION_SUBJECT.TABLE,
63
- actionSubjectId: null,
64
- eventType: EVENT_TYPE.TRACK,
65
- attributes: {
66
- editorContainerWidth: (_pluginInjectionApi$w = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$w2 = pluginInjectionApi.width) === null || _pluginInjectionApi$w2 === void 0 ? void 0 : (_pluginInjectionApi$w3 = _pluginInjectionApi$w2.sharedState.currentState()) === null || _pluginInjectionApi$w3 === void 0 ? void 0 : _pluginInjectionApi$w3.width) !== null && _pluginInjectionApi$w !== void 0 ? _pluginInjectionApi$w : 0,
67
- totalTablesResized: measuredTables.length,
68
- measurements: measuredTables.map(({
69
- measurement
70
- }) => ({
71
- tableWidth: measurement.tableWidth,
72
- totalColumnCount: measurement.colWidths.length
73
- }))
74
- }
75
- })(tr);
76
- view.dispatch(tr.setMeta('addToHistory', false));
77
- }
78
- };
79
-
80
- /**
81
- * Temporarily overrides inline styles on the table and its surrounding containers so the browser
82
- * lays columns out with `table-layout: auto`, takes a content-width measurement, and then
83
- * **resets every modified style** so no temporary overrides leak into the rendered output.
84
- */
85
- export const measureTableWithAutoLayout = tableRef => {
86
- const cols = Array.from(tableRef.querySelectorAll(':scope > colgroup > col'));
87
- const contentWrap = tableRef.closest(`.${TableSharedCssClassName.TABLE_VIEW_CONTENT_WRAP}`);
88
- const resizerContainer = contentWrap === null || contentWrap === void 0 ? void 0 : contentWrap.querySelector(`.${TableSharedCssClassName.TABLE_RESIZER_CONTAINER}`);
89
- const resizerItem = resizerContainer === null || resizerContainer === void 0 ? void 0 : resizerContainer.querySelector('.resizer-item.display-handle');
90
-
91
- // Capture current inline styles so we can restore them after measurement
92
- const prevTableWidth = tableRef.style.width;
93
- const prevTableLayout = tableRef.style.tableLayout;
94
- const prevColWidths = cols.map(col => col.style.width);
95
- const prevResizerItemWidth = resizerItem === null || resizerItem === void 0 ? void 0 : resizerItem.style.width;
96
-
97
- // Apply temporary styles for content-based measurement
98
- tableRef.style.width = '';
99
- tableRef.style.tableLayout = 'auto';
100
- cols.forEach(col => col.style.width = '');
101
- if (resizerContainer) {
102
- // favour CSS var to align with the table first render state, which gets reset
103
- // once resized by user. By doing this we avoid the need to any 'reset' work after
104
- // measurement and ensures it works if the table has been resized or not in the session.
105
- resizerContainer.style.width = 'var(--ak-editor-table-width)';
106
- resizerContainer.style.setProperty('--ak-editor-table-width', 'max-content');
107
- }
108
- if (resizerItem) {
109
- resizerItem.style.width = 'max-content';
110
- }
111
- const measurement = getTableMeasurement(tableRef);
112
-
113
- // Reset all inline styles back to their previous values
114
- tableRef.style.width = prevTableWidth;
115
- tableRef.style.tableLayout = prevTableLayout;
116
- cols.forEach((col, i) => col.style.width = prevColWidths[i]);
117
- if (resizerItem) {
118
- resizerItem.style.width = prevResizerItemWidth !== null && prevResizerItemWidth !== void 0 ? prevResizerItemWidth : '';
119
- }
120
- return measurement;
121
- };
122
-
123
- /**
124
- * Used to measure a selected table width with it's content being laid out natively by the browser
125
- */
126
- export const applyMeasuredWidthToSelectedTable = (view, api) => {
127
- var _api$analytics, _api$analytics$action, _api$width$sharedStat, _api$width, _api$width$sharedStat2;
128
- const tableObject = findTable(view.state.selection);
129
- if (!tableObject) {
130
- return;
131
- }
132
- const {
133
- node,
134
- pos
135
- } = tableObject;
136
- const tableState = api === null || api === void 0 ? void 0 : api.table.sharedState.currentState();
137
- if (!(tableState !== null && tableState !== void 0 && tableState.tableRef)) {
138
- return;
139
- }
140
-
141
- // Instead of dispatching a transaction to "strip widths" and then waiting
142
- // for a rAF to measure natural column widths, directly update the DOM elements,
143
- // take a measurement, and reset styles so no temporary overrides persist.
144
- const measurement = measureTableWithAutoLayout(tableState.tableRef);
145
- const tr = applyTableMeasurement(view.state.tr, node, measurement, pos);
146
- api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.attachAnalyticsEvent({
147
- action: TABLE_ACTION.FIT_TO_CONTENT_ON_DEMAND,
148
- actionSubject: ACTION_SUBJECT.TABLE,
149
- actionSubjectId: null,
150
- eventType: EVENT_TYPE.TRACK,
151
- attributes: {
152
- editorContainerWidth: (_api$width$sharedStat = api === null || api === void 0 ? void 0 : (_api$width = api.width) === null || _api$width === void 0 ? void 0 : (_api$width$sharedStat2 = _api$width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : 0,
153
- tableWidth: measurement.tableWidth,
154
- totalColumnCount: measurement.colWidths.length
155
- }
156
- })(tr);
157
- view.dispatch(tr);
158
- };
@@ -1,156 +0,0 @@
1
- import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
2
- import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
3
- import { hasTableBeenResized } from '@atlaskit/editor-common/table';
4
- import { findTable } from '@atlaskit/editor-tables/utils';
5
- import { applyTableMeasurement, getTableMeasurement } from '../transforms/content-mode';
6
- export var isContentModeSupported = function isContentModeSupported(_ref) {
7
- var allowColumnResizing = _ref.allowColumnResizing,
8
- allowTableResizing = _ref.allowTableResizing,
9
- isFullPageEditor = _ref.isFullPageEditor;
10
- return allowColumnResizing && allowTableResizing && isFullPageEditor;
11
- };
12
-
13
- /**
14
- * Iterates all top-level tables in the document, and for those in content mode,
15
- * measures rendered column widths and sets colwidth + table width attributes
16
- * in a single batched transaction.
17
- */
18
- export var applyMeasuredWidthToAllTables = function applyMeasuredWidthToAllTables(view, pluginInjectionApi) {
19
- var _view$state = view.state,
20
- doc = _view$state.doc,
21
- schema = _view$state.schema;
22
- var tr = view.state.tr;
23
- var table = schema.nodes.table;
24
- var modified = false;
25
- var measuredTables = [];
26
-
27
- // modify only top-level tables
28
- doc.forEach(function (node, offset) {
29
- if (node.type !== table || hasTableBeenResized(node) && node.attrs.layout !== 'align-start') {
30
- return;
31
- }
32
- var domNode = view.domAtPos(offset + 1).node;
33
- var tableWrapper = domNode instanceof HTMLElement ? domNode.closest(".".concat(TableSharedCssClassName.TABLE_VIEW_CONTENT_WRAP)) : null;
34
- var tableRef = tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.querySelector('table');
35
- if (!tableRef) {
36
- return;
37
- }
38
- measuredTables.push({
39
- node: node,
40
- offset: offset,
41
- measurement: getTableMeasurement(tableRef)
42
- });
43
- });
44
- measuredTables.forEach(function (_ref2) {
45
- var node = _ref2.node,
46
- offset = _ref2.offset,
47
- measurement = _ref2.measurement;
48
- tr = applyTableMeasurement(tr, node, measurement, offset);
49
- modified = true;
50
- });
51
- if (modified) {
52
- var _pluginInjectionApi$a, _pluginInjectionApi$w, _pluginInjectionApi$w2;
53
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 || (_pluginInjectionApi$a = _pluginInjectionApi$a.actions) === null || _pluginInjectionApi$a === void 0 || _pluginInjectionApi$a.attachAnalyticsEvent({
54
- action: TABLE_ACTION.FIT_TO_CONTENT_AUTO_CONVERTED,
55
- actionSubject: ACTION_SUBJECT.TABLE,
56
- actionSubjectId: null,
57
- eventType: EVENT_TYPE.TRACK,
58
- attributes: {
59
- editorContainerWidth: (_pluginInjectionApi$w = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$w2 = pluginInjectionApi.width) === null || _pluginInjectionApi$w2 === void 0 || (_pluginInjectionApi$w2 = _pluginInjectionApi$w2.sharedState.currentState()) === null || _pluginInjectionApi$w2 === void 0 ? void 0 : _pluginInjectionApi$w2.width) !== null && _pluginInjectionApi$w !== void 0 ? _pluginInjectionApi$w : 0,
60
- totalTablesResized: measuredTables.length,
61
- measurements: measuredTables.map(function (_ref3) {
62
- var measurement = _ref3.measurement;
63
- return {
64
- tableWidth: measurement.tableWidth,
65
- totalColumnCount: measurement.colWidths.length
66
- };
67
- })
68
- }
69
- })(tr);
70
- view.dispatch(tr.setMeta('addToHistory', false));
71
- }
72
- };
73
-
74
- /**
75
- * Temporarily overrides inline styles on the table and its surrounding containers so the browser
76
- * lays columns out with `table-layout: auto`, takes a content-width measurement, and then
77
- * **resets every modified style** so no temporary overrides leak into the rendered output.
78
- */
79
- export var measureTableWithAutoLayout = function measureTableWithAutoLayout(tableRef) {
80
- var cols = Array.from(tableRef.querySelectorAll(':scope > colgroup > col'));
81
- var contentWrap = tableRef.closest(".".concat(TableSharedCssClassName.TABLE_VIEW_CONTENT_WRAP));
82
- var resizerContainer = contentWrap === null || contentWrap === void 0 ? void 0 : contentWrap.querySelector(".".concat(TableSharedCssClassName.TABLE_RESIZER_CONTAINER));
83
- var resizerItem = resizerContainer === null || resizerContainer === void 0 ? void 0 : resizerContainer.querySelector('.resizer-item.display-handle');
84
-
85
- // Capture current inline styles so we can restore them after measurement
86
- var prevTableWidth = tableRef.style.width;
87
- var prevTableLayout = tableRef.style.tableLayout;
88
- var prevColWidths = cols.map(function (col) {
89
- return col.style.width;
90
- });
91
- var prevResizerItemWidth = resizerItem === null || resizerItem === void 0 ? void 0 : resizerItem.style.width;
92
-
93
- // Apply temporary styles for content-based measurement
94
- tableRef.style.width = '';
95
- tableRef.style.tableLayout = 'auto';
96
- cols.forEach(function (col) {
97
- return col.style.width = '';
98
- });
99
- if (resizerContainer) {
100
- // favour CSS var to align with the table first render state, which gets reset
101
- // once resized by user. By doing this we avoid the need to any 'reset' work after
102
- // measurement and ensures it works if the table has been resized or not in the session.
103
- resizerContainer.style.width = 'var(--ak-editor-table-width)';
104
- resizerContainer.style.setProperty('--ak-editor-table-width', 'max-content');
105
- }
106
- if (resizerItem) {
107
- resizerItem.style.width = 'max-content';
108
- }
109
- var measurement = getTableMeasurement(tableRef);
110
-
111
- // Reset all inline styles back to their previous values
112
- tableRef.style.width = prevTableWidth;
113
- tableRef.style.tableLayout = prevTableLayout;
114
- cols.forEach(function (col, i) {
115
- return col.style.width = prevColWidths[i];
116
- });
117
- if (resizerItem) {
118
- resizerItem.style.width = prevResizerItemWidth !== null && prevResizerItemWidth !== void 0 ? prevResizerItemWidth : '';
119
- }
120
- return measurement;
121
- };
122
-
123
- /**
124
- * Used to measure a selected table width with it's content being laid out natively by the browser
125
- */
126
- export var applyMeasuredWidthToSelectedTable = function applyMeasuredWidthToSelectedTable(view, api) {
127
- var _api$analytics, _api$width$sharedStat, _api$width;
128
- var tableObject = findTable(view.state.selection);
129
- if (!tableObject) {
130
- return;
131
- }
132
- var node = tableObject.node,
133
- pos = tableObject.pos;
134
- var tableState = api === null || api === void 0 ? void 0 : api.table.sharedState.currentState();
135
- if (!(tableState !== null && tableState !== void 0 && tableState.tableRef)) {
136
- return;
137
- }
138
-
139
- // Instead of dispatching a transaction to "strip widths" and then waiting
140
- // for a rAF to measure natural column widths, directly update the DOM elements,
141
- // take a measurement, and reset styles so no temporary overrides persist.
142
- var measurement = measureTableWithAutoLayout(tableState.tableRef);
143
- var tr = applyTableMeasurement(view.state.tr, node, measurement, pos);
144
- api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.attachAnalyticsEvent({
145
- action: TABLE_ACTION.FIT_TO_CONTENT_ON_DEMAND,
146
- actionSubject: ACTION_SUBJECT.TABLE,
147
- actionSubjectId: null,
148
- eventType: EVENT_TYPE.TRACK,
149
- attributes: {
150
- editorContainerWidth: (_api$width$sharedStat = api === null || api === void 0 || (_api$width = api.width) === null || _api$width === void 0 || (_api$width = _api$width.sharedState.currentState()) === null || _api$width === void 0 ? void 0 : _api$width.width) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : 0,
151
- tableWidth: measurement.tableWidth,
152
- totalColumnCount: measurement.colWidths.length
153
- }
154
- })(tr);
155
- view.dispatch(tr);
156
- };
@@ -1,26 +0,0 @@
1
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- import type { PluginInjectionAPI } from '../../types';
3
- import { type TableMeasurement } from '../transforms/content-mode';
4
- type ContentModePluginOptions = {
5
- allowColumnResizing: boolean;
6
- allowTableResizing: boolean;
7
- isFullPageEditor: boolean;
8
- };
9
- export declare const isContentModeSupported: ({ allowColumnResizing, allowTableResizing, isFullPageEditor, }: ContentModePluginOptions) => boolean;
10
- /**
11
- * Iterates all top-level tables in the document, and for those in content mode,
12
- * measures rendered column widths and sets colwidth + table width attributes
13
- * in a single batched transaction.
14
- */
15
- export declare const applyMeasuredWidthToAllTables: (view: EditorView, pluginInjectionApi?: PluginInjectionAPI) => void;
16
- /**
17
- * Temporarily overrides inline styles on the table and its surrounding containers so the browser
18
- * lays columns out with `table-layout: auto`, takes a content-width measurement, and then
19
- * **resets every modified style** so no temporary overrides leak into the rendered output.
20
- */
21
- export declare const measureTableWithAutoLayout: (tableRef: HTMLTableElement) => TableMeasurement;
22
- /**
23
- * Used to measure a selected table width with it's content being laid out natively by the browser
24
- */
25
- export declare const applyMeasuredWidthToSelectedTable: (view: EditorView, api?: PluginInjectionAPI) => void;
26
- export {};
@@ -1,26 +0,0 @@
1
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
- import type { PluginInjectionAPI } from '../../types';
3
- import { type TableMeasurement } from '../transforms/content-mode';
4
- type ContentModePluginOptions = {
5
- allowColumnResizing: boolean;
6
- allowTableResizing: boolean;
7
- isFullPageEditor: boolean;
8
- };
9
- export declare const isContentModeSupported: ({ allowColumnResizing, allowTableResizing, isFullPageEditor, }: ContentModePluginOptions) => boolean;
10
- /**
11
- * Iterates all top-level tables in the document, and for those in content mode,
12
- * measures rendered column widths and sets colwidth + table width attributes
13
- * in a single batched transaction.
14
- */
15
- export declare const applyMeasuredWidthToAllTables: (view: EditorView, pluginInjectionApi?: PluginInjectionAPI) => void;
16
- /**
17
- * Temporarily overrides inline styles on the table and its surrounding containers so the browser
18
- * lays columns out with `table-layout: auto`, takes a content-width measurement, and then
19
- * **resets every modified style** so no temporary overrides leak into the rendered output.
20
- */
21
- export declare const measureTableWithAutoLayout: (tableRef: HTMLTableElement) => TableMeasurement;
22
- /**
23
- * Used to measure a selected table width with it's content being laid out natively by the browser
24
- */
25
- export declare const applyMeasuredWidthToSelectedTable: (view: EditorView, api?: PluginInjectionAPI) => void;
26
- export {};