@bigbinary/neeto-editor 1.47.86 → 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.
@@ -20054,31 +20054,42 @@ var Table = Table$2.extend({
20054
20054
  });
20055
20055
  },
20056
20056
  renderHTML: function renderHTML(_ref) {
20057
- var _node$content, _node$attrs, _node$attrs2;
20057
+ var _this$options$cellMin, _this$options, _node$content, _node$attrs, _node$attrs2;
20058
20058
  var node = _ref.node;
20059
+ var totalWidth = 0;
20060
+ var fixedWidth = true;
20059
20061
  var colgroups = [];
20060
- var tableBody = node === null || node === void 0 || (_node$content = node.content) === null || _node$content === void 0 ? void 0 : _node$content.firstChild;
20061
- if (tableBody && tableBody.firstChild) {
20062
- var firstRow = tableBody.firstChild;
20063
- if (firstRow && firstRow.childCount) {
20064
- for (var i = 0; i < firstRow.childCount; i++) {
20065
- var _cell$attrs;
20066
- var cell = firstRow.child(i);
20067
- var style = "min-width: 100px;";
20068
- if ((_cell$attrs = cell.attrs) !== null && _cell$attrs !== void 0 && _cell$attrs.colwidth) {
20069
- style += "width: ".concat(cell.attrs.colwidth, "px;");
20070
- }
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;");
20071
20076
  colgroups.push(["col", {
20072
20077
  style: style
20073
20078
  }]);
20074
20079
  }
20075
20080
  }
20076
20081
  }
20082
+ var tableStyle = "";
20083
+ if (totalWidth > 0) {
20084
+ tableStyle = fixedWidth ? "width: ".concat(totalWidth, "px;") : "min-width: ".concat(totalWidth, "px;");
20085
+ }
20077
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";
20078
20087
  return ["div", {
20079
20088
  "class": "table-responsive ".concat(alignmentClass),
20080
20089
  "data-text-align": ((_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.textAlign) || "left"
20081
- }, ["table", {}, ["colgroup"].concat(colgroups), ["tbody", 0]]];
20090
+ }, ["table", tableStyle ? {
20091
+ style: tableStyle
20092
+ } : {}, ["colgroup"].concat(colgroups), ["tbody", 0]]];
20082
20093
  },
20083
20094
  addKeyboardShortcuts: function addKeyboardShortcuts() {
20084
20095
  var _this$parent2,