@lobehub/editor 3.14.0 → 3.14.1
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.
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
var _class;
|
|
2
2
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
3
6
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
7
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
5
8
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -103,10 +106,26 @@ export var TablePlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
103
106
|
var colWidths = colWidthsAttr ? colWidthsAttr.split(',').map(function (width) {
|
|
104
107
|
return parseInt(width, 10);
|
|
105
108
|
}) : [];
|
|
109
|
+
var maxTdlen = 1;
|
|
110
|
+
var _iterator = _createForOfIteratorHelper(children),
|
|
111
|
+
_step;
|
|
112
|
+
try {
|
|
113
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
114
|
+
var _child$children;
|
|
115
|
+
var child = _step.value;
|
|
116
|
+
if ((((_child$children = child.children) === null || _child$children === void 0 ? void 0 : _child$children.length) || -1) > maxTdlen) {
|
|
117
|
+
maxTdlen = child.children.length;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
} catch (err) {
|
|
121
|
+
_iterator.e(err);
|
|
122
|
+
} finally {
|
|
123
|
+
_iterator.f();
|
|
124
|
+
}
|
|
106
125
|
return INodeHelper.createElementNode(TableNode.getType(), {
|
|
107
126
|
children: children,
|
|
108
127
|
// eslint-disable-next-line unicorn/no-new-array
|
|
109
|
-
colWidths: colWidths.length > 0 ? colWidths :
|
|
128
|
+
colWidths: colWidths.length > 0 ? colWidths : new Array(maxTdlen).fill(750 / maxTdlen),
|
|
110
129
|
direction: null,
|
|
111
130
|
format: '',
|
|
112
131
|
indent: 0,
|
|
@@ -123,7 +142,7 @@ export var TablePlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
123
142
|
version: 1
|
|
124
143
|
});
|
|
125
144
|
});
|
|
126
|
-
|
|
145
|
+
var tdReader = function tdReader(xmlNode, children) {
|
|
127
146
|
return INodeHelper.createElementNode(TableCellNode.getType(), {
|
|
128
147
|
backgroundColor: xmlNode.getAttribute('backgroundColor') || null,
|
|
129
148
|
children: children,
|
|
@@ -135,7 +154,9 @@ export var TablePlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
135
154
|
rowSpan: xmlNode.getAttribute('rowSpan') ? parseInt(xmlNode.getAttribute('rowSpan'), 10) : 1,
|
|
136
155
|
version: 1
|
|
137
156
|
});
|
|
138
|
-
}
|
|
157
|
+
};
|
|
158
|
+
litexmlService.registerXMLReader('th', tdReader);
|
|
159
|
+
litexmlService.registerXMLReader('td', tdReader);
|
|
139
160
|
}
|
|
140
161
|
}, {
|
|
141
162
|
key: "registerMarkdown",
|
package/package.json
CHANGED