@atlaskit/editor-plugin-table 0.0.0 → 0.0.2
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 +23 -0
- package/dist/cjs/plugins/table/commands/clear.js +64 -0
- package/dist/cjs/plugins/table/commands/collapse.js +24 -0
- package/dist/cjs/plugins/table/commands/go-to-next-cell.js +66 -0
- package/dist/cjs/plugins/table/commands/hover.js +183 -0
- package/dist/cjs/plugins/table/commands/index.js +235 -0
- package/dist/cjs/plugins/table/commands/insert.js +186 -0
- package/dist/cjs/plugins/table/commands/misc.js +509 -0
- package/dist/cjs/plugins/table/commands/selection.js +419 -0
- package/dist/cjs/plugins/table/commands/sort.js +94 -0
- package/dist/cjs/plugins/table/commands/split-cell.js +38 -0
- package/dist/cjs/plugins/table/commands/toggle.js +124 -0
- package/dist/cjs/plugins/table/commands-with-analytics.js +543 -0
- package/dist/cjs/plugins/table/create-plugin-config.js +31 -0
- package/dist/cjs/plugins/table/event-handlers.js +441 -0
- package/dist/cjs/plugins/table/handlers.js +155 -0
- package/dist/cjs/plugins/table/index.js +374 -0
- package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +182 -0
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +610 -0
- package/dist/cjs/plugins/table/nodeviews/table.js +261 -0
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +123 -0
- package/dist/cjs/plugins/table/nodeviews/types.js +5 -0
- package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +67 -0
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +81 -0
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +88 -0
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +55 -0
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +21 -0
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/index.js +35 -0
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/types.js +5 -0
- package/dist/cjs/plugins/table/pm-plugins/default-table-selection.js +12 -0
- package/dist/cjs/plugins/table/pm-plugins/keymap.js +59 -0
- package/dist/cjs/plugins/table/pm-plugins/main.js +308 -0
- package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +65 -0
- package/dist/cjs/plugins/table/pm-plugins/plugin-key.js +11 -0
- package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +79 -0
- package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +118 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/commands.js +30 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/index.js +51 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +46 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +590 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-key.js +11 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-state.js +68 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +34 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/types.js +5 -0
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/util.js +25 -0
- package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +205 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +158 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +182 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/index.js +29 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-factory.js +40 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-key.js +11 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin.js +70 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/reducer.js +46 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +71 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/column-state.js +107 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/content-width.js +112 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +158 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/index.js +209 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +115 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-column.js +19 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +279 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +364 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +132 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/types.js +5 -0
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.js +12 -0
- package/dist/cjs/plugins/table/pm-plugins/table-selection-keymap.js +23 -0
- package/dist/cjs/plugins/table/reducer.js +107 -0
- package/dist/cjs/plugins/table/todo-stubs.js +10 -0
- package/dist/cjs/plugins/table/toolbar.js +325 -0
- package/dist/cjs/plugins/table/transforms/column-width.js +196 -0
- package/dist/cjs/plugins/table/transforms/delete-columns.js +293 -0
- package/dist/cjs/plugins/table/transforms/delete-rows.js +176 -0
- package/dist/cjs/plugins/table/transforms/fix-tables.js +250 -0
- package/dist/cjs/plugins/table/transforms/index.js +85 -0
- package/dist/cjs/plugins/table/transforms/merge.js +349 -0
- package/dist/cjs/plugins/table/transforms/metadata.js +23 -0
- package/dist/cjs/plugins/table/transforms/replace-table.js +48 -0
- package/dist/cjs/plugins/table/transforms/split.js +92 -0
- package/dist/cjs/plugins/table/types.js +106 -0
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +194 -0
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +26 -0
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +529 -0
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +116 -0
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/styles.js +34 -0
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +49 -0
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +71 -0
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +365 -0
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/types.js +5 -0
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +118 -0
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +108 -0
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +244 -0
- package/dist/cjs/plugins/table/ui/LayoutButton/index.js +255 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +140 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +146 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +135 -0
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +229 -0
- package/dist/cjs/plugins/table/ui/common-styles.js +48 -0
- package/dist/cjs/plugins/table/ui/consts.js +109 -0
- package/dist/cjs/plugins/table/ui/messages.js +48 -0
- package/dist/cjs/plugins/table/ui/ui-styles.js +116 -0
- package/dist/cjs/plugins/table/utils/analytics.js +86 -0
- package/dist/cjs/plugins/table/utils/collapse.js +98 -0
- package/dist/cjs/plugins/table/utils/column-controls.js +234 -0
- package/dist/cjs/plugins/table/utils/decoration.js +405 -0
- package/dist/cjs/plugins/table/utils/dom.js +224 -0
- package/dist/cjs/plugins/table/utils/get-allow-add-column-custom-step.js +13 -0
- package/dist/cjs/plugins/table/utils/index.js +355 -0
- package/dist/cjs/plugins/table/utils/nodes.js +159 -0
- package/dist/cjs/plugins/table/utils/paste.js +148 -0
- package/dist/cjs/plugins/table/utils/referentiality.js +29 -0
- package/dist/cjs/plugins/table/utils/row-controls.js +254 -0
- package/dist/cjs/plugins/table/utils/selection.js +116 -0
- package/dist/cjs/plugins/table/utils/table.js +48 -0
- package/dist/cjs/plugins/table/utils/update-plugin-state-decorations.js +16 -0
- package/dist/cjs/plugins/table-plugin.js +4 -45
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/commands/clear.js +48 -0
- package/dist/es2019/plugins/table/commands/collapse.js +14 -0
- package/dist/es2019/plugins/table/commands/go-to-next-cell.js +47 -0
- package/dist/es2019/plugins/table/commands/hover.js +117 -0
- package/dist/es2019/plugins/table/commands/index.js +7 -0
- package/dist/es2019/plugins/table/commands/insert.js +141 -0
- package/dist/es2019/plugins/table/commands/misc.js +405 -0
- package/dist/es2019/plugins/table/commands/selection.js +369 -0
- package/dist/es2019/plugins/table/commands/sort.js +74 -0
- package/dist/es2019/plugins/table/commands/split-cell.js +29 -0
- package/dist/es2019/plugins/table/commands/toggle.js +76 -0
- package/dist/es2019/plugins/table/commands-with-analytics.js +409 -0
- package/dist/es2019/plugins/table/create-plugin-config.js +14 -0
- package/dist/es2019/plugins/table/event-handlers.js +387 -0
- package/dist/es2019/plugins/table/handlers.js +123 -0
- package/dist/es2019/plugins/table/index.js +340 -0
- package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +159 -0
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +578 -0
- package/dist/es2019/plugins/table/nodeviews/table.js +200 -0
- package/dist/es2019/plugins/table/nodeviews/tableCell.js +77 -0
- package/dist/es2019/plugins/table/nodeviews/types.js +1 -0
- package/dist/es2019/plugins/table/nodeviews/update-overflow-shadows.js +52 -0
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +52 -0
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +67 -0
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-resizing.js +27 -0
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +7 -0
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/index.js +3 -0
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/types.js +1 -0
- package/dist/es2019/plugins/table/pm-plugins/default-table-selection.js +5 -0
- package/dist/es2019/plugins/table/pm-plugins/keymap.js +34 -0
- package/dist/es2019/plugins/table/pm-plugins/main.js +274 -0
- package/dist/es2019/plugins/table/pm-plugins/plugin-factory.js +46 -0
- package/dist/es2019/plugins/table/pm-plugins/plugin-key.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +66 -0
- package/dist/es2019/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +106 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/commands.js +9 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/index.js +5 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +34 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +546 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin-key.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin-state.js +47 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin.js +17 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/types.js +1 -0
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/util.js +14 -0
- package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +203 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/commands.js +109 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +173 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/index.js +3 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin-factory.js +20 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin-key.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin.js +58 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/reducer.js +31 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +45 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/column-state.js +78 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/content-width.js +97 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +124 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/index.js +9 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +90 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-column.js +8 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +221 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +276 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +105 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/types.js +1 -0
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.js +1 -0
- package/dist/es2019/plugins/table/pm-plugins/table-selection-keymap.js +10 -0
- package/dist/es2019/plugins/table/reducer.js +103 -0
- package/dist/es2019/plugins/table/todo-stubs.js +1 -0
- package/dist/es2019/plugins/table/toolbar.js +287 -0
- package/dist/es2019/plugins/table/transforms/column-width.js +163 -0
- package/dist/es2019/plugins/table/transforms/delete-columns.js +247 -0
- package/dist/es2019/plugins/table/transforms/delete-rows.js +135 -0
- package/dist/es2019/plugins/table/transforms/fix-tables.js +218 -0
- package/dist/es2019/plugins/table/transforms/index.js +7 -0
- package/dist/es2019/plugins/table/transforms/merge.js +312 -0
- package/dist/es2019/plugins/table/transforms/metadata.js +11 -0
- package/dist/es2019/plugins/table/transforms/replace-table.js +33 -0
- package/dist/es2019/plugins/table/transforms/split.js +72 -0
- package/dist/es2019/plugins/table/types.js +84 -0
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +142 -0
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/styles.js +28 -0
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +482 -0
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +99 -0
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/styles.js +48 -0
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +36 -0
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +59 -0
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +302 -0
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/types.js +1 -0
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +96 -0
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +96 -0
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +199 -0
- package/dist/es2019/plugins/table/ui/LayoutButton/index.js +195 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +95 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +91 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/index.js +82 -0
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +158 -0
- package/dist/es2019/plugins/table/ui/common-styles.js +647 -0
- package/dist/es2019/plugins/table/ui/consts.js +61 -0
- package/dist/es2019/plugins/table/ui/messages.js +38 -0
- package/dist/es2019/plugins/table/ui/ui-styles.js +398 -0
- package/dist/es2019/plugins/table/utils/analytics.js +65 -0
- package/dist/es2019/plugins/table/utils/collapse.js +84 -0
- package/dist/es2019/plugins/table/utils/column-controls.js +178 -0
- package/dist/es2019/plugins/table/utils/decoration.js +346 -0
- package/dist/es2019/plugins/table/utils/dom.js +160 -0
- package/dist/es2019/plugins/table/utils/get-allow-add-column-custom-step.js +5 -0
- package/dist/es2019/plugins/table/utils/index.js +10 -0
- package/dist/es2019/plugins/table/utils/nodes.js +104 -0
- package/dist/es2019/plugins/table/utils/paste.js +117 -0
- package/dist/es2019/plugins/table/utils/referentiality.js +18 -0
- package/dist/es2019/plugins/table/utils/row-controls.js +210 -0
- package/dist/es2019/plugins/table/utils/selection.js +95 -0
- package/dist/es2019/plugins/table/utils/table.js +27 -0
- package/dist/es2019/plugins/table/utils/update-plugin-state-decorations.js +3 -0
- package/dist/es2019/plugins/table-plugin.js +1 -44
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/commands/clear.js +48 -0
- package/dist/esm/plugins/table/commands/collapse.js +14 -0
- package/dist/esm/plugins/table/commands/go-to-next-cell.js +50 -0
- package/dist/esm/plugins/table/commands/hover.js +149 -0
- package/dist/esm/plugins/table/commands/index.js +7 -0
- package/dist/esm/plugins/table/commands/insert.js +153 -0
- package/dist/esm/plugins/table/commands/misc.js +427 -0
- package/dist/esm/plugins/table/commands/selection.js +401 -0
- package/dist/esm/plugins/table/commands/sort.js +79 -0
- package/dist/esm/plugins/table/commands/split-cell.js +28 -0
- package/dist/esm/plugins/table/commands/toggle.js +97 -0
- package/dist/esm/plugins/table/commands-with-analytics.js +464 -0
- package/dist/esm/plugins/table/create-plugin-config.js +20 -0
- package/dist/esm/plugins/table/event-handlers.js +387 -0
- package/dist/esm/plugins/table/handlers.js +140 -0
- package/dist/esm/plugins/table/index.js +338 -0
- package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +177 -0
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +596 -0
- package/dist/esm/plugins/table/nodeviews/table.js +235 -0
- package/dist/esm/plugins/table/nodeviews/tableCell.js +111 -0
- package/dist/esm/plugins/table/nodeviews/types.js +1 -0
- package/dist/esm/plugins/table/nodeviews/update-overflow-shadows.js +54 -0
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +58 -0
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +71 -0
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-resizing.js +40 -0
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +12 -0
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/index.js +3 -0
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/types.js +1 -0
- package/dist/esm/plugins/table/pm-plugins/default-table-selection.js +5 -0
- package/dist/esm/plugins/table/pm-plugins/keymap.js +36 -0
- package/dist/esm/plugins/table/pm-plugins/main.js +278 -0
- package/dist/esm/plugins/table/pm-plugins/plugin-factory.js +51 -0
- package/dist/esm/plugins/table/pm-plugins/plugin-key.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +66 -0
- package/dist/esm/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +102 -0
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/commands.js +17 -0
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/index.js +5 -0
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +34 -0
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +588 -0
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin-key.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin-state.js +57 -0
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin.js +21 -0
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/types.js +1 -0
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/util.js +16 -0
- package/dist/esm/plugins/table/pm-plugins/table-local-id.js +205 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/commands.js +127 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +159 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/index.js +3 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin-factory.js +26 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin-key.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin.js +52 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/reducer.js +35 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +50 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/column-state.js +80 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/content-width.js +104 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +125 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/index.js +9 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +88 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-column.js +8 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +257 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +320 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +109 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/types.js +1 -0
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.js +3 -0
- package/dist/esm/plugins/table/pm-plugins/table-selection-keymap.js +10 -0
- package/dist/esm/plugins/table/reducer.js +95 -0
- package/dist/esm/plugins/table/todo-stubs.js +1 -0
- package/dist/esm/plugins/table/toolbar.js +290 -0
- package/dist/esm/plugins/table/transforms/column-width.js +175 -0
- package/dist/esm/plugins/table/transforms/delete-columns.js +271 -0
- package/dist/esm/plugins/table/transforms/delete-rows.js +156 -0
- package/dist/esm/plugins/table/transforms/fix-tables.js +229 -0
- package/dist/esm/plugins/table/transforms/index.js +7 -0
- package/dist/esm/plugins/table/transforms/merge.js +324 -0
- package/dist/esm/plugins/table/transforms/metadata.js +13 -0
- package/dist/esm/plugins/table/transforms/replace-table.js +34 -0
- package/dist/esm/plugins/table/transforms/split.js +82 -0
- package/dist/esm/plugins/table/types.js +90 -0
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +167 -0
- package/dist/esm/plugins/table/ui/FloatingContextualButton/styles.js +11 -0
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +501 -0
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +96 -0
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/styles.js +15 -0
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +37 -0
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +61 -0
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +333 -0
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/types.js +1 -0
- package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +90 -0
- package/dist/esm/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +96 -0
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +214 -0
- package/dist/esm/plugins/table/ui/LayoutButton/index.js +227 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +120 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +126 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/index.js +113 -0
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +207 -0
- package/dist/esm/plugins/table/ui/common-styles.js +25 -0
- package/dist/esm/plugins/table/ui/consts.js +61 -0
- package/dist/esm/plugins/table/ui/messages.js +38 -0
- package/dist/esm/plugins/table/ui/ui-styles.js +73 -0
- package/dist/esm/plugins/table/utils/analytics.js +71 -0
- package/dist/esm/plugins/table/utils/collapse.js +84 -0
- package/dist/esm/plugins/table/utils/column-controls.js +202 -0
- package/dist/esm/plugins/table/utils/decoration.js +366 -0
- package/dist/esm/plugins/table/utils/dom.js +175 -0
- package/dist/esm/plugins/table/utils/get-allow-add-column-custom-step.js +5 -0
- package/dist/esm/plugins/table/utils/index.js +10 -0
- package/dist/esm/plugins/table/utils/nodes.js +112 -0
- package/dist/esm/plugins/table/utils/paste.js +115 -0
- package/dist/esm/plugins/table/utils/referentiality.js +20 -0
- package/dist/esm/plugins/table/utils/row-controls.js +221 -0
- package/dist/esm/plugins/table/utils/selection.js +96 -0
- package/dist/esm/plugins/table/utils/table.js +30 -0
- package/dist/esm/plugins/table/utils/update-plugin-state-decorations.js +5 -0
- package/dist/esm/plugins/table-plugin.js +1 -42
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/commands/clear.d.ts +3 -0
- package/dist/types/plugins/table/commands/collapse.d.ts +2 -0
- package/dist/types/plugins/table/commands/go-to-next-cell.d.ts +4 -0
- package/dist/types/plugins/table/commands/hover.d.ts +8 -0
- package/dist/types/plugins/table/commands/index.d.ts +7 -0
- package/dist/types/plugins/table/commands/insert.d.ts +10 -0
- package/dist/types/plugins/table/commands/misc.d.ts +27 -0
- package/dist/types/plugins/table/commands/selection.d.ts +8 -0
- package/dist/types/plugins/table/commands/sort.d.ts +3 -0
- package/dist/types/plugins/table/commands/split-cell.d.ts +6 -0
- package/dist/types/plugins/table/commands/toggle.d.ts +12 -0
- package/dist/types/plugins/table/commands-with-analytics.d.ts +26 -0
- package/dist/types/plugins/table/create-plugin-config.d.ts +2 -0
- package/dist/types/plugins/table/event-handlers.d.ts +16 -0
- package/dist/types/plugins/table/handlers.d.ts +3 -0
- package/dist/types/plugins/table/index.d.ts +17 -0
- package/dist/types/plugins/table/nodeviews/OverflowShadowsObserver.d.ts +26 -0
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +72 -0
- package/dist/types/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.d.ts +9 -0
- package/dist/types/plugins/table/nodeviews/__mocks__/OverridableMock.d.ts +9 -0
- package/dist/types/plugins/table/nodeviews/table.d.ts +31 -0
- package/dist/types/plugins/table/nodeviews/tableCell.d.ts +19 -0
- package/dist/types/plugins/table/nodeviews/types.d.ts +23 -0
- package/dist/types/plugins/table/nodeviews/update-overflow-shadows.d.ts +8 -0
- package/dist/types/plugins/table/pm-plugins/decorations/plugin.d.ts +7 -0
- package/dist/types/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +2 -0
- package/dist/types/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +2 -0
- package/dist/types/plugins/table/pm-plugins/decorations/utils/index.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/decorations/utils/types.d.ts +6 -0
- package/dist/types/plugins/table/pm-plugins/default-table-selection.d.ts +5 -0
- package/dist/types/plugins/table/pm-plugins/keymap.d.ts +5 -0
- package/dist/types/plugins/table/pm-plugins/main.d.ts +8 -0
- package/dist/types/plugins/table/pm-plugins/plugin-factory.d.ts +1 -0
- package/dist/types/plugins/table/pm-plugins/plugin-key.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +15 -0
- package/dist/types/plugins/table/pm-plugins/sticky-headers/commands.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/sticky-headers/index.d.ts +6 -0
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.d.ts +6 -0
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +65 -0
- package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/sticky-headers/types.d.ts +16 -0
- package/dist/types/plugins/table/pm-plugins/sticky-headers/util.d.ts +2 -0
- package/dist/types/plugins/table/pm-plugins/table-local-id.d.ts +22 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/commands.d.ts +25 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/index.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/plugin.d.ts +6 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/reducer.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +8 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/column-state.d.ts +14 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/content-width.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +13 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/index.d.ts +12 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +22 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-column.d.ts +2 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-logic.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +29 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +17 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +22 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.d.ts +1 -0
- package/dist/types/plugins/table/pm-plugins/table-selection-keymap.d.ts +4 -0
- package/dist/types/plugins/table/reducer.d.ts +3 -0
- package/dist/types/plugins/table/todo-stubs.d.ts +1 -0
- package/dist/types/plugins/table/toolbar.d.ts +36 -0
- package/dist/types/plugins/table/transforms/column-width.d.ts +18 -0
- package/dist/types/plugins/table/transforms/delete-columns.d.ts +3 -0
- package/dist/types/plugins/table/transforms/delete-rows.d.ts +3 -0
- package/dist/types/plugins/table/transforms/fix-tables.d.ts +10 -0
- package/dist/types/plugins/table/transforms/index.d.ts +7 -0
- package/dist/types/plugins/table/transforms/merge.d.ts +5 -0
- package/dist/types/plugins/table/transforms/metadata.d.ts +21 -0
- package/dist/types/plugins/table/transforms/replace-table.d.ts +5 -0
- package/dist/types/plugins/table/transforms/split.d.ts +9 -0
- package/dist/types/plugins/table/types.d.ts +328 -0
- package/dist/types/plugins/table/ui/FloatingContextualButton/index.d.ts +29 -0
- package/dist/types/plugins/table/ui/FloatingContextualButton/styles.d.ts +1 -0
- package/dist/types/plugins/table/ui/FloatingContextualMenu/ContextualMenu.d.ts +87 -0
- package/dist/types/plugins/table/ui/FloatingContextualMenu/index.d.ts +22 -0
- package/dist/types/plugins/table/ui/FloatingContextualMenu/styles.d.ts +2 -0
- package/dist/types/plugins/table/ui/FloatingDeleteButton/DeleteButton.d.ts +14 -0
- package/dist/types/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.d.ts +10 -0
- package/dist/types/plugins/table/ui/FloatingDeleteButton/index.d.ts +54 -0
- package/dist/types/plugins/table/ui/FloatingDeleteButton/types.d.ts +1 -0
- package/dist/types/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +12 -0
- package/dist/types/plugins/table/ui/FloatingInsertButton/getPopupOptions.d.ts +3 -0
- package/dist/types/plugins/table/ui/FloatingInsertButton/index.d.ts +35 -0
- package/dist/types/plugins/table/ui/LayoutButton/index.d.ts +21 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/CornerControls/index.d.ts +19 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/NumberColumn/index.d.ts +21 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/RowControls/index.d.ts +17 -0
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +40 -0
- package/dist/types/plugins/table/ui/common-styles.d.ts +4 -0
- package/dist/types/plugins/table/ui/consts.d.ts +39 -0
- package/dist/types/plugins/table/ui/messages.d.ts +38 -0
- package/dist/types/plugins/table/ui/ui-styles.d.ts +15 -0
- package/dist/types/plugins/table/utils/analytics.d.ts +18 -0
- package/dist/types/plugins/table/utils/collapse.d.ts +29 -0
- package/dist/types/plugins/table/utils/column-controls.d.ts +10 -0
- package/dist/types/plugins/table/utils/decoration.d.ts +13 -0
- package/dist/types/plugins/table/utils/dom.d.ts +17 -0
- package/dist/types/plugins/table/utils/get-allow-add-column-custom-step.d.ts +2 -0
- package/dist/types/plugins/table/utils/index.d.ts +11 -0
- package/dist/types/plugins/table/utils/nodes.d.ts +12 -0
- package/dist/types/plugins/table/utils/paste.d.ts +14 -0
- package/dist/types/plugins/table/utils/referentiality.d.ts +2 -0
- package/dist/types/plugins/table/utils/row-controls.d.ts +16 -0
- package/dist/types/plugins/table/utils/selection.d.ts +6 -0
- package/dist/types/plugins/table/utils/table.d.ts +4 -0
- package/dist/types/plugins/table/utils/update-plugin-state-decorations.d.ts +4 -0
- package/dist/types/plugins/table-plugin.d.ts +1 -1
- package/package.json +27 -5
- package/report.api.md +90 -4
- package/src/plugins/table/__tests__/integration/block-node-selection.ts +164 -0
- package/src/plugins/table/__tests__/unit/commands/go-to-next-cell.ts +155 -0
- package/src/plugins/table/__tests__/unit/commands/insert.ts +115 -0
- package/src/plugins/table/__tests__/unit/commands/misc.ts +165 -0
- package/src/plugins/table/__tests__/unit/commands.ts +982 -0
- package/src/plugins/table/__tests__/unit/event-handlers.ts +130 -0
- package/src/plugins/table/__tests__/unit/get-toolbar-config.ts +140 -0
- package/src/plugins/table/__tests__/unit/nodeviews/OverflowShadowsObserver.ts +153 -0
- package/src/plugins/table/__tests__/unit/nodeviews/TableComponent.tsx +388 -0
- package/src/plugins/table/__tests__/unit/nodeviews/table.ts +121 -0
- package/src/plugins/table/__tests__/unit/pm-plugins/decorations/column-controls.ts +34 -0
- package/src/plugins/table/__tests__/unit/pm-plugins/decorations/column-resizing.ts +152 -0
- package/src/plugins/table/__tests__/unit/pm-plugins/decorations/plugin.ts +140 -0
- package/src/plugins/table/__tests__/unit/pm-plugins/main-with-allow-collapse.ts +100 -0
- package/src/plugins/table/__tests__/unit/pm-plugins/main.ts +187 -0
- package/src/plugins/table/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +83 -0
- package/src/plugins/table/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +603 -0
- package/src/plugins/table/__tests__/unit/pm-plugins/table-local-id.ts +515 -0
- package/src/plugins/table/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +86 -0
- package/src/plugins/table/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +134 -0
- package/src/plugins/table/__tests__/unit/pm-plugins/table-selection-keymap.ts +564 -0
- package/src/plugins/table/__tests__/unit/toolbar.ts +240 -0
- package/src/plugins/table/__tests__/unit/utils/collapse.ts +74 -0
- package/src/plugins/table/__tests__/unit/utils/column-controls.ts +61 -0
- package/src/plugins/table/__tests__/visual-regression/__fixtures__/table-with-100-numbered-list-items.json +20272 -0
- package/src/plugins/table/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-should-remove-the-table-column-on-click-1-snap.png +3 -0
- package/src/plugins/table/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +3 -0
- package/src/plugins/table/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-should-remove-the-table-row-on-click-1-snap.png +3 -0
- package/src/plugins/table/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +3 -0
- package/src/plugins/table/__tests__/visual-regression/__image_snapshots__/copy-button-ts-floating-toolbar-copy-button-table-target-node-displays-blue-border-when-copy-button-is-hovered-1-snap.png +3 -0
- package/src/plugins/table/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-1-snap.png +3 -0
- package/src/plugins/table/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-2-snap.png +3 -0
- package/src/plugins/table/__tests__/visual-regression/__image_snapshots__/index-ts-snapshot-test-table-numbered-list-should-not-overflow-table-cell-when-there-are-more-than-100-ordered-list-items-3-snap.png +3 -0
- package/src/plugins/table/__tests__/visual-regression/cell-options-menu.ts +97 -0
- package/src/plugins/table/__tests__/visual-regression/index.ts +42 -0
- package/src/plugins/table/commands/clear.ts +58 -0
- package/src/plugins/table/commands/collapse.ts +16 -0
- package/src/plugins/table/commands/go-to-next-cell.ts +56 -0
- package/src/plugins/table/commands/hover.ts +192 -0
- package/src/plugins/table/commands/index.ts +40 -0
- package/src/plugins/table/commands/insert.ts +174 -0
- package/src/plugins/table/commands/misc.ts +506 -0
- package/src/plugins/table/commands/selection.ts +406 -0
- package/src/plugins/table/commands/sort.ts +109 -0
- package/src/plugins/table/commands/split-cell.ts +28 -0
- package/src/plugins/table/commands/toggle.ts +93 -0
- package/src/plugins/table/commands-with-analytics.ts +523 -0
- package/src/plugins/table/create-plugin-config.ts +18 -0
- package/src/plugins/table/event-handlers.ts +514 -0
- package/src/plugins/table/handlers.ts +169 -0
- package/src/plugins/table/index.tsx +440 -0
- package/src/plugins/table/nodeviews/OverflowShadowsObserver.ts +189 -0
- package/src/plugins/table/nodeviews/TableComponent.tsx +693 -0
- package/src/plugins/table/nodeviews/__mocks__/OverflowShadowsObserver.ts +13 -0
- package/src/plugins/table/nodeviews/__mocks__/OverridableMock.ts +21 -0
- package/src/plugins/table/nodeviews/table.tsx +241 -0
- package/src/plugins/table/nodeviews/tableCell.tsx +110 -0
- package/src/plugins/table/nodeviews/types.ts +29 -0
- package/src/plugins/table/nodeviews/update-overflow-shadows.ts +72 -0
- package/src/plugins/table/pm-plugins/decorations/plugin.ts +74 -0
- package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +89 -0
- package/src/plugins/table/pm-plugins/decorations/utils/column-resizing.ts +46 -0
- package/src/plugins/table/pm-plugins/decorations/utils/compose-decorations.ts +11 -0
- package/src/plugins/table/pm-plugins/decorations/utils/index.ts +6 -0
- package/src/plugins/table/pm-plugins/decorations/utils/types.ts +10 -0
- package/src/plugins/table/pm-plugins/default-table-selection.ts +5 -0
- package/src/plugins/table/pm-plugins/keymap.ts +108 -0
- package/src/plugins/table/pm-plugins/main.ts +399 -0
- package/src/plugins/table/pm-plugins/plugin-factory.ts +43 -0
- package/src/plugins/table/pm-plugins/plugin-key.ts +4 -0
- package/src/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.ts +78 -0
- package/src/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.ts +118 -0
- package/src/plugins/table/pm-plugins/sticky-headers/commands.ts +12 -0
- package/src/plugins/table/pm-plugins/sticky-headers/index.ts +7 -0
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.ts +37 -0
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +658 -0
- package/src/plugins/table/pm-plugins/sticky-headers/plugin-key.ts +6 -0
- package/src/plugins/table/pm-plugins/sticky-headers/plugin-state.ts +55 -0
- package/src/plugins/table/pm-plugins/sticky-headers/plugin.ts +36 -0
- package/src/plugins/table/pm-plugins/sticky-headers/types.ts +20 -0
- package/src/plugins/table/pm-plugins/sticky-headers/util.ts +18 -0
- package/src/plugins/table/pm-plugins/table-local-id.ts +203 -0
- package/src/plugins/table/pm-plugins/table-resizing/commands.ts +168 -0
- package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +218 -0
- package/src/plugins/table/pm-plugins/table-resizing/index.ts +3 -0
- package/src/plugins/table/pm-plugins/table-resizing/plugin-factory.ts +28 -0
- package/src/plugins/table/pm-plugins/table-resizing/plugin-key.ts +6 -0
- package/src/plugins/table/pm-plugins/table-resizing/plugin.ts +79 -0
- package/src/plugins/table/pm-plugins/table-resizing/reducer.ts +40 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/colgroup.ts +58 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/column-state.ts +122 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/content-width.ts +130 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +176 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/index.ts +37 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/misc.ts +136 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/resize-column.ts +23 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/resize-logic.ts +275 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/resize-state.ts +348 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/scale-table.ts +142 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/types.ts +23 -0
- package/src/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.ts +2 -0
- package/src/plugins/table/pm-plugins/table-selection-keymap.ts +32 -0
- package/src/plugins/table/reducer.ts +106 -0
- package/src/plugins/table/todo-stubs.ts +1 -0
- package/src/plugins/table/toolbar.ts +401 -0
- package/src/plugins/table/transforms/column-width.ts +187 -0
- package/src/plugins/table/transforms/delete-columns.ts +251 -0
- package/src/plugins/table/transforms/delete-rows.ts +150 -0
- package/src/plugins/table/transforms/fix-tables.ts +296 -0
- package/src/plugins/table/transforms/index.ts +7 -0
- package/src/plugins/table/transforms/merge.ts +312 -0
- package/src/plugins/table/transforms/metadata.ts +35 -0
- package/src/plugins/table/transforms/replace-table.ts +48 -0
- package/src/plugins/table/transforms/split.ts +99 -0
- package/src/plugins/table/types.ts +345 -0
- package/src/plugins/table/ui/FloatingContextualButton/index.tsx +196 -0
- package/src/plugins/table/ui/FloatingContextualButton/styles.ts +29 -0
- package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +524 -0
- package/src/plugins/table/ui/FloatingContextualMenu/__tests__/ContextualMenu.tsx +55 -0
- package/src/plugins/table/ui/FloatingContextualMenu/__tests__/FloatingContextualMenu.tsx +49 -0
- package/src/plugins/table/ui/FloatingContextualMenu/index.tsx +131 -0
- package/src/plugins/table/ui/FloatingContextualMenu/styles.ts +53 -0
- package/src/plugins/table/ui/FloatingDeleteButton/DeleteButton.tsx +49 -0
- package/src/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.ts +75 -0
- package/src/plugins/table/ui/FloatingDeleteButton/index.tsx +384 -0
- package/src/plugins/table/ui/FloatingDeleteButton/types.ts +1 -0
- package/src/plugins/table/ui/FloatingInsertButton/InsertButton.tsx +132 -0
- package/src/plugins/table/ui/FloatingInsertButton/getPopupOptions.ts +122 -0
- package/src/plugins/table/ui/FloatingInsertButton/index.tsx +268 -0
- package/src/plugins/table/ui/LayoutButton/index.tsx +220 -0
- package/src/plugins/table/ui/TableFloatingControls/CornerControls/index.tsx +105 -0
- package/src/plugins/table/ui/TableFloatingControls/NumberColumn/index.tsx +108 -0
- package/src/plugins/table/ui/TableFloatingControls/RowControls/index.tsx +119 -0
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +202 -0
- package/src/plugins/table/ui/common-styles.ts +726 -0
- package/src/plugins/table/ui/consts.ts +100 -0
- package/src/plugins/table/ui/messages.ts +43 -0
- package/src/plugins/table/ui/ui-styles.ts +459 -0
- package/src/plugins/table/utils/analytics.ts +81 -0
- package/src/plugins/table/utils/collapse.ts +99 -0
- package/src/plugins/table/utils/column-controls.ts +225 -0
- package/src/plugins/table/utils/decoration.ts +456 -0
- package/src/plugins/table/utils/dom.ts +211 -0
- package/src/plugins/table/utils/get-allow-add-column-custom-step.ts +11 -0
- package/src/plugins/table/utils/index.ts +69 -0
- package/src/plugins/table/utils/nodes.ts +140 -0
- package/src/plugins/table/utils/paste.ts +164 -0
- package/src/plugins/table/utils/referentiality.ts +24 -0
- package/src/plugins/table/utils/row-controls.ts +238 -0
- package/src/plugins/table/utils/selection.ts +107 -0
- package/src/plugins/table/utils/table.ts +31 -0
- package/src/plugins/table/utils/update-plugin-state-decorations.ts +14 -0
- package/src/plugins/table-plugin.ts +1 -38
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import { Fragment, Slice } from 'prosemirror-model';
|
|
3
|
+
import { flatten } from 'prosemirror-utils'; // import { flatmap, mapSlice } from '@atlaskit/editor-core/src/utils/slice';
|
|
4
|
+
|
|
5
|
+
import { flatmap, mapSlice } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { getPluginState } from '../pm-plugins/plugin-factory'; // lifts up the content of each cell, returning an array of nodes
|
|
7
|
+
|
|
8
|
+
export var unwrapContentFromTable = function unwrapContentFromTable(maybeTable) {
|
|
9
|
+
var schema = maybeTable.type.schema;
|
|
10
|
+
|
|
11
|
+
if (maybeTable.type === schema.nodes.table) {
|
|
12
|
+
var content = [];
|
|
13
|
+
var _schema$nodes = schema.nodes,
|
|
14
|
+
tableCell = _schema$nodes.tableCell,
|
|
15
|
+
tableHeader = _schema$nodes.tableHeader;
|
|
16
|
+
maybeTable.descendants(function (maybeCell) {
|
|
17
|
+
if (maybeCell.type === tableCell || maybeCell.type === tableHeader) {
|
|
18
|
+
content.push.apply(content, _toConsumableArray(flatten(maybeCell, false).map(function (child) {
|
|
19
|
+
return child.node;
|
|
20
|
+
})));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return true;
|
|
24
|
+
});
|
|
25
|
+
return content;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return maybeTable;
|
|
29
|
+
};
|
|
30
|
+
export var removeTableFromFirstChild = function removeTableFromFirstChild(node, i) {
|
|
31
|
+
return i === 0 ? unwrapContentFromTable(node) : node;
|
|
32
|
+
};
|
|
33
|
+
export var removeTableFromLastChild = function removeTableFromLastChild(node, i, fragment) {
|
|
34
|
+
return i === fragment.childCount - 1 ? unwrapContentFromTable(node) : node;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* When we copy from a table cell with a hardBreak at the end,
|
|
38
|
+
* the slice generated will come with a hardBreak outside of the table.
|
|
39
|
+
* This code will look for that pattern and fix it.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
export var transformSliceToFixHardBreakProblemOnCopyFromCell = function transformSliceToFixHardBreakProblemOnCopyFromCell(slice, schema) {
|
|
43
|
+
var _schema$nodes2 = schema.nodes,
|
|
44
|
+
paragraph = _schema$nodes2.paragraph,
|
|
45
|
+
table = _schema$nodes2.table,
|
|
46
|
+
hardBreak = _schema$nodes2.hardBreak;
|
|
47
|
+
var emptyParagraphNode = paragraph.createAndFill();
|
|
48
|
+
var hardBreakNode = hardBreak === null || hardBreak === void 0 ? void 0 : hardBreak.createAndFill();
|
|
49
|
+
var paragraphNodeSize = emptyParagraphNode ? emptyParagraphNode.nodeSize : 0;
|
|
50
|
+
var hardBreakNodeSize = hardBreakNode ? hardBreakNode.nodeSize : 0;
|
|
51
|
+
var paragraphWithHardBreakSize = paragraphNodeSize + hardBreakNodeSize;
|
|
52
|
+
|
|
53
|
+
if (slice.content.childCount === 2 && slice.content.firstChild && slice.content.lastChild && slice.content.firstChild.type === table && slice.content.lastChild.type === paragraph && slice.content.lastChild.nodeSize === paragraphWithHardBreakSize) {
|
|
54
|
+
var nodes = unwrapContentFromTable(slice.content.firstChild);
|
|
55
|
+
|
|
56
|
+
if (nodes instanceof Array) {
|
|
57
|
+
return new Slice(Fragment.from( // keep only the content and discard the hardBreak
|
|
58
|
+
nodes[0]), slice.openStart, slice.openEnd);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return slice;
|
|
63
|
+
};
|
|
64
|
+
export var transformSliceToRemoveOpenTable = function transformSliceToRemoveOpenTable(slice, schema) {
|
|
65
|
+
var _slice$content$firstC6;
|
|
66
|
+
|
|
67
|
+
// we're removing the table, tableRow and tableCell reducing the open depth by 3
|
|
68
|
+
var depthDecrement = 3; // Case 1: A slice entirely within a single CELL
|
|
69
|
+
|
|
70
|
+
if ( // starts and ends inside of a cell
|
|
71
|
+
slice.openStart >= 4 && slice.openEnd >= 4 && // slice is a table node
|
|
72
|
+
slice.content.childCount === 1 && slice.content.firstChild.type === schema.nodes.table) {
|
|
73
|
+
var _slice$content$firstC, _slice$content$firstC2, _slice$content$firstC3, _slice$content$firstC4, _slice$content$firstC5;
|
|
74
|
+
|
|
75
|
+
// prosemirror-view has a bug that it duplicates table entry when selecting multiple paragraphs in a table cell.
|
|
76
|
+
// https://github.com/ProseMirror/prosemirror/issues/1270
|
|
77
|
+
// The structure becomes
|
|
78
|
+
// table(genuine) > tableRow(genuine) > table(duplicated) > tableRow(duplicated) > tableCell/tableHeader(genuine) > contents(genuine)
|
|
79
|
+
// As we are removing wrapping table anyway, we keep duplicated table and tableRow for simplicity
|
|
80
|
+
var cleaned = slice;
|
|
81
|
+
|
|
82
|
+
if (((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : (_slice$content$firstC2 = _slice$content$firstC.content) === null || _slice$content$firstC2 === void 0 ? void 0 : (_slice$content$firstC3 = _slice$content$firstC2.firstChild) === null || _slice$content$firstC3 === void 0 ? void 0 : (_slice$content$firstC4 = _slice$content$firstC3.content) === null || _slice$content$firstC4 === void 0 ? void 0 : (_slice$content$firstC5 = _slice$content$firstC4.firstChild) === null || _slice$content$firstC5 === void 0 ? void 0 : _slice$content$firstC5.type) === schema.nodes.table) {
|
|
83
|
+
cleaned = new Slice(slice.content.firstChild.content.firstChild.content, slice.openStart - 2, slice.openEnd - 2);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return new Slice(flatmap(cleaned.content, unwrapContentFromTable), cleaned.openStart - depthDecrement, cleaned.openEnd - depthDecrement);
|
|
87
|
+
} // Case 2: A slice starting within a CELL and ending outside the table
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
if ( // starts inside of a cell but ends outside of the starting table
|
|
91
|
+
slice.openStart >= 4 && // slice starts from a table node (and spans across more than one node)
|
|
92
|
+
slice.content.childCount > 1 && ((_slice$content$firstC6 = slice.content.firstChild) === null || _slice$content$firstC6 === void 0 ? void 0 : _slice$content$firstC6.type) === schema.nodes.table) {
|
|
93
|
+
// repoint the slice's cutting depth so that cell content where the slice starts
|
|
94
|
+
// does not get lifted out of the cell on paste
|
|
95
|
+
return new Slice(slice.content, 1, slice.openEnd);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return slice;
|
|
99
|
+
};
|
|
100
|
+
export var transformSliceToCorrectEmptyTableCells = function transformSliceToCorrectEmptyTableCells(slice, schema) {
|
|
101
|
+
var _schema$nodes3 = schema.nodes,
|
|
102
|
+
tableCell = _schema$nodes3.tableCell,
|
|
103
|
+
tableHeader = _schema$nodes3.tableHeader;
|
|
104
|
+
return mapSlice(slice, function (node) {
|
|
105
|
+
if (node && (node.type === tableCell || node.type === tableHeader) && !node.content.childCount) {
|
|
106
|
+
return node.type.createAndFill(node.attrs) || node;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return node;
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
export function isHeaderRowRequired(state) {
|
|
113
|
+
var tableState = getPluginState(state);
|
|
114
|
+
return tableState && tableState.pluginConfig.isHeaderRowRequired;
|
|
115
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export var isReferencedSource = function isReferencedSource(state, localId) {
|
|
2
|
+
var found = false;
|
|
3
|
+
state.doc.descendants(function (node) {
|
|
4
|
+
if (found) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
var dataConsumer = node.marks.find(function (mark) {
|
|
9
|
+
return mark.type === state.schema.marks.dataConsumer;
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
if (!dataConsumer) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
found = (dataConsumer.attrs.sources || []).includes(localId);
|
|
17
|
+
return !found;
|
|
18
|
+
});
|
|
19
|
+
return found;
|
|
20
|
+
};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
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) { _defineProperty(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; }
|
|
6
|
+
|
|
7
|
+
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
8
|
+
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
9
|
+
import { safeInsert } from 'prosemirror-utils';
|
|
10
|
+
import { findTable, getSelectionRect, isRowSelected, isTableSelected } from '@atlaskit/editor-tables/utils'; // import { parsePx } from '@atlaskit/editor-core/src/utils/dom';
|
|
11
|
+
|
|
12
|
+
import { parsePx } from '@atlaskit/editor-common/utils';
|
|
13
|
+
import { TableCssClassName as ClassName } from '../types';
|
|
14
|
+
import { tableDeleteButtonSize } from '../ui/consts';
|
|
15
|
+
export var getRowHeights = function getRowHeights(tableRef) {
|
|
16
|
+
var heights = [];
|
|
17
|
+
|
|
18
|
+
if (tableRef.lastChild) {
|
|
19
|
+
var rows = tableRef.lastChild.childNodes;
|
|
20
|
+
|
|
21
|
+
for (var i = 0, count = rows.length; i < count; i++) {
|
|
22
|
+
var row = rows[i];
|
|
23
|
+
heights[i] = row.getBoundingClientRect().height + 1; // padding only gets applied when the container has sticky
|
|
24
|
+
|
|
25
|
+
if (row.classList.contains('sticky') && i === 0) {
|
|
26
|
+
var styles = window.getComputedStyle(row);
|
|
27
|
+
var paddingTop = parsePx(styles.paddingTop || '');
|
|
28
|
+
heights[i] -= paddingTop ? paddingTop + 1 : +1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return heights;
|
|
34
|
+
};
|
|
35
|
+
export var isRowDeleteButtonVisible = function isRowDeleteButtonVisible(selection) {
|
|
36
|
+
if (!isTableSelected(selection) && selection instanceof CellSelection && selection.isRowSelection()) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return false;
|
|
41
|
+
};
|
|
42
|
+
export var getRowDeleteButtonParams = function getRowDeleteButtonParams(rowsHeights, selection) {
|
|
43
|
+
var offsetTop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
44
|
+
var rect = getSelectionRect(selection);
|
|
45
|
+
|
|
46
|
+
if (!rect) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var height = 0;
|
|
51
|
+
var offset = offsetTop; // find the rows before the selection
|
|
52
|
+
|
|
53
|
+
for (var i = 0; i < rect.top; i++) {
|
|
54
|
+
var rowHeight = rowsHeights[i];
|
|
55
|
+
|
|
56
|
+
if (rowHeight) {
|
|
57
|
+
offset += rowHeight - 1;
|
|
58
|
+
}
|
|
59
|
+
} // these are the selected rows widths
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
var indexes = [];
|
|
63
|
+
|
|
64
|
+
for (var _i = rect.top; _i < rect.bottom; _i++) {
|
|
65
|
+
var _rowHeight = rowsHeights[_i];
|
|
66
|
+
|
|
67
|
+
if (_rowHeight) {
|
|
68
|
+
height += _rowHeight - 1;
|
|
69
|
+
indexes.push(_i);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var top = offset + height / 2 - tableDeleteButtonSize / 2;
|
|
74
|
+
return {
|
|
75
|
+
top: top,
|
|
76
|
+
indexes: indexes
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export var getRowsParams = function getRowsParams(rowsHeights) {
|
|
80
|
+
var rows = [];
|
|
81
|
+
|
|
82
|
+
for (var i = 0, count = rowsHeights.length; i < count; i++) {
|
|
83
|
+
var height = rowsHeights[i];
|
|
84
|
+
|
|
85
|
+
if (!height) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var endIndex = rowsHeights.length;
|
|
90
|
+
|
|
91
|
+
for (var k = i + 1, _count = rowsHeights.length; k < _count; k++) {
|
|
92
|
+
if (rowsHeights[k]) {
|
|
93
|
+
endIndex = k;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
rows.push({
|
|
99
|
+
startIndex: i,
|
|
100
|
+
endIndex: endIndex,
|
|
101
|
+
height: height
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return rows;
|
|
106
|
+
};
|
|
107
|
+
export var getRowClassNames = function getRowClassNames(index, selection) {
|
|
108
|
+
var hoveredRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
109
|
+
var isInDanger = arguments.length > 3 ? arguments[3] : undefined;
|
|
110
|
+
var isResizing = arguments.length > 4 ? arguments[4] : undefined;
|
|
111
|
+
var classNames = [];
|
|
112
|
+
|
|
113
|
+
if (isRowSelected(index)(selection) || hoveredRows.indexOf(index) > -1 && !isResizing) {
|
|
114
|
+
classNames.push(ClassName.HOVERED_CELL_ACTIVE);
|
|
115
|
+
|
|
116
|
+
if (isInDanger) {
|
|
117
|
+
classNames.push(ClassName.HOVERED_CELL_IN_DANGER);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return classNames.join(' ');
|
|
122
|
+
};
|
|
123
|
+
export var copyPreviousRow = function copyPreviousRow(schema) {
|
|
124
|
+
return function (insertNewRowIndex) {
|
|
125
|
+
return function (tr) {
|
|
126
|
+
var table = findTable(tr.selection);
|
|
127
|
+
|
|
128
|
+
if (!table) {
|
|
129
|
+
return tr;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
var map = TableMap.get(table.node);
|
|
133
|
+
var copyPreviousRowIndex = insertNewRowIndex - 1;
|
|
134
|
+
|
|
135
|
+
if (insertNewRowIndex <= 0) {
|
|
136
|
+
throw Error("Row Index less or equal 0 isn't not allowed since there is not a previous to copy");
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (insertNewRowIndex > map.height) {
|
|
140
|
+
return tr;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
var tableNode = table.node;
|
|
144
|
+
var tableRow = schema.nodes.tableRow;
|
|
145
|
+
var cellsInRow = map.cellsInRect({
|
|
146
|
+
left: 0,
|
|
147
|
+
right: map.width,
|
|
148
|
+
top: copyPreviousRowIndex,
|
|
149
|
+
bottom: copyPreviousRowIndex + 1
|
|
150
|
+
});
|
|
151
|
+
var offsetIndexPosition = copyPreviousRowIndex * map.width;
|
|
152
|
+
var offsetNextLineIndexPosition = insertNewRowIndex * map.width;
|
|
153
|
+
var cellsPositionsInOriginalRow = map.map.slice(offsetIndexPosition, offsetIndexPosition + map.width);
|
|
154
|
+
var cellsPositionsInNextRow = map.map.slice(offsetNextLineIndexPosition, offsetNextLineIndexPosition + map.width);
|
|
155
|
+
var cells = [];
|
|
156
|
+
var fixRowspans = [];
|
|
157
|
+
|
|
158
|
+
for (var i = 0; i < cellsPositionsInOriginalRow.length;) {
|
|
159
|
+
var pos = cellsPositionsInOriginalRow[i];
|
|
160
|
+
var documentCellPos = pos + table.start;
|
|
161
|
+
var node = tr.doc.nodeAt(documentCellPos);
|
|
162
|
+
|
|
163
|
+
if (!node) {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
var attributes = _objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
168
|
+
colspan: 1,
|
|
169
|
+
rowspan: 1
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
var newCell = node.type.createAndFill(attributes);
|
|
173
|
+
|
|
174
|
+
if (!newCell) {
|
|
175
|
+
return tr;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (cellsPositionsInNextRow.indexOf(pos) > -1) {
|
|
179
|
+
fixRowspans.push({
|
|
180
|
+
pos: documentCellPos,
|
|
181
|
+
node: node
|
|
182
|
+
});
|
|
183
|
+
} else if (cellsInRow.indexOf(pos) > -1) {
|
|
184
|
+
if (node.attrs.colspan > 1) {
|
|
185
|
+
var newCellWithColspanFixed = node.type.createAndFill(_objectSpread(_objectSpread({}, attributes), {}, {
|
|
186
|
+
colspan: node.attrs.colspan
|
|
187
|
+
}));
|
|
188
|
+
|
|
189
|
+
if (!newCellWithColspanFixed) {
|
|
190
|
+
return tr;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
cells.push(newCellWithColspanFixed);
|
|
194
|
+
i = i + node.attrs.colspan;
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
cells.push(newCell);
|
|
199
|
+
} else {
|
|
200
|
+
cells.push(newCell);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
i++;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
fixRowspans.forEach(function (cell) {
|
|
207
|
+
tr.setNodeMarkup(cell.pos, undefined, _objectSpread(_objectSpread({}, cell.node.attrs), {}, {
|
|
208
|
+
rowspan: cell.node.attrs.rowspan + 1
|
|
209
|
+
}));
|
|
210
|
+
});
|
|
211
|
+
var cloneRow = tableNode.child(copyPreviousRowIndex);
|
|
212
|
+
var rowPos = table.start;
|
|
213
|
+
|
|
214
|
+
for (var _i2 = 0; _i2 < insertNewRowIndex; _i2++) {
|
|
215
|
+
rowPos += tableNode.child(_i2).nodeSize;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
return safeInsert(tableRow.createChecked(cloneRow.attrs, cells, cloneRow.marks), rowPos)(tr);
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
2
|
+
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
3
|
+
import { findTable, getSelectionRangeInColumn, getSelectionRangeInRow, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
4
|
+
export var isSelectionUpdated = function isSelectionUpdated(oldSelection, newSelection) {
|
|
5
|
+
return !!(!newSelection && oldSelection) || isSelectionType(oldSelection, 'cell') !== isSelectionType(newSelection, 'cell') || isSelectionType(oldSelection, 'cell') && isSelectionType(newSelection, 'cell') && oldSelection.ranges !== newSelection.ranges;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
var isRectangularCellSelection = function isRectangularCellSelection(selection, rect) {
|
|
9
|
+
var table = findTable(selection);
|
|
10
|
+
|
|
11
|
+
if (!table) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
var _TableMap$get = TableMap.get(table.node),
|
|
16
|
+
width = _TableMap$get.width,
|
|
17
|
+
height = _TableMap$get.height,
|
|
18
|
+
map = _TableMap$get.map;
|
|
19
|
+
|
|
20
|
+
var indexTop = rect.top * width + rect.left;
|
|
21
|
+
var indexLeft = indexTop;
|
|
22
|
+
var indexBottom = (rect.bottom - 1) * width + rect.left;
|
|
23
|
+
var indexRight = indexTop + (rect.right - rect.left - 1);
|
|
24
|
+
|
|
25
|
+
for (var i = rect.top; i < rect.bottom; i++) {
|
|
26
|
+
if (rect.left > 0 && map[indexLeft] === map[indexLeft - 1] || rect.right < width && map[indexRight] === map[indexRight + 1]) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
indexLeft += width;
|
|
31
|
+
indexRight += width;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
for (var _i = rect.left; _i < rect.right; _i++) {
|
|
35
|
+
if (rect.top > 0 && map[indexTop] === map[indexTop - width] || rect.bottom < height && map[indexBottom] === map[indexBottom + width]) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
indexTop++;
|
|
40
|
+
indexBottom++;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return true;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export var normalizeSelection = function normalizeSelection(tr) {
|
|
47
|
+
var selection = tr.selection;
|
|
48
|
+
var rect = getSelectionRect(selection);
|
|
49
|
+
|
|
50
|
+
if (!rect || !(selection instanceof CellSelection) || isRectangularCellSelection(selection, rect)) {
|
|
51
|
+
return tr;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (selection.isColSelection()) {
|
|
55
|
+
var _getSelectionRangeInC, _getSelectionRangeInC2;
|
|
56
|
+
|
|
57
|
+
var $anchor = (_getSelectionRangeInC = getSelectionRangeInColumn(rect.left)(tr)) === null || _getSelectionRangeInC === void 0 ? void 0 : _getSelectionRangeInC.$anchor;
|
|
58
|
+
var $head = (_getSelectionRangeInC2 = getSelectionRangeInColumn(rect.right - 1)(tr)) === null || _getSelectionRangeInC2 === void 0 ? void 0 : _getSelectionRangeInC2.$head;
|
|
59
|
+
|
|
60
|
+
if ($anchor && $head) {
|
|
61
|
+
return tr.setSelection(new CellSelection($anchor, $head));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (selection.isRowSelection()) {
|
|
66
|
+
var _getSelectionRangeInR, _getSelectionRangeInR2;
|
|
67
|
+
|
|
68
|
+
var _$anchor = (_getSelectionRangeInR = getSelectionRangeInRow(rect.top)(tr)) === null || _getSelectionRangeInR === void 0 ? void 0 : _getSelectionRangeInR.$anchor;
|
|
69
|
+
|
|
70
|
+
var _$head = (_getSelectionRangeInR2 = getSelectionRangeInRow(rect.bottom - 1)(tr)) === null || _getSelectionRangeInR2 === void 0 ? void 0 : _getSelectionRangeInR2.$head;
|
|
71
|
+
|
|
72
|
+
if (_$anchor && _$head) {
|
|
73
|
+
return tr.setSelection(new CellSelection(_$anchor, _$head));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return tr;
|
|
78
|
+
};
|
|
79
|
+
export var getSelectedColumnIndexes = function getSelectedColumnIndexes(selectionRect) {
|
|
80
|
+
var columnIndexes = [];
|
|
81
|
+
|
|
82
|
+
for (var i = selectionRect.left; i < selectionRect.right; i++) {
|
|
83
|
+
columnIndexes.push(i);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return columnIndexes;
|
|
87
|
+
};
|
|
88
|
+
export var getSelectedRowIndexes = function getSelectedRowIndexes(selectionRect) {
|
|
89
|
+
var rowIndexes = [];
|
|
90
|
+
|
|
91
|
+
for (var i = selectionRect.top; i < selectionRect.bottom; i++) {
|
|
92
|
+
rowIndexes.push(i);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return rowIndexes;
|
|
96
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
3
|
+
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
|
+
export var getMergedCellsPositions = function getMergedCellsPositions(tr) {
|
|
5
|
+
var table = findTable(tr.selection);
|
|
6
|
+
|
|
7
|
+
if (!table) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
var map = TableMap.get(table.node);
|
|
12
|
+
var cellPositions = new Set();
|
|
13
|
+
var mergedCells = [];
|
|
14
|
+
map.map.forEach(function (value) {
|
|
15
|
+
if (cellPositions.has(value)) {
|
|
16
|
+
mergedCells.push(value);
|
|
17
|
+
} else {
|
|
18
|
+
cellPositions.add(value);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
return mergedCells;
|
|
22
|
+
};
|
|
23
|
+
export var colsToRect = function colsToRect(cols, noOfRows) {
|
|
24
|
+
return {
|
|
25
|
+
left: Math.min.apply(Math, _toConsumableArray(cols)),
|
|
26
|
+
right: Math.max.apply(Math, _toConsumableArray(cols)) + 1,
|
|
27
|
+
top: 0,
|
|
28
|
+
bottom: noOfRows
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { getDecorations } from '../pm-plugins/decorations/plugin';
|
|
2
|
+
import { updateDecorations } from './decoration';
|
|
3
|
+
export var updatePluginStateDecorations = function updatePluginStateDecorations(state, decorations, key) {
|
|
4
|
+
return updateDecorations(state.doc, getDecorations(state), decorations, key);
|
|
5
|
+
};
|
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { pluginKey } from './plugin-key';
|
|
3
|
-
import { Mark } from 'prosemirror-model';
|
|
4
|
-
import { EditorView } from 'prosemirror-view';
|
|
5
|
-
|
|
6
|
-
function createPlugin() {
|
|
7
|
-
return new SafePlugin({
|
|
8
|
-
key: pluginKey,
|
|
9
|
-
state: {
|
|
10
|
-
init: function init() {
|
|
11
|
-
var z = {
|
|
12
|
-
Mark: Mark,
|
|
13
|
-
EditorView: EditorView
|
|
14
|
-
}; // eslint-disable-next-line no-console
|
|
15
|
-
|
|
16
|
-
console.log('delete to use prosemirror-model/view', z); // eslint-disable-next-line no-console
|
|
17
|
-
|
|
18
|
-
console.log('next table plugin loaded');
|
|
19
|
-
return {
|
|
20
|
-
scaffold: true
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
apply: function apply() {}
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
} // const tablesPlugin = (options?: TablePluginOptions): any => ({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var tablesPlugin = function tablesPlugin() {
|
|
30
|
-
return {
|
|
31
|
-
name: 'nextTable',
|
|
32
|
-
pmPlugins: function pmPlugins() {
|
|
33
|
-
return [{
|
|
34
|
-
name: 'next-table-scaffold',
|
|
35
|
-
plugin: function plugin() {
|
|
36
|
-
return createPlugin();
|
|
37
|
-
}
|
|
38
|
-
}];
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
|
|
1
|
+
import { default as tablesPlugin } from './table';
|
|
43
2
|
export default tablesPlugin;
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Direction } from '@atlaskit/editor-tables/types';
|
|
2
|
+
import { Command } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
export declare const goToNextCell: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (direction: Direction) => Command;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CellColumnPositioning } from '../types';
|
|
2
|
+
export declare const hoverMergedCells: () => import("@atlaskit/editor-common/types").Command;
|
|
3
|
+
export declare const hoverColumns: (hoveredColumns: number[], isInDanger?: boolean | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
4
|
+
export declare const hoverRows: (hoveredRows: number[], isInDanger?: boolean | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
5
|
+
export declare const hoverTable: (isInDanger?: boolean | undefined, isSelected?: boolean | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
6
|
+
export declare const clearHoverSelection: () => import("@atlaskit/editor-common/types").Command;
|
|
7
|
+
export declare const showResizeHandleLine: (cellColumnPositioning: CellColumnPositioning) => import("@atlaskit/editor-common/types").Command;
|
|
8
|
+
export declare const hideResizeHandleLine: () => import("@atlaskit/editor-common/types").Command;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { hoverColumns, hoverRows, hoverTable, hoverMergedCells, clearHoverSelection, showResizeHandleLine, hideResizeHandleLine, } from './hover';
|
|
2
|
+
export { insertColumn, insertRow, createTable } from './insert';
|
|
3
|
+
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout, } from './toggle';
|
|
4
|
+
export { clearMultipleCells } from './clear';
|
|
5
|
+
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectRow, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, } from './misc';
|
|
6
|
+
export { sortByColumn } from './sort';
|
|
7
|
+
export { goToNextCell } from './go-to-next-cell';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Transaction } from 'prosemirror-state';
|
|
2
|
+
import { Command } from '@atlaskit/editor-common/types';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
5
|
+
export declare function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction<any>;
|
|
6
|
+
export declare const addColumnBefore: (getEditorContainerWidth: GetEditorContainerWidth) => Command;
|
|
7
|
+
export declare const addColumnAfter: (getEditorContainerWidth: GetEditorContainerWidth) => Command;
|
|
8
|
+
export declare const insertColumn: (getEditorContainerWidth: GetEditorContainerWidth) => (column: number) => Command;
|
|
9
|
+
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
|
|
10
|
+
export declare const createTable: () => Command;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Node as PMNode, Schema, Slice } from 'prosemirror-model';
|
|
2
|
+
import { Transaction } from 'prosemirror-state';
|
|
3
|
+
import { ContentNodeWithPos } from 'prosemirror-utils';
|
|
4
|
+
import { EditorView } from 'prosemirror-view';
|
|
5
|
+
import { Command } from '@atlaskit/editor-common/types';
|
|
6
|
+
export declare const setEditorFocus: (editorHasFocus: boolean) => Command;
|
|
7
|
+
export declare const setTableRef: (ref?: HTMLTableElement | undefined) => Command;
|
|
8
|
+
export declare const setCellAttr: (name: string, value: any) => Command;
|
|
9
|
+
export declare const triggerUnlessTableHeader: (command: Command) => Command;
|
|
10
|
+
export declare const transformSliceRemoveCellBackgroundColor: (slice: Slice, schema: Schema) => Slice;
|
|
11
|
+
export declare const transformSliceToAddTableHeaders: (slice: Slice, schema: Schema) => Slice;
|
|
12
|
+
export declare const transformSliceToRemoveColumnsWidths: (slice: Slice, schema: Schema) => Slice;
|
|
13
|
+
export declare const deleteTable: Command;
|
|
14
|
+
export declare const deleteTableIfSelected: Command;
|
|
15
|
+
export declare const convertFirstRowToHeader: (schema: Schema) => (tr: Transaction) => Transaction;
|
|
16
|
+
export declare const moveCursorBackward: Command;
|
|
17
|
+
export declare const setMultipleCellAttrs: (attrs: Object, targetCellPosition?: number | undefined) => Command;
|
|
18
|
+
export declare const selectColumn: (column: number, expand?: boolean | undefined) => Command;
|
|
19
|
+
export declare const selectRow: (row: number, expand?: boolean | undefined) => Command;
|
|
20
|
+
export declare const showInsertColumnButton: (columnIndex: number) => Command;
|
|
21
|
+
export declare const showInsertRowButton: (rowIndex: number) => Command;
|
|
22
|
+
export declare const hideInsertColumnOrRowButton: () => Command;
|
|
23
|
+
export declare const addResizeHandleDecorations: (columnIndex: number) => Command;
|
|
24
|
+
export declare const autoSizeTable: (view: EditorView, node: PMNode, table: HTMLTableElement, basePos: number, opts: {
|
|
25
|
+
containerWidth: number;
|
|
26
|
+
}) => boolean;
|
|
27
|
+
export declare const addBoldInEmptyHeaderCells: (tableCellHeader: ContentNodeWithPos) => Command;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
|
+
import { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
3
|
+
export declare enum TableSelectionDirection {
|
|
4
|
+
TopToBottom = "TopToBottom",
|
|
5
|
+
BottomToTop = "BottomToTop"
|
|
6
|
+
}
|
|
7
|
+
export declare const arrowLeftFromTable: (editorSelectionAPI: EditorSelectionAPI | undefined | null) => () => Command;
|
|
8
|
+
export declare const arrowRightFromTable: (editorSelectionAPI: EditorSelectionAPI | undefined | null) => () => Command;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Command } from '@atlaskit/editor-common/types';
|
|
2
|
+
/**
|
|
3
|
+
* We need to split cell keeping the right type of cell given current table configuration.
|
|
4
|
+
* We are using editor-tables splitCellWithType that allows you to choose what cell type should be.
|
|
5
|
+
*/
|
|
6
|
+
export declare const splitCell: Command;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TableLayout } from '@atlaskit/adf-schema';
|
|
2
|
+
import { Command } from '@atlaskit/editor-common/types';
|
|
3
|
+
/**
|
|
4
|
+
* Table layout toggle logic
|
|
5
|
+
* default -> wide -> full-width -> default
|
|
6
|
+
*/
|
|
7
|
+
export declare const getNextLayout: (currentLayout: TableLayout) => TableLayout;
|
|
8
|
+
export declare const toggleHeaderRow: Command;
|
|
9
|
+
export declare const toggleHeaderColumn: Command;
|
|
10
|
+
export declare const toggleNumberColumn: Command;
|
|
11
|
+
export declare const toggleTableLayout: Command;
|
|
12
|
+
export declare const toggleContextualMenu: () => Command;
|