1(function () { 2 window.QuillFunctions = { 3 createQuill: function (quillElement) { 4 var options = { 5 debug: 'info', 6 modules: { 7 toolbar: '#toolbar' 8 }, 9 placeholder: 'Ingrese el texto de la noticia...', 10 readOnly: false, 11 theme: 'snow' 12 }; 13 // set quill at the object we can call 14 // methods on later 15 quillElement.__quill = new Quill(quillElement, options); 16 17 //new Quill(quillElement, options); 18 }, 19 getQuillContent: function (quillControl) { 20 return JSON.stringify(quillControl.__quill.getContents()); 21 }, 22 getQuillText: function (quillControl) { 23 return quillControl.__quill.getText(); 24 }, 25 getQuillHTML: function (quillControl) { 26 return quillControl.__quill.root.innerHTML; 27 }, 28 loadQuillContentFromHTML: function (quillControl, quillContent) { 29 if (!quillControl.__quill) { 30 console.error("Quill no está inicializado."); 31 return; 32 } 33 quillControl.__quill.root.innerHTML = quillContent; // Inserta el HTML directamente en el editor 34 } 35, 36 //loadQuillContent: function (quillControl, quillContent) { 37 // let content; 38 // try { 39 // content = JSON.parse(quillContent); 40 // } catch (e) { 41 // content = htmlToQuillDelta(quillContent); 42 // //if (!quillControl.__quill.clipboard) { 43 // // console.warn("Clipboard no disponible, usando conversión manual."); 44 // // content = htmlToQuillDelta(quillContent); 45 // //} else { 46 // // content = quillControl.__quill.clipboard.convert(quillContent); 47 // //} 48 // } 49 // quillControl.__quill.setContents(content, 'api'); 50 // return JSON.stringify(content); 51 //}, 52 loadQuillContent: function (quillControl, quillContent) { 53 if (!quillControl.__quill) { 54 console.error("Quill no está inicializado."); 55 return; 56 } 57 58 let tempDiv = document.createElement("div"); 59 tempDiv.innerHTML = quillContent; // Insertar HTML en un div temporal 60 61 let content = quillControl.__quill.clipboard.convert(tempDiv.innerHTML); // Convertir HTML a Delta 62 63 quillControl.__quill.setContents(content, 'api'); 64 return JSON.stringify(content); 65 }, 66 disableQuillEditor: function (quillControl) { 67 quillControl.__quill.enable(false); 68 } 69 }; 70})(); 71 72function htmlToQuillDelta(html) { 73 const div = document.createElement("div"); 74 div.innerHTML = html; 75 76 let quillOps = []; 77 div.childNodes.forEach(node => { 78 if (node.nodeName === "P") { 79 quillOps.push({ insert: node.innerText + "\n" }); 80 } else if (node.nodeName === "SPAN" && node.classList.contains("ql-size-large")) { 81 quillOps.push({ insert: node.innerText, attributes: { size: "large" } }); 82 } 83 }); 84 85 return { ops: quillOps }; 86}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.