TinyMCE Quattro and its wysiwyg bbcodes

TinyMCE Quattro and its wysiwyg bbcodes 2.7.2

No permission to download
@cclearhout thanks again.

Now i'm trying to render the new bbcode generated by tinymce quattro on my front website.
I was using this before I install this addon :

Code:
$start_time = microtime(true);
$file_dir = FORUM_PATH;

require($file_dir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($file_dir . '/library');

XenForo_Application::initialize($file_dir . '/library', $file_dir);
XenForo_Application::set('page_start_time', $start_time);

$topic = XenForo_Model::create('XenForo_Model_Thread')->getThreadById($topic_id, array('join' => XenForo_Model_Thread::FETCH_FIRSTPOST));
        $formatter = XenForo_BbCode_Formatter_Base::create();
        $parser = new XenForo_BbCode_Parser($formatter);
        $topic['message_html'] = $parser->render($topic['message']);

Do you have any idea how can I use your bbcode formater/parser ?
Thanks again.
 
Last edited:
@cclaerhout

Using XF 1.4.4 and TinyMCE Quattro 2.5.7 here. Facing issues with the Microsoft's Edge browser on Windows 10. I'm unable to edit a post successfully.

The editor opens up and I'm able to 'Save Changes' without any errors, but the post doesn't get edited. I tried more than 15 times to edit a post, but was successful only once which was the first time I think. This issue does not occur when using the XF default editor on Edge.

@cclaerhout

Still facing this issue. Though I haven't updated my Edge version. I'll do that and report here again.


I wonder if anyone else is facing this issue.
 
Hello
  1. Sometime, when I edit a thread, I lost all predefined tag (like title, anchor etc).
    I have to reload the edit thread page many times to get all tags correctly.
    How to prevent that please?

  2. Has you can see on the screen bellow, when we edit something, the ATTACH tag is displayed as bbcode.
    Is there a way to get the image ?

    ae2f31a92a.png


Thanks
 
Last edited:
Hello
  1. Sometime, when I edit a thread, I lost all predefined tag (like title, anchor etc).
    I have to reload the edit thread page many times to get all tags correctly.
    How to prevent that please?

  2. Has you can see on the screen bellow, when we edit something, the ATTACH tag is displayed as bbcode.
    Is there a way to get the image ?
    Thanks
  1. I never have this problem. So when you edit a post, the H1/H2(...) Bb Codes are not converted in Wysiwyg html? I never got this, do you have any error logged in the admin panel?
  2. This is the standard behavior of XenForo
 
As you can see,

On the first screen bellow, all seem look normal.
All work perfectly
bug1ok.webp
c958cc27b5.png


Now when i use the full edit page,
sometimes i get this :
bug2pasok.webp
cf4bb085f3.png


As you can see, nothing seem work.
No title, no anchor, nothing work but I only have "styles" of element.

I have to reload many times until to get all fonctionnality

No error in admin
 
@Xon
I will try to find a moment to look at it. But it should be related to the TinyQuattro addon.
Edit:
Yes it's coming from the option "Activate the HTML > BbCode Converter Patch".
I've had a quick look and I'm not sure what is going wrong in there, I've left it disabled for the moment.
 
I've had a quick look and I'm not sure what is going wrong in there, I've left it disabled for the moment.
You did the right thing. The problem is using a regex is not the good way to fix/optimize tags. A kind of parser would need to be rewritten that checks at least two things:
  1. Check if the parent tag is the same than the current opening tag being read by the parser. For both (parent tag and current one), the opening tag option should
    also be checked if available. Example:
    Code:
    [b]This is a bold text [i]with some italic[/i] and a [b]useless bold tag[/b] with some [u]underline text[/u][/b]
    Code:
    [color=red]This is a red color text [color=pink]with some pink text[/color] and a [color=red]useless red color text[/color] with some [color=yellow]yellow color text[/color] and again the remaining red color[/color]
  2. Check if the last used tag is not the same than the current opening tag being read by the parser. For both (parent tag and current one), the opening tag option should
    also be checked if available. Example:
    Code:
    [b]This is a bold text [i]with some italic[/i] [i]and again with italic[/i] and remaining bold text[/b]
    Code:
    [color=red]This is a red color text [color=pink]with some pink text[/color]       [color=pink]and again some pink text[/color] remaining red color text[/color]

... a lot of work as you see.
 
You should be able to use the standard XenForo bbcode parser to generate the bbcode tree, a custom bbcode tree simplification pass and then render to back to bbcode easily enough.

Might have a go at it this weekend if I have time.
 
You should be able to use the standard XenForo bbcode parser to generate the bbcode tree, a custom bbcode tree simplification pass and then render to back to bbcode easily enough.

Might have a go at it this weekend if I have time.
I'm currently testing with the mini parser and it should be ok I think.
 
I'm currently testing with the mini parser and it should be ok I think.
I've got a pull request for improving this functionality, as I want to also fix some performance hits when someone copy & pastes a lot of text from google docs which looks like:
[font=Times New Roman][b][i]word1[/i][/b][/font] [font=Times New Roman][b][i] word2[/i][/b][/font]
 
It seems this addon has a few issues with this theme, specifically anchor links, I can add more then one and I get this error:

Uh Oh! It looks like there's an error in your page's javascript. There will likely be significant issues with the use of the forum until this is corrected. If you are unable to resolve this and believe it is due to a bug in your Audentio Design theme, contact Audentio support and include a copy of the text between the designated areas from your javascript console. This is the error:

Error: Syntax error, unrecognized expression: #message-anchor-section%204

If i disable this theme there are no errors or issues.

Any ideas?
 
This is a paid addon. I don't have access to it. I let the addon coders fix the problem. If the problem is coming from my addon, please let me know on Github. By the way this issue reminds me one I've met on an other addon [ref].

It seems without spaces [anchor=#Section1]section 1[/anchor][anchor]Section1[/anchor] works but with spaces it does break
 
I've got a pull request for improving this functionality, as I want to also fix some performance hits when someone copy & pastes a lot of text from google docs which looks like:
[font=Times New Roman][b][i]word1[/i][/b][/font] [font=Times New Roman][b][i] word2[/i][/b][/font]
I think I found a solution to make it work... but I might have cursed you for giving me such a brain teaser :p;)

https://gist.github.com/cclaerhout/84400da7c758fbd6790f

To enable it for example in Sedo_TinyQuattro_ViewPublic_Editor_ToBbCode:
PHP:
    $parserOptions = array(
       'parserOpeningCharacter' => '[',
       'parserClosingCharacter' => ']',
       'htmlspecialcharsForContent' => false,
       'htmlspecialcharsForOptions' => false,
       'checkClosingTag' => true,
       'mergeAdjacentTextNodes' => true,
       'nl2br' => false,
       'trimTextNodes' => false
     );

     $tagsToCheck = array_fill_keys(explode(',', $options->tinyquattro_guilty_tags), array());
     $tagsToCheck['plain'] = array('plainText' => true);
     $miniParser= new Sedo_TinyQuattro_Helper_MiniParser($content, $tagsToCheck, array(), $parserOptions);
     $content = $miniParser->fixer();
     var_dump($content);
 
  • Like
Reactions: Xon
Top Bottom