@modusoperandi/licit 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LinkSetURLCommand.js +1 -1
- package/LinkTooltipPlugin.js +1 -1
- package/TableBackgroundColorCommand.js +1 -1
- package/TableBackgroundColorCommand.js.flow +2 -2
- package/TableBorderColorCommand.js +35 -3
- package/TableBorderColorCommand.js.flow +31 -4
- package/TableCellColorCommand.js +1 -1
- package/TableCellColorCommand.js.flow +3 -3
- package/TableNodesSpecs.js +55 -0
- package/TableNodesSpecs.js.flow +55 -0
- package/bom.xml +36727 -30036
- package/client/Licit.js +20 -4
- package/client/Licit.js.flow +18 -6
- package/package.json +6 -6
- package/ui/Icon.js +1 -1
- package/ui/LinkURLEditor.js +12 -12
- package/ui/LinkURLEditor.js.flow +8 -8
- package/ui/czi-editor.css +5 -0
- package/ui/czi-table.css +4 -1
package/LinkSetURLCommand.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (
|
|
2
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
3
3
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
|
|
4
4
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
5
5
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
package/LinkTooltipPlugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (
|
|
2
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
3
3
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { if (r) i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n;else { var o = function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); }; o("next", 0), o("throw", 1), o("return", 2); } }, _regeneratorDefine2(e, r, n, t); }
|
|
4
4
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
5
5
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
@@ -71,7 +71,7 @@ var TableBackgroundColorCommand = /*#__PURE__*/function (_UICommand) {
|
|
|
71
71
|
});
|
|
72
72
|
_defineProperty(_this, "executeWithUserInput", function (state, dispatch, view, hex) {
|
|
73
73
|
if (dispatch && hex !== undefined) {
|
|
74
|
-
var cmd = setCellAttr('background', hex);
|
|
74
|
+
var cmd = setCellAttr('background', hex.color);
|
|
75
75
|
cmd(state, dispatch, view);
|
|
76
76
|
return true;
|
|
77
77
|
}
|
|
@@ -61,10 +61,10 @@ class TableBackgroundColorCommand extends UICommand {
|
|
|
61
61
|
state: EditorState,
|
|
62
62
|
dispatch: ?(tr: Transform) => void,
|
|
63
63
|
view: ?EditorView,
|
|
64
|
-
hex: ?string
|
|
64
|
+
hex: ?{ color: string, selectedPosition?: string }
|
|
65
65
|
): boolean => {
|
|
66
66
|
if (dispatch && hex !== undefined) {
|
|
67
|
-
const cmd = setCellAttr('background', hex);
|
|
67
|
+
const cmd = setCellAttr('background', hex.color);
|
|
68
68
|
cmd(state, dispatch, view);
|
|
69
69
|
return true;
|
|
70
70
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2
4
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
5
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
6
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
@@ -55,7 +57,8 @@ var TableBorderColorCommand = /*#__PURE__*/function (_UICommand) {
|
|
|
55
57
|
return new Promise(function (resolve) {
|
|
56
58
|
_this._popUp = createPopUp(ColorEditor, {
|
|
57
59
|
hex: hex,
|
|
58
|
-
runtime: view.runtime
|
|
60
|
+
runtime: view.runtime,
|
|
61
|
+
showCheckbox: true
|
|
59
62
|
}, {
|
|
60
63
|
anchor: anchor,
|
|
61
64
|
autoDismiss: false,
|
|
@@ -71,8 +74,10 @@ var TableBorderColorCommand = /*#__PURE__*/function (_UICommand) {
|
|
|
71
74
|
});
|
|
72
75
|
_defineProperty(_this, "executeWithUserInput", function (state, dispatch, view, color) {
|
|
73
76
|
if (dispatch && color !== undefined) {
|
|
74
|
-
var
|
|
75
|
-
|
|
77
|
+
var pos = _this.findCellPosFromSelection(view.state);
|
|
78
|
+
if (pos !== null) {
|
|
79
|
+
_this.setCellBorder(view, pos, color.selectedPosition, color.color);
|
|
80
|
+
}
|
|
76
81
|
return true;
|
|
77
82
|
}
|
|
78
83
|
return false;
|
|
@@ -86,6 +91,33 @@ var TableBorderColorCommand = /*#__PURE__*/function (_UICommand) {
|
|
|
86
91
|
var _this$_popUp;
|
|
87
92
|
(_this$_popUp = this._popUp) === null || _this$_popUp === void 0 || _this$_popUp.close(undefined);
|
|
88
93
|
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "setCellBorder",
|
|
96
|
+
value: function setCellBorder(view, pos, side, color) {
|
|
97
|
+
var width = '0.25px';
|
|
98
|
+
var style = 'solid';
|
|
99
|
+
var state = view.state,
|
|
100
|
+
dispatch = view.dispatch;
|
|
101
|
+
var node = state.doc.nodeAt(pos);
|
|
102
|
+
if (!node || !['table_cell', 'table_header'].includes(node.type.name)) return;
|
|
103
|
+
var newAttrs = _objectSpread({}, node.attrs);
|
|
104
|
+
var cssValue = "".concat(width, " ").concat(style, " ").concat(color);
|
|
105
|
+
var attrName = "border".concat(side.charAt(0).toUpperCase() + side.slice(1));
|
|
106
|
+
newAttrs[attrName] = cssValue;
|
|
107
|
+
dispatch(state.tr.setNodeMarkup(pos, null, newAttrs));
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "findCellPosFromSelection",
|
|
111
|
+
value: function findCellPosFromSelection(state) {
|
|
112
|
+
var $from = state.selection.$from;
|
|
113
|
+
for (var d = $from.depth; d > 0; d--) {
|
|
114
|
+
var node = $from.node(d);
|
|
115
|
+
if (['cell', 'header_cell'].includes(node.type.spec.tableRole)) {
|
|
116
|
+
return $from.before(d);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
89
121
|
}]);
|
|
90
122
|
}(UICommand);
|
|
91
123
|
export default TableBorderColorCommand;
|
|
@@ -43,7 +43,7 @@ class TableBorderColorCommand extends UICommand {
|
|
|
43
43
|
const hex = result ? result.mark.attrs.color : null;
|
|
44
44
|
|
|
45
45
|
return new Promise((resolve) => {
|
|
46
|
-
this._popUp = createPopUp(ColorEditor, { hex, runtime: view.runtime },
|
|
46
|
+
this._popUp = createPopUp(ColorEditor, { hex, runtime: view.runtime, showCheckbox: true },
|
|
47
47
|
{
|
|
48
48
|
anchor,
|
|
49
49
|
autoDismiss: false,
|
|
@@ -62,11 +62,13 @@ class TableBorderColorCommand extends UICommand {
|
|
|
62
62
|
state: EditorState,
|
|
63
63
|
dispatch: ?(tr: Transform) => void,
|
|
64
64
|
view: ?EditorView,
|
|
65
|
-
color: ?string
|
|
65
|
+
color: ?{ color: string, selectedPosition?: string }
|
|
66
66
|
): boolean => {
|
|
67
67
|
if (dispatch && color !== undefined) {
|
|
68
|
-
const
|
|
69
|
-
|
|
68
|
+
const pos = this.findCellPosFromSelection(view.state);
|
|
69
|
+
if (pos !== null) {
|
|
70
|
+
this.setCellBorder(view, pos, color.selectedPosition, color.color);
|
|
71
|
+
}
|
|
70
72
|
return true;
|
|
71
73
|
}
|
|
72
74
|
return false;
|
|
@@ -75,6 +77,31 @@ class TableBorderColorCommand extends UICommand {
|
|
|
75
77
|
cancel(): void {
|
|
76
78
|
this._popUp?.close(undefined);
|
|
77
79
|
}
|
|
80
|
+
|
|
81
|
+
setCellBorder(view: ?EditorView, pos: Number, side: string, color: string) {
|
|
82
|
+
const width = '0.25px';
|
|
83
|
+
const style = 'solid';
|
|
84
|
+
const { state, dispatch } = view;
|
|
85
|
+
const node = state.doc.nodeAt(pos);
|
|
86
|
+
if (!node || !['table_cell', 'table_header'].includes(node.type.name)) return;
|
|
87
|
+
|
|
88
|
+
const newAttrs = { ...node.attrs };
|
|
89
|
+
const cssValue = `${width} ${style} ${color}`;
|
|
90
|
+
const attrName = `border${side.charAt(0).toUpperCase() + side.slice(1)}`;
|
|
91
|
+
newAttrs[attrName] = cssValue;
|
|
92
|
+
dispatch(state.tr.setNodeMarkup(pos, null, newAttrs));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
findCellPosFromSelection(state: EditorState) {
|
|
96
|
+
const { $from } = state.selection;
|
|
97
|
+
for (let d = $from.depth; d > 0; d--) {
|
|
98
|
+
const node = $from.node(d);
|
|
99
|
+
if (['cell', 'header_cell'].includes(node.type.spec.tableRole)) {
|
|
100
|
+
return $from.before(d);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
78
105
|
}
|
|
79
106
|
|
|
80
107
|
export default TableBorderColorCommand;
|
package/TableCellColorCommand.js
CHANGED
|
@@ -60,7 +60,7 @@ var TableCellColorCommand = /*#__PURE__*/function (_UICommand) {
|
|
|
60
60
|
});
|
|
61
61
|
_defineProperty(_this, "executeWithUserInput", function (state, dispatch, view, hex) {
|
|
62
62
|
if (dispatch && hex !== undefined) {
|
|
63
|
-
var cmd = setCellAttr('background', hex);
|
|
63
|
+
var cmd = setCellAttr('background', hex.color);
|
|
64
64
|
cmd(state, dispatch, view);
|
|
65
65
|
return true;
|
|
66
66
|
}
|
|
@@ -39,7 +39,7 @@ class TableCellColorCommand extends UICommand {
|
|
|
39
39
|
return new Promise((resolve) => {
|
|
40
40
|
this._popUp = createPopUp(ColorEditor, null, {
|
|
41
41
|
anchor,
|
|
42
|
-
autoDismiss:false,
|
|
42
|
+
autoDismiss: false,
|
|
43
43
|
position: atAnchorRight,
|
|
44
44
|
onClose: (val) => {
|
|
45
45
|
if (this._popUp) {
|
|
@@ -55,10 +55,10 @@ class TableCellColorCommand extends UICommand {
|
|
|
55
55
|
state: EditorState,
|
|
56
56
|
dispatch: ?(tr: Transform) => void,
|
|
57
57
|
view: ?EditorView,
|
|
58
|
-
hex: ?string
|
|
58
|
+
hex: ?{ color: string, selectedPosition?: string }
|
|
59
59
|
): boolean => {
|
|
60
60
|
if (dispatch && hex !== undefined) {
|
|
61
|
-
const cmd = setCellAttr('background', hex);
|
|
61
|
+
const cmd = setCellAttr('background', hex.color);
|
|
62
62
|
cmd(state, dispatch, view);
|
|
63
63
|
return true;
|
|
64
64
|
}
|
package/TableNodesSpecs.js
CHANGED
|
@@ -8,6 +8,61 @@ var TableNodesSpecs = tableNodes({
|
|
|
8
8
|
tableGroup: 'block',
|
|
9
9
|
cellContent: 'block+',
|
|
10
10
|
cellAttributes: {
|
|
11
|
+
className: {
|
|
12
|
+
"default": null,
|
|
13
|
+
getFromDOM: function getFromDOM(dom) {
|
|
14
|
+
return dom.getAttribute('class') || null;
|
|
15
|
+
},
|
|
16
|
+
setDOMAttr: function setDOMAttr(value, attrs) {
|
|
17
|
+
if (value) {
|
|
18
|
+
attrs["class"] = value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
borderTop: {
|
|
23
|
+
"default": null,
|
|
24
|
+
getFromDOM: function getFromDOM(dom) {
|
|
25
|
+
return dom.style.borderTop || null;
|
|
26
|
+
},
|
|
27
|
+
setDOMAttr: function setDOMAttr(value, attrs) {
|
|
28
|
+
if (value) {
|
|
29
|
+
attrs.style = (attrs.style || '') + ";border-top: ".concat(value, ";");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
borderRight: {
|
|
34
|
+
"default": null,
|
|
35
|
+
getFromDOM: function getFromDOM(dom) {
|
|
36
|
+
return dom.style.borderRight || null;
|
|
37
|
+
},
|
|
38
|
+
setDOMAttr: function setDOMAttr(value, attrs) {
|
|
39
|
+
if (value) {
|
|
40
|
+
attrs.style = (attrs.style || '') + ";border-right: ".concat(value, ";");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
borderBottom: {
|
|
45
|
+
"default": null,
|
|
46
|
+
getFromDOM: function getFromDOM(dom) {
|
|
47
|
+
return dom.style.borderBottom || null;
|
|
48
|
+
},
|
|
49
|
+
setDOMAttr: function setDOMAttr(value, attrs) {
|
|
50
|
+
if (value) {
|
|
51
|
+
attrs.style = (attrs.style || '') + ";border-bottom: ".concat(value, ";");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
borderLeft: {
|
|
56
|
+
"default": null,
|
|
57
|
+
getFromDOM: function getFromDOM(dom) {
|
|
58
|
+
return dom.style.borderLeft || null;
|
|
59
|
+
},
|
|
60
|
+
setDOMAttr: function setDOMAttr(value, attrs) {
|
|
61
|
+
if (value) {
|
|
62
|
+
attrs.style = (attrs.style || '') + ";border-left: ".concat(value, ";");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
11
66
|
borderColor: {
|
|
12
67
|
"default": null,
|
|
13
68
|
getFromDOM: function getFromDOM(dom) {
|
package/TableNodesSpecs.js.flow
CHANGED
|
@@ -11,6 +11,61 @@ const TableNodesSpecs = tableNodes({
|
|
|
11
11
|
tableGroup: 'block',
|
|
12
12
|
cellContent: 'block+',
|
|
13
13
|
cellAttributes: {
|
|
14
|
+
className: {
|
|
15
|
+
default: null,
|
|
16
|
+
getFromDOM(dom) {
|
|
17
|
+
return dom.getAttribute('class') || null;
|
|
18
|
+
},
|
|
19
|
+
setDOMAttr(value, attrs) {
|
|
20
|
+
if (value) {
|
|
21
|
+
attrs.class = value;
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
borderTop: {
|
|
26
|
+
default: null,
|
|
27
|
+
getFromDOM(dom) {
|
|
28
|
+
return dom.style.borderTop || null;
|
|
29
|
+
},
|
|
30
|
+
setDOMAttr(value, attrs) {
|
|
31
|
+
if (value) {
|
|
32
|
+
attrs.style = (attrs.style || '') + `;border-top: ${value};`;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
borderRight: {
|
|
37
|
+
default: null,
|
|
38
|
+
getFromDOM(dom) {
|
|
39
|
+
return dom.style.borderRight || null;
|
|
40
|
+
},
|
|
41
|
+
setDOMAttr(value, attrs) {
|
|
42
|
+
if (value) {
|
|
43
|
+
attrs.style = (attrs.style || '') + `;border-right: ${value};`;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
borderBottom: {
|
|
48
|
+
default: null,
|
|
49
|
+
getFromDOM(dom) {
|
|
50
|
+
return dom.style.borderBottom || null;
|
|
51
|
+
},
|
|
52
|
+
setDOMAttr(value, attrs) {
|
|
53
|
+
if (value) {
|
|
54
|
+
attrs.style = (attrs.style || '') + `;border-bottom: ${value};`;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
borderLeft: {
|
|
59
|
+
default: null,
|
|
60
|
+
getFromDOM(dom) {
|
|
61
|
+
return dom.style.borderLeft || null;
|
|
62
|
+
},
|
|
63
|
+
setDOMAttr(value, attrs) {
|
|
64
|
+
if (value) {
|
|
65
|
+
attrs.style = (attrs.style || '') + `;border-left: ${value};`;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
},
|
|
14
69
|
borderColor: {
|
|
15
70
|
default: null,
|
|
16
71
|
getFromDOM(dom) {
|