Strange problem with quill field
Strange problem with quill field
Good morning,
I have a problem with quill.
It has always worked very well, but now it has a problem that I cannot solve.
I should mention that I am using the latest version of Datables and Editor.
Quill works normally with different font sizes, bold and italics, but it no longer works with colours (both font and background colours). When I use colours, it adds the <span></span> tag.
<p><strong>Bold font</strong></p>
<p><em>Italic font</em></p>
<p><u>Underlined font</u></p>
<p><span>Red font</span></p>
<p><span>Font with red background</span></p>
Can anyone help me?
Thank you,
Giuseppe
This question has an accepted answers - jump to answer
Answers
It seems that is the way Quill works. Go to the Quill format example and change the text and background colors. Use the browser's inspect tool to see the generated HTML. For example:
Datatables doesn't control the HTML generated by Quill.
Does this answer your questions?
Does the
span
cause issues?Kevin
Thank you for your reply.
The problem is that quill should not put only the <span></span> tags for colours but should generate something like this:
Instead, he writes <span></span> for colours!!!!
Giuseppe
Do you mean the DB is missing the styles in the
span
?I built this simple test case:
https://live.datatables.net/guwafemu/646/edit
Edit any of the Position fields and set the color of some or all the text. The console output shows the style remains and the field shows the updated styles.
I would start by using the browser's network inspector tool to see the request and response data when performing an edit. What do you see? Post both the request and response data.
Kevin
Is this a problem with the Editor integration with Quill, or is it a problem with the HTML that Quill generates? If you use Quill standalone, I believe it will generate the same HTML with a span, that's just how it works. You'd need to take that up with the Quill developers if you need it to work differently.
Allan
I'm going crazy trying to figure out what the problem is.
I have another application that uses exactly the same libraries and works perfectly.
In this one, however, in the quill edit mask, I see all the lines with colours, but when I save to the database, all the other control characters remain, while those relating to colours are saved as <span></span>.
Unbelievable...
Edit row



Show row
Alert added in edit
Have you tried my debugging suggestion above:
If you see the styles in the
span
in the request data but not in the JSON response then something is happening in the server to remove the styles.Kevin
Are you using the PHP Editor libraries? Try adding
->xss(false)
to theField
in question. Possibly the XSS protection might be stripping out the style attribute.Allan
Do I need to write:
Field::inst( “help_text” ) -> xss(false)
in the PHP file?
I'll try that.
In the meantime, I'm attaching images of the edit sequence.
Thank you both,
Giuseppe!
Yes, where you define the Field instance in the PHP, add
->xss(false)
to it.Allan
It works!
I know I won't understand anything, but would you mind trying to explain it to me even though I'm sure I won't understand a thing?
Thanks again,
Giuseppe
Sure thing - Editor uses the htmLawed libraries in its PHP libraries to try and help prevent XSS attacks. Unfortunately, part of the way htmLawed works is to strip parts of HTML that it doesn't know about. Normally it isn't an issue since HTML isn't submitted, but obviously in the case of a WYSIWYG editor such as Quill, that becomes important, and in this case results in the need to disable the XSS protection.
Allan
Incredible, I UNDERSTAND!
Thanks again,
Giuseppe