123456789101112131415161718192021222324252627282930313233343536 |
- // nettoyer le parsing des pragraphes
- if (debug) console.log('start cleanParagraphsParsing');
- (function() {
- let labeurs = document.querySelectorAll('.labeur, .free');
- for(let labeur of labeurs) {
- if (labeur.childNodes.length == 1) {
- labeur.innerHTML = '<p>' + labeur.innerHTML + '</p>';
- } else {
- labeur.innerHTML = "<p>" + labeur.innerHTML.replace("<p>", "");
- }
-
- // data align last split
- if (labeur.innerHTML.includes('<br>')) {
- if (labeur.childElementCount > 0) {
- for (let j = 0; j < labeur.childElementCount; j++) {
- let parts = labeur.children[j].innerHTML.split('<br>');
- let newParts = parts.map(function(part) {
- return `<p>${ part }</p>`;
- });
- labeur.children[j].innerHTML = newParts.join('');
- }
- } else {
- let parts = labeur.innerHTML.split('<br>');
- let newParts = parts.map(function(part) {
- return `<p>${ part }</p>`;
- });
- labeur.innerHTML = newParts.join('');
- }
- }
- }
- })();
- if (debug) console.log('end cleanParagraphsParsing');
|