@atlaskit/editor-plugin-table 5.3.24 → 5.3.25
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 +6 -0
- package/dist/cjs/plugins/table/transforms/column-width.js +10 -43
- package/dist/es2019/plugins/table/transforms/column-width.js +10 -43
- package/dist/esm/plugins/table/transforms/column-width.js +10 -43
- package/package.json +1 -4
- package/src/plugins/table/transforms/column-width.ts +14 -60
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 5.3.25
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#42925](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42925) [`8ea16423505`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8ea16423505) - Removes FF platform.editor.update-table-cell-width-via-step
|
|
8
|
+
|
|
3
9
|
## 5.3.24
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -67,52 +67,19 @@ var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidth
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
// updating all cells with new attributes
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
for (var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
tr.step(new _transform.AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
|
|
80
|
-
}
|
|
81
|
-
seen[pos] = true;
|
|
70
|
+
var seen = {};
|
|
71
|
+
for (var _rowIndex = 0; _rowIndex < map.height; _rowIndex++) {
|
|
72
|
+
for (var _columnIndex = 0; _columnIndex < map.width; _columnIndex++) {
|
|
73
|
+
var _mapIndex = _rowIndex * map.width + _columnIndex;
|
|
74
|
+
var pos = map.map[_mapIndex];
|
|
75
|
+
var cell = table.nodeAt(pos);
|
|
76
|
+
if (!seen[pos] && cell) {
|
|
77
|
+
if (updatedCellsAttrs[pos]) {
|
|
78
|
+
tr.step(new _transform.AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
|
|
82
79
|
}
|
|
80
|
+
seen[pos] = true;
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
|
-
} else {
|
|
86
|
-
var rows = [];
|
|
87
|
-
var _seen = {};
|
|
88
|
-
for (var _rowIndex2 = 0; _rowIndex2 < map.height; _rowIndex2++) {
|
|
89
|
-
var row = table.child(_rowIndex2);
|
|
90
|
-
var cells = [];
|
|
91
|
-
for (var _columnIndex2 = 0; _columnIndex2 < map.width; _columnIndex2++) {
|
|
92
|
-
var _mapIndex2 = _rowIndex2 * map.width + _columnIndex2;
|
|
93
|
-
var _pos = map.map[_mapIndex2];
|
|
94
|
-
var _cell = table.nodeAt(_pos);
|
|
95
|
-
if (!_seen[_pos] && _cell) {
|
|
96
|
-
cells.push(_cell.type.createChecked(updatedCellsAttrs[_pos] || _cell.attrs, _cell.content, _cell.marks));
|
|
97
|
-
_seen[_pos] = true;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
rows.push(row.type.createChecked(row.attrs, cells, row.marks));
|
|
101
|
-
}
|
|
102
|
-
var tablePos = start - 1;
|
|
103
|
-
var selectionBookmark = tr.selection.getBookmark();
|
|
104
|
-
tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks));
|
|
105
|
-
/**
|
|
106
|
-
* We want to restore to the original selection but w/o applying the mapping. Function
|
|
107
|
-
* tr.replaceWith puts the selection after the inserted content. We need to manually
|
|
108
|
-
* set the selection back to original state. Mapping in this case doesn't quite work
|
|
109
|
-
* e.g. if we change the content before a selection. This is because mapping
|
|
110
|
-
* means moving it if the content in front of it changed. Instead we can get
|
|
111
|
-
* bookmark of selection.
|
|
112
|
-
*
|
|
113
|
-
* @see https://github.com/ProseMirror/prosemirror/issues/645
|
|
114
|
-
*/
|
|
115
|
-
tr.setSelection(selectionBookmark.resolve(tr.doc));
|
|
116
83
|
}
|
|
117
84
|
return tr;
|
|
118
85
|
};
|
|
@@ -60,52 +60,19 @@ export const updateColumnWidths = (resizeState, table, start) => tr => {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// updating all cells with new attributes
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
for (let
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
|
|
73
|
-
}
|
|
74
|
-
seen[pos] = true;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
} else {
|
|
79
|
-
const rows = [];
|
|
80
|
-
const seen = {};
|
|
81
|
-
for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {
|
|
82
|
-
const row = table.child(rowIndex);
|
|
83
|
-
const cells = [];
|
|
84
|
-
for (let columnIndex = 0; columnIndex < map.width; columnIndex++) {
|
|
85
|
-
const mapIndex = rowIndex * map.width + columnIndex;
|
|
86
|
-
const pos = map.map[mapIndex];
|
|
87
|
-
const cell = table.nodeAt(pos);
|
|
88
|
-
if (!seen[pos] && cell) {
|
|
89
|
-
cells.push(cell.type.createChecked(updatedCellsAttrs[pos] || cell.attrs, cell.content, cell.marks));
|
|
90
|
-
seen[pos] = true;
|
|
63
|
+
const seen = {};
|
|
64
|
+
for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {
|
|
65
|
+
for (let columnIndex = 0; columnIndex < map.width; columnIndex++) {
|
|
66
|
+
const mapIndex = rowIndex * map.width + columnIndex;
|
|
67
|
+
const pos = map.map[mapIndex];
|
|
68
|
+
const cell = table.nodeAt(pos);
|
|
69
|
+
if (!seen[pos] && cell) {
|
|
70
|
+
if (updatedCellsAttrs[pos]) {
|
|
71
|
+
tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
|
|
91
72
|
}
|
|
73
|
+
seen[pos] = true;
|
|
92
74
|
}
|
|
93
|
-
rows.push(row.type.createChecked(row.attrs, cells, row.marks));
|
|
94
75
|
}
|
|
95
|
-
const tablePos = start - 1;
|
|
96
|
-
const selectionBookmark = tr.selection.getBookmark();
|
|
97
|
-
tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks));
|
|
98
|
-
/**
|
|
99
|
-
* We want to restore to the original selection but w/o applying the mapping. Function
|
|
100
|
-
* tr.replaceWith puts the selection after the inserted content. We need to manually
|
|
101
|
-
* set the selection back to original state. Mapping in this case doesn't quite work
|
|
102
|
-
* e.g. if we change the content before a selection. This is because mapping
|
|
103
|
-
* means moving it if the content in front of it changed. Instead we can get
|
|
104
|
-
* bookmark of selection.
|
|
105
|
-
*
|
|
106
|
-
* @see https://github.com/ProseMirror/prosemirror/issues/645
|
|
107
|
-
*/
|
|
108
|
-
tr.setSelection(selectionBookmark.resolve(tr.doc));
|
|
109
76
|
}
|
|
110
77
|
return tr;
|
|
111
78
|
};
|
|
@@ -61,52 +61,19 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// updating all cells with new attributes
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
for (var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
|
|
74
|
-
}
|
|
75
|
-
seen[pos] = true;
|
|
64
|
+
var seen = {};
|
|
65
|
+
for (var _rowIndex = 0; _rowIndex < map.height; _rowIndex++) {
|
|
66
|
+
for (var _columnIndex = 0; _columnIndex < map.width; _columnIndex++) {
|
|
67
|
+
var _mapIndex = _rowIndex * map.width + _columnIndex;
|
|
68
|
+
var pos = map.map[_mapIndex];
|
|
69
|
+
var cell = table.nodeAt(pos);
|
|
70
|
+
if (!seen[pos] && cell) {
|
|
71
|
+
if (updatedCellsAttrs[pos]) {
|
|
72
|
+
tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
|
|
76
73
|
}
|
|
74
|
+
seen[pos] = true;
|
|
77
75
|
}
|
|
78
76
|
}
|
|
79
|
-
} else {
|
|
80
|
-
var rows = [];
|
|
81
|
-
var _seen = {};
|
|
82
|
-
for (var _rowIndex2 = 0; _rowIndex2 < map.height; _rowIndex2++) {
|
|
83
|
-
var row = table.child(_rowIndex2);
|
|
84
|
-
var cells = [];
|
|
85
|
-
for (var _columnIndex2 = 0; _columnIndex2 < map.width; _columnIndex2++) {
|
|
86
|
-
var _mapIndex2 = _rowIndex2 * map.width + _columnIndex2;
|
|
87
|
-
var _pos = map.map[_mapIndex2];
|
|
88
|
-
var _cell = table.nodeAt(_pos);
|
|
89
|
-
if (!_seen[_pos] && _cell) {
|
|
90
|
-
cells.push(_cell.type.createChecked(updatedCellsAttrs[_pos] || _cell.attrs, _cell.content, _cell.marks));
|
|
91
|
-
_seen[_pos] = true;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
rows.push(row.type.createChecked(row.attrs, cells, row.marks));
|
|
95
|
-
}
|
|
96
|
-
var tablePos = start - 1;
|
|
97
|
-
var selectionBookmark = tr.selection.getBookmark();
|
|
98
|
-
tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks));
|
|
99
|
-
/**
|
|
100
|
-
* We want to restore to the original selection but w/o applying the mapping. Function
|
|
101
|
-
* tr.replaceWith puts the selection after the inserted content. We need to manually
|
|
102
|
-
* set the selection back to original state. Mapping in this case doesn't quite work
|
|
103
|
-
* e.g. if we change the content before a selection. This is because mapping
|
|
104
|
-
* means moving it if the content in front of it changed. Instead we can get
|
|
105
|
-
* bookmark of selection.
|
|
106
|
-
*
|
|
107
|
-
* @see https://github.com/ProseMirror/prosemirror/issues/645
|
|
108
|
-
*/
|
|
109
|
-
tr.setSelection(selectionBookmark.resolve(tr.doc));
|
|
110
77
|
}
|
|
111
78
|
return tr;
|
|
112
79
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.25",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -118,9 +118,6 @@
|
|
|
118
118
|
"platform.editor.table.column-controls-styles-updated": {
|
|
119
119
|
"type": "boolean"
|
|
120
120
|
},
|
|
121
|
-
"platform.editor.update-table-cell-width-via-step": {
|
|
122
|
-
"type": "boolean"
|
|
123
|
-
},
|
|
124
121
|
"platform.editor.resizing-table-height-improvement": {
|
|
125
122
|
"type": "boolean"
|
|
126
123
|
},
|
|
@@ -78,71 +78,25 @@ export const updateColumnWidths =
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// updating all cells with new attributes
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
for (let
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
updatedCellsAttrs[pos].colwidth,
|
|
95
|
-
),
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
seen[pos] = true;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
} else {
|
|
103
|
-
const rows: PMNode[] = [];
|
|
104
|
-
const seen: { [key: number]: boolean } = {};
|
|
105
|
-
for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {
|
|
106
|
-
const row = table.child(rowIndex);
|
|
107
|
-
const cells: PMNode[] = [];
|
|
108
|
-
|
|
109
|
-
for (let columnIndex = 0; columnIndex < map.width; columnIndex++) {
|
|
110
|
-
const mapIndex = rowIndex * map.width + columnIndex;
|
|
111
|
-
const pos = map.map[mapIndex];
|
|
112
|
-
const cell = table.nodeAt(pos);
|
|
113
|
-
if (!seen[pos] && cell) {
|
|
114
|
-
cells.push(
|
|
115
|
-
cell.type.createChecked(
|
|
116
|
-
updatedCellsAttrs[pos] || cell.attrs,
|
|
117
|
-
cell.content,
|
|
118
|
-
cell.marks,
|
|
81
|
+
const seen: { [key: number]: boolean } = {};
|
|
82
|
+
for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {
|
|
83
|
+
for (let columnIndex = 0; columnIndex < map.width; columnIndex++) {
|
|
84
|
+
const mapIndex = rowIndex * map.width + columnIndex;
|
|
85
|
+
const pos = map.map[mapIndex];
|
|
86
|
+
const cell = table.nodeAt(pos);
|
|
87
|
+
if (!seen[pos] && cell) {
|
|
88
|
+
if (updatedCellsAttrs[pos]) {
|
|
89
|
+
tr.step(
|
|
90
|
+
new AttrStep(
|
|
91
|
+
pos + start,
|
|
92
|
+
'colwidth',
|
|
93
|
+
updatedCellsAttrs[pos].colwidth,
|
|
119
94
|
),
|
|
120
95
|
);
|
|
121
|
-
seen[pos] = true;
|
|
122
96
|
}
|
|
97
|
+
seen[pos] = true;
|
|
123
98
|
}
|
|
124
|
-
rows.push(row.type.createChecked(row.attrs, cells, row.marks));
|
|
125
99
|
}
|
|
126
|
-
|
|
127
|
-
const tablePos = start - 1;
|
|
128
|
-
const selectionBookmark = tr.selection.getBookmark();
|
|
129
|
-
|
|
130
|
-
tr.replaceWith(
|
|
131
|
-
tablePos,
|
|
132
|
-
tablePos + table.nodeSize,
|
|
133
|
-
table.type.createChecked(table.attrs, rows, table.marks),
|
|
134
|
-
);
|
|
135
|
-
/**
|
|
136
|
-
* We want to restore to the original selection but w/o applying the mapping. Function
|
|
137
|
-
* tr.replaceWith puts the selection after the inserted content. We need to manually
|
|
138
|
-
* set the selection back to original state. Mapping in this case doesn't quite work
|
|
139
|
-
* e.g. if we change the content before a selection. This is because mapping
|
|
140
|
-
* means moving it if the content in front of it changed. Instead we can get
|
|
141
|
-
* bookmark of selection.
|
|
142
|
-
*
|
|
143
|
-
* @see https://github.com/ProseMirror/prosemirror/issues/645
|
|
144
|
-
*/
|
|
145
|
-
tr.setSelection(selectionBookmark.resolve(tr.doc));
|
|
146
100
|
}
|
|
147
101
|
|
|
148
102
|
return tr;
|