Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@remirror/extension-tables

Package Overview
Dependencies
Maintainers
1
Versions
247
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remirror/extension-tables - npm Package Compare versions

Comparing version 0.0.0-pr905.1 to 0.0.0-pr911.1

1

dist/declarations/src/index.d.ts
export type { TableOptions } from './table-extensions';
export { TableCellExtension, TableExtension, TableHeaderCellExtension, TableRowExtension, } from './table-extensions';
export type { TableRole, TableSchemaSpec } from './table-utils';

@@ -102,2 +102,7 @@ import { ApplySchemaAttributes, CommandFunction, Helper, NodeExtension, NodeSpecOverride, NonChainableCommandFunction, OnSetOptionsProps, ProsemirrorPlugin, StateUpdateLifecycleProps } from '@remirror/core';

/**
* Update the background of one cell or multiple cells by passing a color
* string. You can also remove the color by passing a `null`.
*/
setTableCellBackground(background: string | null): CommandFunction;
/**
* This managers the updates of the collaboration provider.

@@ -104,0 +109,0 @@ */

66

dist/remirror-extension-tables.browser.cjs.js

@@ -58,4 +58,2 @@ 'use strict';

function createTableNodeSchema(extra, override) {
var _override$parseDOM, _override$parseDOM2, _override$parseDOM3, _override$parseDOM4;
var cellAttrs = _objectSpread(_objectSpread({}, extra.defaults()), {}, {

@@ -86,3 +84,3 @@ colspan: {

getAttrs: extra.parse
}, ...((_override$parseDOM = override.parseDOM) !== null && _override$parseDOM !== void 0 ? _override$parseDOM : [])],
}],

@@ -101,3 +99,3 @@ toDOM(node) {

getAttrs: extra.parse
}, ...((_override$parseDOM2 = override.parseDOM) !== null && _override$parseDOM2 !== void 0 ? _override$parseDOM2 : [])],
}],

@@ -118,3 +116,3 @@ toDOM(node) {

getAttrs: dom => _objectSpread(_objectSpread({}, extra.parse(dom)), getCellAttrs(dom))
}, ...((_override$parseDOM3 = override.parseDOM) !== null && _override$parseDOM3 !== void 0 ? _override$parseDOM3 : [])],
}],

@@ -135,3 +133,3 @@ toDOM(node) {

getAttrs: dom => _objectSpread(_objectSpread({}, extra.parse(dom)), getCellAttrs(dom))
}, ...((_override$parseDOM4 = override.parseDOM) !== null && _override$parseDOM4 !== void 0 ? _override$parseDOM4 : [])],
}],

@@ -250,3 +248,3 @@ toDOM(node) {

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _class, _class2, _dec19, _class4, _dec20, _class5, _dec21, _class6;
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _class, _class2, _temp, _dec20, _class4, _dec21, _class5, _dec22, _class6;
var createTableCommand = {

@@ -271,3 +269,3 @@ icon: 'table2',

disableChaining: true
}), _dec18 = core.helper(), _dec(_class = (_class2 = class TableExtension extends core.NodeExtension {
}), _dec18 = core.helper(), _dec19 = core.command(), _dec(_class = (_class2 = (_temp = class TableExtension extends core.NodeExtension {
constructor() {

@@ -491,2 +489,40 @@ super(...arguments);

/**
* Update the background of one cell or multiple cells by passing a color
* string. You can also remove the color by passing a `null`.
*/
setTableCellBackground(background) {
return props => {
var tr = props.tr;
var dispatch = props.dispatch;
var _tr = tr,
selection = _tr.selection;
if (selection instanceof tables.CellSelection) {
selection.forEachCell((cellNode, pos) => {
tr = tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, cellNode.attrs), {}, {
background
}));
});
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
return true;
}
var found = core.findParentNodeOfType({
selection,
types: 'tableCell'
});
if (found) {
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.setNodeMarkup(found.pos, undefined, _objectSpread(_objectSpread({}, found.node.attrs), {}, {
background
})));
return true;
}
return false;
};
}
/**
* This managers the updates of the collaboration provider.

@@ -504,3 +540,3 @@ */

}, (_applyDecoratedDescriptor(_class2.prototype, "createTable", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "createTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTable", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnBefore", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnAfter", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableColumn", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowBefore", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowAfter", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableRow", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableCellMerge", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableCellMerge"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "mergeTableCells", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "mergeTableCells"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "splitTableCell", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "splitTableCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderColumn", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderRow", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderCell", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellAttribute", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellAttribute"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fixTables", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "fixTables"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "enableTableSupport", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "enableTableSupport"), _class2.prototype)), _class2)) || _class);
}, _temp), (_applyDecoratedDescriptor(_class2.prototype, "createTable", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "createTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTable", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnBefore", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnAfter", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableColumn", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowBefore", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowAfter", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableRow", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableCellMerge", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableCellMerge"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "mergeTableCells", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "mergeTableCells"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "splitTableCell", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "splitTableCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderColumn", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderRow", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderCell", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellAttribute", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellAttribute"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fixTables", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "fixTables"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "enableTableSupport", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "enableTableSupport"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellBackground", [_dec19], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellBackground"), _class2.prototype)), _class2)) || _class);
/**

@@ -510,5 +546,5 @@ * The extension for a table row node.

var TableRowExtension = (_dec19 = core.extension({
var TableRowExtension = (_dec20 = core.extension({
defaultPriority: core.ExtensionPriority.Low
}), _dec19(_class4 = class TableRowExtension extends core.NodeExtension {
}), _dec20(_class4 = class TableRowExtension extends core.NodeExtension {
get name() {

@@ -541,5 +577,5 @@ return 'tableRow';

var TableCellExtension = (_dec20 = core.extension({
var TableCellExtension = (_dec21 = core.extension({
defaultPriority: core.ExtensionPriority.Low
}), _dec20(_class5 = class TableCellExtension extends core.NodeExtension {
}), _dec21(_class5 = class TableCellExtension extends core.NodeExtension {
get name() {

@@ -558,5 +594,5 @@ return 'tableCell';

var TableHeaderCellExtension = (_dec21 = core.extension({
var TableHeaderCellExtension = (_dec22 = core.extension({
defaultPriority: core.ExtensionPriority.Low
}), _dec21(_class6 = class TableHeaderCellExtension extends core.NodeExtension {
}), _dec22(_class6 = class TableHeaderCellExtension extends core.NodeExtension {
get name() {

@@ -563,0 +599,0 @@ return 'tableHeaderCell';

import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
import { ExtensionTag, invariant, ErrorConstant, object, values, includes, extension, ExtensionPriority, command, helper, NodeExtension, convertCommand, nonChainable } from '@remirror/core';
import { ExtensionTag, invariant, ErrorConstant, object, values, includes, extension, ExtensionPriority, command, helper, NodeExtension, convertCommand, nonChainable, findParentNodeOfType } from '@remirror/core';
import { ExtensionTablesMessages } from '@remirror/messages';
import { TextSelection } from '@remirror/pm/state';
import { fixTablesKey, tableEditing, columnResizing, deleteTable, addColumnBefore, addColumnAfter, deleteColumn, addRowBefore, addRowAfter, deleteRow, mergeCells, splitCell, toggleHeaderColumn, toggleHeaderRow, toggleHeaderCell, setCellAttr, fixTables } from '@remirror/pm/tables';
import { fixTablesKey, tableEditing, columnResizing, deleteTable, addColumnBefore, addColumnAfter, deleteColumn, addRowBefore, addRowAfter, deleteRow, mergeCells, splitCell, toggleHeaderColumn, toggleHeaderRow, toggleHeaderCell, setCellAttr, fixTables, CellSelection } from '@remirror/pm/tables';
import _createForOfIteratorHelper from '@babel/runtime/helpers/esm/createForOfIteratorHelper';

@@ -54,4 +54,2 @@

function createTableNodeSchema(extra, override) {
var _override$parseDOM, _override$parseDOM2, _override$parseDOM3, _override$parseDOM4;
var cellAttrs = _objectSpread(_objectSpread({}, extra.defaults()), {}, {

@@ -82,3 +80,3 @@ colspan: {

getAttrs: extra.parse
}, ...((_override$parseDOM = override.parseDOM) !== null && _override$parseDOM !== void 0 ? _override$parseDOM : [])],
}],

@@ -97,3 +95,3 @@ toDOM(node) {

getAttrs: extra.parse
}, ...((_override$parseDOM2 = override.parseDOM) !== null && _override$parseDOM2 !== void 0 ? _override$parseDOM2 : [])],
}],

@@ -114,3 +112,3 @@ toDOM(node) {

getAttrs: dom => _objectSpread(_objectSpread({}, extra.parse(dom)), getCellAttrs(dom))
}, ...((_override$parseDOM3 = override.parseDOM) !== null && _override$parseDOM3 !== void 0 ? _override$parseDOM3 : [])],
}],

@@ -131,3 +129,3 @@ toDOM(node) {

getAttrs: dom => _objectSpread(_objectSpread({}, extra.parse(dom)), getCellAttrs(dom))
}, ...((_override$parseDOM4 = override.parseDOM) !== null && _override$parseDOM4 !== void 0 ? _override$parseDOM4 : [])],
}],

@@ -246,3 +244,3 @@ toDOM(node) {

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _class, _class2, _dec19, _class4, _dec20, _class5, _dec21, _class6;
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _class, _class2, _temp, _dec20, _class4, _dec21, _class5, _dec22, _class6;
var createTableCommand = {

@@ -267,3 +265,3 @@ icon: 'table2',

disableChaining: true
}), _dec18 = helper(), _dec(_class = (_class2 = class TableExtension extends NodeExtension {
}), _dec18 = helper(), _dec19 = command(), _dec(_class = (_class2 = (_temp = class TableExtension extends NodeExtension {
constructor() {

@@ -487,2 +485,40 @@ super(...arguments);

/**
* Update the background of one cell or multiple cells by passing a color
* string. You can also remove the color by passing a `null`.
*/
setTableCellBackground(background) {
return props => {
var tr = props.tr;
var dispatch = props.dispatch;
var _tr = tr,
selection = _tr.selection;
if (selection instanceof CellSelection) {
selection.forEachCell((cellNode, pos) => {
tr = tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, cellNode.attrs), {}, {
background
}));
});
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
return true;
}
var found = findParentNodeOfType({
selection,
types: 'tableCell'
});
if (found) {
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.setNodeMarkup(found.pos, undefined, _objectSpread(_objectSpread({}, found.node.attrs), {}, {
background
})));
return true;
}
return false;
};
}
/**
* This managers the updates of the collaboration provider.

@@ -500,3 +536,3 @@ */

}, (_applyDecoratedDescriptor(_class2.prototype, "createTable", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "createTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTable", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnBefore", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnAfter", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableColumn", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowBefore", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowAfter", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableRow", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableCellMerge", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableCellMerge"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "mergeTableCells", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "mergeTableCells"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "splitTableCell", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "splitTableCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderColumn", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderRow", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderCell", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellAttribute", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellAttribute"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fixTables", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "fixTables"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "enableTableSupport", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "enableTableSupport"), _class2.prototype)), _class2)) || _class);
}, _temp), (_applyDecoratedDescriptor(_class2.prototype, "createTable", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "createTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTable", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnBefore", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnAfter", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableColumn", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowBefore", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowAfter", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableRow", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableCellMerge", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableCellMerge"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "mergeTableCells", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "mergeTableCells"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "splitTableCell", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "splitTableCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderColumn", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderRow", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderCell", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellAttribute", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellAttribute"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fixTables", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "fixTables"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "enableTableSupport", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "enableTableSupport"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellBackground", [_dec19], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellBackground"), _class2.prototype)), _class2)) || _class);
/**

@@ -506,5 +542,5 @@ * The extension for a table row node.

var TableRowExtension = (_dec19 = extension({
var TableRowExtension = (_dec20 = extension({
defaultPriority: ExtensionPriority.Low
}), _dec19(_class4 = class TableRowExtension extends NodeExtension {
}), _dec20(_class4 = class TableRowExtension extends NodeExtension {
get name() {

@@ -537,5 +573,5 @@ return 'tableRow';

var TableCellExtension = (_dec20 = extension({
var TableCellExtension = (_dec21 = extension({
defaultPriority: ExtensionPriority.Low
}), _dec20(_class5 = class TableCellExtension extends NodeExtension {
}), _dec21(_class5 = class TableCellExtension extends NodeExtension {
get name() {

@@ -554,5 +590,5 @@ return 'tableCell';

var TableHeaderCellExtension = (_dec21 = extension({
var TableHeaderCellExtension = (_dec22 = extension({
defaultPriority: ExtensionPriority.Low
}), _dec21(_class6 = class TableHeaderCellExtension extends NodeExtension {
}), _dec22(_class6 = class TableHeaderCellExtension extends NodeExtension {
get name() {

@@ -559,0 +595,0 @@ return 'tableHeaderCell';

@@ -58,4 +58,2 @@ 'use strict';

function createTableNodeSchema(extra, override) {
var _override$parseDOM, _override$parseDOM2, _override$parseDOM3, _override$parseDOM4;
var cellAttrs = _objectSpread(_objectSpread({}, extra.defaults()), {}, {

@@ -86,3 +84,3 @@ colspan: {

getAttrs: extra.parse
}, ...((_override$parseDOM = override.parseDOM) !== null && _override$parseDOM !== void 0 ? _override$parseDOM : [])],
}],

@@ -101,3 +99,3 @@ toDOM(node) {

getAttrs: extra.parse
}, ...((_override$parseDOM2 = override.parseDOM) !== null && _override$parseDOM2 !== void 0 ? _override$parseDOM2 : [])],
}],

@@ -118,3 +116,3 @@ toDOM(node) {

getAttrs: dom => _objectSpread(_objectSpread({}, extra.parse(dom)), getCellAttrs(dom))
}, ...((_override$parseDOM3 = override.parseDOM) !== null && _override$parseDOM3 !== void 0 ? _override$parseDOM3 : [])],
}],

@@ -135,3 +133,3 @@ toDOM(node) {

getAttrs: dom => _objectSpread(_objectSpread({}, extra.parse(dom)), getCellAttrs(dom))
}, ...((_override$parseDOM4 = override.parseDOM) !== null && _override$parseDOM4 !== void 0 ? _override$parseDOM4 : [])],
}],

@@ -250,3 +248,3 @@ toDOM(node) {

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _class, _class2, _dec19, _class4, _dec20, _class5, _dec21, _class6;
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _class, _class2, _temp, _dec20, _class4, _dec21, _class5, _dec22, _class6;
var createTableCommand = {

@@ -271,3 +269,3 @@ icon: 'table2',

disableChaining: true
}), _dec18 = core.helper(), _dec(_class = (_class2 = class TableExtension extends core.NodeExtension {
}), _dec18 = core.helper(), _dec19 = core.command(), _dec(_class = (_class2 = (_temp = class TableExtension extends core.NodeExtension {
constructor() {

@@ -491,2 +489,40 @@ super(...arguments);

/**
* Update the background of one cell or multiple cells by passing a color
* string. You can also remove the color by passing a `null`.
*/
setTableCellBackground(background) {
return props => {
var tr = props.tr;
var dispatch = props.dispatch;
var _tr = tr,
selection = _tr.selection;
if (selection instanceof tables.CellSelection) {
selection.forEachCell((cellNode, pos) => {
tr = tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, cellNode.attrs), {}, {
background
}));
});
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
return true;
}
var found = core.findParentNodeOfType({
selection,
types: 'tableCell'
});
if (found) {
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.setNodeMarkup(found.pos, undefined, _objectSpread(_objectSpread({}, found.node.attrs), {}, {
background
})));
return true;
}
return false;
};
}
/**
* This managers the updates of the collaboration provider.

@@ -504,3 +540,3 @@ */

}, (_applyDecoratedDescriptor(_class2.prototype, "createTable", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "createTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTable", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnBefore", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnAfter", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableColumn", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowBefore", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowAfter", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableRow", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableCellMerge", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableCellMerge"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "mergeTableCells", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "mergeTableCells"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "splitTableCell", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "splitTableCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderColumn", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderRow", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderCell", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellAttribute", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellAttribute"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fixTables", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "fixTables"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "enableTableSupport", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "enableTableSupport"), _class2.prototype)), _class2)) || _class);
}, _temp), (_applyDecoratedDescriptor(_class2.prototype, "createTable", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "createTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTable", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnBefore", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnAfter", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableColumn", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowBefore", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowAfter", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableRow", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableCellMerge", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableCellMerge"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "mergeTableCells", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "mergeTableCells"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "splitTableCell", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "splitTableCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderColumn", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderRow", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderCell", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellAttribute", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellAttribute"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fixTables", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "fixTables"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "enableTableSupport", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "enableTableSupport"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellBackground", [_dec19], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellBackground"), _class2.prototype)), _class2)) || _class);
/**

@@ -510,5 +546,5 @@ * The extension for a table row node.

var TableRowExtension = (_dec19 = core.extension({
var TableRowExtension = (_dec20 = core.extension({
defaultPriority: core.ExtensionPriority.Low
}), _dec19(_class4 = class TableRowExtension extends core.NodeExtension {
}), _dec20(_class4 = class TableRowExtension extends core.NodeExtension {
get name() {

@@ -541,5 +577,5 @@ return 'tableRow';

var TableCellExtension = (_dec20 = core.extension({
var TableCellExtension = (_dec21 = core.extension({
defaultPriority: core.ExtensionPriority.Low
}), _dec20(_class5 = class TableCellExtension extends core.NodeExtension {
}), _dec21(_class5 = class TableCellExtension extends core.NodeExtension {
get name() {

@@ -558,5 +594,5 @@ return 'tableCell';

var TableHeaderCellExtension = (_dec21 = core.extension({
var TableHeaderCellExtension = (_dec22 = core.extension({
defaultPriority: core.ExtensionPriority.Low
}), _dec21(_class6 = class TableHeaderCellExtension extends core.NodeExtension {
}), _dec22(_class6 = class TableHeaderCellExtension extends core.NodeExtension {
get name() {

@@ -563,0 +599,0 @@ return 'tableHeaderCell';

@@ -58,4 +58,2 @@ 'use strict';

function createTableNodeSchema(extra, override) {
var _override$parseDOM, _override$parseDOM2, _override$parseDOM3, _override$parseDOM4;
var cellAttrs = _objectSpread(_objectSpread({}, extra.defaults()), {}, {

@@ -86,3 +84,3 @@ colspan: {

getAttrs: extra.parse
}, ...((_override$parseDOM = override.parseDOM) !== null && _override$parseDOM !== void 0 ? _override$parseDOM : [])],
}],

@@ -101,3 +99,3 @@ toDOM(node) {

getAttrs: extra.parse
}, ...((_override$parseDOM2 = override.parseDOM) !== null && _override$parseDOM2 !== void 0 ? _override$parseDOM2 : [])],
}],

@@ -118,3 +116,3 @@ toDOM(node) {

getAttrs: dom => _objectSpread(_objectSpread({}, extra.parse(dom)), getCellAttrs(dom))
}, ...((_override$parseDOM3 = override.parseDOM) !== null && _override$parseDOM3 !== void 0 ? _override$parseDOM3 : [])],
}],

@@ -135,3 +133,3 @@ toDOM(node) {

getAttrs: dom => _objectSpread(_objectSpread({}, extra.parse(dom)), getCellAttrs(dom))
}, ...((_override$parseDOM4 = override.parseDOM) !== null && _override$parseDOM4 !== void 0 ? _override$parseDOM4 : [])],
}],

@@ -247,3 +245,3 @@ toDOM(node) {

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _class, _class2, _dec19, _class4, _dec20, _class5, _dec21, _class6;
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _class, _class2, _temp, _dec20, _class4, _dec21, _class5, _dec22, _class6;
var createTableCommand = {

@@ -268,3 +266,3 @@ icon: 'table2',

disableChaining: true
}), _dec18 = core.helper(), _dec(_class = (_class2 = class TableExtension extends core.NodeExtension {
}), _dec18 = core.helper(), _dec19 = core.command(), _dec(_class = (_class2 = (_temp = class TableExtension extends core.NodeExtension {
constructor() {

@@ -488,2 +486,40 @@ super(...arguments);

/**
* Update the background of one cell or multiple cells by passing a color
* string. You can also remove the color by passing a `null`.
*/
setTableCellBackground(background) {
return props => {
var tr = props.tr;
var dispatch = props.dispatch;
var _tr = tr,
selection = _tr.selection;
if (selection instanceof tables.CellSelection) {
selection.forEachCell((cellNode, pos) => {
tr = tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, cellNode.attrs), {}, {
background
}));
});
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
return true;
}
var found = core.findParentNodeOfType({
selection,
types: 'tableCell'
});
if (found) {
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.setNodeMarkup(found.pos, undefined, _objectSpread(_objectSpread({}, found.node.attrs), {}, {
background
})));
return true;
}
return false;
};
}
/**
* This managers the updates of the collaboration provider.

@@ -501,3 +537,3 @@ */

}, (_applyDecoratedDescriptor(_class2.prototype, "createTable", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "createTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTable", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnBefore", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnAfter", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableColumn", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowBefore", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowAfter", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableRow", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableCellMerge", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableCellMerge"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "mergeTableCells", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "mergeTableCells"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "splitTableCell", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "splitTableCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderColumn", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderRow", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderCell", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellAttribute", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellAttribute"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fixTables", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "fixTables"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "enableTableSupport", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "enableTableSupport"), _class2.prototype)), _class2)) || _class);
}, _temp), (_applyDecoratedDescriptor(_class2.prototype, "createTable", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "createTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTable", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnBefore", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnAfter", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableColumn", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowBefore", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowAfter", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableRow", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableCellMerge", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableCellMerge"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "mergeTableCells", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "mergeTableCells"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "splitTableCell", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "splitTableCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderColumn", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderRow", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderCell", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellAttribute", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellAttribute"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fixTables", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "fixTables"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "enableTableSupport", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "enableTableSupport"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellBackground", [_dec19], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellBackground"), _class2.prototype)), _class2)) || _class);
/**

@@ -507,5 +543,5 @@ * The extension for a table row node.

var TableRowExtension = (_dec19 = core.extension({
var TableRowExtension = (_dec20 = core.extension({
defaultPriority: core.ExtensionPriority.Low
}), _dec19(_class4 = class TableRowExtension extends core.NodeExtension {
}), _dec20(_class4 = class TableRowExtension extends core.NodeExtension {
get name() {

@@ -538,5 +574,5 @@ return 'tableRow';

var TableCellExtension = (_dec20 = core.extension({
var TableCellExtension = (_dec21 = core.extension({
defaultPriority: core.ExtensionPriority.Low
}), _dec20(_class5 = class TableCellExtension extends core.NodeExtension {
}), _dec21(_class5 = class TableCellExtension extends core.NodeExtension {
get name() {

@@ -555,5 +591,5 @@ return 'tableCell';

var TableHeaderCellExtension = (_dec21 = core.extension({
var TableHeaderCellExtension = (_dec22 = core.extension({
defaultPriority: core.ExtensionPriority.Low
}), _dec21(_class6 = class TableHeaderCellExtension extends core.NodeExtension {
}), _dec22(_class6 = class TableHeaderCellExtension extends core.NodeExtension {
get name() {

@@ -560,0 +596,0 @@ return 'tableHeaderCell';

import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2';
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
import _applyDecoratedDescriptor from '@babel/runtime/helpers/esm/applyDecoratedDescriptor';
import { ExtensionTag, invariant, ErrorConstant, object, values, includes, extension, ExtensionPriority, command, helper, NodeExtension, convertCommand, nonChainable } from '@remirror/core';
import { ExtensionTag, invariant, ErrorConstant, object, values, includes, extension, ExtensionPriority, command, helper, NodeExtension, convertCommand, nonChainable, findParentNodeOfType } from '@remirror/core';
import { ExtensionTablesMessages } from '@remirror/messages';
import { TextSelection } from '@remirror/pm/state';
import { fixTablesKey, tableEditing, columnResizing, deleteTable, addColumnBefore, addColumnAfter, deleteColumn, addRowBefore, addRowAfter, deleteRow, mergeCells, splitCell, toggleHeaderColumn, toggleHeaderRow, toggleHeaderCell, setCellAttr, fixTables } from '@remirror/pm/tables';
import { fixTablesKey, tableEditing, columnResizing, deleteTable, addColumnBefore, addColumnAfter, deleteColumn, addRowBefore, addRowAfter, deleteRow, mergeCells, splitCell, toggleHeaderColumn, toggleHeaderRow, toggleHeaderCell, setCellAttr, fixTables, CellSelection } from '@remirror/pm/tables';
import _createForOfIteratorHelper from '@babel/runtime/helpers/esm/createForOfIteratorHelper';

@@ -54,4 +54,2 @@

function createTableNodeSchema(extra, override) {
var _override$parseDOM, _override$parseDOM2, _override$parseDOM3, _override$parseDOM4;
var cellAttrs = _objectSpread(_objectSpread({}, extra.defaults()), {}, {

@@ -82,3 +80,3 @@ colspan: {

getAttrs: extra.parse
}, ...((_override$parseDOM = override.parseDOM) !== null && _override$parseDOM !== void 0 ? _override$parseDOM : [])],
}],

@@ -97,3 +95,3 @@ toDOM(node) {

getAttrs: extra.parse
}, ...((_override$parseDOM2 = override.parseDOM) !== null && _override$parseDOM2 !== void 0 ? _override$parseDOM2 : [])],
}],

@@ -114,3 +112,3 @@ toDOM(node) {

getAttrs: dom => _objectSpread(_objectSpread({}, extra.parse(dom)), getCellAttrs(dom))
}, ...((_override$parseDOM3 = override.parseDOM) !== null && _override$parseDOM3 !== void 0 ? _override$parseDOM3 : [])],
}],

@@ -131,3 +129,3 @@ toDOM(node) {

getAttrs: dom => _objectSpread(_objectSpread({}, extra.parse(dom)), getCellAttrs(dom))
}, ...((_override$parseDOM4 = override.parseDOM) !== null && _override$parseDOM4 !== void 0 ? _override$parseDOM4 : [])],
}],

@@ -246,3 +244,3 @@ toDOM(node) {

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _class, _class2, _dec19, _class4, _dec20, _class5, _dec21, _class6;
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _class, _class2, _temp, _dec20, _class4, _dec21, _class5, _dec22, _class6;
var createTableCommand = {

@@ -267,3 +265,3 @@ icon: 'table2',

disableChaining: true
}), _dec18 = helper(), _dec(_class = (_class2 = class TableExtension extends NodeExtension {
}), _dec18 = helper(), _dec19 = command(), _dec(_class = (_class2 = (_temp = class TableExtension extends NodeExtension {
constructor() {

@@ -487,2 +485,40 @@ super(...arguments);

/**
* Update the background of one cell or multiple cells by passing a color
* string. You can also remove the color by passing a `null`.
*/
setTableCellBackground(background) {
return props => {
var tr = props.tr;
var dispatch = props.dispatch;
var _tr = tr,
selection = _tr.selection;
if (selection instanceof CellSelection) {
selection.forEachCell((cellNode, pos) => {
tr = tr.setNodeMarkup(pos, undefined, _objectSpread(_objectSpread({}, cellNode.attrs), {}, {
background
}));
});
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
return true;
}
var found = findParentNodeOfType({
selection,
types: 'tableCell'
});
if (found) {
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr.setNodeMarkup(found.pos, undefined, _objectSpread(_objectSpread({}, found.node.attrs), {}, {
background
})));
return true;
}
return false;
};
}
/**
* This managers the updates of the collaboration provider.

@@ -500,3 +536,3 @@ */

}, (_applyDecoratedDescriptor(_class2.prototype, "createTable", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "createTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTable", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnBefore", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnAfter", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableColumn", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowBefore", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowAfter", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableRow", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableCellMerge", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableCellMerge"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "mergeTableCells", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "mergeTableCells"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "splitTableCell", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "splitTableCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderColumn", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderRow", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderCell", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellAttribute", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellAttribute"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fixTables", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "fixTables"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "enableTableSupport", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "enableTableSupport"), _class2.prototype)), _class2)) || _class);
}, _temp), (_applyDecoratedDescriptor(_class2.prototype, "createTable", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "createTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTable", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTable"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnBefore", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableColumnAfter", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableColumnAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableColumn", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowBefore", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowBefore"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "addTableRowAfter", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "addTableRowAfter"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "deleteTableRow", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "deleteTableRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableCellMerge", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableCellMerge"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "mergeTableCells", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "mergeTableCells"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "splitTableCell", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "splitTableCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderColumn", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderColumn"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderRow", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderRow"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleTableHeaderCell", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleTableHeaderCell"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellAttribute", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellAttribute"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fixTables", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "fixTables"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "enableTableSupport", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "enableTableSupport"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "setTableCellBackground", [_dec19], Object.getOwnPropertyDescriptor(_class2.prototype, "setTableCellBackground"), _class2.prototype)), _class2)) || _class);
/**

@@ -506,5 +542,5 @@ * The extension for a table row node.

var TableRowExtension = (_dec19 = extension({
var TableRowExtension = (_dec20 = extension({
defaultPriority: ExtensionPriority.Low
}), _dec19(_class4 = class TableRowExtension extends NodeExtension {
}), _dec20(_class4 = class TableRowExtension extends NodeExtension {
get name() {

@@ -537,5 +573,5 @@ return 'tableRow';

var TableCellExtension = (_dec20 = extension({
var TableCellExtension = (_dec21 = extension({
defaultPriority: ExtensionPriority.Low
}), _dec20(_class5 = class TableCellExtension extends NodeExtension {
}), _dec21(_class5 = class TableCellExtension extends NodeExtension {
get name() {

@@ -554,5 +590,5 @@ return 'tableCell';

var TableHeaderCellExtension = (_dec21 = extension({
var TableHeaderCellExtension = (_dec22 = extension({
defaultPriority: ExtensionPriority.Low
}), _dec21(_class6 = class TableHeaderCellExtension extends NodeExtension {
}), _dec22(_class6 = class TableHeaderCellExtension extends NodeExtension {
get name() {

@@ -559,0 +595,0 @@ return 'tableHeaderCell';

{
"name": "@remirror/extension-tables",
"version": "0.0.0-pr905.1",
"version": "0.0.0-pr911.1",
"description": "A table a day keeps the doctor away. Remirror and play keeps the bad times at bay.",

@@ -44,11 +44,12 @@ "keywords": [

"@babel/runtime": "^7.13.10",
"@remirror/core": "0.0.0-pr905.1",
"@remirror/messages": "0.0.0-pr905.1",
"@remirror/theme": "0.0.0-pr905.1"
"@linaria/core": "^3.0.0-beta.1",
"@remirror/core": "0.0.0-pr911.1",
"@remirror/messages": "0.0.0-pr911.1",
"@remirror/theme": "0.0.0-pr911.1"
},
"devDependencies": {
"@remirror/pm": "0.0.0-pr905.1"
"@remirror/pm": "0.0.0-pr911.1"
},
"peerDependencies": {
"@remirror/pm": "0.0.0-pr905.1"
"@remirror/pm": "0.0.0-pr911.1"
},

@@ -55,0 +56,0 @@ "publishConfig": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc