Resource icon

WYSIWYG Page Editor 0.9.2

No permission to download
All the buttons work but none of them are rendered correctly upon page save. I skimmed through the add-on code but failed to understand how the bbcode is supposed to be used, help?

When you say the "buttons work", you mean that they wrapped the selected text between tags OR create a new text wrapped into tags, aren't you ?
If yes, then the addon works but the Bb Codes (from the Bbcm - bbcode xml must be imported) must be parsed. Are you using the XenForo parser on the text of the page ?
Something like this:
PHP:
            $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base'));
            $output = $bbCodeParser->render($output);

That's why my first question was: are the Bb Codes are working in those pages?
 
When you say the "buttons work", you mean that they wrapped the selected text between tags OR create a new text wrapped into tags, aren't you ?
The selected text is wrapped.

If yes, then the addon works but the Bb Codes (from the Bbcm - bbcode xml must be imported) must be parsed. Are you using the XenForo parser on the text of the page ?
Something like this:
PHP:
            $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base'));
            $output = $bbCodeParser->render($output);

That's why my first question was: are the Bb Codes are working in those pages?
The parser is used but with a custom formatter.
PHP:
$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('PageEditor_BbCode_Formatter_ToDisplay', array('view' => $view)));
 
The selected text is wrapped.


The parser is used but with a custom formatter.
PHP:
$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('PageEditor_BbCode_Formatter_ToDisplay', array('view' => $view)));

Oh ok, the Bbcm is extended the Base formatter, that's why. Here is its extended formatter on pastbin. Can't you reparse the content with the base formatter ?
 
Oh ok, the Bbcm is extended the Base formatter, that's why. Here is its extended formatter on pastbin. Can't you reparse the content with the base formatter ?
That's what I fear. Unfortunately the base formatter needs some changes to make it works with page (mostly because of attachment support). So I guess I can just ask King Kovifor to add support for this formatter?
 
That's what I fear. Unfortunately the base formatter needs some changes to make it works with page (mostly because of attachment support). So I guess I can just ask King Kovifor to add support for this formatter?
You can try but I'm not sure, I mean technically, it's going to be that easy. I've checked your formatter and it also extends the formatter base, but your code deletes all Bb Codes except the attach one:
PHP:
<?php

class PageEditor_BbCode_Formatter_ToDisplay extends XenForo_BbCode_Formatter_Base
{
    public function getTags()
    {
        $tags = parent::getTags();
        
        foreach (array_keys($tags) as $key) {
            if ($key != 'attach') {
                unset($tags[$key]);
            }
        }
        
        return $tags;
    }
    
    public function filterString($string, array $rendererStates)
    {
        return $string;
    }
}

You can first check if without the unset, the custom bb codes are available here. I don't think so, since there was the same problem with the autolinking function which forced me to extend the autolinking formatter too.
 
You can first check if without the unset, the custom bb codes are available here. I don't think so, since there was the same problem with the autolinking function which forced me to extend the autolinking formatter too.

It's better to extend 'PageEditor_BbCode_Formatter_ToSave' but I noticed that some of your bbcode requires js so extending 'PageEditor_BbCode_Formatter_ToDisplay' is better. Probably need to have a higher execution order.
 
This is almost perfect. It doesnt work on page nodes though, for some reason? It converts it to HTML, doesnt leave it as bb code.
 
Does this mean that if you made a page with bbcode when you go to edit it ... it's now HTML ?
Yes. And you shouldn't make a page with Bb Code from the beginning because by default, page content is not passed through Bb Code formatter.

But it converts it to styled HTML, as in instead of <h2> its <font style="font: 18px georgia, etc. etc.">.
The Bb Code is converted using the built-in formatter. It will be the same as in your posts.
 
Yes. And you shouldn't make a page with Bb Code from the beginning because by default, page content is not passed through Bb Code formatter..
Yes, you're right. Why not use Ckeditor, it should be very easy to integrate. No need to bother with XenForo official editor templates. Just a simple js to load the full editor.

And I've tried this addon and the problem is it's working only once; example:
I create a new phrase: [b]hello world[/b]
I save the page, it's working
I edit, the bbcodes are now html, no problem, it's logical but if I save the tag, the html are protected and then converted to text.
 
The Bb Code is converted using the built-in formatter. It will be the same as in your posts.

My only issue is that I want to be able to use [h2] (<h2> without the manager) and it stay as <h2>. Using the other toolbar options should stick to what they do and stay rendered as such. It would work exactly as it does not, except instead of adding its own style for default tags (h1-6, hr, anything) it would leave them be.
 
Yes, you're right. Why not use Ckeditor, it should be very easy to integrate. No need to bother with XenForo official editor templates. Just a simple js to load the full editor.

And I've tried this addon and the problem is it's working only once; example:
I create a new phrase: [b]hello world[/b]
I save the page, it's working
I edit, the bbcodes are now html, no problem, it's logical but if I save the tag, the html are protected and then converted to text.
Hmm, looks like it's not working correctly for you. By design, if you enter

Code:
[b]hello world[/b]

And save the page, it should show up as bold text when user view the page.
If you edit the page again (in front end, not in AdminCP), it should get translated back to B tag...
 
My only issue is that I want to be able to use [h2] (<h2> without the manager) and it stay as <h2>. Using the other toolbar options should stick to what they do and stay rendered as such. It would work exactly as it does not, except instead of adding its own style for default tags (h1-6, hr, anything) it would leave them be.
Sorry, currently this add-on does not work reliably with Custom Bb Code Manager add-on. The issue is being worked on.
 
Hmm, looks like it's not working correctly for you. By design, if you enter

Code:
[b]hello world[/b]

And save the page, it should show up as bold text when user view the page.
If you edit the page again (in front end, not in AdminCP), it should get translated back to B tag...
I've tested again. The problem is when you don't use the RTE editor (TinyMCE), the html content is not converted back to Bb Code.

I'm curious, why do you want to use Bb Codes in html page? Is it a request from users?
 
I've tested again. The problem is when you don't use the RTE editor (TinyMCE), the html content is not converted back to Bb Code.

I'm curious, why do you want to use Bb Codes in html page? Is it a request from users?
Yes, it's an important part of the add-on. Users are not always comfortable with HTML.
 
Top Bottom