@bigbinary/neeto-editor 1.47.85 → 1.47.87

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.
@@ -14297,7 +14297,8 @@ var suggestion$1 = {
14297
14297
  return (_reactRenderer$ref = reactRenderer.ref) === null || _reactRenderer$ref === void 0 ? void 0 : _reactRenderer$ref.onKeyDown(props);
14298
14298
  },
14299
14299
  onExit: function onExit() {
14300
- popup[0].destroy();
14300
+ var _popup;
14301
+ (_popup = popup) === null || _popup === void 0 || (_popup = _popup[0]) === null || _popup === void 0 || _popup.destroy();
14301
14302
  reactRenderer.destroy();
14302
14303
  }
14303
14304
  };
@@ -20053,31 +20054,42 @@ var Table = Table$2.extend({
20053
20054
  });
20054
20055
  },
20055
20056
  renderHTML: function renderHTML(_ref) {
20056
- var _node$content, _node$attrs, _node$attrs2;
20057
+ var _this$options$cellMin, _this$options, _node$content, _node$attrs, _node$attrs2;
20057
20058
  var node = _ref.node;
20059
+ var totalWidth = 0;
20060
+ var fixedWidth = true;
20058
20061
  var colgroups = [];
20059
- var tableBody = node === null || node === void 0 || (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.firstChild;
20060
- if (tableBody && tableBody.firstChild) {
20061
- var firstRow = tableBody.firstChild;
20062
- if (firstRow && firstRow.childCount) {
20063
- for (var i = 0; i < firstRow.childCount; i++) {
20064
- var _cell$attrs;
20065
- var cell = firstRow.child(i);
20066
- var style = "min-width: 100px;";
20067
- if ((_cell$attrs = cell.attrs) !== null && _cell$attrs !== void 0 && _cell$attrs.colwidth) {
20068
- style += "width: ".concat(cell.attrs.colwidth, "px;");
20069
- }
20062
+ var cellMinWidth = (_this$options$cellMin = (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.cellMinWidth) !== null && _this$options$cellMin !== void 0 ? _this$options$cellMin : 100;
20063
+ var firstRow = (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.firstChild;
20064
+ if (firstRow && firstRow.childCount) {
20065
+ for (var i = 0; i < firstRow.childCount; i++) {
20066
+ var cell = firstRow.child(i);
20067
+ var _cell$attrs = cell.attrs,
20068
+ colspan = _cell$attrs.colspan,
20069
+ colwidth = _cell$attrs.colwidth;
20070
+ var span = colspan || 1;
20071
+ for (var j = 0; j < span; j++) {
20072
+ var hasWidth = colwidth && colwidth[j];
20073
+ totalWidth += Number(hasWidth) || cellMinWidth;
20074
+ if (!hasWidth) fixedWidth = false;
20075
+ var style = hasWidth ? "min-width: ".concat(cellMinWidth, "px; width: ").concat(Number(hasWidth), "px;") : "min-width: ".concat(cellMinWidth, "px;");
20070
20076
  colgroups.push(["col", {
20071
20077
  style: style
20072
20078
  }]);
20073
20079
  }
20074
20080
  }
20075
20081
  }
20082
+ var tableStyle = "";
20083
+ if (totalWidth > 0) {
20084
+ tableStyle = fixedWidth ? "width: ".concat(totalWidth, "px;") : "min-width: ".concat(totalWidth, "px;");
20085
+ }
20076
20086
  var alignmentClass = (_node$attrs = node.attrs) !== null && _node$attrs !== void 0 && _node$attrs.textAlign ? "neeto-editor-table--".concat(node.attrs.textAlign) : "neeto-editor-table--left";
20077
20087
  return ["div", {
20078
20088
  "class": "table-responsive ".concat(alignmentClass),
20079
20089
  "data-text-align": ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.textAlign) || "left"
20080
- }, ["table", {}, ["colgroup"].concat(colgroups), ["tbody", 0]]];
20090
+ }, ["table", tableStyle ? {
20091
+ style: tableStyle
20092
+ } : {}, ["colgroup"].concat(colgroups), ["tbody", 0]]];
20081
20093
  },
20082
20094
  addKeyboardShortcuts: function addKeyboardShortcuts() {
20083
20095
  var _this$parent2,