?
Referenced as Pull Request for: # 11192
avatar OctavianC
OctavianC
19 Jul 2016

Steps to reproduce the issue

  • Set TinyMCE as your default Editor
  • Run the following code:
$editor = JFactory::getEditor();
echo $editor->display( 'some[name]', '', '100%' , '20%' , '100' , '10' );

Expected result

The WYSIWYG TinyMCE editor shows up.

Actual result

<textarea> shows up, clicking on Toggle Editor will turn it into the WYSIWYG editor.

System information (as much as possible)

Joomla! 3.6.0

Additional comments

Found the resolution, will provide a PR as soon as possible.

avatar OctavianC OctavianC - open - 19 Jul 2016
avatar dgt41
dgt41 - comment - 19 Jul 2016

@OctavianC your code will not work, let me explain:
tinymce display needs an id:
(plugins/editors/tinymce/tinymce.php:121)


    public function onDisplay($name, $content, $width, $height, $col, $row, $buttons = true, $id = null, $asset = null, $author = null)

If non is given then this code will be executed:
(plugins/editors/tinymce/tinymce.php:123)

        if (empty($id))
        {
            $id = $name;
        }

and obviously an id with brackets won't be accepted

avatar OctavianC
OctavianC - comment - 19 Jul 2016

Worked before. Also, the $id is optional so why not clean it before using it? It shouldn't take more than a couple of lines.

avatar dgt41
dgt41 - comment - 19 Jul 2016

There was a change in tinMCE (joomla side): before the selector for tinMCE was a class .mce-editable and now is using the id, check plugins/editors/tinymce/tinymce.php line 834

avatar OctavianC
OctavianC - comment - 19 Jul 2016

So, if code worked correctly on previous versions of Joomla!, then this is a B/C break. There's obviously a small oversight, because there is some filtering done to the $id but that variable never gets used.

The issue is NOT with TinyMCE, but with its initialization, because HTML ids are not sanitized. It's a small fix which I'll provide in a little while.

avatar dgt41
dgt41 - comment - 19 Jul 2016

NO! the code before was crap for multiple instances of tinyMCE in the same page, that was fixed with this change

avatar OctavianC
OctavianC - comment - 19 Jul 2016

I just love endless discussions without any arguments :)

avatar dgt41
dgt41 - comment - 19 Jul 2016

try this:

        if (empty($id))
        {
            $id = $name;
            $id = str_replace('[', '__', $name);
            $id = str_repeat(']', '', $id);
        }
avatar brianteeman brianteeman - close - 19 Jul 2016
avatar brianteeman brianteeman - change - 19 Jul 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-07-19 09:30:37
Closed_By brianteeman
avatar brianteeman
brianteeman - comment - 19 Jul 2016

Closed as we have a PR for testing


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/11190.

avatar brianteeman brianteeman - close - 19 Jul 2016
avatar brianteeman brianteeman - change - 21 Jul 2016
Labels Added: ?

Add a Comment

Login with GitHub to post a comment