Skip to content

How can i load the text with the styling from the text editor #4142

Answered by phantom92029
Ahmadiyrot asked this question in Q&A
Discussion options

You must be logged in to vote

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:

$…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@phantom92029
Comment options

Answer selected by Ahmadiyrot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants