mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-21 21:01:30 +08:00
Lexical: Added cell width fetching, Created custom row node
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import {BaseSelection, LexicalEditor} from "lexical";
|
||||
import {$isTableRowNode, $isTableSelection, TableRowNode, TableSelection, TableSelectionShape} from "@lexical/table";
|
||||
import {$isCustomTableNode, CustomTableNode} from "../nodes/custom-table";
|
||||
import {$isCustomTableCellNode, CustomTableCellNode} from "../nodes/custom-table-cell-node";
|
||||
import {$isCustomTableCellNode, CustomTableCellNode} from "../nodes/custom-table-cell";
|
||||
import {$getParentOfType} from "./nodes";
|
||||
import {$getNodeFromSelection} from "./selection";
|
||||
import {formatSizeValue} from "./dom";
|
||||
@ -124,6 +124,17 @@ export function $setTableCellColumnWidth(cell: CustomTableCellNode, width: strin
|
||||
}
|
||||
}
|
||||
|
||||
export function $getTableCellColumnWidth(editor: LexicalEditor, cell: CustomTableCellNode): string {
|
||||
const table = $getTableFromCell(cell)
|
||||
const index = $getCellColumnIndex(cell);
|
||||
if (!table) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const widths = table.getColWidths();
|
||||
return (widths.length > index) ? widths[index] : '';
|
||||
}
|
||||
|
||||
export function $getTableCellsFromSelection(selection: BaseSelection|null): CustomTableCellNode[] {
|
||||
if ($isTableSelection(selection)) {
|
||||
const nodes = selection.getNodes();
|
||||
|
Reference in New Issue
Block a user