The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Bug in 4.1.5 enhanced editor with custom bb-code?
When using 4.1.5 with the Enhanced (WYSIWYG) editor i can not edit a post that contains a custom bb-code that was added with a plugin. In the editor the parsed text is shown instead of the original bb-code.
It could also be of course that i am setting an option wrong. I performed the following test: - Create 2 identical bb-codes, 1 using the BB-Code Manager ("test") and 1 added by plugins ("test2"). BB-Code Manager: Attachment 132151 - Next i created 2 plugins: --- Hook location: bbcode_create PHP Code:
PHP Code:
Attachment 132152 - The result of the post shows like: Attachment 132153 Now i can edit this post as many times as i want using the basic editor (or standard editor) and it will always be the same: when editing the tag is preserved, when viewing the tag is processed. - If i now edit the same post with the enhanced editor however, i only get the parsed text in the edit window. But only for the bb-code that was added with a plugin: Attachment 132154 This makes it impossible to edit the post and preserve the bb-code. Am i doing something wrong or is this a bug? |
#2
|
|||
|
|||
It looks like the problem is that the code that converts from standard to wysiwyg is set up not to parse custom bbcodes, so they stay bbcode tags even in wysiwyg mode. fetch_tag_list() doesn't return the custom bbcodes, and when code in class_wysiwygparser.php does the standard to wysiwyg conversion, when it loads the custom tags, it changes the callback to 'handle_wysiwyg_unparsable'.
In any case, I don't know what you can do abut it short of editing vb files because there doesn't seem to be hooks in the right places. But if you were to edit the files, you could add your tag to the list of unparsed tags in class_bbcode_alt: PHP Code:
|
#3
|
|||
|
|||
Quote:
I have done some more testing and in 4.1.3 it still worked as expected, this started with 4.1.4. I have by now also posted it in the bug tracker: http://tracker.vbulletin.com/browse/VBIV-13004 Will look into solving it tomorrow, but as you say i doubt that can be done without patching vB, so not a real option. |
#4
|
|||
|
|||
Right, I believe it's the conversion of the text from "non-wysiwyg" to wysiwyg mode that is the problem.
|
#5
|
|||
|
|||
Might be able to do something at the bbcode_fetch_tags hook, but then i would need to be able to know if the taglist is for the Wysiwyg editor or not. Will look into it tomorrow.
|
#6
|
|||
|
|||
Yes, I was thinking that you could change your callback there if you knew where it was called from, but I think I gave up on that when I noticed that the tag list is cached. But maybe it would still work.
You could probably have your callback do something different if you knew where it was being called from. Maybe there's some global you can check or something. (I think you can actually get an array of calling functions using the debug_backtrace() function, but that seems pretty ugly). |
#7
|
|||
|
|||
Did check early in the morning but didn't see your reply then.
Did a lot of testing and i first thought i was on the right track by changing the hook bbcode_fetch_tags to: PHP Code:
I thought it all worked but when testing a bit more i found out that if there is an option used in the tag (lucky i tested with bb codes that had an option), the option would be stripped due to a call to handle_preformatted_tag() by class vB_BbCodeParser_Wysiwyg: PHP Code:
So i had to do it in another way. What i finally came up with, and this works in all situation i tested, was to change the handler (hook: bbcode_create) to: PHP Code:
- We are now operating inside the class, so we can simply check the class. - More control over the output. - This example should work for any tagname with or without options. - Downside is that i have added a check on the vBulletin versionnumber. If this issue ever is going to be changed, then you will need to update the plugin with the highest versionnumber. - The emulate_pre_tag() will not be needed for all types of bb-codes. But as i am working on (yet another) Syntax Highlighter i thought it best to stay as close to the default tags like "code" and "php". |
#8
|
|||
|
|||
Nice, thanks for posting your fix.
I don't know if I ever would have thought of that. |
#9
|
|||
|
|||
It would still fail if they decided to rename the class somewhere in the future. Don't really like to depend on such a constant, but got to do something.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|