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