Quill - saving the formatted text
Quill - saving the formatted text
I have created a datatable using the online generator, and added Quill to the .js file.
"label": "Comment:",
"name": "comment",
"type": "quill"
How do I get it to keep the formatted text upon submit.? At the moment it just saves everything without spaces etc.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I'm seeing the same. For example the bullet list or bold text i create is not sent to the server. Just the plain text. I'm more interested in the bullet list then text formatting.
Any ideas?
Kevin
I've slightly misunderstood how the new Quill API works which is what is causing this error I'm afraid. They focus on using delta objects to describe the content rather than using HTML. Great as an abstraction, but it isn't as useful for working with HTML as I think the majority of cases will be for this.
What to do is update the
set
andget
functions in the Editor / Quill plug-in to be:This thread is fairly enlightening on the topic.
Allan
Interesting read.
The change is not working for me. When I exit the field the plugin doesn't complete processing. I console.log statements in the
get
andset
functions. Before making the change I would see this pattern when exiting the updated field:(2)get
(2)set
(2)get
After the change I don't see the
set
function running. All I see is this:(2)get
Don't know if that helps. Let me know if I can provide more info.
Kevin
Weird! does the console show anything else? Or is it cooking your processor?
Allan
Guess I worked on it too early this morning - on my first coffee
Short story: It does work!
Long story: The page I'm working on has two quill fields. One field I want to have the formatting. The other I want to be a plain text file for YAML data. The YAML was working as desired as plain text. When I applied the change it appeared as though the script was stopping and not updating using inline editing.
The problem I found is that the YAML field was also updated behind the scenes and both fields were sent to the server for updating. My validation verifies the YMAL syntax and was failing due to the HTML formatting being added. My server script returned a field error for the YAML field but since I was editing the other field the error never showed. Which on the surface looked like the script failed.
Maybe there is an issue with either two fields being sent during inline editing or that the non-edited field needs to display the field error.
For this particular page I'm using two versions of the plugin. The original for the plain text field and the updated for the other field.
EDIT: thats why there is the 2 in parenthesis because both fields are being accessed even though I'm only editing one during inline edit.
Kevin
Another aspect of my tables is to edit and save some of the HTML used by my web pages, such as sidebars, etc using Quill. The
root.innerHTML
changes caused problems with the HTML fields being saved. For example it saves
instead of white space. So, for this I went back to the original usinggetText
andsetText
.Although for other fields I want the formatting so still using the
root.innerHTML
version for those.Sometimes you need to be careful of what you ask for
Kevin
Hmmm. I can't help but wonder if something like this might make a better candidate as the "recommended" approach for wysiwyg in Editor. Or if anyone has any other suggestions...
Allan
And two more: