@modusoperandi/licit 1.1.5 → 1.1.7

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.
@@ -118,7 +118,7 @@ function handleMouseMove(view, event) {
118
118
  cell = edgeCell(view, event, 'right');
119
119
  }
120
120
  }
121
- if (cell === resizeState.cellPos && forMarginLeft === resizeState.forMarginLeft) {
121
+ if (cell === (resizeState === null || resizeState === void 0 ? void 0 : resizeState.cellPos) && forMarginLeft === (resizeState === null || resizeState === void 0 ? void 0 : resizeState.forMarginLeft)) {
122
122
  return;
123
123
  }
124
124
  if (cell !== -1) {
@@ -287,8 +287,13 @@ function handleDragEnd(view, event) {
287
287
  if (attrs.colwidth && compareNumbersList(attrs.colwidth, colwidth)) {
288
288
  continue;
289
289
  }
290
- attrs.colwidth = colwidth;
291
- tr = tr.setNodeMarkup(start + pos, null, attrs);
290
+ if (colwidth && colwidth.length > 0 && !isNaN(colwidth[0])) {
291
+ var newAttrs = _objectSpread(_objectSpread({}, attrs), {}, {
292
+ colwidth: colwidth
293
+ });
294
+ tr = tr.setNodeMarkup(start + pos, null, newAttrs);
295
+ tr = tr.setNodeMarkup(start + pos, null, newAttrs);
296
+ }
292
297
  }
293
298
  }
294
299
  var marginLeft = parseFloat(tableElement.style.marginLeft) || null;
@@ -515,7 +520,7 @@ var TableResizePlugin = /*#__PURE__*/function (_Plugin) {
515
520
  props: {
516
521
  attributes: function attributes(state) {
517
522
  var resizeState = PLUGIN_KEY.getState(state);
518
- return resizeState.cellPos > -1 ? {
523
+ return (resizeState === null || resizeState === void 0 ? void 0 : resizeState.cellPos) > -1 ? {
519
524
  "class": 'resize-cursor'
520
525
  } : null;
521
526
  },
@@ -530,7 +535,7 @@ var TableResizePlugin = /*#__PURE__*/function (_Plugin) {
530
535
  var resizeState = PLUGIN_KEY.getState(state);
531
536
  // [FS] IRAD-1008 2020-07-16
532
537
  // Does not allow Table cell Resize in disable mode
533
- return resizeState.cellPos > -1 && isEnabled ? handleDecorations(state, resizeState) : undefined;
538
+ return (resizeState === null || resizeState === void 0 ? void 0 : resizeState.cellPos) > -1 && isEnabled ? handleDecorations(state, resizeState) : undefined;
534
539
  },
535
540
  nodeViews: {}
536
541
  }
@@ -149,8 +149,8 @@ function handleMouseMove(view: EditorView, event: PointerEvent): void {
149
149
  }
150
150
 
151
151
  if (
152
- cell === resizeState.cellPos &&
153
- forMarginLeft === resizeState.forMarginLeft
152
+ cell === resizeState?.cellPos &&
153
+ forMarginLeft === resizeState?.forMarginLeft
154
154
  ) {
155
155
  return;
156
156
  }
@@ -338,12 +338,18 @@ function handleDragEnd(view: EditorView, event: any): void {
338
338
  if (attrs.colwidth && compareNumbersList(attrs.colwidth, colwidth)) {
339
339
  continue;
340
340
  }
341
- attrs.colwidth = colwidth;
342
- tr = tr.setNodeMarkup(
343
- start + pos,
344
- null,
345
- attrs
346
- );
341
+ if (colwidth && colwidth.length > 0 && !isNaN(colwidth[0])) {
342
+ const newAttrs = {
343
+ ...attrs,
344
+ colwidth: colwidth
345
+ };
346
+ tr = tr.setNodeMarkup(
347
+ start + pos,
348
+ null,
349
+ newAttrs
350
+ );
351
+ tr = tr.setNodeMarkup(start + pos, null, newAttrs);
352
+ }
347
353
  }
348
354
  }
349
355
 
@@ -606,7 +612,7 @@ export default class TableResizePlugin extends Plugin {
606
612
  props: {
607
613
  attributes(state: EditorState): ?Object {
608
614
  const resizeState = PLUGIN_KEY.getState(state);
609
- return resizeState.cellPos > -1 ? { class: 'resize-cursor' } : null;
615
+ return resizeState?.cellPos > -1 ? { class: 'resize-cursor' } : null;
610
616
  },
611
617
  handleDOMEvents: {
612
618
  // Move events should be batched to avoid over-handling the mouse
@@ -619,7 +625,7 @@ export default class TableResizePlugin extends Plugin {
619
625
  const resizeState = PLUGIN_KEY.getState(state);
620
626
  // [FS] IRAD-1008 2020-07-16
621
627
  // Does not allow Table cell Resize in disable mode
622
- return resizeState.cellPos > -1 && isEnabled
628
+ return resizeState?.cellPos > -1 && isEnabled
623
629
  ? handleDecorations(state, resizeState)
624
630
  : undefined;
625
631
  },