update
This commit is contained in:
parent
a2c66a98dc
commit
b15ed40e93
2 changed files with 40 additions and 1 deletions
|
|
@ -1,7 +1,8 @@
|
|||
/**
|
||||
* app.js – v3.3.1 PREVIEW + PORTAL
|
||||
* app.js – v3.3.2 PRECISION LAYOUT
|
||||
* High-coherence, readable, maintainable.
|
||||
* No hacks. No surgery. Only truth.
|
||||
* Now with preview spacing precision.
|
||||
*/
|
||||
|
||||
const els = {
|
||||
|
|
@ -248,6 +249,12 @@ async function generatePreview(rel) {
|
|||
.replace(/\s+(on\w+)=["'][^"']*["']/gi, "")
|
||||
.replace(/\s+style=["'][^"']*["']/gi, "");
|
||||
|
||||
// Normalize whitespace and strip blank nodes
|
||||
content = content.replace(/^\s+|\s+$/g, '').replace(/(\n\s*){2,}/g, '\n');
|
||||
|
||||
// Remove stray <br> or empty paragraph tags that create phantom space
|
||||
content = content.replace(/<p>\s*<\/p>/gi, '').replace(/<br\s*\/?>/gi, '');
|
||||
|
||||
const div = document.createElement("div");
|
||||
div.innerHTML = content;
|
||||
trimPreview(div, 3, 3000); // depth, char limit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue