@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.
package/dist/Editor.js CHANGED
@@ -14277,7 +14277,8 @@ var suggestion$1 = {
14277
14277
  return (_reactRenderer$ref = reactRenderer.ref) === null || _reactRenderer$ref === void 0 ? void 0 : _reactRenderer$ref.onKeyDown(props);
14278
14278
  },
14279
14279
  onExit: function onExit() {
14280
- popup[0].destroy();
14280
+ var _popup;
14281
+ (_popup = popup) === null || _popup === void 0 || (_popup = _popup[0]) === null || _popup === void 0 || _popup.destroy();
14281
14282
  reactRenderer.destroy();
14282
14283
  }
14283
14284
  };
@@ -20033,31 +20034,42 @@ var Table = Table$2.extend({
20033
20034
  });
20034
20035
  },
20035
20036
  renderHTML: function renderHTML(_ref) {
20036
- var _node$content, _node$attrs, _node$attrs2;
20037
+ var _this$options$cellMin, _this$options, _node$content, _node$attrs, _node$attrs2;
20037
20038
  var node = _ref.node;
20039
+ var totalWidth = 0;
20040
+ var fixedWidth = true;
20038
20041
  var colgroups = [];
20039
- var tableBody = node === null || node === void 0 || (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.firstChild;
20040
- if (tableBody && tableBody.firstChild) {
20041
- var firstRow = tableBody.firstChild;
20042
- if (firstRow && firstRow.childCount) {
20043
- for (var i = 0; i < firstRow.childCount; i++) {
20044
- var _cell$attrs;
20045
- var cell = firstRow.child(i);
20046
- var style = "min-width: 100px;";
20047
- if ((_cell$attrs = cell.attrs) !== null && _cell$attrs !== void 0 && _cell$attrs.colwidth) {
20048
- style += "width: ".concat(cell.attrs.colwidth, "px;");
20049
- }
20042
+ 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;
20043
+ var firstRow = (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.firstChild;
20044
+ if (firstRow && firstRow.childCount) {
20045
+ for (var i = 0; i < firstRow.childCount; i++) {
20046
+ var cell = firstRow.child(i);
20047
+ var _cell$attrs = cell.attrs,
20048
+ colspan = _cell$attrs.colspan,
20049
+ colwidth = _cell$attrs.colwidth;
20050
+ var span = colspan || 1;
20051
+ for (var j = 0; j < span; j++) {
20052
+ var hasWidth = colwidth && colwidth[j];
20053
+ totalWidth += Number(hasWidth) || cellMinWidth;
20054
+ if (!hasWidth) fixedWidth = false;
20055
+ var style = hasWidth ? "min-width: ".concat(cellMinWidth, "px; width: ").concat(Number(hasWidth), "px;") : "min-width: ".concat(cellMinWidth, "px;");
20050
20056
  colgroups.push(["col", {
20051
20057
  style: style
20052
20058
  }]);
20053
20059
  }
20054
20060
  }
20055
20061
  }
20062
+ var tableStyle = "";
20063
+ if (totalWidth > 0) {
20064
+ tableStyle = fixedWidth ? "width: ".concat(totalWidth, "px;") : "min-width: ".concat(totalWidth, "px;");
20065
+ }
20056
20066
  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";
20057
20067
  return ["div", {
20058
20068
  "class": "table-responsive ".concat(alignmentClass),
20059
20069
  "data-text-align": ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.textAlign) || "left"
20060
- }, ["table", {}, ["colgroup"].concat(colgroups), ["tbody", 0]]];
20070
+ }, ["table", tableStyle ? {
20071
+ style: tableStyle
20072
+ } : {}, ["colgroup"].concat(colgroups), ["tbody", 0]]];
20061
20073
  },
20062
20074
  addKeyboardShortcuts: function addKeyboardShortcuts() {
20063
20075
  var _this$parent2,