@modusoperandi/licit 1.3.6 → 1.4.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modusoperandi/licit",
3
- "version": "1.3.6",
3
+ "version": "1.4.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "subversion": "1",
@@ -90,7 +90,7 @@
90
90
  "exports-loader": "^5.0.0",
91
91
  "express": "^5.1.0",
92
92
  "file-loader": "^6.2.0",
93
- "flow-bin": "^0.271.0",
93
+ "flow-bin": "^0.272.1",
94
94
  "flow-copy-source": "^2.0.9",
95
95
  "flow-typed": "^4.0.0",
96
96
  "flow-webpack-plugin": "^1.2.0",
package/ui/Icon.js CHANGED
@@ -12,7 +12,8 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
12
12
  function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
13
13
  function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
14
14
  function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
15
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i["return"] && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, "catch": function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
15
+ 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) && (c = i[4] || 3, u = i[5] === e ? i[3] : i[5], i[4] = 3, 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 }; })(); }
16
+ 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); }
16
17
  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); }
17
18
  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); }); }; }
18
19
  import cx from 'classnames';
@@ -22,24 +23,23 @@ var VALID_CHARS = /[a-z_]+/;
22
23
  var cached = {};
23
24
  var CSS_CDN_URL = '//fonts.googleapis.com/icon?family=Material+Icons';
24
25
  var CSS_FONT = 'Material Icons';
25
- _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
26
+ _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
26
27
  var fontSupported;
27
- return _regeneratorRuntime().wrap(function _callee$(_context) {
28
- while (1) switch (_context.prev = _context.next) {
28
+ return _regenerator().w(function (_context) {
29
+ while (1) switch (_context.n) {
29
30
  case 0:
30
- _context.next = 2;
31
+ _context.n = 1;
31
32
  return canUseCSSFont(CSS_FONT);
32
- case 2:
33
- fontSupported = _context.sent;
33
+ case 1:
34
+ fontSupported = _context.v;
34
35
  if (!fontSupported) {
35
36
  console.info('Add CSS from ', CSS_CDN_URL);
36
37
  // [FS] IRAD-1061 2020-09-19
37
38
  // Now loaded locally, so that it work in closed network as well.
38
39
  //injectStyleSheet(CSS_CDN_URL);
39
40
  }
40
- case 4:
41
- case "end":
42
- return _context.stop();
41
+ case 2:
42
+ return _context.a(2);
43
43
  }
44
44
  }, _callee);
45
45
  }))();
@@ -1,6 +1,4 @@
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; }
4
2
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
5
3
  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); } }
6
4
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -19,8 +17,6 @@ import PropTypes from 'prop-types';
19
17
  import sanitizeURL from '../sanitizeURL.js';
20
18
  import { CustomButton, preventEventDefault } from '@modusoperandi/licit-ui-commands';
21
19
  import { ENTER } from './KeyCodes.js';
22
- import uuid from '../uuid.js';
23
- import { EditorView } from 'prosemirror-view';
24
20
  import { INNER_LINK } from '../Types.js';
25
21
  import { Tooltip as ReactTooltip } from 'react-tooltip';
26
22
  var BAD_CHARACTER_PATTER = /\s/;
