@atlaskit/editor-tables 2.1.1 → 2.1.4
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 +54 -0
- package/dist/cjs/pm-plugins/table-editing.js +2 -13
- package/dist/cjs/utils/handle-paste.js +14 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/pm-plugins/table-editing.js +2 -1
- package/dist/es2019/utils/handle-paste.js +13 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/pm-plugins/table-editing.js +2 -1
- package/dist/esm/utils/handle-paste.js +13 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/pm-plugins/table-editing.d.ts +3 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# @atlaskit/editor-tables
|
|
2
2
|
|
|
3
|
+
## 2.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`b29ce16dad8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b29ce16dad8) - [ED-14606] Move bitbucket schema, confluence schema, jira schema, and default schema from @atlaskit/adf-schema to their own entry points. These new entry points are as follows
|
|
8
|
+
|
|
9
|
+
@atlaskit/adf-schema/schema-bitbucket for:
|
|
10
|
+
|
|
11
|
+
- bitbucketSchema
|
|
12
|
+
|
|
13
|
+
@atlaskit/adf-schema/schema-confluence for:
|
|
14
|
+
|
|
15
|
+
- confluenceSchema
|
|
16
|
+
- confluenceSchemaWithMediaSingle
|
|
17
|
+
|
|
18
|
+
@atlaskit/adf-schema/schema-jira for:
|
|
19
|
+
|
|
20
|
+
- default as createJIRASchema
|
|
21
|
+
- isSchemaWithLists
|
|
22
|
+
- isSchemaWithMentions
|
|
23
|
+
- isSchemaWithEmojis
|
|
24
|
+
- isSchemaWithLinks
|
|
25
|
+
- isSchemaWithAdvancedTextFormattingMarks
|
|
26
|
+
- isSchemaWithCodeBlock
|
|
27
|
+
- isSchemaWithBlockQuotes
|
|
28
|
+
- isSchemaWithMedia
|
|
29
|
+
- isSchemaWithSubSupMark
|
|
30
|
+
- isSchemaWithTextColor
|
|
31
|
+
- isSchemaWithTables
|
|
32
|
+
|
|
33
|
+
@atlaskit/adf-schema/schema-default for:
|
|
34
|
+
|
|
35
|
+
- defaultSchema
|
|
36
|
+
- getSchemaBasedOnStage
|
|
37
|
+
- defaultSchemaConfig
|
|
38
|
+
|
|
39
|
+
This change also includes codemods in @atlaskit/adf-schema to update these entry points. It also introduces a new util function "changeImportEntryPoint" to @atlaskit/codemod-utils to handle this scenario.
|
|
40
|
+
|
|
41
|
+
## 2.1.3
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- [`cbfbaab61bb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cbfbaab61bb) - [ux][ed-14300] Remove column width from table cells being pasted into another table as it should take the formatting of the destination table.
|
|
46
|
+
|
|
47
|
+
## 2.1.2
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- [`4e6fbaf5898`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4e6fbaf5898) - ED-14117 Change EditorState.apply type to receive readonly transaction
|
|
52
|
+
|
|
53
|
+
Transactions should not be mutated after being dispatched as it can lead to
|
|
54
|
+
unexpected behaviour. This change patches the relevant types declared in
|
|
55
|
+
prosemirror-state as a compile-time safeguard.
|
|
56
|
+
|
|
3
57
|
## 2.1.1
|
|
4
58
|
|
|
5
59
|
### Patch Changes
|
|
@@ -19,18 +19,6 @@ var _input = require("./input");
|
|
|
19
19
|
|
|
20
20
|
var _pluginKey = require("./plugin-key");
|
|
21
21
|
|
|
22
|
-
// :: () → Plugin
|
|
23
|
-
//
|
|
24
|
-
// Creates a [plugin](http://prosemirror.net/docs/ref/#state.Plugin)
|
|
25
|
-
// that, when added to an editor, enables cell-selection, handles
|
|
26
|
-
// cell-based copy/paste, and makes sure tables stay well-formed (each
|
|
27
|
-
// row has the same width, and cells don't overlap).
|
|
28
|
-
//
|
|
29
|
-
// You should probably put this plugin near the end of your array of
|
|
30
|
-
// plugins, since it handles mouse and arrow key events in tables
|
|
31
|
-
// rather broadly, and other plugins, like the gap cursor or the
|
|
32
|
-
// column-width dragging plugin, might want to get a turn first to
|
|
33
|
-
// perform more specific behavior.
|
|
34
22
|
function tableEditing() {
|
|
35
23
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
36
24
|
_ref$allowTableNodeSe = _ref.allowTableNodeSelection,
|
|
@@ -45,7 +33,8 @@ function tableEditing() {
|
|
|
45
33
|
init: function init() {
|
|
46
34
|
return null;
|
|
47
35
|
},
|
|
48
|
-
apply: function apply(
|
|
36
|
+
apply: function apply(unsafeTr, cur) {
|
|
37
|
+
var tr = unsafeTr;
|
|
49
38
|
var set = tr.getMeta(_pluginKey.tableEditingKey);
|
|
50
39
|
|
|
51
40
|
if (set != null) {
|
|
@@ -42,7 +42,7 @@ function handlePaste(view, event, slice) {
|
|
|
42
42
|
var rect = _tableMap.TableMap.get(table).rectBetween(sel.$anchorCell.pos - start, sel.$headCell.pos - start);
|
|
43
43
|
|
|
44
44
|
cells = (0, _copyPaste.clipCells)(cells, rect.right - rect.left, rect.bottom - rect.top);
|
|
45
|
-
(0, _copyPaste.insertCells)(view.state, view.dispatch, start, rect, cells);
|
|
45
|
+
(0, _copyPaste.insertCells)(view.state, view.dispatch, start, rect, clearColumnWidthOfCells(cells));
|
|
46
46
|
return true;
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -55,9 +55,20 @@ function handlePaste(view, event, slice) {
|
|
|
55
55
|
|
|
56
56
|
var _start = $cell.start(-1);
|
|
57
57
|
|
|
58
|
-
(0, _copyPaste.insertCells)(view.state, view.dispatch, _start, _tableMap.TableMap.get($cell.node(-1)).findCell($cell.pos - _start), cells);
|
|
58
|
+
(0, _copyPaste.insertCells)(view.state, view.dispatch, _start, _tableMap.TableMap.get($cell.node(-1)).findCell($cell.pos - _start), clearColumnWidthOfCells(cells));
|
|
59
59
|
return true;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
return false;
|
|
63
|
-
}
|
|
63
|
+
} // Clear the pasted cells column widths so that it maintains
|
|
64
|
+
// the column widths of the destination table
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
var clearColumnWidthOfCells = function clearColumnWidthOfCells(cells) {
|
|
68
|
+
cells.rows.forEach(function (row) {
|
|
69
|
+
for (var i = 0; i < row.childCount; i++) {
|
|
70
|
+
row.child(i).attrs.colwidth = null;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return cells;
|
|
74
|
+
};
|
package/dist/cjs/version.json
CHANGED
|
@@ -26,7 +26,7 @@ export function handlePaste(view, event, slice) {
|
|
|
26
26
|
const start = sel.$anchorCell.start(-1);
|
|
27
27
|
const rect = TableMap.get(table).rectBetween(sel.$anchorCell.pos - start, sel.$headCell.pos - start);
|
|
28
28
|
cells = clipCells(cells, rect.right - rect.left, rect.bottom - rect.top);
|
|
29
|
-
insertCells(view.state, view.dispatch, start, rect, cells);
|
|
29
|
+
insertCells(view.state, view.dispatch, start, rect, clearColumnWidthOfCells(cells));
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -38,9 +38,19 @@ export function handlePaste(view, event, slice) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const start = $cell.start(-1);
|
|
41
|
-
insertCells(view.state, view.dispatch, start, TableMap.get($cell.node(-1)).findCell($cell.pos - start), cells);
|
|
41
|
+
insertCells(view.state, view.dispatch, start, TableMap.get($cell.node(-1)).findCell($cell.pos - start), clearColumnWidthOfCells(cells));
|
|
42
42
|
return true;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
return false;
|
|
46
|
-
}
|
|
46
|
+
} // Clear the pasted cells column widths so that it maintains
|
|
47
|
+
// the column widths of the destination table
|
|
48
|
+
|
|
49
|
+
const clearColumnWidthOfCells = cells => {
|
|
50
|
+
cells.rows.forEach(row => {
|
|
51
|
+
for (let i = 0; i < row.childCount; i++) {
|
|
52
|
+
row.child(i).attrs.colwidth = null;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return cells;
|
|
56
|
+
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -26,7 +26,7 @@ export function handlePaste(view, event, slice) {
|
|
|
26
26
|
var start = sel.$anchorCell.start(-1);
|
|
27
27
|
var rect = TableMap.get(table).rectBetween(sel.$anchorCell.pos - start, sel.$headCell.pos - start);
|
|
28
28
|
cells = clipCells(cells, rect.right - rect.left, rect.bottom - rect.top);
|
|
29
|
-
insertCells(view.state, view.dispatch, start, rect, cells);
|
|
29
|
+
insertCells(view.state, view.dispatch, start, rect, clearColumnWidthOfCells(cells));
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -39,9 +39,19 @@ export function handlePaste(view, event, slice) {
|
|
|
39
39
|
|
|
40
40
|
var _start = $cell.start(-1);
|
|
41
41
|
|
|
42
|
-
insertCells(view.state, view.dispatch, _start, TableMap.get($cell.node(-1)).findCell($cell.pos - _start), cells);
|
|
42
|
+
insertCells(view.state, view.dispatch, _start, TableMap.get($cell.node(-1)).findCell($cell.pos - _start), clearColumnWidthOfCells(cells));
|
|
43
43
|
return true;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
return false;
|
|
47
|
-
}
|
|
47
|
+
} // Clear the pasted cells column widths so that it maintains
|
|
48
|
+
// the column widths of the destination table
|
|
49
|
+
|
|
50
|
+
var clearColumnWidthOfCells = function clearColumnWidthOfCells(cells) {
|
|
51
|
+
cells.rows.forEach(function (row) {
|
|
52
|
+
for (var i = 0; i < row.childCount; i++) {
|
|
53
|
+
row.child(i).attrs.colwidth = null;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return cells;
|
|
57
|
+
};
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-tables",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "A package that contains common classes and utility functions for editor tables",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"prosemirror-view": "1.23.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^
|
|
33
|
-
"@atlaskit/editor-test-helpers": "^
|
|
32
|
+
"@atlaskit/adf-schema": "^23.0.0",
|
|
33
|
+
"@atlaskit/editor-test-helpers": "^17.0.0",
|
|
34
34
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1"
|
|
35
35
|
},
|
|
36
36
|
"techstack": {
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"import-structure": "atlassian-conventions"
|
|
42
42
|
},
|
|
43
43
|
"@repo/internal": {
|
|
44
|
-
"deprecation": "no-deprecated-imports"
|
|
44
|
+
"deprecation": "no-deprecated-imports",
|
|
45
|
+
"theming": "tokens"
|
|
45
46
|
}
|
|
46
47
|
},
|
|
47
48
|
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
|