@modusoperandi/licit 1.4.10 → 1.5.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.
@@ -1,3 +1,9 @@
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
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
7
  import toCSSColor from './ui/toCSSColor.js';
2
8
  import { Node } from 'prosemirror-model';
3
9
  import { tableNodes } from 'prosemirror-tables';
@@ -99,21 +105,26 @@ var TableNodesSpecs = tableNodes({
99
105
 
100
106
  // Override the default table node spec to support custom attributes.
101
107
  var TableNodeSpec = Object.assign({}, TableNodesSpecs.table, {
102
- attrs: {
108
+ attrs: _objectSpread(_objectSpread({}, TableNodesSpecs.table.attrs), {}, {
103
109
  marginLeft: {
104
110
  "default": null
105
111
  },
106
112
  dirty: {
107
113
  "default": false
114
+ },
115
+ coverPage: {
116
+ "default": false
108
117
  }
109
- },
118
+ }),
110
119
  parseDOM: [{
111
120
  tag: 'table',
112
121
  getAttrs: function getAttrs(dom) {
113
122
  var dirty = dom.getAttribute('dirty') || false;
123
+ var coverPage = dom.getAttribute('data-cover-page') === 'true';
114
124
  var marginLeft = dom.style.marginLeft;
115
125
  var attrs = {
116
- dirty: dirty
126
+ dirty: dirty,
127
+ coverPage: coverPage
117
128
  };
118
129
  if (marginLeft && /\d+px/.test(marginLeft)) {
119
130
  attrs.marginLeft = parseFloat(marginLeft);
@@ -128,7 +139,8 @@ var TableNodeSpec = Object.assign({}, TableNodesSpecs.table, {
128
139
  // that calles this method.
129
140
  var _node$attrs = node.attrs,
130
141
  marginLeft = _node$attrs.marginLeft,
131
- dirty = _node$attrs.dirty;
142
+ dirty = _node$attrs.dirty,
143
+ coverPage = _node$attrs.coverPage;
132
144
  var domAttrs = {};
133
145
  if (marginLeft) {
134
146
  domAttrs.style = "margin-left: ".concat(marginLeft, "px");
@@ -136,6 +148,9 @@ var TableNodeSpec = Object.assign({}, TableNodesSpecs.table, {
136
148
  if (dirty) {
137
149
  domAttrs.dirty = dirty;
138
150
  }
151
+ if (coverPage) {
152
+ domAttrs['data-cover-page'] = 'true';
153
+ }
139
154
  return ['table', domAttrs, 0];
140
155
  }
141
156
  });
@@ -104,16 +104,19 @@ const TableNodesSpecs = tableNodes({
104
104
  // Override the default table node spec to support custom attributes.
105
105
  const TableNodeSpec = Object.assign({}, TableNodesSpecs.table, {
106
106
  attrs: {
107
+ ...TableNodesSpecs.table.attrs,
107
108
  marginLeft: { default: null },
108
109
  dirty: { default: false },
110
+ coverPage: { default: false },
109
111
  },
110
112
  parseDOM: [
111
113
  {
112
114
  tag: 'table',
113
115
  getAttrs(dom: HTMLElement): ?Object {
114
116
  const dirty = dom.getAttribute('dirty') || false;
117
+ const coverPage = dom.getAttribute('data-cover-page') === 'true';
115
118
  const { marginLeft } = dom.style;
116
- const attrs = { dirty };
119
+ const attrs = { dirty, coverPage };
117
120
 
118
121
  if (marginLeft && /\d+px/.test(marginLeft)) {
119
122
  attrs.marginLeft = parseFloat(marginLeft);
@@ -128,7 +131,7 @@ const TableNodeSpec = Object.assign({}, TableNodesSpecs.table, {
128
131
  // `TableNodeView`. This method is only called when user selects a
129
132
  // table node and copies it, which triggers the "serialize to HTML" flow
130
133
  // that calles this method.
131
- const { marginLeft, dirty } = node.attrs;
134
+ const { marginLeft, dirty, coverPage } = node.attrs;
132
135
  const domAttrs = {};
133
136
  if (marginLeft) {
134
137
  domAttrs.style = `margin-left: ${marginLeft}px`;
@@ -136,6 +139,9 @@ const TableNodeSpec = Object.assign({}, TableNodesSpecs.table, {
136
139
  if (dirty) {
137
140
  domAttrs.dirty = dirty;
138
141
  }
142
+ if (coverPage) {
143
+ domAttrs['data-cover-page'] = 'true';
144
+ }
139
145
  return ['table', domAttrs, 0];
140
146
  },
141
147
  });