Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 6.0.5 GA
-
Fix Version/s: --Sprint - SP, 6.0.6 GA, 6.1.0 CE RC1
-
Component/s: WCM > Web Content Administration
-
Labels:None
-
Environment:windows 7 professional, latest firefox, latest firebug
Tomcat + MySQL, 6.0.x rev 65343
-
Branch Version/s:6.0.x
Description
See LPS-57703.
Steps to reproduce the error:
1. log as bruno (admin);
2.go to control panel, web content
3.create simple text content
4.save
5.try to edit content again
what was expected when trying to edit:
- see the content on editor;
actual behavior:
- editor does not show content
Firebug message:
parent._15_initEditor is not a function
textArea.value = parent._15_initEditor();
-
- input_editor_page.jsp.diff
- 28/Oct/10 8:49 PM
- 3 kB
- Tobias Kaefer
Issue Links
- is duplicated by
-
LPS-24147
CLONE - web content editor bug
-
Activity
I guess I have the same problem. 6.0.5 GA, Mac OS X 10.6.4, Firefox 3.6.10, Firebug 1.5.4. At first it seemed to be working but now every time when I try to create or edit web content it fails to load it. And it seems that the toolbar is a bit different than it should be. Also the background should be transparent but for some reason it is rendered white. I haven't change any editor settings. Seems to be very random problem because some of the 6.0.5 installation are working correctly, some with IE8.
I believe its not random. Tested at 5 workstations, same behavior.
Hi guys!
I think the problem is in parent call. Because u can't be sure that <code> textArea.value = parent.<%= HtmlUtil.escape(initMethod) %>(); </code> is loaded on parent. The line is from ckeditor.jsp
I simply touched the file ckeditor.jsp after server started, and the error disappeared (wow). Then i restarted the server, and the error does not exists anymore. Is it possible to have some cached jsp inside archives available for download? Can someone reproduce my test?
We have the same problem.
windows 7 ultimate, latest firefox, latest firebug.
I indeed have the same
Firebug message:
parent._15_initEditor is not a function
textArea.value = parent._15_initEditor();
I did a little test to recall the web content editor 10 times.
8 times a get the error but twice the content editor did not give the error but showed the correct content.
Strange behaviour?!?!
The parent is the edit_article.jsp of the journal portlet.
This jps has the code:
<aui:script>
function <portlet:namespace />initEditor()
</aui:script>
This could be an alloy issue
Forget about "touch", i tried Leon's way, refreshing the page many times and got the same strange behavior, sometimes the content shows up, sometimes not.
At ckeditor.jsp we have:
...
String initMethod = ParamUtil.getString(request, "initMethod", DEFAULT_INIT_METHOD);
...
textArea.value = parent.<%= HtmlUtil.escape(initMethod) %>();
At edit_article.jsp we have:
...
function <portlet:namespace />initEditor()
...
I think we need to verify the actual rendered code at browser, because seems that what is coming from request is different from what is rendered by <portlet:namespace>. They must be the same thing, i guess...
I've got the same problem. Currently I've made workaround in ckeditor.jsp (see below). To fix just create hook to replace default ckeditor.jsp or update it directly in ROOT/html/js/editor/ckeditor.jsp.
Fix tested with Firefox 3.6.10 and Google Chrome 6.0.472.63 (I hope it will work in IE too, but didn't have a chance to prove that).
ckeditor.jsp:
...
function initCkArea() {
var textArea = document.getElementById("CKEditor1");
var ckEditor = CKEDITOR.instances.CKEditor1;
//-------- changes started here ----------
if (parent.<%= HtmlUtil.escape(initMethod) %>)
else {
var waitParentIntervalId =
setInterval(
function() {
if (parent.<%= HtmlUtil.escape(initMethod) %>)
},
300
);
}
//-------- changes ended here ------------
CKEDITOR.config.toolbar = '<%= TextFormatter.format(HtmlUtil.escape(toolbarSet), TextFormatter.M) %>';
CKEDITOR.config.customConfig = '<%= request.getContextPath() %>/html/js/editor/ckeditor/ckconfig.jsp?p_l_id=<%= plid %>&p_main_path=<%= HttpUtil.encodeURL(mainPath) %>&doAsUserId=<%= HttpUtil.encodeURL(doAsUserId)
...
Hi Dmitry,
thanks for your suggestion, but that is not the solution.
If after the timeout the parent still not available I indeed don't get an error but the value of the textArea will be blank.
I again did refresh the page and sometimes I see the content of the blog but most of the time the value is blank.
Kind regards,
Leon
Ok, I got the same problem after some time and on other machines. And even more strange - I've added 'alert' if parent is not available after 20 seconds (when browser already finished all his loading) and I got that alert if text area is blank.
So, from my point of view, it looks like Firefox didn't load that script in parent page at all ( optimization?
)
But another solution works for me now (checked in Firefox, Chrome, Safary, IE7, IE8) - I've placed call to the child IFrame into the parent page (edit_article.jsp). See below new versions of the fixes (ckeditor.jsp and edit_article.jsp).
Let me know if it doesn't work for you.
ckeditor.jsp:
function initCkArea() {
var textArea = document.getElementById("CKEditor1");
var ckEditor = CKEDITOR.instances.CKEditor1;
//------------- changes to the original version started here:
if (parent.<%= HtmlUtil.escape(initMethod) %>)
{ textArea.value = parent.<%= HtmlUtil.escape(initMethod) %>(); }//------------- changes to the original version ended here:
....
} // end of 'initCkArea'
//------------- new function for initialization from parent page (edit_article.jsp)
function initEditorArea() {
var textArea = document.getElementById("CKEditor1");
if (parent.<%= HtmlUtil.escape(initMethod) %>) { textArea.value = parent.<%= HtmlUtil.escape(initMethod) %>(); }
else {
//------------- may be, we didn't get this path forever, but just for any case ...
var waitParentIntervalId =
setInterval(
function() {
if (parent.<%= HtmlUtil.escape(initMethod) %>)
},
300
);
}
}
//------------- end of new function for initialization from parent page (edit_article.jsp)
...
and here is fix for parent page (edit_article.jsp):
...
// somewhere inside <aui:script> block after declaration of "_15_initEditor" function, in my case - line 814
//------------- start of the call to child IFrame's function
// hack for re-initialization of Editor's content in case of late script loading (Firefox problem)
if (document.getElementById('<%= renderResponse.getNamespace() + "structure_el_TextAreaField_content" %>').contentWindow.initEditorArea)
//------------- end of the call to child IFrame's function
</aui:script>
<aui:script use="liferay-portlet-journal">
the last approach didn't work for me.
"So, from my point of view, it looks like Firefox didn't load that script in parent page at all" = i agree.
I have to say that i think iframes were not designed to wait parent content loading completely (this is why they have a url attribute), so the code were are trying to fix may be conceptually wrong (except if ckeditor plugin or something else imposes workarounds to work properly).
Anyway, i'm trying to add jquery and use the document.ready() method, so the iframe will wait until its parent loads completely.
I will update this asap, if you guys have some time, please consider my proposal.
More news... while testing
Steps: put two diferent web contents, and try to edit one, cancel, try to edit other, and so on. Soon the bug will raise.
Then i looked at the log and i get:
An error occurred at line: 759 in the jsp file: /html/portlet/journal/edit_article.jsp
initMethod cannot be resolved
756: function() {
757: if (parent.<%= HtmlUtil.escape(initMethod) %>)
761: },
762: 300
Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:335)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:313)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:300)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:543)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:480)
at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:175)
at com.liferay.taglib.util.IncludeTag._doInclude(IncludeTag.java:223)
at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:58)
at org.apache.jsp.html.common.themes.portlet_jsp._jspService(portlet_jsp.java:4464)
ops, my mistake. The last stacktrace belongs to Dmitry's approach, not to the original code. I will revert edit_article and ckeditor files to its original state, before continuing.
Try this at ckeditor.jsp:
//add jquery to page:
...
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="../jquery/jquery.js"></script>
...
//at the end of page replace:
initCkArea();
//by
$(parent).ready(function()
);
let me know if it solved, thanks.
Same problem with Firefox 6.3.10 in Fedora 13 with Liferay 6.0.5.
But with Chrome 7.0.517.41 it works.
I,ve also seen the next javascript error when editing an structure with the rich text editor:
document._15_editorForm._15_xsdContent is undefined http://localhost:8080/html/js/everything.jsp?browserId=firefox&themeId=controlpanel&colorSchemeId=01&minifierType=js&minifierBundleId=javascript.everything.files&languageId=en_US&t=1281948294000 Line 3
¿It's related to this one or might it be a new one?
How to reproduce:
1- Go to Control Panel -> Web content -> structures
2- Create or edit an existing structure
2- Push "Launch Editor" button and select Rich Editor.
3- Change the structure and try save changes
I think its related. (i'm at home now
cant reproduce your steps, i will try tomorrow )
I also noticed one thing: disable all cache in firefox (using about:config) and this error will happen every time you try to edit something using the rich text editor. With the cache enabled, however, my fix seems to work. Can you verify please?
The solution I found focuses on the JSP that creates the IFrame.
Therefore I don't set the URL for the CKEditor in the IFrame element.
This is set afterwords, when the page is renderer.
To achieve this, I also use jQuery (jQuery(document).ready(...)).
Since we use jQuery by default in our portals, you might want to add this
<script type="text/javascript" src="/html/js/jquery/jquery.js"/>
to the input_editor_page.jsp file as well - besides applying the attached patch.
Marcos's fix works for me. Either with or without firefox's cache enabled. But the other issue I found is still there and that happens when you push the update button, not before.
I reproduced the issue by creating a simple web content, clicking edit, and then refreshing the web browser. Upon refresh, the content was no longer there, the input box background color was white, and firebug told me about the error in parent.15.
When I click back to return to full page, and then click to edit again, all my original content was there and everything was normal. As long as I edit without refreshing the page, everything works as expected.
Hi,
After some investigation we have found out that portal.properties contains "com.liferay.portal.upload.LiferayFileItem.threshold.size=262144". You can control the limitation of content size by increasing this value to a higher number.
I solve this problem adding after this in ckeditor.jsp
//after var ckEditor = CKEDITOR.instances.CKEditor1; add this
if (parent.<%= HtmlUtil.escape(initMethod) %>)
{ textArea.value = parent.<%= HtmlUtil.escape(initMethod) %>(); ckEditor.setData(parent.<%= HtmlUtil.escape(initMethod) %>()); } else {
var waitParentIntervalId =
setInterval(
function() {
if (parent.<%= HtmlUtil.escape(initMethod) %>)
},
300
);
}
Hi, I am on 6.0.6 and still seeing these issues.
add some web content:-
Sometimes the content frame with the editor does not load.
or
in control panel. Edit some web content, type something in, refresh the page and most of the time the content frame does not load.
I have tested this with both Chrome and Internet explorer.
or is the info at the top of this jira page wrong and this was not fixed in 6.0.6 ?
Dev friends,
I´ve tested the code solution by Dmitry Kudinov, and it´s work fine, without errors, in IE8 under Windows XP/7.
Jorge are you testing with 6.0.6? because there are 3 of us saying that we can reproduce this error.
The error that is reported in both IE8 and chrome is 'length' is null or not an object at line 77 of ckeditor.js
I am confused, Jorge are you acknowledging that 6.0.6 is broken and that it works after you apply a fix from Dmitry?
because I still get this error in IE8.

LPS-5703