@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
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import { Node as PmNode } from 'prosemirror-model';
|
|
3
|
+
import { EditorView, NodeView } from 'prosemirror-view';
|
|
4
|
+
import { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
5
|
+
import { TablePluginState } from '../../../types';
|
|
6
|
+
import { TableDOMElements } from './dom';
|
|
7
|
+
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
8
|
+
/**
|
|
9
|
+
* Check if a given node is a header row with this definition:
|
|
10
|
+
* - all children are tableHeader cells
|
|
11
|
+
* - no table cells have been have merged with other table row cells
|
|
12
|
+
*
|
|
13
|
+
* @param node ProseMirror node
|
|
14
|
+
* @return boolean if it meets definition
|
|
15
|
+
*/
|
|
16
|
+
export declare const supportedHeaderRow: (node: PmNode) => boolean;
|
|
17
|
+
export declare class TableRowNodeView implements NodeView {
|
|
18
|
+
view: EditorView;
|
|
19
|
+
node: PmNode;
|
|
20
|
+
getPos: () => number;
|
|
21
|
+
eventDispatcher: EventDispatcher;
|
|
22
|
+
dom: HTMLTableRowElement;
|
|
23
|
+
contentDOM: HTMLElement;
|
|
24
|
+
isHeaderRow: boolean;
|
|
25
|
+
editorScrollableElement?: HTMLElement | Window;
|
|
26
|
+
colControlsOffset: number;
|
|
27
|
+
focused: boolean;
|
|
28
|
+
topPosEditorElement: number;
|
|
29
|
+
isSticky: boolean;
|
|
30
|
+
lastTimePainted: number;
|
|
31
|
+
private intersectionObserver?;
|
|
32
|
+
private resizeObserver?;
|
|
33
|
+
private stickyHeadersOptimization;
|
|
34
|
+
private sentinels;
|
|
35
|
+
private stickyRowHeight?;
|
|
36
|
+
get tree(): TableDOMElements | null | undefined;
|
|
37
|
+
constructor(node: PmNode, view: EditorView, getPos: any, eventDispatcher: EventDispatcher, getEditorFeatureFlags: GetEditorFeatureFlags);
|
|
38
|
+
listening: boolean;
|
|
39
|
+
headerRowMouseScrollEnd: import("lodash").DebouncedFunc<() => void>;
|
|
40
|
+
headerRowMouseScroll: import("lodash").DebouncedFunc<() => void>;
|
|
41
|
+
subscribe(): void;
|
|
42
|
+
unsubscribe(): void;
|
|
43
|
+
private initObservers;
|
|
44
|
+
private createResizeObserver;
|
|
45
|
+
private createIntersectionObserver;
|
|
46
|
+
previousDomTop: number | undefined;
|
|
47
|
+
previousPadding: number | undefined;
|
|
48
|
+
latestDomTop: number | undefined;
|
|
49
|
+
nextFrame: number | undefined;
|
|
50
|
+
onScroll: () => void;
|
|
51
|
+
loop: () => void;
|
|
52
|
+
paint: (tree: TableDOMElements) => void;
|
|
53
|
+
update(node: PmNode, ..._args: any[]): boolean;
|
|
54
|
+
destroy(): void;
|
|
55
|
+
ignoreMutation(mutationRecord: MutationRecord | {
|
|
56
|
+
type: 'selection';
|
|
57
|
+
target: Element;
|
|
58
|
+
}): boolean;
|
|
59
|
+
onTablePluginState: (state: TablePluginState) => void;
|
|
60
|
+
updateStickyHeaderWidth: () => void;
|
|
61
|
+
shouldHeaderStick: (tree: TableDOMElements) => boolean;
|
|
62
|
+
makeHeaderRowSticky: (tree: TableDOMElements, scrollTop?: number) => void;
|
|
63
|
+
makeRowHeaderNotSticky: (table: HTMLElement, isEditorDestroyed?: boolean) => void;
|
|
64
|
+
getWrapperoffset: (inverse?: boolean) => number;
|
|
65
|
+
getWrapperRefTop: (wrapper: HTMLElement) => number;
|
|
66
|
+
getScrolledTableTop: (wrapper: HTMLElement) => number;
|
|
67
|
+
getCurrentTableTop: (tree: TableDOMElements) => number;
|
|
68
|
+
padding: number;
|
|
69
|
+
top: number;
|
|
70
|
+
emitOn: (top: number, padding: number) => void;
|
|
71
|
+
emitOff: (isEditorDestroyed: boolean) => void;
|
|
72
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { StickyPluginAction, StickyPluginState } from './types';
|
|
2
|
+
declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: StickyPluginState | ((state: import("prosemirror-state").EditorState<any>) => StickyPluginState)) => import("prosemirror-state").SafeStateField<StickyPluginState, import("prosemirror-model").Schema<any, any>>, createCommand: <A = StickyPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState<any>>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction<any>, state: import("prosemirror-state").EditorState<any>) => import("prosemirror-state").Transaction<any>) | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
3
|
+
export { createPluginState, createCommand };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
3
|
+
import { EventDispatcher, Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
|
+
export declare const createPlugin: (dispatch: Dispatch, eventDispatcher: EventDispatcher, initialState: (() => never[]) | undefined, getEditorFeatureFlags: GetEditorFeatureFlags) => SafePlugin<import("./types").StickyPluginState, import("prosemirror-model").Schema<any, any>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type RowStickyState = {
|
|
2
|
+
pos: number;
|
|
3
|
+
top: number;
|
|
4
|
+
padding: number;
|
|
5
|
+
sticky: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type StickyPluginState = RowStickyState[];
|
|
8
|
+
export type UpdateSticky = {
|
|
9
|
+
name: 'UPDATE';
|
|
10
|
+
state: RowStickyState;
|
|
11
|
+
};
|
|
12
|
+
export type RemoveSticky = {
|
|
13
|
+
name: 'REMOVE';
|
|
14
|
+
pos: number;
|
|
15
|
+
};
|
|
16
|
+
export type StickyPluginAction = UpdateSticky | RemoveSticky;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A plugin for ensuring tables always have unique local IDs, and to
|
|
3
|
+
* preserve/not regenerate them when they are being cut and paste around the
|
|
4
|
+
* document.
|
|
5
|
+
*
|
|
6
|
+
* More broadly, this plugin should be generalised so it can solve this ‘unique
|
|
7
|
+
* id’ problem across the codebase for any node, but for now this will live on
|
|
8
|
+
* its own solving only for tables.
|
|
9
|
+
*
|
|
10
|
+
* TODO: https://product-fabric.atlassian.net/browse/ED-12714
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
14
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
15
|
+
interface TableLocalIdPluginState {
|
|
16
|
+
parsedForLocalIds: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Ensures uniqueness of `localId`s on tables being created or edited
|
|
20
|
+
*/
|
|
21
|
+
declare const createPlugin: (dispatch: Dispatch) => SafePlugin<TableLocalIdPluginState, any>;
|
|
22
|
+
export { createPlugin };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import { Transaction } from 'prosemirror-state';
|
|
3
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { DomAtPos } from 'prosemirror-utils';
|
|
5
|
+
import { ResizeState, ScaleOptions } from './utils';
|
|
6
|
+
import { ContentNodeWithPos } from 'prosemirror-utils';
|
|
7
|
+
export declare const scaleTable: (tableRef: HTMLTableElement | null | undefined, options: ScaleOptions, domAtPos: DomAtPos) => Command;
|
|
8
|
+
export declare const evenColumns: ({ resizeState, table, start, event, }: {
|
|
9
|
+
resizeState: ResizeState;
|
|
10
|
+
table: PMNode;
|
|
11
|
+
start: number;
|
|
12
|
+
event: MouseEvent;
|
|
13
|
+
}) => Command;
|
|
14
|
+
export declare const distributeColumnsWidths: (newResizeState: ResizeState, table: ContentNodeWithPos) => Command;
|
|
15
|
+
export declare const setResizeHandlePos: (resizeHandlePos: number | null) => Command;
|
|
16
|
+
export declare const stopResizing: (tr?: Transaction) => Command;
|
|
17
|
+
export declare const setDragging: (dragging: {
|
|
18
|
+
startX: number;
|
|
19
|
+
startWidth: number;
|
|
20
|
+
} | null, tr?: Transaction) => Command;
|
|
21
|
+
export declare const setLastClick: (lastClick: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
time: number;
|
|
25
|
+
} | null, transform?: ((tr: Transaction) => Transaction) | undefined) => Command;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
|
+
export declare const handleMouseDown: (view: EditorView, event: MouseEvent, localResizeHandlePos: number, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI) => boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ColumnResizingPluginState } from '../../types';
|
|
2
|
+
export declare const createCommand: <A = import("../../types").ColumnResizingPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState<any>>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction<any>, state: import("prosemirror-state").EditorState<any>) => import("prosemirror-state").Transaction<any>) | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
3
|
+
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: ColumnResizingPluginState | ((state: import("prosemirror-state").EditorState<any>) => ColumnResizingPluginState)) => import("prosemirror-state").SafeStateField<ColumnResizingPluginState, import("prosemirror-model").Schema<any, any>>;
|
|
4
|
+
export declare const getPluginState: (state: import("prosemirror-state").EditorState<any>) => ColumnResizingPluginState;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
|
+
import { ColumnResizingPluginState } from '../../types';
|
|
4
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
6
|
+
export declare function createPlugin(dispatch: Dispatch<ColumnResizingPluginState>, { lastColumnResizable }: ColumnResizingPluginState, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI): SafePlugin<ColumnResizingPluginState, import("prosemirror-model").Schema<any, any>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Node as PmNode } from 'prosemirror-model';
|
|
2
|
+
type Col = Array<string | {
|
|
3
|
+
[name: string]: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const generateColgroup: (table: PmNode) => Col[];
|
|
6
|
+
export declare const insertColgroupFromNode: (tableRef: HTMLTableElement, table: PmNode) => HTMLCollection;
|
|
7
|
+
export declare const hasTableBeenResized: (table: PmNode) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Check if a table has all the column width set to tableCellMinWidth(48px) or null
|
|
10
|
+
*
|
|
11
|
+
* @param table
|
|
12
|
+
* @returns true if all column width is equal to tableCellMinWidth or null, false otherwise
|
|
13
|
+
*/
|
|
14
|
+
export declare const isMinCellWidthTable: (table: PmNode) => boolean;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
export interface ColumnState {
|
|
3
|
+
index: number;
|
|
4
|
+
width: number;
|
|
5
|
+
minWidth: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const getColumnStateFromDOM: (cells: HTMLElement[], index: number, minWidth: number) => ColumnState;
|
|
8
|
+
export declare const getFreeSpace: (state: ColumnState) => number;
|
|
9
|
+
export declare const getCellsRefsInColumn: (columnIndex: number, table: PMNode, tableStart: number, domAtPos: (pos: number) => {
|
|
10
|
+
node: Node;
|
|
11
|
+
offset: number;
|
|
12
|
+
}) => HTMLElement[];
|
|
13
|
+
export declare const calculateColumnWidth: (cells: HTMLElement[], calculateColumnWidthCb: (css: CSSStyleDeclaration, cellRef: HTMLElement, colSpan: number) => number) => number;
|
|
14
|
+
export declare const addContainerLeftRightPadding: (amount: number, css: CSSStyleDeclaration) => number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EditorState } from 'prosemirror-state';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
4
|
+
export declare const updateControls: (getEditorFeatureFlags: GetEditorFeatureFlags) => (state: EditorState) => void;
|
|
5
|
+
export declare const isClickNear: (event: MouseEvent, click: {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
}) => boolean;
|
|
9
|
+
export declare const getResizeCellPos: (view: EditorView, event: MouseEvent, lastColumnResizable: boolean) => number | null;
|
|
10
|
+
export declare const updateStickyMargins: (table: HTMLElement) => void;
|
|
11
|
+
export declare const applyColWidthsToStickyRow: (colGroup: HTMLTableColElement | null, headerRow: HTMLTableRowElement) => void;
|
|
12
|
+
export declare const syncStickyRowToTable: (tableRef?: HTMLElement | null) => void;
|
|
13
|
+
export declare const applyTableWidthToStickyRow: (tableRef: HTMLElement, headerRow: HTMLTableRowElement) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { generateColgroup, insertColgroupFromNode, hasTableBeenResized, } from './colgroup';
|
|
2
|
+
export { contentWidth } from './content-width';
|
|
3
|
+
export { getColumnStateFromDOM, getFreeSpace, getCellsRefsInColumn, calculateColumnWidth, addContainerLeftRightPadding, } from './column-state';
|
|
4
|
+
export type { ColumnState } from './column-state';
|
|
5
|
+
export { growColumn, shrinkColumn, reduceSpace } from './resize-logic';
|
|
6
|
+
export { getResizeState, updateColgroup, getTotalWidth, evenAllColumnsWidths, bulkColumnsResize, areColumnsEven, adjustColumnsWidths, } from './resize-state';
|
|
7
|
+
export { tableLayoutToSize, getLayoutSize, getDefaultLayoutMaxWidth, pointsAtCell, currentColWidth, domCellAround, } from './misc';
|
|
8
|
+
export { updateControls, isClickNear, getResizeCellPos } from './dom';
|
|
9
|
+
export { scale, scaleWithParent } from './scale-table';
|
|
10
|
+
export type { ScaleOptions } from './scale-table';
|
|
11
|
+
export type { ResizeState, ResizeStateWithAnalytics } from './types';
|
|
12
|
+
export { resizeColumn } from './resize-column';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ResolvedPos } from 'prosemirror-model';
|
|
2
|
+
import { EditorView } from 'prosemirror-view';
|
|
3
|
+
import { CellAttributes, TableLayout } from '@atlaskit/adf-schema';
|
|
4
|
+
import { TableOptions } from '../../../nodeviews/types';
|
|
5
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
6
|
+
import { EditorState } from 'prosemirror-state';
|
|
7
|
+
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
8
|
+
export declare const tableLayoutToSize: Record<string, number>;
|
|
9
|
+
export declare function getLayoutSize(tableLayout: TableLayout, containerWidth: number | undefined, options: TableOptions): number;
|
|
10
|
+
export declare function getDefaultLayoutMaxWidth(containerWidth?: number): number;
|
|
11
|
+
export declare function pointsAtCell($pos: ResolvedPos<any>): false | PMNode<any> | null | undefined;
|
|
12
|
+
export declare function currentColWidth(view: EditorView, cellPos: number, { colspan, colwidth }: CellAttributes): number;
|
|
13
|
+
export declare function domCellAround(target: HTMLElement | null): HTMLElement | null;
|
|
14
|
+
interface getTableMaxWidthProps {
|
|
15
|
+
table: PMNode;
|
|
16
|
+
tableStart: number;
|
|
17
|
+
state: EditorState;
|
|
18
|
+
layout: TableLayout;
|
|
19
|
+
getEditorContainerWidth: GetEditorContainerWidth;
|
|
20
|
+
}
|
|
21
|
+
export declare const getTableMaxWidth: ({ table, tableStart, state, layout, getEditorContainerWidth, }: getTableMaxWidthProps) => any;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ResizeState } from './types';
|
|
2
|
+
export declare const growColumn: (state: ResizeState, colIndex: number, amount: number, selectedColumns?: number[]) => ResizeState;
|
|
3
|
+
export declare const shrinkColumn: (state: ResizeState, colIndex: number, amount: number, selectedColumns?: number[]) => ResizeState;
|
|
4
|
+
export declare function reduceSpace(state: ResizeState, amount: number, ignoreCols?: number[]): ResizeState;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import { Rect } from '@atlaskit/editor-tables/table-map';
|
|
3
|
+
import { TableLayout } from '@atlaskit/adf-schema';
|
|
4
|
+
import { ResizeState, ResizeStateWithAnalytics } from './types';
|
|
5
|
+
import { EditorState } from 'prosemirror-state';
|
|
6
|
+
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
7
|
+
export declare const getResizeState: ({ minWidth, maxSize, table, tableRef, start, domAtPos, }: {
|
|
8
|
+
minWidth: number;
|
|
9
|
+
maxSize: number;
|
|
10
|
+
table: PMNode;
|
|
11
|
+
tableRef: HTMLTableElement;
|
|
12
|
+
start: number;
|
|
13
|
+
domAtPos: (pos: number) => {
|
|
14
|
+
node: Node;
|
|
15
|
+
offset: number;
|
|
16
|
+
};
|
|
17
|
+
}) => ResizeState;
|
|
18
|
+
export declare const updateColgroup: (state: ResizeState, tableRef: HTMLElement) => void;
|
|
19
|
+
export declare const getTotalWidth: ({ cols }: ResizeState) => number;
|
|
20
|
+
export declare const adjustColumnsWidths: (resizeState: ResizeState, maxSize: number) => ResizeState;
|
|
21
|
+
export declare const evenAllColumnsWidths: (resizeState: ResizeState) => ResizeState;
|
|
22
|
+
export declare const evenSelectedColumnsWidths: (resizeState: ResizeState, rect: Rect) => ResizeState;
|
|
23
|
+
export declare const bulkColumnsResize: (resizeState: ResizeState, columnsIndexes: number[], sourceColumnIndex: number) => ResizeState;
|
|
24
|
+
export declare const areColumnsEven: (resizeState: ResizeState) => boolean;
|
|
25
|
+
export declare const normaliseTableLayout: (input: string | undefined | null) => TableLayout;
|
|
26
|
+
export declare const getNewResizeStateFromSelectedColumns: (rect: Rect, state: EditorState, domAtPos: (pos: number) => {
|
|
27
|
+
node: Node;
|
|
28
|
+
offset: number;
|
|
29
|
+
}, getEditorContainerWidth: GetEditorContainerWidth) => ResizeStateWithAnalytics | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import type { DomAtPos } from 'prosemirror-utils';
|
|
3
|
+
import { ResizeState } from '../utils/types';
|
|
4
|
+
export interface ScaleOptions {
|
|
5
|
+
node: PMNode;
|
|
6
|
+
prevNode: PMNode;
|
|
7
|
+
start: number;
|
|
8
|
+
containerWidth?: number;
|
|
9
|
+
previousContainerWidth?: number;
|
|
10
|
+
parentWidth?: number;
|
|
11
|
+
layoutChanged?: boolean;
|
|
12
|
+
isBreakoutEnabled?: boolean;
|
|
13
|
+
isFullWidthModeEnabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const scale: (tableRef: HTMLTableElement, options: ScaleOptions, domAtPos: DomAtPos) => ResizeState | undefined;
|
|
16
|
+
export declare const scaleWithParent: (tableRef: HTMLTableElement, parentWidth: number, table: PMNode, start: number, domAtPos: DomAtPos) => ResizeState;
|
|
17
|
+
export declare function scaleTableTo(state: ResizeState, maxSize: number): ResizeState;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ColumnState } from './column-state';
|
|
2
|
+
import { ContentNodeWithPos } from 'prosemirror-utils';
|
|
3
|
+
export interface ResizeState {
|
|
4
|
+
cols: ColumnState[];
|
|
5
|
+
widths: number[];
|
|
6
|
+
maxSize: number;
|
|
7
|
+
overflow: boolean;
|
|
8
|
+
tableWidth: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ResizeStateWithAnalytics {
|
|
11
|
+
resizeState: ResizeState;
|
|
12
|
+
table: ContentNodeWithPos;
|
|
13
|
+
changed: boolean;
|
|
14
|
+
attributes: {
|
|
15
|
+
position: number;
|
|
16
|
+
count: number;
|
|
17
|
+
totalRowCount: number;
|
|
18
|
+
totalColumnCount: number;
|
|
19
|
+
widthsBefore: number[];
|
|
20
|
+
widthsAfter: number[];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const unitToNumber: (unit: string | null) => number;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
3
|
+
export declare function tableSelectionKeymapPlugin(editorSelectionAPI: EditorSelectionAPI | undefined | null): SafePlugin;
|
|
4
|
+
export default tableSelectionKeymapPlugin;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Command, FloatingToolbarDropdown, FloatingToolbarHandler, FloatingToolbarItem, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { ToolbarMenuConfig, ToolbarMenuState, ToolbarMenuContext, PluginConfig } from './types';
|
|
4
|
+
import { EditorState } from 'prosemirror-state';
|
|
5
|
+
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
6
|
+
import { Rect } from '@atlaskit/editor-tables/table-map';
|
|
7
|
+
import { EditorView } from 'prosemirror-view';
|
|
8
|
+
export declare const messages: {
|
|
9
|
+
tableOptions: {
|
|
10
|
+
id: string;
|
|
11
|
+
defaultMessage: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
headerRow: {
|
|
15
|
+
id: string;
|
|
16
|
+
defaultMessage: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
headerColumn: {
|
|
20
|
+
id: string;
|
|
21
|
+
defaultMessage: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
numberedColumn: {
|
|
25
|
+
id: string;
|
|
26
|
+
defaultMessage: string;
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
collapseTable: {
|
|
30
|
+
id: string;
|
|
31
|
+
defaultMessage: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export declare const getToolbarMenuConfig: (config: ToolbarMenuConfig, state: ToolbarMenuState, { formatMessage }: ToolbarMenuContext, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => FloatingToolbarItem<Command>;
|
|
36
|
+
export declare const getToolbarCellOptionsConfig: (editorState: EditorState, editorView: EditorView | undefined | null, initialSelectionRect: Rect, { formatMessage }: ToolbarMenuContext, getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => FloatingToolbarDropdown<Command>;
|
|
37
|
+
export declare const getToolbarConfig: (getEditorContainerWidth: GetEditorContainerWidth, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, getEditorFeatureFlags: GetEditorFeatureFlags, getEditorView: () => EditorView | null) => (config: PluginConfig) => FloatingToolbarHandler;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import { Transaction } from 'prosemirror-state';
|
|
3
|
+
import { ResizeState } from '../pm-plugins/table-resizing/utils';
|
|
4
|
+
import { ContentNodeWithPos } from 'prosemirror-utils';
|
|
5
|
+
import { EditorView } from 'prosemirror-view';
|
|
6
|
+
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
7
|
+
export declare const updateColumnWidths: (resizeState: ResizeState, table: PMNode, start: number) => (tr: Transaction) => Transaction;
|
|
8
|
+
/**
|
|
9
|
+
* This function is called when user inserts/deletes a column in a table to;
|
|
10
|
+
* - rescale all columns (if the table did not overflow before the insertion)
|
|
11
|
+
* - and update column widths.
|
|
12
|
+
*
|
|
13
|
+
* This is done manually to avoid a multi-dispatch in TableComponent. See [ED-8288].
|
|
14
|
+
* @param table
|
|
15
|
+
* @param view
|
|
16
|
+
* @returns Updated transaction with rescaled columns for a given table
|
|
17
|
+
*/
|
|
18
|
+
export declare const rescaleColumns: (getEditorContainerWidth: GetEditorContainerWidth) => (table: ContentNodeWithPos, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import { Transaction } from 'prosemirror-state';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
import { ReportInvalidNodeAttrs } from '../types';
|
|
5
|
+
export declare const removeExtraneousColumnWidths: (node: PMNode, basePos: number, tr: Transaction, reportInvalidTableCellSpanAttrs?: ReportInvalidNodeAttrs) => boolean;
|
|
6
|
+
export declare const fixTables: (tr: Transaction, reportInvalidTableCellSpanAttrs?: ReportInvalidNodeAttrs) => Transaction | undefined;
|
|
7
|
+
export declare const fixAutoSizedTable: (view: EditorView, tableNode: PMNode, tableRef: HTMLTableElement, tablePos: number, opts: {
|
|
8
|
+
containerWidth: number;
|
|
9
|
+
}) => Transaction;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { fixTables, fixAutoSizedTable } from './fix-tables';
|
|
2
|
+
export { mergeCells, canMergeCells, mergeEmptyColumns } from './merge';
|
|
3
|
+
export { deleteColumns } from './delete-columns';
|
|
4
|
+
export { deleteRows } from './delete-rows';
|
|
5
|
+
export { updateColumnWidths } from './column-width';
|
|
6
|
+
export { replaceSelectedTable } from './replace-table';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import { Transaction } from 'prosemirror-state';
|
|
3
|
+
export declare function mergeCells(tr: Transaction): Transaction;
|
|
4
|
+
export declare function canMergeCells(tr: Transaction): boolean;
|
|
5
|
+
export declare function mergeEmptyColumns(table: PMNode): PMNode | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Transaction, EditorState } from 'prosemirror-state';
|
|
2
|
+
import { Slice } from 'prosemirror-model';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
export declare const replaceSelectedTable: (state: EditorState, content: string | Slice, inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.CLIPBOARD, editorAnalyticsAPI?: EditorAnalyticsAPI) => Transaction;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Transaction } from 'prosemirror-state';
|
|
2
|
+
/**
|
|
3
|
+
* Helper to split all the cells in a range of columns
|
|
4
|
+
* @param tr
|
|
5
|
+
* @param tablePos
|
|
6
|
+
* @param columnStart - Start of the rect included (rect.left)
|
|
7
|
+
* @param columnEnd - End of the rect not included (rect.right)
|
|
8
|
+
*/
|
|
9
|
+
export declare function splitCellsInColumns(tr: Transaction, tablePos: number, columnStart: number, columnEnd: number): Transaction;
|