@atlaskit/editor-plugin-table 1.3.1 → 1.4.1
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 +22 -0
- package/dist/cjs/plugins/table/commands/misc.js +1 -2
- package/dist/cjs/plugins/table/index.js +25 -34
- package/dist/cjs/plugins/table/transforms/column-width.js +0 -17
- package/dist/cjs/plugins/table/transforms/delete-columns.js +4 -13
- package/dist/cjs/plugins/table/transforms/delete-rows.js +4 -13
- package/dist/cjs/plugins/table/transforms/fix-tables.js +6 -24
- package/dist/cjs/plugins/table/transforms/index.js +0 -13
- package/dist/cjs/plugins/table/transforms/merge.js +5 -20
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/commands/misc.js +2 -3
- package/dist/es2019/plugins/table/index.js +21 -33
- package/dist/es2019/plugins/table/transforms/column-width.js +0 -17
- package/dist/es2019/plugins/table/transforms/delete-columns.js +4 -13
- package/dist/es2019/plugins/table/transforms/delete-rows.js +4 -13
- package/dist/es2019/plugins/table/transforms/fix-tables.js +0 -14
- package/dist/es2019/plugins/table/transforms/index.js +1 -2
- package/dist/es2019/plugins/table/transforms/merge.js +5 -21
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/commands/misc.js +2 -3
- package/dist/esm/plugins/table/index.js +25 -34
- package/dist/esm/plugins/table/transforms/column-width.js +0 -17
- package/dist/esm/plugins/table/transforms/delete-columns.js +4 -13
- package/dist/esm/plugins/table/transforms/delete-rows.js +4 -13
- package/dist/esm/plugins/table/transforms/fix-tables.js +0 -17
- package/dist/esm/plugins/table/transforms/index.js +1 -2
- package/dist/esm/plugins/table/transforms/merge.js +5 -21
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/index.d.ts +9 -0
- package/dist/types/plugins/table/transforms/fix-tables.d.ts +0 -1
- package/dist/types/plugins/table/transforms/index.d.ts +1 -2
- package/dist/types-ts4.5/i18n/cs.d.ts +35 -0
- package/dist/types-ts4.5/i18n/da.d.ts +33 -0
- package/dist/types-ts4.5/i18n/de.d.ts +33 -0
- package/dist/types-ts4.5/i18n/en.d.ts +35 -0
- package/dist/types-ts4.5/i18n/en_GB.d.ts +35 -0
- package/dist/types-ts4.5/i18n/es.d.ts +33 -0
- package/dist/types-ts4.5/i18n/fi.d.ts +33 -0
- package/dist/types-ts4.5/i18n/fr.d.ts +35 -0
- package/dist/types-ts4.5/i18n/hu.d.ts +35 -0
- package/dist/types-ts4.5/i18n/it.d.ts +35 -0
- package/dist/types-ts4.5/i18n/ja.d.ts +35 -0
- package/dist/types-ts4.5/i18n/ko.d.ts +33 -0
- package/dist/types-ts4.5/i18n/nb.d.ts +33 -0
- package/dist/types-ts4.5/i18n/nl.d.ts +35 -0
- package/dist/types-ts4.5/i18n/pl.d.ts +35 -0
- package/dist/types-ts4.5/i18n/pt_BR.d.ts +35 -0
- package/dist/types-ts4.5/i18n/ru.d.ts +35 -0
- package/dist/types-ts4.5/i18n/sv.d.ts +33 -0
- package/dist/types-ts4.5/i18n/th.d.ts +33 -0
- package/dist/types-ts4.5/i18n/tr.d.ts +35 -0
- package/dist/types-ts4.5/i18n/uk.d.ts +35 -0
- package/dist/types-ts4.5/i18n/vi.d.ts +33 -0
- package/dist/types-ts4.5/i18n/zh.d.ts +35 -0
- package/dist/types-ts4.5/i18n/zh_TW.d.ts +35 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/commands/clear.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/commands/collapse.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/commands/go-to-next-cell.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/commands/hover.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/commands/index.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/commands/insert.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +27 -0
- package/dist/types-ts4.5/plugins/table/commands/referentiality.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/commands/selection.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/commands/split-cell.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/commands/toggle.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +26 -0
- package/dist/types-ts4.5/plugins/table/create-plugin-config.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/handlers.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/index.d.ts +30 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +25 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +73 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +34 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/tableCell.d.ts +19 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +24 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/update-overflow-shadows.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +7 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/index.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/types.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/default-table-selection.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/keymap.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-factory.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/commands.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/index.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +72 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/types.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/util.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-local-id.d.ts +22 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/commands.d.ts +25 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/index.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/reducer.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +14 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +13 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +22 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +29 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +17 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +22 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-selection-keymap.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/reducer.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/toolbar.d.ts +37 -0
- package/dist/types-ts4.5/plugins/table/transforms/column-width.d.ts +18 -0
- package/dist/types-ts4.5/plugins/table/transforms/delete-columns.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/transforms/delete-rows.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/transforms/fix-tables.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/transforms/index.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/transforms/merge.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/transforms/replace-table.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/transforms/split.d.ts +9 -0
- package/dist/types-ts4.5/plugins/table/types.d.ts +332 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/index.d.ts +29 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualButton/styles.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +88 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/index.d.ts +23 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingContextualMenu/styles.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +14 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/index.d.ts +54 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingDeleteButton/types.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/index.d.ts +35 -0
- package/dist/types-ts4.5/plugins/table/ui/LayoutButton/index.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +21 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +17 -0
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +40 -0
- package/dist/types-ts4.5/plugins/table/ui/common-styles.d.ts +8 -0
- package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +39 -0
- package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +58 -0
- package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +15 -0
- package/dist/types-ts4.5/plugins/table/utils/analytics.d.ts +18 -0
- package/dist/types-ts4.5/plugins/table/utils/collapse.d.ts +29 -0
- package/dist/types-ts4.5/plugins/table/utils/column-controls.d.ts +10 -0
- package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +20 -0
- package/dist/types-ts4.5/plugins/table/utils/get-allow-add-column-custom-step.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/utils/index.d.ts +11 -0
- package/dist/types-ts4.5/plugins/table/utils/nodes.d.ts +12 -0
- package/dist/types-ts4.5/plugins/table/utils/paste.d.ts +14 -0
- package/dist/types-ts4.5/plugins/table/utils/row-controls.d.ts +16 -0
- package/dist/types-ts4.5/plugins/table/utils/selection.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/utils/table.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/utils/update-plugin-state-decorations.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table-plugin.d.ts +2 -0
- package/dist/types-ts4.5/types/i18n.d.ts +5 -0
- package/examples/99-testing.tsx +4 -94
- package/package.json +8 -6
- package/report.api.md +11 -0
- package/src/__tests__/unit/analytics.ts +6 -0
- package/src/__tests__/unit/collab.ts +6 -0
- package/src/__tests__/unit/color-picker.ts +4 -0
- package/src/__tests__/unit/commands/go-to-next-cell.ts +8 -1
- package/src/__tests__/unit/commands/insert.ts +6 -0
- package/src/__tests__/unit/commands/misc.ts +14 -6
- package/src/__tests__/unit/commands/sort.ts +19 -12
- package/src/__tests__/unit/commands.ts +10 -2
- package/src/__tests__/unit/copy-paste.ts +6 -0
- package/src/__tests__/unit/event-handlers/index.ts +13 -8
- package/src/__tests__/unit/event-handlers.ts +13 -1
- package/src/__tests__/unit/fix-tables.ts +8 -4
- package/src/__tests__/unit/get-toolbar-config.ts +4 -0
- package/src/__tests__/unit/handlers.ts +8 -1
- package/src/__tests__/unit/hover-selection.ts +8 -1
- package/src/__tests__/unit/index.ts +10 -2
- package/src/__tests__/unit/keymap.ts +10 -4
- package/src/__tests__/unit/layout.ts +4 -0
- package/src/__tests__/unit/nodeviews/cell.ts +6 -0
- package/src/__tests__/unit/nodeviews/table.ts +16 -9
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +14 -4
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +8 -1
- package/src/__tests__/unit/pm-plugins/main-with-allow-collapse.ts +4 -0
- package/src/__tests__/unit/pm-plugins/main.ts +6 -0
- package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +8 -4
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +13 -4
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +6 -0
- package/src/__tests__/unit/pm-plugins/table-selection-keymap.ts +6 -0
- package/src/__tests__/unit/sort-column.ts +6 -0
- package/src/__tests__/unit/toolbar.ts +16 -9
- package/src/__tests__/unit/transforms/delete-columns.ts +8 -1
- package/src/__tests__/unit/transforms/delete-rows.ts +8 -1
- package/src/__tests__/unit/transforms/merging.ts +8 -1
- package/src/__tests__/unit/ui/ContextualMenu.tsx +8 -4
- package/src/__tests__/unit/ui/CornerControls.tsx +8 -1
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +8 -1
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +8 -1
- package/src/__tests__/unit/ui/RowControls.tsx +8 -1
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +8 -1
- package/src/__tests__/unit/undo-redo.ts +6 -0
- package/src/__tests__/unit/utils/collapse.ts +4 -0
- package/src/__tests__/unit/utils/nodes.ts +8 -1
- package/src/__tests__/unit/utils/row-controls.ts +8 -1
- package/src/__tests__/unit/utils.ts +8 -1
- package/src/plugins/table/commands/misc.ts +2 -4
- package/src/plugins/table/index.tsx +39 -40
- package/src/plugins/table/transforms/column-width.ts +0 -11
- package/src/plugins/table/transforms/delete-columns.ts +4 -5
- package/src/plugins/table/transforms/delete-rows.ts +4 -7
- package/src/plugins/table/transforms/fix-tables.ts +0 -17
- package/src/plugins/table/transforms/index.ts +1 -2
- package/src/plugins/table/transforms/merge.ts +9 -20
- package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +0 -79
- package/dist/cjs/plugins/table/transforms/metadata.js +0 -20
- package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +0 -71
- package/dist/es2019/plugins/table/transforms/metadata.js +0 -12
- package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +0 -71
- package/dist/esm/plugins/table/transforms/metadata.js +0 -14
- package/dist/types/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.d.ts +0 -4
- package/dist/types/plugins/table/transforms/metadata.d.ts +0 -21
- package/src/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.ts +0 -78
- package/src/plugins/table/transforms/metadata.ts +0 -35
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 1.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 1.4.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [`8a391616ecc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8a391616ecc) - Moving insert node API to a new editor plugin to allow it to be more extensible. Also exposing a new editor plugin action for tables to allow for consistent insertion.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`5cc449dac8d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5cc449dac8d) - Decouple card plugin so that it uses new NextEditorPlugin for any injected dependencies.
|
|
19
|
+
- [`b804d3ad561`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b804d3ad561) - Remove unused code related to GASv2 table analytics from editor-plugin table, editor-core and editor-common
|
|
20
|
+
- [`6550d08f5af`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6550d08f5af) - [ux] Color picker button should not be focused after selecting color.
|
|
21
|
+
- [`f621ae6490a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f621ae6490a) - Adding type dependency on analytics plugin to tables plugin.
|
|
22
|
+
- [`a142ba1aa28`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a142ba1aa28) - [ED17172] Bump prosemirror-model to 1.16.0 and prosemirror-view to 1.23.7 and removed work-arounds for fixed issues
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 1.3.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -275,9 +275,8 @@ var setMultipleCellAttrs = function setMultipleCellAttrs(attrs, targetCellPositi
|
|
|
275
275
|
cursorPos = cell.pos;
|
|
276
276
|
}
|
|
277
277
|
if (tr.docChanged && cursorPos !== undefined) {
|
|
278
|
-
var $pos = tr.doc.resolve(tr.mapping.map(cursorPos));
|
|
279
278
|
if (dispatch) {
|
|
280
|
-
dispatch(tr
|
|
279
|
+
dispatch(tr);
|
|
281
280
|
}
|
|
282
281
|
return true;
|
|
283
282
|
}
|
|
@@ -18,7 +18,6 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
18
18
|
var _icons = require("@atlaskit/editor-common/icons");
|
|
19
19
|
var _createPluginConfig = require("./create-plugin-config");
|
|
20
20
|
var _tableLocalId = require("./pm-plugins/table-local-id");
|
|
21
|
-
var _safariDelayedDomSelectionSyncingWorkaround = require("./pm-plugins/safari-delayed-dom-selection-syncing-workaround");
|
|
22
21
|
var _safariDeleteCompositionTextIssueWorkaround = require("./pm-plugins/safari-delete-composition-text-issue-workaround");
|
|
23
22
|
var _plugin = require("./pm-plugins/decorations/plugin");
|
|
24
23
|
var _keymap = require("./pm-plugins/keymap");
|
|
@@ -38,7 +37,7 @@ var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
|
|
|
38
37
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
39
38
|
return {};
|
|
40
39
|
};
|
|
41
|
-
var tablesPlugin = function tablesPlugin(options) {
|
|
40
|
+
var tablesPlugin = function tablesPlugin(options, api) {
|
|
42
41
|
var editorViewRef = {
|
|
43
42
|
current: null
|
|
44
43
|
};
|
|
@@ -58,6 +57,25 @@ var tablesPlugin = function tablesPlugin(options) {
|
|
|
58
57
|
};
|
|
59
58
|
return {
|
|
60
59
|
name: 'table',
|
|
60
|
+
actions: {
|
|
61
|
+
insertTable: function insertTable(analyticsPayload) {
|
|
62
|
+
return function (state, dispatch) {
|
|
63
|
+
var _api$dependencies$con, _api$dependencies, _api$dependencies$con2, _api$dependencies$con3;
|
|
64
|
+
var node = (0, _utils2.createTable)({
|
|
65
|
+
schema: state.schema
|
|
66
|
+
});
|
|
67
|
+
return (_api$dependencies$con = api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$con2 = _api$dependencies.contentInsertion) === null || _api$dependencies$con2 === void 0 ? void 0 : (_api$dependencies$con3 = _api$dependencies$con2.actions) === null || _api$dependencies$con3 === void 0 ? void 0 : _api$dependencies$con3.insert({
|
|
68
|
+
state: state,
|
|
69
|
+
dispatch: dispatch,
|
|
70
|
+
node: node,
|
|
71
|
+
options: {
|
|
72
|
+
selectNodeInserted: false,
|
|
73
|
+
analyticsPayload: analyticsPayload
|
|
74
|
+
}
|
|
75
|
+
})) !== null && _api$dependencies$con !== void 0 ? _api$dependencies$con : false;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
},
|
|
61
79
|
nodes: function nodes() {
|
|
62
80
|
return [{
|
|
63
81
|
name: 'table',
|
|
@@ -81,7 +99,9 @@ var tablesPlugin = function tablesPlugin(options) {
|
|
|
81
99
|
dispatch = _ref.dispatch,
|
|
82
100
|
portalProviderAPI = _ref.portalProviderAPI,
|
|
83
101
|
eventDispatcher = _ref.eventDispatcher;
|
|
84
|
-
var _ref2 = options || {
|
|
102
|
+
var _ref2 = options || {
|
|
103
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : api.dependencies.analytics.actions
|
|
104
|
+
},
|
|
85
105
|
fullWidthEnabled = _ref2.fullWidthEnabled,
|
|
86
106
|
wasFullWidthEnabled = _ref2.wasFullWidthEnabled,
|
|
87
107
|
breakoutEnabled = _ref2.breakoutEnabled,
|
|
@@ -175,21 +195,6 @@ var tablesPlugin = function tablesPlugin(options) {
|
|
|
175
195
|
}
|
|
176
196
|
}];
|
|
177
197
|
|
|
178
|
-
// workaround for prosemirrors delayed dom selection syncing during pointer drag
|
|
179
|
-
// causing issues with table selections in Safari
|
|
180
|
-
// https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
|
|
181
|
-
|
|
182
|
-
// NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
|
|
183
|
-
// https://github.com/ProseMirror/prosemirror-view/pull/116
|
|
184
|
-
if (_utils.browser.safari) {
|
|
185
|
-
plugins.push({
|
|
186
|
-
name: 'tableSafariDelayedDomSelectionSyncingWorkaround',
|
|
187
|
-
plugin: function plugin() {
|
|
188
|
-
return (0, _safariDelayedDomSelectionSyncingWorkaround.createPlugin)();
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
|
|
193
198
|
// Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
|
|
194
199
|
// https://github.com/ProseMirror/prosemirror/issues/934
|
|
195
200
|
if (_utils.browser.safari) {
|
|
@@ -300,22 +305,8 @@ var tablesPlugin = function tablesPlugin(options) {
|
|
|
300
305
|
}));
|
|
301
306
|
},
|
|
302
307
|
pluginsOptions: {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
createNodeHandler: function createNodeHandler(_ref11) {
|
|
306
|
-
var nodeName = _ref11.nodeName,
|
|
307
|
-
schema = _ref11.schema;
|
|
308
|
-
// An EditorPlugin may manage more than one node.
|
|
309
|
-
if (nodeName !== 'table') {
|
|
310
|
-
return null;
|
|
311
|
-
}
|
|
312
|
-
var table = (0, _utils2.createTable)({
|
|
313
|
-
schema: schema
|
|
314
|
-
});
|
|
315
|
-
return table;
|
|
316
|
-
},
|
|
317
|
-
quickInsert: function quickInsert(_ref12) {
|
|
318
|
-
var formatMessage = _ref12.formatMessage;
|
|
308
|
+
quickInsert: function quickInsert(_ref11) {
|
|
309
|
+
var formatMessage = _ref11.formatMessage;
|
|
319
310
|
return [{
|
|
320
311
|
id: 'table',
|
|
321
312
|
title: formatMessage(_messages.toolbarInsertBlockMessages.table),
|
|
@@ -10,7 +10,6 @@ var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
|
10
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
11
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
12
|
var _utils = require("../pm-plugins/table-resizing/utils");
|
|
13
|
-
var _metadata = require("./metadata");
|
|
14
13
|
var _resizeState = require("../pm-plugins/table-resizing/utils/resize-state");
|
|
15
14
|
var _misc = require("../pm-plugins/table-resizing/utils/misc");
|
|
16
15
|
var _scaleTable = require("../pm-plugins/table-resizing/utils/scale-table");
|
|
@@ -32,14 +31,6 @@ var updateColumnWidths = function updateColumnWidths(resizeState, table, start)
|
|
|
32
31
|
var attrs = updatedCellsAttrs[cellPos] || _objectSpread({}, table.nodeAt(cellPos).attrs);
|
|
33
32
|
var colspan = attrs.colspan || 1;
|
|
34
33
|
if (attrs.colwidth && attrs.colwidth.length > colspan) {
|
|
35
|
-
tr = (0, _metadata.setMeta)({
|
|
36
|
-
type: 'UPDATE_COLUMN_WIDTHS',
|
|
37
|
-
problem: 'COLWIDTHS_BEFORE_UPDATE',
|
|
38
|
-
data: {
|
|
39
|
-
colwidths: attrs.colwidth,
|
|
40
|
-
colspan: colspan
|
|
41
|
-
}
|
|
42
|
-
})(tr);
|
|
43
34
|
attrs.colwidth = attrs.colwidth.slice(0, colspan);
|
|
44
35
|
}
|
|
45
36
|
|
|
@@ -58,14 +49,6 @@ var updateColumnWidths = function updateColumnWidths(resizeState, table, start)
|
|
|
58
49
|
});
|
|
59
50
|
colwidths[colspanIndex] = width;
|
|
60
51
|
if (colwidths.length > colspan) {
|
|
61
|
-
tr = (0, _metadata.setMeta)({
|
|
62
|
-
type: 'UPDATE_COLUMN_WIDTHS',
|
|
63
|
-
problem: 'COLWIDTHS_AFTER_UPDATE',
|
|
64
|
-
data: {
|
|
65
|
-
colwidths: colwidths,
|
|
66
|
-
colspan: colspan
|
|
67
|
-
}
|
|
68
|
-
})(tr);
|
|
69
52
|
colwidths = colwidths.slice(0, colspan);
|
|
70
53
|
}
|
|
71
54
|
updatedCellsAttrs[cellPos] = _objectSpread(_objectSpread({}, attrs), {}, {
|
|
@@ -11,7 +11,6 @@ var _prosemirrorState = require("prosemirror-state");
|
|
|
11
11
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
12
12
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
13
13
|
var _steps = require("@atlaskit/adf-schema/steps");
|
|
14
|
-
var _metadata = require("./metadata");
|
|
15
14
|
var _split = require("./split");
|
|
16
15
|
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; }
|
|
17
16
|
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; }
|
|
@@ -140,25 +139,17 @@ var deleteColumnsLegacy = function deleteColumnsLegacy(rect) {
|
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
if (!rows.length) {
|
|
143
|
-
return
|
|
144
|
-
type: 'DELETE_COLUMNS',
|
|
145
|
-
problem: 'EMPTY_TABLE'
|
|
146
|
-
})(tr);
|
|
142
|
+
return tr;
|
|
147
143
|
}
|
|
148
144
|
var newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
|
|
149
145
|
var fixedTable = fixRowSpans(newTable);
|
|
150
146
|
if (fixedTable === null) {
|
|
151
|
-
return
|
|
152
|
-
type: 'DELETE_COLUMNS',
|
|
153
|
-
problem: 'FIX_ROWSPANS'
|
|
154
|
-
})(tr);
|
|
147
|
+
return tr;
|
|
155
148
|
}
|
|
156
149
|
var cursorPos = getNextCursorPos(newTable, columnsToDelete);
|
|
157
|
-
return (
|
|
158
|
-
type: 'DELETE_COLUMNS'
|
|
159
|
-
})(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
150
|
+
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
160
151
|
// move cursor to the left of the deleted columns if possible, otherwise - to the first column
|
|
161
|
-
.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(table.pos + cursorPos)))
|
|
152
|
+
.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
|
162
153
|
};
|
|
163
154
|
};
|
|
164
155
|
function getNextCursorPos(table, deletedColumns) {
|
|
@@ -11,7 +11,6 @@ var _prosemirrorState = require("prosemirror-state");
|
|
|
11
11
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
12
12
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
13
13
|
var _merge = require("./merge");
|
|
14
|
-
var _metadata = require("./metadata");
|
|
15
14
|
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; }
|
|
16
15
|
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; }
|
|
17
16
|
var deleteRows = function deleteRows(rect) {
|
|
@@ -108,25 +107,17 @@ var deleteRows = function deleteRows(rect) {
|
|
|
108
107
|
_loop(rowIndex);
|
|
109
108
|
}
|
|
110
109
|
if (!rows.length) {
|
|
111
|
-
return
|
|
112
|
-
type: 'DELETE_ROWS',
|
|
113
|
-
problem: 'EMPTY_TABLE'
|
|
114
|
-
})(tr);
|
|
110
|
+
return tr;
|
|
115
111
|
}
|
|
116
112
|
var newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
|
|
117
113
|
var fixedTable = (0, _merge.mergeEmptyColumns)(newTable);
|
|
118
114
|
if (fixedTable === null) {
|
|
119
|
-
return
|
|
120
|
-
type: 'DELETE_ROWS',
|
|
121
|
-
problem: 'REMOVE_EMPTY_COLUMNS'
|
|
122
|
-
})(tr);
|
|
115
|
+
return tr;
|
|
123
116
|
}
|
|
124
117
|
var cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
125
|
-
return (
|
|
126
|
-
type: 'DELETE_ROWS'
|
|
127
|
-
})(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
118
|
+
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
128
119
|
// move cursor before the deleted rows if possible, otherwise - to the first row
|
|
129
|
-
.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(table.pos + cursorPos)))
|
|
120
|
+
.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
|
130
121
|
};
|
|
131
122
|
};
|
|
132
123
|
exports.deleteRows = deleteRows;
|
|
@@ -4,28 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.removeExtraneousColumnWidths = exports.fixTables = exports.fixAutoSizedTable =
|
|
7
|
+
exports.removeExtraneousColumnWidths = exports.fixTables = exports.fixAutoSizedTable = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
10
10
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
11
|
-
var _utils = require("
|
|
12
|
-
var _utils2 = require("../pm-plugins/table-resizing/utils");
|
|
11
|
+
var _utils = require("../pm-plugins/table-resizing/utils");
|
|
13
12
|
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; }
|
|
14
13
|
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; }
|
|
15
|
-
var fireAnalytics = function fireAnalytics() {
|
|
16
|
-
var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
17
|
-
return (0, _utils.sendLogs)({
|
|
18
|
-
events: [{
|
|
19
|
-
name: 'atlaskit.fabric.editor.fixtable',
|
|
20
|
-
product: 'atlaskit',
|
|
21
|
-
properties: properties,
|
|
22
|
-
serverTime: new Date().getTime(),
|
|
23
|
-
server: 'local',
|
|
24
|
-
user: '-'
|
|
25
|
-
}]
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
exports.fireAnalytics = fireAnalytics;
|
|
29
14
|
var validateTableCellNodeAttrs = function validateTableCellNodeAttrs(_ref, reportInvalidTableCellSpanAttrs) {
|
|
30
15
|
var colspan = _ref.colspan,
|
|
31
16
|
rowspan = _ref.rowspan,
|
|
@@ -81,9 +66,6 @@ var removeExtraneousColumnWidths = function removeExtraneousColumnWidths(node, b
|
|
|
81
66
|
return cell;
|
|
82
67
|
});
|
|
83
68
|
if (hasProblems) {
|
|
84
|
-
fireAnalytics({
|
|
85
|
-
message: 'removeExtraneousColumnWidths'
|
|
86
|
-
});
|
|
87
69
|
return true;
|
|
88
70
|
}
|
|
89
71
|
return false;
|
|
@@ -123,7 +105,7 @@ var fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, ta
|
|
|
123
105
|
return acc + current;
|
|
124
106
|
}, 0);
|
|
125
107
|
var tableLayout = getLayoutBasedOnWidth(totalContentWidth);
|
|
126
|
-
var maxLayoutSize = (0,
|
|
108
|
+
var maxLayoutSize = (0, _utils.getLayoutSize)(tableLayout, opts.containerWidth, {});
|
|
127
109
|
|
|
128
110
|
// Content width will generally not meet the constraints of the layout
|
|
129
111
|
// whether it be below or above, so we scale our columns widths
|
|
@@ -169,9 +151,9 @@ function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
|
|
|
169
151
|
var colspan = Number(currentCol.getAttribute('colspan') || 1);
|
|
170
152
|
for (var span = 0; span < colspan; span++) {
|
|
171
153
|
var colIdx = col + span;
|
|
172
|
-
var cells = (0,
|
|
173
|
-
var colWidth = (0,
|
|
174
|
-
return (0,
|
|
154
|
+
var cells = (0, _utils.getCellsRefsInColumn)(colIdx, tableNode, tableStart, domAtPos);
|
|
155
|
+
var colWidth = (0, _utils.calculateColumnWidth)(cells, function (_, col) {
|
|
156
|
+
return (0, _utils.contentWidth)(col, tableRef).width;
|
|
175
157
|
});
|
|
176
158
|
cols[colIdx] = Math.max(colWidth, _styles.tableCellMinWidth);
|
|
177
159
|
}
|
|
@@ -21,12 +21,6 @@ Object.defineProperty(exports, "deleteRows", {
|
|
|
21
21
|
return _deleteRows.deleteRows;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "fireAnalytics", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _fixTables.fireAnalytics;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
24
|
Object.defineProperty(exports, "fixAutoSizedTable", {
|
|
31
25
|
enumerable: true,
|
|
32
26
|
get: function get() {
|
|
@@ -57,12 +51,6 @@ Object.defineProperty(exports, "replaceSelectedTable", {
|
|
|
57
51
|
return _replaceTable.replaceSelectedTable;
|
|
58
52
|
}
|
|
59
53
|
});
|
|
60
|
-
Object.defineProperty(exports, "setMeta", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function get() {
|
|
63
|
-
return _metadata.setMeta;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
54
|
Object.defineProperty(exports, "updateColumnWidths", {
|
|
67
55
|
enumerable: true,
|
|
68
56
|
get: function get() {
|
|
@@ -74,5 +62,4 @@ var _merge = require("./merge");
|
|
|
74
62
|
var _deleteColumns = require("./delete-columns");
|
|
75
63
|
var _deleteRows = require("./delete-rows");
|
|
76
64
|
var _columnWidth = require("./column-width");
|
|
77
|
-
var _metadata = require("./metadata");
|
|
78
65
|
var _replaceTable = require("./replace-table");
|
|
@@ -13,7 +13,6 @@ var _prosemirrorState = require("prosemirror-state");
|
|
|
13
13
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
14
14
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
15
15
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
16
|
-
var _metadata = require("./metadata");
|
|
17
16
|
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; }
|
|
18
17
|
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; }
|
|
19
18
|
// re-creates table node with merged cells
|
|
@@ -60,10 +59,7 @@ function mergeCells(tr) {
|
|
|
60
59
|
}
|
|
61
60
|
var rowspan = rect.bottom - rect.top;
|
|
62
61
|
if (rowspan < 1) {
|
|
63
|
-
return
|
|
64
|
-
type: 'MERGE_CELLS',
|
|
65
|
-
problem: 'NEGATIVE_ROWSPAN'
|
|
66
|
-
})(tr);
|
|
62
|
+
return tr;
|
|
67
63
|
}
|
|
68
64
|
// update colspan and rowspan of the merged cell to span the selection
|
|
69
65
|
var attrs = addColSpan(_objectSpread(_objectSpread({}, cell.attrs), {}, {
|
|
@@ -91,10 +87,7 @@ function mergeCells(tr) {
|
|
|
91
87
|
if (_rowspan && _rowspan + _i - 1 >= rows.length) {
|
|
92
88
|
rowChanged = true;
|
|
93
89
|
if (_rowspan < 2) {
|
|
94
|
-
return
|
|
95
|
-
type: 'MERGE_CELLS',
|
|
96
|
-
problem: 'NEGATIVE_ROWSPAN'
|
|
97
|
-
})(tr);
|
|
90
|
+
return tr;
|
|
98
91
|
}
|
|
99
92
|
cells.push(_cell.type.createChecked(_objectSpread(_objectSpread({}, _cell.attrs), {}, {
|
|
100
93
|
rowspan: _rowspan - 1
|
|
@@ -112,22 +105,14 @@ function mergeCells(tr) {
|
|
|
112
105
|
|
|
113
106
|
// empty tables? cancel merging like nothing happened
|
|
114
107
|
if (!rows.length) {
|
|
115
|
-
return
|
|
116
|
-
type: 'MERGE_CELLS',
|
|
117
|
-
problem: 'EMPTY_TABLE'
|
|
118
|
-
})(tr);
|
|
108
|
+
return tr;
|
|
119
109
|
}
|
|
120
110
|
var newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
|
|
121
111
|
var fixedTable = mergeEmptyColumns(newTable);
|
|
122
112
|
if (fixedTable === null) {
|
|
123
|
-
return
|
|
124
|
-
type: 'MERGE_CELLS',
|
|
125
|
-
problem: 'REMOVE_EMPTY_COLUMNS'
|
|
126
|
-
})(tr);
|
|
113
|
+
return tr;
|
|
127
114
|
}
|
|
128
|
-
return (
|
|
129
|
-
type: 'MERGE_CELLS'
|
|
130
|
-
})(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable).setSelection(_prosemirrorState.Selection.near(tr.doc.resolve((mergedCellPos || 0) + table.start))));
|
|
115
|
+
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable).setSelection(_prosemirrorState.Selection.near(tr.doc.resolve((mergedCellPos || 0) + table.start)));
|
|
131
116
|
}
|
|
132
117
|
function canMergeCells(tr) {
|
|
133
118
|
var selection = tr.selection;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// #region Imports
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { TextSelection } from 'prosemirror-state';
|
|
4
4
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
5
5
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
6
6
|
import { selectionCell, findCellClosestToPos, findTable, getCellsInColumn, getCellsInRow, getSelectionRect, isSelectionType, removeTable, selectColumn as selectColumnTransform, selectRow as selectRowTransform, setCellAttrs, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
@@ -270,9 +270,8 @@ export const setMultipleCellAttrs = (attrs, targetCellPosition) => (state, dispa
|
|
|
270
270
|
cursorPos = cell.pos;
|
|
271
271
|
}
|
|
272
272
|
if (tr.docChanged && cursorPos !== undefined) {
|
|
273
|
-
const $pos = tr.doc.resolve(tr.mapping.map(cursorPos));
|
|
274
273
|
if (dispatch) {
|
|
275
|
-
dispatch(tr
|
|
274
|
+
dispatch(tr);
|
|
276
275
|
}
|
|
277
276
|
return true;
|
|
278
277
|
}
|
|
@@ -11,7 +11,6 @@ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/
|
|
|
11
11
|
import { IconTable } from '@atlaskit/editor-common/icons';
|
|
12
12
|
import { pluginConfig } from './create-plugin-config';
|
|
13
13
|
import { createPlugin as createTableLocalIdPlugin } from './pm-plugins/table-local-id';
|
|
14
|
-
import { createPlugin as createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin } from './pm-plugins/safari-delayed-dom-selection-syncing-workaround';
|
|
15
14
|
import { createPlugin as createTableSafariDeleteCompositionTextIssueWorkaroundPlugin } from './pm-plugins/safari-delete-composition-text-issue-workaround';
|
|
16
15
|
import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
|
|
17
16
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
@@ -29,7 +28,7 @@ import LayoutButton from './ui/LayoutButton';
|
|
|
29
28
|
import { isLayoutSupported } from './utils';
|
|
30
29
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
31
30
|
const defaultGetEditorFeatureFlags = () => ({});
|
|
32
|
-
const tablesPlugin = options => {
|
|
31
|
+
const tablesPlugin = (options, api) => {
|
|
33
32
|
const editorViewRef = {
|
|
34
33
|
current: null
|
|
35
34
|
};
|
|
@@ -53,6 +52,23 @@ const tablesPlugin = options => {
|
|
|
53
52
|
};
|
|
54
53
|
return {
|
|
55
54
|
name: 'table',
|
|
55
|
+
actions: {
|
|
56
|
+
insertTable: analyticsPayload => (state, dispatch) => {
|
|
57
|
+
var _api$dependencies$con, _api$dependencies, _api$dependencies$con2, _api$dependencies$con3;
|
|
58
|
+
const node = createTable({
|
|
59
|
+
schema: state.schema
|
|
60
|
+
});
|
|
61
|
+
return (_api$dependencies$con = api === null || api === void 0 ? void 0 : (_api$dependencies = api.dependencies) === null || _api$dependencies === void 0 ? void 0 : (_api$dependencies$con2 = _api$dependencies.contentInsertion) === null || _api$dependencies$con2 === void 0 ? void 0 : (_api$dependencies$con3 = _api$dependencies$con2.actions) === null || _api$dependencies$con3 === void 0 ? void 0 : _api$dependencies$con3.insert({
|
|
62
|
+
state,
|
|
63
|
+
dispatch,
|
|
64
|
+
node,
|
|
65
|
+
options: {
|
|
66
|
+
selectNodeInserted: false,
|
|
67
|
+
analyticsPayload
|
|
68
|
+
}
|
|
69
|
+
})) !== null && _api$dependencies$con !== void 0 ? _api$dependencies$con : false;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
56
72
|
nodes() {
|
|
57
73
|
return [{
|
|
58
74
|
name: 'table',
|
|
@@ -84,7 +100,9 @@ const tablesPlugin = options => {
|
|
|
84
100
|
tableOptions,
|
|
85
101
|
editorAnalyticsAPI,
|
|
86
102
|
getEditorFeatureFlags
|
|
87
|
-
} = options || {
|
|
103
|
+
} = options || {
|
|
104
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : api.dependencies.analytics.actions
|
|
105
|
+
};
|
|
88
106
|
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI);
|
|
89
107
|
}
|
|
90
108
|
}, {
|
|
@@ -164,21 +182,6 @@ const tablesPlugin = options => {
|
|
|
164
182
|
}
|
|
165
183
|
}];
|
|
166
184
|
|
|
167
|
-
// workaround for prosemirrors delayed dom selection syncing during pointer drag
|
|
168
|
-
// causing issues with table selections in Safari
|
|
169
|
-
// https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
|
|
170
|
-
|
|
171
|
-
// NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
|
|
172
|
-
// https://github.com/ProseMirror/prosemirror-view/pull/116
|
|
173
|
-
if (browser.safari) {
|
|
174
|
-
plugins.push({
|
|
175
|
-
name: 'tableSafariDelayedDomSelectionSyncingWorkaround',
|
|
176
|
-
plugin: () => {
|
|
177
|
-
return createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin();
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
|
|
182
185
|
// Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
|
|
183
186
|
// https://github.com/ProseMirror/prosemirror/issues/934
|
|
184
187
|
if (browser.safari) {
|
|
@@ -296,21 +299,6 @@ const tablesPlugin = options => {
|
|
|
296
299
|
}));
|
|
297
300
|
},
|
|
298
301
|
pluginsOptions: {
|
|
299
|
-
// TODO: ED-14676 This is not the final API design
|
|
300
|
-
// For now, we are using this on (insert-api/api.ts) but we may create a proper place for it
|
|
301
|
-
createNodeHandler: ({
|
|
302
|
-
nodeName,
|
|
303
|
-
schema
|
|
304
|
-
}) => {
|
|
305
|
-
// An EditorPlugin may manage more than one node.
|
|
306
|
-
if (nodeName !== 'table') {
|
|
307
|
-
return null;
|
|
308
|
-
}
|
|
309
|
-
const table = createTable({
|
|
310
|
-
schema
|
|
311
|
-
});
|
|
312
|
-
return table;
|
|
313
|
-
},
|
|
314
302
|
quickInsert: ({
|
|
315
303
|
formatMessage
|
|
316
304
|
}) => [{
|
|
@@ -2,7 +2,6 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
2
2
|
import { tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
|
|
5
|
-
import { setMeta } from './metadata';
|
|
6
5
|
import { getResizeState, normaliseTableLayout } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
7
6
|
import { getTableMaxWidth } from '../pm-plugins/table-resizing/utils/misc';
|
|
8
7
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
@@ -26,14 +25,6 @@ export const updateColumnWidths = (resizeState, table, start) => tr => {
|
|
|
26
25
|
};
|
|
27
26
|
const colspan = attrs.colspan || 1;
|
|
28
27
|
if (attrs.colwidth && attrs.colwidth.length > colspan) {
|
|
29
|
-
tr = setMeta({
|
|
30
|
-
type: 'UPDATE_COLUMN_WIDTHS',
|
|
31
|
-
problem: 'COLWIDTHS_BEFORE_UPDATE',
|
|
32
|
-
data: {
|
|
33
|
-
colwidths: attrs.colwidth,
|
|
34
|
-
colspan
|
|
35
|
-
}
|
|
36
|
-
})(tr);
|
|
37
28
|
attrs.colwidth = attrs.colwidth.slice(0, colspan);
|
|
38
29
|
}
|
|
39
30
|
|
|
@@ -50,14 +41,6 @@ export const updateColumnWidths = (resizeState, table, start) => tr => {
|
|
|
50
41
|
}, _ => 0);
|
|
51
42
|
colwidths[colspanIndex] = width;
|
|
52
43
|
if (colwidths.length > colspan) {
|
|
53
|
-
tr = setMeta({
|
|
54
|
-
type: 'UPDATE_COLUMN_WIDTHS',
|
|
55
|
-
problem: 'COLWIDTHS_AFTER_UPDATE',
|
|
56
|
-
data: {
|
|
57
|
-
colwidths,
|
|
58
|
-
colspan
|
|
59
|
-
}
|
|
60
|
-
})(tr);
|
|
61
44
|
colwidths = colwidths.slice(0, colspan);
|
|
62
45
|
}
|
|
63
46
|
updatedCellsAttrs[cellPos] = {
|
|
@@ -2,7 +2,6 @@ import { Selection } from 'prosemirror-state';
|
|
|
2
2
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
4
|
import { AddColumnStep } from '@atlaskit/adf-schema/steps';
|
|
5
|
-
import { setMeta } from './metadata';
|
|
6
5
|
import { splitCellsInColumns } from './split';
|
|
7
6
|
const deleteColumnsCustomStep = rect => tr => {
|
|
8
7
|
const table = findTable(tr.selection);
|
|
@@ -124,25 +123,17 @@ const deleteColumnsLegacy = rect => tr => {
|
|
|
124
123
|
}
|
|
125
124
|
}
|
|
126
125
|
if (!rows.length) {
|
|
127
|
-
return
|
|
128
|
-
type: 'DELETE_COLUMNS',
|
|
129
|
-
problem: 'EMPTY_TABLE'
|
|
130
|
-
})(tr);
|
|
126
|
+
return tr;
|
|
131
127
|
}
|
|
132
128
|
const newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
|
|
133
129
|
const fixedTable = fixRowSpans(newTable);
|
|
134
130
|
if (fixedTable === null) {
|
|
135
|
-
return
|
|
136
|
-
type: 'DELETE_COLUMNS',
|
|
137
|
-
problem: 'FIX_ROWSPANS'
|
|
138
|
-
})(tr);
|
|
131
|
+
return tr;
|
|
139
132
|
}
|
|
140
133
|
const cursorPos = getNextCursorPos(newTable, columnsToDelete);
|
|
141
|
-
return
|
|
142
|
-
type: 'DELETE_COLUMNS'
|
|
143
|
-
})(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
134
|
+
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
144
135
|
// move cursor to the left of the deleted columns if possible, otherwise - to the first column
|
|
145
|
-
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)))
|
|
136
|
+
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
|
146
137
|
};
|
|
147
138
|
function getNextCursorPos(table, deletedColumns) {
|
|
148
139
|
const minColumn = Math.min(...deletedColumns);
|
|
@@ -2,7 +2,6 @@ import { Selection } from 'prosemirror-state';
|
|
|
2
2
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
4
|
import { mergeEmptyColumns } from './merge';
|
|
5
|
-
import { setMeta } from './metadata';
|
|
6
5
|
export const deleteRows = (rect, isHeaderRowRequired = false) => tr => {
|
|
7
6
|
const table = findTable(tr.selection);
|
|
8
7
|
if (!table) {
|
|
@@ -90,25 +89,17 @@ export const deleteRows = (rect, isHeaderRowRequired = false) => tr => {
|
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
91
|
if (!rows.length) {
|
|
93
|
-
return
|
|
94
|
-
type: 'DELETE_ROWS',
|
|
95
|
-
problem: 'EMPTY_TABLE'
|
|
96
|
-
})(tr);
|
|
92
|
+
return tr;
|
|
97
93
|
}
|
|
98
94
|
const newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
|
|
99
95
|
const fixedTable = mergeEmptyColumns(newTable);
|
|
100
96
|
if (fixedTable === null) {
|
|
101
|
-
return
|
|
102
|
-
type: 'DELETE_ROWS',
|
|
103
|
-
problem: 'REMOVE_EMPTY_COLUMNS'
|
|
104
|
-
})(tr);
|
|
97
|
+
return tr;
|
|
105
98
|
}
|
|
106
99
|
const cursorPos = getNextCursorPos(newTable, rowsToDelete);
|
|
107
|
-
return
|
|
108
|
-
type: 'DELETE_ROWS'
|
|
109
|
-
})(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
100
|
+
return tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable)
|
|
110
101
|
// move cursor before the deleted rows if possible, otherwise - to the first row
|
|
111
|
-
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)))
|
|
102
|
+
.setSelection(Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
|
112
103
|
};
|
|
113
104
|
function getNextCursorPos(table, deletedRows) {
|
|
114
105
|
const minRow = Math.min(...deletedRows);
|