vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Custom bbcode and WYSIWYG editor...again! (https://vborg.vbsupport.ru/showthread.php?t=145120)

PhinisheDTom 04-17-2007 08:11 PM

Custom bbcode and WYSIWYG editor...again!
 
I've scoured this forum and seen the question asked several times, but never satisfactorily answered: How do you get a simple custom bbcode to render properly in the WYSIWYG editor? I'm using a patched vB 3.6.4, and I'm just trying to add two simple text formatting tools--strikethrough and superscript.

If I add icons via the BB Code Manager--the "approved" way of doing it--the code properly renders the formatted text in the posted message, but shows up as raw tags in the WYSIWYG editor, which irks and confuses my users. If I add the icons manually in the editor template, the code properly renders the formatted text in the WYSIWYG editor, but is stripped out of the posted message entirely. Surely there must be some relatively easy hack to a PHP or JS file that will get it to look right in both places! I've figured out every other vB development problem I've had, but I can't seem to crack this one. Any ideas?

cheesegrits 04-18-2007 05:24 AM

This is just a "me too" ... can't help you, but I have exactly the same problem, and am actively working on finding a solution. If you do happen to work this out, please follow up with whatever you come up with. I'll do the same if I can find a maintainable solution (i.e. hook based, no code edits).

-- hugh

[vborg keeps merging this post with my first one for some reaosn, trying again]

Well, as far as I can tell, the reason is in append_custom_tags(), where it does this:

PHP Code:

                // str_replace is stop gap until custom tags are updated to the new format
                
$this->tag_list["$has_option"]["$customtag[bbcodetag]"] = array(
                    
'callback' => 'handle_wysiwyg_unparsable',
                    
'strip_empty' => true
                
); 

In other words, even if you define a callback function to handle the bbcode, it'll get blown away and replaced with 'handle_wysiwyg_unparsable', which basically just returns the bbcode unchanged.

And unfortunately I've yet to find a hook which will enable me to override that, although I'm still looking. I'm intreagued by your statement that "If I add the icons manually in the editor template, the code properly renders the formatted text in the WYSIWYG editor", which I haven't investigated yet. From my reading of the code, I'm not quite sure how or why that would work, but if it does ... I'll try and work out how and why!

[edit - looks like might be able to do something with the 'bbcode_create' hook for setting the callback function]

Going back the other way (from WYSIWYG to bbcode) there seems to be a hook (wysiwyg_parse_complete) where I could call the standard parse_wysiwyg_recurse() on a custom parse_wysiwyg_mybbcode() function.

If I don't find anything, I guess our only choice is to start beating up on the developers either for a new hook, or to finish the "until custom tags are updated to the new format" stuff!

-- hugh


All times are GMT. The time now is 01:04 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01001 seconds
  • Memory Usage 1,716KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete