mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-22 21:51:50 +08:00
Lexical: Linked row properties form up
This commit is contained in:
@ -6,6 +6,7 @@ import {$getParentOfType} from "./nodes";
|
||||
import {$getNodeFromSelection} from "./selection";
|
||||
import {formatSizeValue} from "./dom";
|
||||
import {TableMap} from "./table-map";
|
||||
import {$isCustomTableRowNode, CustomTableRowNode} from "../nodes/custom-table-row";
|
||||
|
||||
function $getTableFromCell(cell: CustomTableCellNode): CustomTableNode|null {
|
||||
return $getParentOfType(cell, $isCustomTableNode) as CustomTableNode|null;
|
||||
@ -192,6 +193,19 @@ export function $mergeTableCellsInSelection(selection: TableSelection): void {
|
||||
firstCell.setRowSpan(newHeight);
|
||||
}
|
||||
|
||||
export function $getTableRowsFromSelection(selection: BaseSelection|null): CustomTableRowNode[] {
|
||||
const cells = $getTableCellsFromSelection(selection);
|
||||
const rowsByKey: Record<string, CustomTableRowNode> = {};
|
||||
for (const cell of cells) {
|
||||
const row = cell.getParent();
|
||||
if ($isCustomTableRowNode(row)) {
|
||||
rowsByKey[row.getKey()] = row;
|
||||
}
|
||||
}
|
||||
|
||||
return Object.values(rowsByKey);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user