Conversation
91c34b5 to
b8a8568
Compare
0da4d2a to
12cb86e
Compare
|
so I used the below markdown text for test: { So if you do conversion from markdown to html but through saves you will notice its losing data, due to showdown conversion from html to showdown again. Links to test samples: |
|
There is an issue with italics they are being escaped by _\italics_ if you add underscore, showdown prefers using asterisks ** to represent italics. Think this can be by passed when a user adds whichever the case _ or *, it just treats it as italics for all. Had a similar issue, so I override the italics button under |
|
Issue about losing of data during conversion has to do with how html renders markdown,or rather how it interprets markdown syntax from the conversion from |
7030824 to
12cb86e
Compare
|
@thomaspaulb worked perfectly. with some nice feedback for the user. After save it is gone. I will try a "stupid" re-injection after save now. Maybe you have an intuition here. |
|
@thomaspaulb after sending you a message i found the problem. please no not investigate |
|
@thomaspaulb the bug i found had to be fixed, but the removal of script on save remains. |
|
I tried to remove default sanitize from HTML field. It does not work. I could just save the tag, and then impose a XML-RPC call with a write on the field that forces the tag to be appended, but it seems like a bad solution. there must be a way. |
We are certain the missing tag is not do to the a cleanup done in the rendering phase, because it is committed to DB without the tag:
|
|
I tried everything, wrapping in it a comment. nothing. so it;s something in the editor itself that wipes out <script> tags. technically the does not wipe out comments , maybe we can do something with that. Worse case scenario: If I can't figure it out i can support this widget with a small model , with a text field that contains the on commitChanges i would save the tag to my support model, and on first instanciation of WYSIWYG read i would check if a tag exists and fetch it... |
|
The best solution is to plugin to summernote and extend it to help with this behaviour, I have suspicions here: |
|
@gfcapalbo Call it a weekend!! :-) My gut feeling says we should be able to just circumvent this behaviour of summernote, by not having the markdown pass to summernote at all - we only need it for the markdown widget anyway. We re-add it upon saving in markdown mode. |
| }); | ||
| } else { | ||
| // yes repeated block of code, the one above needs to be executed async, | ||
| // after the wyswyg has rendered |
There was a problem hiding this comment.
MMMm okaaaay, but i'm not getting why save needs to be called if mode is not "edit" ? Perhaps this needs to be else if (self.mode == 'edit')
There was a problem hiding this comment.
Putting a pin in this. not closing
8d4fdfc to
588db8b
Compare
|
@thomaspaulb I inherit base, and reprocess. THis means that the cleanup is done in HTML FIELD in the backend too? |
|
Interesting ideas here: Obviously there are security issues for <script> usage and loading.... Easy Idea: |
|
HTML field uses html_sanitize from /tools https://github.com/odoo/odoo/blob/13.0/odoo/fields.py#L23 there you go. So i have to monkey patch html_sanitize It fooled me because it is in mail. |
|
@thomaspaulb It is incredible. but then in DB: i send the correct HTML to write function, but it is still wiped out. |
|
just got tag in DB. finishing up. |
|
@thomaspaulb done:
the tag is an invisible p. verifying it works with textarea (had problems with it, but may be due to my mistake.) will verify that too and see if it is needed, |
|
Small corner-case error where it does not save data. fixing. |
|
@gfcapalbo I have a shitty request, but as we originally planned to migrate sunflower to 13.0, this is in 13.0. But now we plan to just migrate our data into Therp's 14.0, and so we need it in 14.0. Could you forward-port and open a new MR? Then we can test it as part of helptest14, if Danny includes it in the migration. |
|
@thomaspaulb last bug? usecase: why: the editor does not save if no changes have been made. Because no onchanges have never been called in this "new" WYSIWYG object: this would make: saving from MD fail. saving from HTML with no edit fail. the most important cases for our tag!!!! but interestengly enough we have "forceChange" , it works. FEATURES: |
1b08872 to
726b87a
Compare
|
@thomaspaulb please note this commit a good improvement: I am very happy with this improvement. works very well. |
|
@thomaspaulb lastly, the tag in context thing is not needed anymore. |
|
@thomaspaulb |
|
@gfcapalbo Closing this in favour of the 14.0 MR, which is the one we'll focus on making Therp- and then OCA-ready. |

Widget to edit in markdown or HTML, saves always in HTML.