+}
+
+export function $tableHasCaption(table: TableNode): boolean {
+ for (const child of table.getChildren()) {
+ if ($isCaptionNode(child)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+export function $addCaptionToTable(table: TableNode, text: string = ''): void {
+ const caption = $createCaptionNode();
+ const textNode = $createTextNode(text || ' ');
+ caption.append(textNode);
+ table.append(caption);