No Code Attached Yet bug
avatar OctavianC
OctavianC
16 Jan 2023

Steps to reproduce the issue

Have 2 different editors on the page. Using this code I'm showing 'Editor - None' and 'Editor - CodeMirror' on the same page:

foreach (array('none', 'codemirror') as $plugin)
{
	$editor = \Joomla\CMS\Editor\Editor::getInstance($plugin);

	echo $editor->display($plugin, $plugin, 500, 320, 70, 10, true);
}

Expected result

Two editors with the same amount of buttons

Actual result

Buttons are duplicated on the second editor
image

Additional comments

Seems to be caused by these lines:
https://github.com/joomla/joomla-cms/blob/4.2-dev/libraries/src/Editor/Editor.php#L93-L104

Every time an editor is initialized the event listener is added. Might be an oversight because you won't notice this out of the box (I haven't found any page where the Joomla! CMS would present different editors).

avatar OctavianC OctavianC - open - 16 Jan 2023
avatar joomla-cms-bot joomla-cms-bot - change - 16 Jan 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 16 Jan 2023
avatar OctavianC OctavianC - change - 16 Jan 2023
Title
Duplicate buttons on second Editor instance
[4.2] Duplicate buttons on second Editor instance
avatar OctavianC OctavianC - edited - 16 Jan 2023
avatar Fedik
Fedik - comment - 16 Jan 2023

The probalem that getButtons is not an event, it is a callback. Original code:

$buttons = $this->_subject->getButtons($name, $buttons, $asset, $author);
($this->_subject is instance of Joomla\CMS\Editor class)

I cannot find PR, but found it was changed in a commit e9c1efc

avatar Fedik Fedik - change - 16 Jan 2023
Labels Added: bug
avatar Fedik Fedik - labeled - 16 Jan 2023
avatar dgrammatiko
dgrammatiko - comment - 16 Jan 2023

@OctavianC @Fedik please test #39648

avatar Quy Quy - change - 16 Jan 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-01-16 17:38:28
Closed_By Quy
avatar Quy Quy - close - 16 Jan 2023

Add a Comment

Login with GitHub to post a comment