mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
38b7f4382f
* added basic table support * fixed table position at bottom * fixed image node deletion logic's regression issue * added compatible styles * enabled slash commands * disabled slash command and bubble menu's node selector for table cells * added dropcursor support to type below the table/image * blocked image uploads for handledrop and paste actions
32 lines
743 B
TypeScript
32 lines
743 B
TypeScript
import { TableCell } from "@tiptap/extension-table-cell";
|
|
|
|
export const CustomTableCell = TableCell.extend({
|
|
addAttributes() {
|
|
return {
|
|
...this.parent?.(),
|
|
isHeader: {
|
|
default: false,
|
|
parseHTML: (element) => { isHeader: element.tagName === "TD" },
|
|
renderHTML: (attributes) => { tag: attributes.isHeader ? "th" : "td" }
|
|
},
|
|
};
|
|
},
|
|
renderHTML({ HTMLAttributes }) {
|
|
if (HTMLAttributes.isHeader) {
|
|
return [
|
|
"th",
|
|
{
|
|
...HTMLAttributes,
|
|
class: `relative ${HTMLAttributes.class}`,
|
|
},
|
|
[
|
|
"span",
|
|
{ class: "absolute top-0 right-0" },
|
|
],
|
|
0,
|
|
];
|
|
}
|
|
return ["td", HTMLAttributes, 0];
|
|
},
|
|
});
|