Bug #77698

Custom Plugin for RTE causes Error on Editor initialization

Added by Marco Dinnbier about 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2016-08-30
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I've tried to add a custom button to rtehtmlarea.

On initialization the RTE hangs with a 404 error for the required JavaScript File and RequireJS throws an error.

The Reason: The registerPlugin Method in Editor.js uses the following namespace for requirejs -> TYPO3/CMS/Rtehtmlarea/Plugins/<MyPluginname> instead of TYPO3/CMS/<MyPackagename>/Plugins/<MyPluginname>

https://git.typo3.org/Packages/TYPO3.CMS.git/blob/HEAD:/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/HTMLArea/Editor/Editor.js#l443

I would fix it, but I need to know what is the best way for getting the full Pluginnamespace or Packagename in this scope?

#1

Updated by Marco Dinnbier about 5 years ago

My current Workaround in the main method of RTE plugin:

  $pageRenderer = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Page\PageRenderer::class);
  $pluginName = $this->pluginName;
  $packagename = GeneralUtility::underscoredToUpperCamelCase($this->extensionKey);
  $jsCode = "define('TYPO3/CMS/Rtehtmlarea/Plugins/$pluginName',['TYPO3/CMS/$packagename/Plugins/$pluginName'],function (Plugin) {return Plugin;});";
  $pageRenderer->addJsInlineCode($this->extensionKey . $pluginName . "_workaround see https://forge.typo3.org/issues/77698",$jsCode);
#2

Updated by Kevin Ditscheid about 5 years ago

Marco Dinnbier wrote:

My current Workaround in the main method of RTE plugin:

[...]

As the RichTextElement loads your requireJS module anyway, the workaround could be done without changing the RTE plugin by simply adding the line

define('TYPO3/CMS/Rtehtmlarea/Plugins/YourPluginName',['TYPO3/CMS/YourPackageName/Plugins/YourPluginName'],function (Plugin) {return Plugin;});

at the beginning of your requireJS module JavaScript File.
This still stays a workaround, though.

#3

Updated by Riccardo De Contardi over 4 years ago

  • Status changed from New to Closed

we are sorry, but we close this issue as now TYPO3 uses CKEditor and RTEHtmlarea development has been stopped.
RTEHtmlarea has been decoupled from the core and its code is available on GitHub:
https://github.com/FriendsOfTYPO3/rtehtmlarea

If you still need this fixed please create a PR on GitHub

Also available in: Atom PDF