Commit ba2cae54 authored by Benjamin Franzke's avatar Benjamin Franzke
Browse files

[TASK] Avoid TBE_EDITOR declaration via synchronous script tag

TBE_EDITOR is only needed for the legacy, inline-javascript based,
TBE_EDITOR.customEvalFunctions registry, therefore the synchronous
script jsfunc.tbe_editor.js is almost always loaded without
ever being used in requests if no legacy code is loaded.

The remaining usages of TBE_EDITOR.registerCustomEvaluation have been
migrated to TBE_EDITOR.registerCustomEvaluation in #95954
(rsee eturnFieldJs in redirects SourceHost evaluation), therefore
TBE_EDITOR.customEvalFunctions is subject for deprecation anyway, and
it's fine to guard any TBE_EDITOR.customEvalFunctions assignment
with a fallback-factory for TBE_EDITOR and to remove jsfunc.tbe_editor.js.

Resolves: #96597
Releases: main
Change-Id: I1d67e0129f91cf6f51b66fb82cb7806f9c9f9672
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/73099

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Benjamin Franzke's avatarBenjamin Franzke <bfr@qbus.de>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Benjamin Franzke's avatarBenjamin Franzke <bfr@qbus.de>
parent 8fdd96d7
......@@ -518,7 +518,7 @@ export default (function() {
// password is only a display evaluation, we ignore it
break;
default:
if (typeof TBE_EDITOR.customEvalFunctions !== 'undefined') {
if (typeof TBE_EDITOR === 'object' && typeof TBE_EDITOR.customEvalFunctions !== 'undefined') {
if (customEvaluations.has(command)) {
returnValue = customEvaluations.get(command).call(null, value);
} else if (typeof TBE_EDITOR.customEvalFunctions[command] === 'function') {
......
......@@ -342,7 +342,7 @@ abstract class AbstractFormElement extends AbstractNode
} else {
// @todo deprecate inline JavaScript in TYPO3 v12.0
$resultArray['additionalJavaScriptPost'][] = sprintf(
'TBE_EDITOR.customEvalFunctions[%s] = function(value) { %s };',
'var TBE_EDITOR = TBE_EDITOR || { customEvalFunctions: {} }; TBE_EDITOR.customEvalFunctions[%s] = function(value) { %s };',
GeneralUtility::quoteJSvalue($name),
$javaScriptEvaluation
);
......
......@@ -188,7 +188,6 @@ class FormResultCompiler
$pageRenderer->getJavaScriptRenderer()->addJavaScriptModuleInstruction($module);
}
$pageRenderer->addJsFile('EXT:backend/Resources/Public/JavaScript/jsfunc.tbe_editor.js');
// Needed for FormEngine manipulation (date picker)
$dateFormat = ['DD-MM-Y', 'HH:mm DD-MM-Y'];
$pageRenderer->addInlineSetting('DateTimePicker', 'DateFormat', $dateFormat);
......
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Contains JavaScript for TYPO3 Core Form generator - AKA "TCEforms"
*/
var TBE_EDITOR = {
customEvalFunctions: {},
};
Markdown is supported
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