@textbus/platform-browser 3.4.3 → 3.4.8
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/bundles/dom-support/parser.d.ts +1 -0
- package/bundles/index.esm.js +22 -12
- package/bundles/index.js +22 -12
- package/package.json +3 -3
package/bundles/index.esm.js
CHANGED
@@ -1280,12 +1280,15 @@ let Parser = Parser_1 = class Parser {
|
|
1280
1280
|
this.readFormats(el, slot);
|
1281
1281
|
}
|
1282
1282
|
else if (el.nodeType === Node.TEXT_NODE) {
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1283
|
+
this.readText(slot, el);
|
1284
|
+
}
|
1285
|
+
}
|
1286
|
+
readText(slot, el) {
|
1287
|
+
const textContent = el.textContent;
|
1288
|
+
if (/^\s*[\r\n\u200b]+\s*$/.test(textContent)) {
|
1289
|
+
return;
|
1288
1290
|
}
|
1291
|
+
slot.insert(textContent);
|
1289
1292
|
}
|
1290
1293
|
readFormats(el, slot) {
|
1291
1294
|
const formats = this.formatLoaders.filter(f => {
|
@@ -1312,13 +1315,20 @@ let Parser = Parser_1 = class Parser {
|
|
1312
1315
|
return slot;
|
1313
1316
|
}
|
1314
1317
|
readSlot(childSlot, slotRootElement, slotContentElement) {
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1318
|
+
if (slotRootElement.nodeType === Node.ELEMENT_NODE) {
|
1319
|
+
this.attributeLoaders.filter(a => {
|
1320
|
+
return a.match(slotRootElement);
|
1321
|
+
}).forEach(a => {
|
1322
|
+
const r = a.read(slotRootElement);
|
1323
|
+
childSlot.setAttribute(r.attribute, r.value);
|
1324
|
+
});
|
1325
|
+
}
|
1326
|
+
if (slotContentElement.nodeType === Node.ELEMENT_NODE) {
|
1327
|
+
this.readFormats(slotContentElement, childSlot);
|
1328
|
+
}
|
1329
|
+
else {
|
1330
|
+
this.readText(childSlot, slotContentElement);
|
1331
|
+
}
|
1322
1332
|
return childSlot;
|
1323
1333
|
}
|
1324
1334
|
applyFormats(slot, formatItems) {
|
package/bundles/index.js
CHANGED
@@ -1282,12 +1282,15 @@ exports.Parser = Parser_1 = class Parser {
|
|
1282
1282
|
this.readFormats(el, slot);
|
1283
1283
|
}
|
1284
1284
|
else if (el.nodeType === Node.TEXT_NODE) {
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1285
|
+
this.readText(slot, el);
|
1286
|
+
}
|
1287
|
+
}
|
1288
|
+
readText(slot, el) {
|
1289
|
+
const textContent = el.textContent;
|
1290
|
+
if (/^\s*[\r\n\u200b]+\s*$/.test(textContent)) {
|
1291
|
+
return;
|
1290
1292
|
}
|
1293
|
+
slot.insert(textContent);
|
1291
1294
|
}
|
1292
1295
|
readFormats(el, slot) {
|
1293
1296
|
const formats = this.formatLoaders.filter(f => {
|
@@ -1314,13 +1317,20 @@ exports.Parser = Parser_1 = class Parser {
|
|
1314
1317
|
return slot;
|
1315
1318
|
}
|
1316
1319
|
readSlot(childSlot, slotRootElement, slotContentElement) {
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1320
|
+
if (slotRootElement.nodeType === Node.ELEMENT_NODE) {
|
1321
|
+
this.attributeLoaders.filter(a => {
|
1322
|
+
return a.match(slotRootElement);
|
1323
|
+
}).forEach(a => {
|
1324
|
+
const r = a.read(slotRootElement);
|
1325
|
+
childSlot.setAttribute(r.attribute, r.value);
|
1326
|
+
});
|
1327
|
+
}
|
1328
|
+
if (slotContentElement.nodeType === Node.ELEMENT_NODE) {
|
1329
|
+
this.readFormats(slotContentElement, childSlot);
|
1330
|
+
}
|
1331
|
+
else {
|
1332
|
+
this.readText(childSlot, slotContentElement);
|
1333
|
+
}
|
1324
1334
|
return childSlot;
|
1325
1335
|
}
|
1326
1336
|
applyFormats(slot, formatItems) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/platform-browser",
|
3
|
-
"version": "3.4.
|
3
|
+
"version": "3.4.8",
|
4
4
|
"description": "Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.",
|
5
5
|
"main": "./bundles/index.js",
|
6
6
|
"module": "./bundles/index.esm.js",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"dependencies": {
|
28
28
|
"@tanbo/di": "^1.1.5",
|
29
29
|
"@tanbo/stream": "^1.2.0",
|
30
|
-
"@textbus/core": "^3.4.
|
30
|
+
"@textbus/core": "^3.4.5",
|
31
31
|
"reflect-metadata": "^0.1.13"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
@@ -48,5 +48,5 @@
|
|
48
48
|
"bugs": {
|
49
49
|
"url": "https://github.com/textbus/textbus.git/issues"
|
50
50
|
},
|
51
|
-
"gitHead": "
|
51
|
+
"gitHead": "3fc9163650adf5e6a8279b874b1869e9d810c9b7"
|
52
52
|
}
|