Bug #23019
closedExtJS is not included when RTE is invoked by USER_INT frontend script
0%
Description
Some time ago I wrote a frontend extension that uses pi2 of htmlarea. That worked fine in Typo3 4.3, but does not work in 4.4. As I found no API for the new rtehtmlarea, I do not know whether it is my fault or a bug in the new htmlarea version. Do I have to change my code in order to get the new htmlarea work?
The pageRenderer is invoked by the RTE in order to include required js librairies and scripts and required css files. However, the USER_INT scripts are invoked after page generation and, in particular, after the pageRenderer is invoked. Therefore, the required files are not included and the RTE fails to load.
(issue imported from #M14896)
Files
Updated by Stanislas Rolland over 14 years ago
The FE plugin API has not changed.
What error do you get?
Updated by TO_Webmaster no-lastname-given over 14 years ago
Well, it just says: "The editor is being loaded. Please wait...". In Typo3 4.3, the editor appears, in Typo3 4.4, it does not.
Updated by Stanislas Rolland over 14 years ago
Do you get an error on the JavaScript console?
Updated by TO_Webmaster no-lastname-given over 14 years ago
Thanks for the hint. The error is: "Ext is not defined"
Updated by Stanislas Rolland over 14 years ago
Please try to set config.absRefPrefix in your TS template setup.
Updated by Administrator Admin over 14 years ago
I have absolutly the same problem. I didn't manage to set absRefPrefix to fix it.
I tried to load my extJS on my own:
<script src="typo3/contrib/extjs/ext-core.js?1277220966" type="text/javascript"></script>
<script src="typo3/contrib/extjs/adapter/ext/ext-base.js?1277220966" type="text/javascript"></script>
<script src="typo3/contrib/extjs/ext-all.js?1277220966" type="text/javascript"></script>
<script src="typo3/contrib/extjs/locale/ext-lang-de.js?1277220966" type="text/javascript" charset="utf-8"></script>
and I got a this error message:
TYPO3.settings is undefined
this.resizable = TYPO3.settings.textareaResize;
Updated by TO_Webmaster no-lastname-given over 14 years ago
Changing from baseURL to absRefPrefix does not help.
Updated by Stanislas Rolland over 14 years ago
Do you have this inline js in the head of the page:
<script type="text/javascript">
/*<![CDATA[*/
/*]]>*/
</script>
Updated by Nathan L over 14 years ago
I am also experiencing this problem. I tried adding both the <script src=""> tags that Daniel Dimitrov suggested along with the code Stanislas Rolland suggested at the same time.
This removed the "Ext is not defined" error.
However, the RTE is not styled at all and isn't really recognizable. Something is initialized, but there are unstyled input buttons everywhere on my page.
(I also set my config.absRefPrefix in the main template, with no improvement in behavior.)
I think it's just missing css, but I'm not sure which ones to include.
Updated by Nathan L over 14 years ago
It's because we're using the RTE in a USER_INT plugin.
The pageRender is called and looks to include JS libraries before the USER_INT plugin is executed.
If I echo "about to call loadExtJs()"; in the class.tx_rtehtmlarea_pi2.php file.
And I echo "in render js"; in class.t3lib_pagerenderer.php just above the " if ($this->addExtCore) { line the results look like this:
in render js
about to call loadExtJs()
I've run into this before, but can't remember if I figured out how to fix it. It's like a plugin needs the ability to do some stuff as USER and some stuff as USER_INT.
Updated by Nathan L over 14 years ago
I tried changing my extension to a USER and disabled caching. Now all the appropriate includes are in the header automatically.
<script src="http://example.com/typo3/contrib/extjs/adapter/ext/ext-base.js?1277474434" type="text/javascript"></script>
<script src="http://example.com/typo3/contrib/extjs/ext-all.js?1277474447" type="text/javascript"></script>
<script src="http://example.com/typo3/contrib/extjs/locale/ext-lang-en.js?1277474433" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
/*<![CDATA[*/
/*]]>*/
</script>
<script src="http://example.com/t3lib/js/extjs/ux/ext.resizable.js" type="text/javascript"></script>
Now I see "The editor is being loaded. Please wait..." with the animated gif floating behind it. However, it never loads and there are no errors on the javascript console.
Updated by Stanislas Rolland over 14 years ago
I am unable to reproduce this issue. Could anyone provide an extension that allows to reproduce it?
Updated by Thomas Lange over 14 years ago
@Stanislaw.
I use the Extension Calendar Base ( cal ). In this one I can reproduce the issue
"The editor is being loaded. Please wait..." each time.
In TYPO3 4.3 it works fine, in 4.4 I get this message, wenn I try to change oder to make a
new termin in frontend as a frontend-user. In the Backend there are no problems.
The Extension (version 1.3.2) was installed normaly, without any special configurations.
Only the language of all extensions and in setup typoscript for the whole pageI have changed to gemany.
On the page with the calendar plugin you have to set the rights to change the calendar:
page.config.no_cache = 1
plugin.tx_cal_controller.rights.edit = 1
plugin.tx_cal_controller.rights.admin.user = 1
plugin.tx_cal_controller.rights.admin.group = 1
For user oder group the "1" ist your frontend-user-id or frontend-group-id.
Further things to install see the manual please.
Updated by TO_Webmaster no-lastname-given over 14 years ago
Does not work for me. It still says: "Ext is not defined"
Updated by Nathan L over 14 years ago
My previous comment (Which I deleted) was wrong.
I applied the patch, cleared the cache and still get "Ext is not defined"
I created a simple extension to demonstrate the issue. This extension shows the RTE successfully in 4.3.3.
Hope this helps.
Updated by Stanislas Rolland over 14 years ago
Thanks for the test extension.
I uploaded a new patch (v3). Please test it.
The patch will ensure that the pageRenderer is invoked after USER_INT scripts are invoked and substituted on the page.
Updated by TO_Webmaster no-lastname-given over 14 years ago
Thank you!
Now, the editor loads and there is no error, but I only see the header of the editor (icons, style, ...) and no textarea. It works fine in typo3 4.3 with the same configuration. Is this a configuration/CSS issue or still a bug?
Updated by Stanislas Rolland over 14 years ago
Sorry, I have to backtrack on this patch. There is no way to have the pagerenderer invoked before the USER_INT script without having everything cached.
Please remove v3 and apply and test v2 of the patch.
Updated by Stanislas Rolland over 14 years ago
@TO_Webmaster no-lastname-given: Do you mean that the editing area is completely collapsed? Do you have some configuration option that is setting the height of the RTE?
Updated by Christian Futterlieb over 14 years ago
I also got this problem. The patch v2 solved it for me. Thanks, Stanislas!
Updated by Nathan L over 14 years ago
Patch v2 makes the editor load in the test extension. However, for some odd reason the additionalJS_post javascript is displayed on the page as HTML text instead of being executed as javascript.
This happens in my test extension and in the original location I noticed the problem.
Does anyone else see this? It was the same in Chrome and Firefox. So weird.
I solved it by moving the additionalJS_post var to inside the </form> tag. So weird.
Updated by Stanislas Rolland over 14 years ago
@Nathan: Yes, I noted this, but could not figure out why the javascript was being displayed. It does not in another extension with which I was also able to reproduce the problem (and in which the additionalJS_post is not inside the form element...). I thought maybe some illegal html structure somewhere, but could not find any.
Updated by Nathan L over 14 years ago
@Stanislas The thing that's weird to me is that it doesn't do that if I switch Typo3 back to 4.3.3, using the exact same code.
Updated by Nathan L over 14 years ago
@Stanislas I did some investigation and found that the first HTML tag after the "</form>" tag gets an id="ext-gen11" (or whatever the number) and a style="visibility: true; display: block" added to it when extjs is initialized.
I wrapped the entire form tag in a div and now the JS is not displayed:
<div>
<form>stufff</form>
</div>
additionalJS_post here
Hope this helps someone.
Updated by Stanislas Rolland over 14 years ago
@Nathan: Thanks for investigating this. I think I know where that comes from. I will fix it.
Updated by Stanislas Rolland over 14 years ago
The opposite issue may occur if the plugin is USER and javascriptLibs.ExtJs was configured on the page setup to include ExtJs explicitly. Then ExtJs would be included twice. Version v3 of the patch fixes this issue.
Updated by Stanislas Rolland over 14 years ago
Committed to SVN TYPO3core trunk (revision 8152) and branch TYPO3_4-4 (revision 8153).
Updated by TO_Webmaster no-lastname-given over 14 years ago
Now something is completely wrong.
In the head-part of the html-code, there is another page, like
<html>
<head>
...
<html>
<head>
...
</head>
<body>
...
</body>
</html>
</head>
<body>
...
</body>
</html>
Furthermore, the patch has some problems:
typo3_src-4.4.0$ patch p0 < rtehtmlarea_bugfix_14896_v3_trunk.patch saving rejects to file typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php.rej
(Stripping trailing CRs from patch.)
patching file typo3/sysext/rtehtmlarea/pi2/class.tx_rtehtmlarea_pi2.php
Hunk #2 FAILED at 206.
Hunk #3 succeeded at 230 (offset 1 line).
Hunk #4 FAILED at 276.
Hunk #5 succeeded at 312 (offset 13 lines).
2 out of 5 hunks FAILED -
(Stripping trailing CRs from patch.)
patching file typo3/sysext/rtehtmlarea/templates/rtehtmlarea_pageheader_frontend.html
Additionally, the editor still has wide buttons and no textarea.
Updated by Stanislas Rolland over 14 years ago
Get the code from SVN:
and
Updated by TO_Webmaster no-lastname-given over 14 years ago
Nested html is gone now, but it does not help. See problem.png.
Updated by Stanislas Rolland over 14 years ago
@TO_Webmaster no-lastname-given: Enable troubleshooting mode in the EM and report the log that is then displayed below the RTE editing area.
A skin css file is missing...
Updated by TO_Webmaster no-lastname-given over 14 years ago
Pfad: bodySie befinden sich im TEXT-MODUS. Benutzen Sie die Schaltfläche [<>], um zurück in den WYSIWYG-Modus zu wechseln.
[HTMLArea::init]: Editor url set to: typo3/sysext/rtehtmlarea/htmlarea/
[HTMLArea::init]: Editor skin CSS set to: sysext/t3skin/rtehtmlarea/htmlarea.css
[HTMLArea::init]: Editor content skin CSS set to: sysext/t3skin/rtehtmlarea/htmlarea-edited-content.css
[HTMLArea::initEditor]: Initializing editor with editor Id: user_tud_calendar[new_event][description].
[HTMLArea.Editor::registerPlugin]: Plugin EditorMode was successfully registered.
[HTMLArea.Config::registerHotKey]: A hotkey with key b was registered for toolbar item Bold.
[HTMLArea.Config::registerHotKey]: A hotkey with key i was registered for toolbar item Italic.
[HTMLArea.Editor::registerPlugin]: Plugin DefaultInline was successfully registered.
[HTMLArea.Config::registerHotKey]: A hotkey with key n was registered for toolbar item FormatBlock.
[HTMLArea.Config::registerHotKey]: A hotkey with key 1 was registered for toolbar item FormatBlock.
[HTMLArea.Config::registerHotKey]: A hotkey with key 2 was registered for toolbar item FormatBlock.
[HTMLArea.Config::registerHotKey]: A hotkey with key 3 was registered for toolbar item FormatBlock.
[HTMLArea.Config::registerHotKey]: A hotkey with key 4 was registered for toolbar item FormatBlock.
[HTMLArea.Config::registerHotKey]: A hotkey with key 5 was registered for toolbar item FormatBlock.
[HTMLArea.Config::registerHotKey]: A hotkey with key 6 was registered for toolbar item FormatBlock.
[HTMLArea.Config::registerHotKey]: A hotkey with key TAB was registered for toolbar item Indent.
[HTMLArea.Config::registerHotKey]: A hotkey with key SHIFT-TAB was registered for toolbar item Outdent.
[HTMLArea.Config::registerHotKey]: A hotkey with key l was registered for toolbar item JustifyLeft.
[HTMLArea.Config::registerHotKey]: A hotkey with key e was registered for toolbar item JustifyCenter.
[HTMLArea.Config::registerHotKey]: A hotkey with key r was registered for toolbar item JustifyRight.
[HTMLArea.Config::registerHotKey]: A hotkey with key j was registered for toolbar item JustifyFull.
[HTMLArea.Editor::registerPlugin]: Plugin BlockElements was successfully registered.
[HTMLArea.Config::registerButton]: A toolbar item with the same Id: Indent already exists and will be overidden.
[HTMLArea.Config::registerHotKey]: A hotkey with the same key TAB already exists and will be overidden.
[HTMLArea.Config::registerHotKey]: A hotkey with key TAB was registered for toolbar item Indent.
[HTMLArea.Config::registerButton]: A toolbar item with the same Id: Outdent already exists and will be overidden.
[HTMLArea.Config::registerHotKey]: A hotkey with the same key SHIFT-TAB already exists and will be overidden.
[HTMLArea.Config::registerHotKey]: A hotkey with key SHIFT-TAB was registered for toolbar item Outdent.
[HTMLArea.Editor::registerPlugin]: Plugin DefinitionList was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin BlockStyle was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin CharacterMap was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin UserElements was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin TextStyle was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin TYPO3Image was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin TYPO3Link was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin TYPO3Color was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin TextIndicator was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin Language was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin FindReplace was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin RemoveFormat was successfully registered.
[HTMLArea.Config::registerHotKey]: A hotkey with key 0 was registered for toolbar item CleanWord.
[HTMLArea.Editor::registerPlugin]: Plugin DefaultClean was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin QuickTag was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin TableOperations was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin AboutEditor was successfully registered.
[HTMLArea.Editor::registerPlugin]: Plugin ContextMenu was successfully registered.
[HTMLArea.Config::registerHotKey]: A hotkey with key z was registered for toolbar item Undo.
[HTMLArea.Config::registerHotKey]: A hotkey with key y was registered for toolbar item Redo.
[HTMLArea.Editor::registerPlugin]: Plugin UndoRedo was successfully registered.
[HTMLArea.Config::registerHotKey]: A hotkey with key c was registered for toolbar item Copy.
[HTMLArea.Config::registerHotKey]: A hotkey with key x was registered for toolbar item Cut.
[HTMLArea.Config::registerHotKey]: A hotkey with key v was registered for toolbar item Paste.
[HTMLArea.Editor::registerPlugin]: Plugin CopyPaste was successfully registered.
[HTMLArea.Iframe::createHead]: Iframe baseURL set to: https://
[HTMLArea.Iframe::createHead]: Skin CSS set to: sysext/t3skin/rtehtmlarea/htmlarea-edited-content.css
[HTMLArea.Iframe::createHead]: Override CSS set to: typo3temp/rtehtmlarea/defaultPageStyle_3b806c8aced6931c43bf.css?1277231790
[HTMLArea.Iframe::createHead]: Content CSS set to: fileadmin/template/css/rte.css?1211881884
[HTMLArea.Iframe::createHead]: Editor iframe document head successfully built.
[HTMLArea.Iframe::getStyleSheets]: Stylesheets not yet loaded ([Exception... "A parameter or an operation is not supported by the underlying object" code: "15" nsresult: "0x8053000f (NS_ERROR_DOM_INVALID_ACCESS_ERR)" location: "https://**********/typo3temp/rtehtmlarea/htmlarea_cumulative_215883a121725fdae358.js?1278963486 Line: 973"]). Retrying...
[HTMLArea.Iframe::getStyleSheets]: Stylesheets not yet loaded ([Exception... "A parameter or an operation is not supported by the underlying object" code: "15" nsresult: "0x8053000f (NS_ERROR_DOM_INVALID_ACCESS_ERR)" location: "https://**********/typo3temp/rtehtmlarea/htmlarea_cumulative_215883a121725fdae358.js?1278963486 Line: 973"]). Retrying...
[HTMLArea.Iframe::getStyleSheets]: Stylesheets successfully accessed.
[BlockStyle::getJavascriptFile]: Requesting script typo3temp/rtehtmlarea/classes__e0adef694dd5b2ee3bbc.js?1278963486
[TextStyle::getJavascriptFile]: Requesting script typo3temp/rtehtmlarea/classes__e0adef694dd5b2ee3bbc.js?1278963486
[HTMLArea.Editor::generatePlugins]: All plugins successfully generated.
[BlockStyle::getJavascriptFile]: Requesting script typo3temp/rtehtmlarea/classes__e0adef694dd5b2ee3bbc.js?1278963486
[TextStyle::getJavascriptFile]: Requesting script typo3temp/rtehtmlarea/classes__e0adef694dd5b2ee3bbc.js?1278963486
[HTMLArea.Editor::start]: Editor ready.
[BlockStyle::generate]: Javascript file successfully evaluated: typo3temp/rtehtmlarea/classes__e0adef694dd5b2ee3bbc.js?1278963486
Updated by Stanislas Rolland over 14 years ago
The baseURL
https://
looks wrong.
But should not affect styling of the toolbar.
Updated by Stanislas Rolland over 14 years ago
@TO_Webmaster no-lastname-given: Please upload copy of the source html of the page.
Updated by Christian Buelter over 14 years ago
I had the same problem (RTE not loading in the frontend) with ke_troubletickets.
Using the rtehtmlarea version from current trunk (rev. 8251) the rte loads, works and looks good.
Thanks!
One little thing remains: When I use the litte arrows in the lower right corner of the text input area in order to resize the RTE, it collapses and is not usable anymore. Can I deactivate it for the frontend?
Updated by Stanislas Rolland over 14 years ago
@Christian: Oops!.. I think not. Please post a feature request to make resizing configurable in FE.
And a bug report if the RTE is collapsing when resized. However, I am not currently able to reproduce this behaviour. Please report in which browser(s) this is happening.
Updated by Christian Buelter over 14 years ago
@Stanisland: I opened a feature request.
The collapsing appears only in my local development environment. In a live environment we use the RTE in it works fine. So right now I think the reason lies in my development environment.
Updated by Stanislas Rolland over 14 years ago
@Nathan: the problem causing the display of javascript as text in FE is now fixed in SVN (see issue #15250).
Updated by Stanislas Rolland over 14 years ago
@TO_Webmaster no-lastname-given: I think the patch was not correctly applied on your installation. Please try with TYPO3 4.4.1 to be released tomorrow, July 28.
Updated by TO_Webmaster no-lastname-given over 14 years ago
Hmm, seems to be a problem with our CSS file. Is the new Editor using other HTML-Tags/IDs/Classes :-( ?
Updated by TO_Webmaster no-lastname-given over 14 years ago
I just updated another server using this extension to 4.4.1. It works fine after disabling compression.
Updated by Stanislas Rolland over 14 years ago
@TO_Webmaster no-lastname-given: Indeed, the RTE skin has been deeply modified.
If it does not work with compression, try to clear the RTE cache using the Clear cache menu in the TYPO3 admin BE.
Updated by TO_Webmaster no-lastname-given over 14 years ago
On this server, compression does not matter. I think, this is a server issus, as I cleared all caches. But this is a very small site and I do not need any compression there.
On the other server (the one with the CSS-Problem), compression works fine.
Well, I will ask our CSS-experts to fix this issue then.
I think, you can set the status to "resolved".
Thank you again!
Updated by Stanislas Rolland over 14 years ago
Great! Thank you for your patience.