UNPKG

@limetech/lime-elements

Version:
28 lines (27 loc) 746 B
import { tableNodes, tableEditing } from 'prosemirror-tables'; export const getTableEditingPlugins = (tablesEnabled) => { if (tablesEnabled) { return [tableEditing()]; } return []; }; const createStyleAttribute = (cssProperty) => ({ default: null, getFromDOM: (dom) => dom.style[cssProperty] || null, setDOMAttr: (value, attrs) => { if (value) { attrs.style = (attrs.style || '') + `${cssProperty}: ${value};`; } }, }); export const getTableNodes = () => { return tableNodes({ tableGroup: 'block', cellContent: 'block+', cellAttributes: { background: createStyleAttribute('background-color'), color: createStyleAttribute('color'), }, }); }; //# sourceMappingURL=table-plugin.js.map