@@ -35,7 +31,6 @@ var LinkURLEditor = /*#__PURE__*/function (_React$PureComponent) {
35
31
  _defineProperty(_this, "state", {
36
32
  url: _this.props.href_,
37
33
  TOCselectedNode_: _this.props.TOCselectedNode_,
38
- view_: _this.props.view_,
39
34
  selectionId: _this.props.selectionId_
40
35
  });
41
36
  _defineProperty(_this, "openForm", function (formName) {
@@ -57,23 +52,10 @@ var LinkURLEditor = /*#__PURE__*/function (_React$PureComponent) {
57
52
  clickedButton.classList.add('active');
58
53
  }
59
54
  });
60
- _defineProperty(_this, "handleOptionChange", function (textContent_, tocNodePosition_, view) {
61
- var _TocNode$attrs;
62
- var tr = view.state.tr;
63
- var TocNode = view.state.doc.nodeAt(tocNodePosition_);
64
- var textContent;
65
- if (!(TocNode !== null && TocNode !== void 0 && (_TocNode$attrs = TocNode.attrs) !== null && _TocNode$attrs !== void 0 && _TocNode$attrs.innerLink)) {
66
- var nodeUUID = uuid();
67
- var texthash = '#';
68
- var nodeAttrs = _objectSpread({}, TocNode.attrs);
69
- var nodeconcat_UUID = texthash.concat(nodeUUID);
70
- nodeAttrs.innerLink = nodeconcat_UUID;
71
- tr = tr.setNodeMarkup(tocNodePosition_, undefined, nodeAttrs);
72
- textContent = nodeconcat_UUID.concat(INNER_LINK, textContent_);
73
- } else {
74
- textContent = TocNode.attrs.innerLink.concat(INNER_LINK, textContent_);
75
- }
76
- view.dispatch(tr);
55
+ _defineProperty(_this, "handleOptionChange", function (textContent_, selectionId) {
56
+ var texthash = '';
57
+ var nodeconcat_UUID = texthash.concat(selectionId);
58
+ var textContent = nodeconcat_UUID.concat(INNER_LINK, textContent_);
77
59
  _this.props.close(textContent);
78
60
  });
79
61
  _defineProperty(_this, "_onKeyDown", function (e) {
@@ -115,18 +97,17 @@ var LinkURLEditor = /*#__PURE__*/function (_React$PureComponent) {
115
97
  var _this$state = this.state,
116
98
  url = _this$state.url,
117
99
  TOCselectedNode_ = _this$state.TOCselectedNode_,
118
- view_ = _this$state.view_,
119
100
  selectionId = _this$state.selectionId;
120
101
  var isTOCValid = function isTOCValid() {
121
102
  if (!TOCselectedNode_ || TOCselectedNode_.length === 0) {
122
103
  return false;
123
104
  }
124
105
  return TOCselectedNode_.some(function (item) {
125
- return item.node_ && item.node_.textContent.trim() !== '';
106
+ var _item$node_;
107
+ return ((_item$node_ = item.node_) === null || _item$node_ === void 0 || (_item$node_ = _item$node_.content[0]) === null || _item$node_ === void 0 || (_item$node_ = _item$node_.text) === null || _item$node_ === void 0 ? void 0 : _item$node_.trim()) !== '';
126
108
  });
127
109
  };
128
110
  var isValid = isTOCValid();
129
- console.log('isTOCValid:', isValid);
130
111
  var error = url ? BAD_CHARACTER_PATTER.test(url) : false;
131
112
  var label = 'Apply';
132
113
  var disabled;
@@ -198,23 +179,27 @@ var LinkURLEditor = /*#__PURE__*/function (_React$PureComponent) {
198
179
  action: "#"
199
180
  }, /*#__PURE__*/React.createElement("label", null, "Select the Inner Link"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("select", {
200
181
  defaultValue: TOCselectedNode_.some(function (res) {
201
- return res.node_.textContent === url;
182
+ var _res$node_;
183
+ return ((_res$node_ = res.node_) === null || _res$node_ === void 0 || (_res$node_ = _res$node_.content[0]) === null || _res$node_ === void 0 ? void 0 : _res$node_.text) === url;
202
184
  }) ? url : null,
203
185
  id: "toc",
204
186
  name: "toccontents",
205
187
  size: "3"
206
188
  }, TOCselectedNode_ === null || TOCselectedNode_ === void 0 ? void 0 : TOCselectedNode_.filter(function (res) {
207
- return res.node_.textContent.trim() !== '';
189
+ var _res$node_2;
190
+ return ((_res$node_2 = res.node_) === null || _res$node_2 === void 0 || (_res$node_2 = _res$node_2.content[0]) === null || _res$node_2 === void 0 || (_res$node_2 = _res$node_2.text) === null || _res$node_2 === void 0 ? void 0 : _res$node_2.trim()) !== '';
208
191
  }).map(function (res, index) {
192
+ var _res$node_3, _res$node_6, _res$node_7;
209
193
  return /*#__PURE__*/React.createElement("option", {
210
- "data-tooltip-content": res.node_.textContent,
194
+ "data-tooltip-content": (_res$node_3 = res.node_) === null || _res$node_3 === void 0 || (_res$node_3 = _res$node_3.content[0]) === null || _res$node_3 === void 0 ? void 0 : _res$node_3.text,
211
195
  "data-tooltip-id": "select-toc-tooltip",
212
196
  key: index,
213
197
  onClick: function onClick() {
214
- _this2.handleOptionChange(res.node_.textContent, res.pos_, view_);
198
+ var _res$node_4, _res$node_5;
199
+ _this2.handleOptionChange((_res$node_4 = res.node_) === null || _res$node_4 === void 0 || (_res$node_4 = _res$node_4.content[0]) === null || _res$node_4 === void 0 ? void 0 : _res$node_4.text, (_res$node_5 = res.node_) === null || _res$node_5 === void 0 ? void 0 : _res$node_5.attrs.selectionId);
215
200
  },
216
- value: res.node_.textContent
217
- }, res.node_.textContent);
201
+ value: (_res$node_6 = res.node_) === null || _res$node_6 === void 0 || (_res$node_6 = _res$node_6.content[0]) === null || _res$node_6 === void 0 ? void 0 : _res$node_6.text
202
+ }, (_res$node_7 = res.node_) === null || _res$node_7 === void 0 || (_res$node_7 = _res$node_7.content[0]) === null || _res$node_7 === void 0 ? void 0 : _res$node_7.text);
218
203
  })), /*#__PURE__*/React.createElement(ReactTooltip, {
219
204
  effect: "solid",
220
205
  id: "select-toc-tooltip",
@@ -9,8 +9,6 @@ import {
9
9
  preventEventDefault,
10
10
  } from '@modusoperandi/licit-ui-commands';
11
11
  import { ENTER } from './KeyCodes.js';
12
- import uuid from '../uuid.js';
13
- import { EditorView } from 'prosemirror-view';
14
12
  import { INNER_LINK } from '../Types.js';
15
13
  import { Tooltip as ReactTooltip } from 'react-tooltip';
16
14
 
@@ -26,7 +24,6 @@ class LinkURLEditor extends React.PureComponent<any, any> {
26
24
  state = {
27
25
  url: this.props.href_,
28
26
  TOCselectedNode_: this.props.TOCselectedNode_,
29
- view_: this.props.view_,
30
27
  selectionId: this.props.selectionId_,
31
28
  };
32
29
 
@@ -64,7 +61,7 @@ class LinkURLEditor extends React.PureComponent<any, any> {
64
61
  };
65
62
 
66
63
  render(): React.Element<any> {
67
- const { url, TOCselectedNode_, view_, selectionId } = this.state;
64
+ const { url, TOCselectedNode_, selectionId } = this.state;
68
65
 
69
66
  const isTOCValid = () => {
70
67
  if (!TOCselectedNode_ || TOCselectedNode_.length === 0) {
@@ -72,12 +69,10 @@ class LinkURLEditor extends React.PureComponent<any, any> {
72
69
  }
73
70
 
74
71
  return TOCselectedNode_.some(
75
- (item) => item.node_ && item.node_.textContent.trim() !== ''
72
+ (item) => item.node_?.content[0]?.text?.trim() !== ''
76
73
  );
77
74
  };
78
75
  const isValid = isTOCValid();
79
- console.log('isTOCValid:', isValid);
80
-
81
76
  const error = url ? BAD_CHARACTER_PATTER.test(url) : false;
82
77
 
83
78
  let label = 'Apply';
@@ -151,7 +146,7 @@ class LinkURLEditor extends React.PureComponent<any, any> {
151
146
  <select
152
147
  defaultValue={
153
148
  TOCselectedNode_.some(
154
- (res) => res.node_.textContent === url
149
+ (res) => res.node_?.content[0]?.text === url
155
150
  )
156
151
  ? url
157
152
  : null
@@ -161,22 +156,21 @@ class LinkURLEditor extends React.PureComponent<any, any> {
161
156
  size="3"
162
157
  >
163
158
  {TOCselectedNode_?.filter(
164
- (res) => res.node_.textContent.trim() !== ''
159
+ (res) => res.node_?.content[0]?.text?.trim() !== ''
165
160
  ).map((res, index) => (
166
161
  <option
167
- data-tooltip-content={res.node_.textContent}
162
+ data-tooltip-content={res.node_?.content[0]?.text}
168
163
  data-tooltip-id="select-toc-tooltip"
169
164
  key={index}
170
165
  onClick={() => {
171
166
  this.handleOptionChange(
172
- res.node_.textContent,
173
- res.pos_,
174
- view_
167
+ res.node_?.content[0]?.text,
168
+ res.node_?.attrs.selectionId
175
169
  );
176
170
  }}
177
- value={res.node_.textContent}
171
+ value={res.node_?.content[0]?.text}
178
172
  >
179
- {res.node_.textContent}
173
+ {res.node_?.content[0]?.text}
180
174
  </option>
181
175
  ))}
182
176
  </select>
@@ -197,22 +191,10 @@ class LinkURLEditor extends React.PureComponent<any, any> {
197
191
  );
198
192
  }
199
193
 
200
- handleOptionChange = (textContent_, tocNodePosition_, view: EditorView) => {
201
- let tr = view.state.tr;
202
- const TocNode = view.state.doc.nodeAt(tocNodePosition_);
203
- let textContent;
204
- if (!TocNode?.attrs?.innerLink) {
205
- const nodeUUID = uuid();
206
- const texthash = '#';
207
- const nodeAttrs = { ...TocNode.attrs };
208
- const nodeconcat_UUID = texthash.concat(nodeUUID);
209
- nodeAttrs.innerLink = nodeconcat_UUID;
210
- tr = tr.setNodeMarkup(tocNodePosition_, undefined, nodeAttrs);
211
- textContent = nodeconcat_UUID.concat(INNER_LINK, textContent_);
212
- } else {
213
- textContent = TocNode.attrs.innerLink.concat(INNER_LINK, textContent_);
214
- }
215
- view.dispatch(tr);
194
+ handleOptionChange = (textContent_, selectionId) => {
195
+ const texthash = '';
196
+ const nodeconcat_UUID = texthash.concat(selectionId);
197
+ const textContent = nodeconcat_UUID.concat(INNER_LINK, textContent_);
216
198
  this.props.close(textContent);
217
199
  };
218
200
 
@@ -24,7 +24,7 @@ var TableNodeView = /*#__PURE__*/function (_TableView) {
24
24
  var _this;
25
25
  _classCallCheck(this, TableNodeView);
26
26
  _this = _callSuper(this, TableNodeView, [node, colMinWidth, view]);
27
- _this._updateMargin(node);
27
+ _this._updateAttrs(node);
28
28
  return _this;
29
29
  }
30
30
  _inherits(TableNodeView, _TableView);
@@ -33,19 +33,29 @@ var TableNodeView = /*#__PURE__*/function (_TableView) {
33
33
  value: function update(node) {
34
34
  var updated = _superPropGet(TableNodeView, "update", this, 3)([node]);
35
35
  if (updated) {
36
- this._updateMargin(node);
36
+ this._updateAttrs(node);
37
37
  }
38
38
  return updated;
39
39
  }
40
40
  }, {
41
- key: "_updateMargin",
42
- value: function _updateMargin(node) {
43
- var _node$attrs, _node$attrs2;
41
+ key: "_updateAttrs",
42
+ value: function _updateAttrs(node) {
43
+ var _node$attrs, _node$attrs2, _node$attrs3;
44
+ // Handle marginLeft
44
45
  var marginLeft = ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.marginLeft) || 0;
45
46
  this.table.style.marginLeft = marginLeft ? "".concat(marginLeft, "px") : '';
47
+
48
+ // Handle vignette
46
49
  if ((_node$attrs2 = node.attrs) !== null && _node$attrs2 !== void 0 && _node$attrs2.vignette) {
47
50
  this.table.style.border = 'none';
48
51
  }
52
+
53
+ // Handle dirty -> sets a data attribute for DOM/state sync
54
+ if ((_node$attrs3 = node.attrs) !== null && _node$attrs3 !== void 0 && _node$attrs3.dirty) {
55
+ this.table.setAttribute('dirty', 'true');
56
+ } else {
57
+ this.table.removeAttribute('dirty');
58
+ }
49
59
  }
50
60
  }]);
51
61
  }(TableView);
@@ -6,20 +6,31 @@ import { TableView } from 'prosemirror-tables';
6
6
  export default class TableNodeView extends TableView {
7
7
  constructor(node: Node, colMinWidth: number, view: EditorView) {
8
8
  super(node, colMinWidth, view);
9
- this._updateMargin(node);
9
+ this._updateAttrs(node);
10
10
  }
11
11
  update(node: Node): boolean {
12
12
  const updated = super.update(node);
13
13
  if (updated) {
14
- this._updateMargin(node);
14
+ this._updateAttrs(node);
15
15
  }
16
16
  return updated;
17
17
  }
18
- _updateMargin(node: Node): void {
18
+
19
+ _updateAttrs(node: Node): void {
20
+ // Handle marginLeft
19
21
  const marginLeft = node.attrs?.marginLeft || 0;
20
22
  this.table.style.marginLeft = marginLeft ? `${marginLeft}px` : '';
23
+
24
+ // Handle vignette
21
25
  if (node.attrs?.vignette) {
22
26
  this.table.style.border = 'none';
23
27
  }
28
+
29
+ // Handle dirty -> sets a data attribute for DOM/state sync
30
+ if (node.attrs?.dirty) {
31
+ this.table.setAttribute('dirty', 'true');
32
+ } else {
33
+ this.table.removeAttribute('dirty');
34
+ }
24
35
  }
25
36
  }
package/ui/czi-indent.css CHANGED
@@ -1,43 +1,43 @@
1
1
  /* Indent */
2
2
 
3
3
  .ProseMirror p[data-indent='1'] {
4
- margin-left: 18pt !important;
4
+ margin-left: 15pt !important;
5
5
  }
6
6
 
7
7
  .ProseMirror p[data-indent='2'] {
8
- margin-left: 36pt !important;
8
+ margin-left: 30pt !important;
9
9
  }
10
10
 
11
11
  .ProseMirror p[data-indent='3'] {
12
- margin-left: 54pt !important;
12
+ margin-left: 45pt !important;
13
13
  }
14
14
 
15
15
  .ProseMirror p[data-indent='4'] {
16
- margin-left: 72pt !important;
16
+ margin-left: 60pt !important;
17
17
  }
18
18
 
19
19
  .ProseMirror p[data-indent='5'] {
20
- margin-left: 90pt !important;
20
+ margin-left: 75pt !important;
21
21
  }
22
22
 
23
23
  .ProseMirror p[data-indent='6'] {
24
- margin-left: 108pt !important;
24
+ margin-left: 90pt !important;
25
25
  }
26
26
 
27
27
  .ProseMirror p[data-indent='7'] {
28
- margin-left: 126pt !important;
28
+ margin-left: 105pt !important;
29
29
  }
30
30
 
31
31
  .ProseMirror p[data-indent='8'] {
32
- margin-left: 144pt !important;
32
+ margin-left: 120pt !important;
33
33
  }
34
34
 
35
35
  .ProseMirror p[data-indent='9'] {
36
- margin-left: 162pt !important;
36
+ margin-left: 135pt !important;
37
37
  }
38
38
 
39
39
  .ProseMirror p[data-indent='10'] {
40
- margin-left: 180pt !important;
40
+ margin-left: 150pt !important;
41
41
  }
42
42
 
43
43
  /* list item indents */