Skip to content
Snippets Groups Projects
Commit e9f2bfae authored by Andreas Fernandez's avatar Andreas Fernandez Committed by Frank Naegler
Browse files

[BUGFIX] Initialize T3editor properly

If a T3editor is instantiated on-the-fly, it is not initialized properly.
Add a callback to the ``Form/Element/T3editorElement`` class and mark
editor instances as initialized to prevent double initialization.

Change-Id: I8c6b692eb2c132180ed0d122b35515276df5acd9
Resolves: #73425
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/46680


Reviewed-by: default avatarMarkus Klein <markus.klein@typo3.org>
Reviewed-by: default avatarDaniel Goerz <ervaude@gmail.com>
Tested-by: default avatarDaniel Goerz <ervaude@gmail.com>
Reviewed-by: default avatarFrank Naegler <frank.naegler@typo3.org>
Tested-by: default avatarFrank Naegler <frank.naegler@typo3.org>
parent 5dda0e38
No related merge requests found
......@@ -123,6 +123,7 @@ class T3editorElement extends AbstractFormElement
$this->data['tableName'] . ' > ' . $this->data['fieldName'],
array('target' => 0)
);
$this->resultArray['additionalJavaScriptPost'][] = 'require(["TYPO3/CMS/T3editor/T3editor"], function(T3editor) {T3editor.findAndInitializeEditors();});';
$this->initJavascriptCode();
return $this->resultArray;
......@@ -158,7 +159,6 @@ class T3editorElement extends AbstractFormElement
protected function initJavascriptCode()
{
$this->resultArray['stylesheetFiles'][] = $this->relExtPath . 'Resources/Public/Css/t3editor.css';
$this->resultArray['requireJsModules'][] = 'TYPO3/CMS/T3editor/T3editor';
if ($this->mode === self::MODE_TYPOSCRIPT) {
foreach ($this->codeCompletionComponents as $codeCompletionComponent) {
$this->resultArray['requireJsModules'][] = 'TYPO3/CMS/T3editor/Plugins/CodeCompletion/' . $codeCompletionComponent;
......
......@@ -45,6 +45,9 @@ define(['jquery',
* @param {Number} index
*/
T3editor.initializeEditor = function($editor, index) {
if ($editor.data('initialized')) {
return;
}
var $textarea = $editor.find('textarea'),
options = {
labels: $textarea.data('labels'),
......@@ -76,6 +79,7 @@ define(['jquery',
$textarea.hide();
}
});
$editor.data('initialized', true);
};
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment