1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-24 07:42:07 +03:00

Added table creation and insertion

This commit is contained in:
Dan Brown
2022-01-19 15:22:10 +00:00
parent b2283106fc
commit 4b08eef12c
10 changed files with 185 additions and 6 deletions

View File

@ -1,4 +1,5 @@
import {orderedList, bulletList, listItem} from "prosemirror-schema-list";
import {tableNodes} from "prosemirror-tables";
/**
* @param {HTMLElement} node
@ -200,7 +201,7 @@ const callout = {
],
toDOM(node) {
const type = node.attrs.type || 'info';
return ['p', addAlignmentAttr(node, {class: 'callout ' + type}) , 0];
return ['p', addAlignmentAttr(node, {class: 'callout ' + type}), 0];
}
};
@ -208,6 +209,16 @@ const ordered_list = Object.assign({}, orderedList, {content: "list_item+", grou
const bullet_list = Object.assign({}, bulletList, {content: "list_item+", group: "block"});
const list_item = Object.assign({}, listItem, {content: 'paragraph block*'});
const {
table,
table_row,
table_cell,
table_header,
} = tableNodes({
tableGroup: "block",
cellContent: "block*"
});
const nodes = {
doc,
paragraph,
@ -222,6 +233,10 @@ const nodes = {
ordered_list,
bullet_list,
list_item,
table,
table_row,
table_cell,
table_header,
};
export default nodes;