Submitting content while in preview ignores filters
| Project: | BUEditor |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Hello,
BUEditor with a BBCode filter is exactly what we need for our site, and I thought it was working, however I found a pretty big problem: If you submit while in preview mode, the filter is ignored. Steps to reproduce:
1) Enter "I am [b]bold[/b]"
2) Click preview - the preview looks fine, bold is applied
3) Then click submit
4) The post will become: "I am bold"
I repeat this same process without step 2 and it works fine. So something in the preview button is causing it to revert to HTML and ignore the underlying filter (in this case BBCode).
I am using the BBCode filter provided here: http://drupal.org/project/bbcode
I am using BUEditor with the BBCode buttons provided here: http://drupal.org/node/163034
The source of the preview button is attached.
Any ideas would be greatly appreciated. Thanks.
| Attachment | Size |
|---|---|
| preview_button.txt | 3.21 KB |

#1
To be clear, step #4 is using the < b > bold tags which are HTML
#2
My first thought to fix this was to do a form alter:
When the form is submitted, do a form alter: if preview is currently turned on enabled, if it is, call function eDefPreview(NoAutoP, selOnly) in bueditor\library\default_buttons_functions.js to turn off preview, otherwise do nothing.
Only problem is knowing when it is pressed, which will require another js function, which unfortunately I have no idea how to write js.
#3
This is because the bbcode text is converted to html while previewing.
Adding
E.setContent(E.oriCnt);aftereDefPreview();may help.#4
Worked perfectly. Thanks!
#5