How can i load the text with the styling from the text editor #4142
-
i have this project where i have to use the quill js text editor to write some stuff and save it to the data base, but when i retrieve it from the database it comes back as an object with the styling in each insert, is there a way for me to load that text with the styling itself, is there a function from quill to do that or do i have to write a custom function |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Unfortunately (or fortunately, depending on how you look at this opportunity), I would like to use Quill to create some email templates which can be stored in a database and retrieved/edited in Quill. I am new to Quill and I have no idea where to start... Hint (or crumbs) from the experienced gurus? (I've been developing web-based apps for years -- just this is the first time with Quill.) Thanks in advance. (Sorry, Ahmaditrot, I don't have an answer...yet! I am seeking similar info which I will plan to share if/when a solution can be found.) |
Beta Was this translation helpful? Give feedback.
Ahmadiyrot -- Although this isn't an elegant solution, and I haven't tested it in all situations, I was able to save the output from quill js editor to my database and then reload it and insert it in the text editor...
encoded = $(".ql-editor").html(); // this extracts the editor content for sending to server for database storage
On the server side, I stripped out the non-printable characters (and replaced with a blank), specifically:
$encoded = preg_replace('/[\x00-\x1f\x7F-\xFF]/', ' ', $encoded); // replace non-printable with blanks
Then days later (after storage / retrieval on the server side), sending to the client where it gets inserted into the quill editor with a single statement:
$…