@atlaskit/editor-plugin-table 7.21.5 → 7.22.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 +24 -0
- package/dist/cjs/nodeviews/TableContainer.js +5 -2
- package/dist/cjs/nodeviews/TableResizer.js +9 -6
- package/dist/cjs/plugin.js +3 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +5 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/index.js +6 -0
- package/dist/cjs/pm-plugins/table-width.js +2 -2
- package/dist/cjs/ui/common-styles.js +7 -13
- package/dist/es2019/nodeviews/TableContainer.js +6 -3
- package/dist/es2019/nodeviews/TableResizer.js +10 -7
- package/dist/es2019/plugin.js +3 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +4 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/es2019/pm-plugins/table-width.js +2 -2
- package/dist/es2019/ui/common-styles.js +0 -12
- package/dist/esm/nodeviews/TableContainer.js +6 -3
- package/dist/esm/nodeviews/TableResizer.js +10 -7
- package/dist/esm/plugin.js +3 -3
- package/dist/esm/pm-plugins/table-resizing/utils/consts.js +4 -1
- package/dist/esm/pm-plugins/table-resizing/utils/index.js +1 -1
- package/dist/esm/pm-plugins/table-width.js +2 -2
- package/dist/esm/ui/common-styles.js +7 -13
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/pm-plugins/table-resizing/utils/consts.d.ts +1 -0
- package/dist/types/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types/pm-plugins/table-width.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/consts.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-width.d.ts +1 -1
- package/package.json +10 -13
- package/src/nodeviews/TableContainer.tsx +8 -4
- package/src/nodeviews/TableResizer.tsx +19 -3
- package/src/plugin.tsx +4 -2
- package/src/pm-plugins/table-resizing/utils/consts.ts +4 -0
- package/src/pm-plugins/table-resizing/utils/index.ts +1 -0
- package/src/pm-plugins/table-width.ts +2 -1
- package/src/ui/common-styles.ts +0 -14
package/src/plugin.tsx
CHANGED
|
@@ -472,13 +472,14 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
472
472
|
{
|
|
473
473
|
name: 'tableWidth',
|
|
474
474
|
plugin: ({ dispatchAnalyticsEvent, dispatch }) =>
|
|
475
|
-
options?.tableResizingEnabled
|
|
475
|
+
options?.tableResizingEnabled
|
|
476
476
|
? createTableWidthPlugin(
|
|
477
477
|
dispatch,
|
|
478
478
|
dispatchAnalyticsEvent,
|
|
479
479
|
options?.fullWidthEnabled ?? false,
|
|
480
480
|
options?.isTableScalingEnabled ?? false,
|
|
481
481
|
options?.isTableAlignmentEnabled ?? false,
|
|
482
|
+
options?.isCommentEditor ?? false,
|
|
482
483
|
)
|
|
483
484
|
: undefined,
|
|
484
485
|
},
|
|
@@ -683,7 +684,8 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
683
684
|
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
684
685
|
/>
|
|
685
686
|
)}
|
|
686
|
-
{options?.isTableScalingEnabled
|
|
687
|
+
{(options?.isTableScalingEnabled ||
|
|
688
|
+
(options?.tableResizingEnabled && options.isCommentEditor)) &&
|
|
687
689
|
isTableResizing &&
|
|
688
690
|
widthToWidest &&
|
|
689
691
|
resizingTableLocalId &&
|
|
@@ -6,3 +6,7 @@ export const MAX_SCALING_PERCENT = 0.3;
|
|
|
6
6
|
export const MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION = 0.4;
|
|
7
7
|
// Used to calculate the width of a table using the Editor width
|
|
8
8
|
export const TABLE_EDITOR_MARGIN = 76;
|
|
9
|
+
const COMMENT_AK_EDITOR_CONTENT_AREA_PADDING = 20;
|
|
10
|
+
const COMMENT_PM_TABLE_RESIZING_PLUGIN_MARGIN = 12;
|
|
11
|
+
export const TABLE_OFFSET_IN_COMMENT_EDITOR =
|
|
12
|
+
2 * (COMMENT_AK_EDITOR_CONTENT_AREA_PADDING + COMMENT_PM_TABLE_RESIZING_PLUGIN_MARGIN);
|
|
@@ -47,6 +47,7 @@ const createPlugin = (
|
|
|
47
47
|
fullWidthEnabled: boolean,
|
|
48
48
|
isTableScalingEnabled: boolean,
|
|
49
49
|
isTableAlignmentEnabled: boolean,
|
|
50
|
+
isCommentEditor: boolean,
|
|
50
51
|
) => {
|
|
51
52
|
return new SafePlugin({
|
|
52
53
|
key: pluginKey,
|
|
@@ -158,7 +159,7 @@ const createPlugin = (
|
|
|
158
159
|
});
|
|
159
160
|
}
|
|
160
161
|
|
|
161
|
-
if (isReplaceDocumentOperation) {
|
|
162
|
+
if (isReplaceDocumentOperation && !isCommentEditor) {
|
|
162
163
|
newState.doc.forEach((node, offset) => {
|
|
163
164
|
if (node.type === table) {
|
|
164
165
|
const width = node.attrs.width;
|
package/src/ui/common-styles.ts
CHANGED
|
@@ -242,18 +242,6 @@ const viewModeSortStyles = () => {
|
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
244
|
|
|
245
|
-
const numberColumnFix = () => {
|
|
246
|
-
if (fg('platform.editor.table.editor-num-col-style-changes')) {
|
|
247
|
-
return '';
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
return css`
|
|
251
|
-
> table[data-number-column='true'] {
|
|
252
|
-
width: calc(100% - 1px);
|
|
253
|
-
}
|
|
254
|
-
`;
|
|
255
|
-
};
|
|
256
|
-
|
|
257
245
|
const tableBorderStyles = () => {
|
|
258
246
|
return `border-color: ${tableBorderDeleteColor}`;
|
|
259
247
|
};
|
|
@@ -1070,8 +1058,6 @@ export const baseTableStyles = (props: { featureFlags?: FeatureFlags }) => css`
|
|
|
1070
1058
|
overflow: auto;
|
|
1071
1059
|
overflow-y: hidden;
|
|
1072
1060
|
position: relative;
|
|
1073
|
-
|
|
1074
|
-
${numberColumnFix()}
|
|
1075
1061
|
}
|
|
1076
1062
|
`;
|
|
1077
1063
|
|