When some specific user is editing a WYSIWYG, he gets error in a console. The WYSIWYG also doesn’t appear.
Here is the error:
Uncaught TypeError: Cannot read property 'type' of undefined
at Object.render (_all.js:22640)
at Object.renderUI (_all.js:25423)
at Object.renderUI (_all.js:26242)
at Vb (_all.js:21319)
at Hb (_all.js:21319)
at mC.<anonymous> (_all.js:21319)
at Array.<anonymous> (_all.js:21319)
at St (_all.js:21319)
at s (_all.js:21319)
at r (_all.js:21319)
render @ _all.js:22640
renderUI @ _all.js:25423
renderUI @ _all.js:26242
Vb @ _all.js:21319
Hb @ _all.js:21319
(anonymous) @ _all.js:21319
(anonymous) @ _all.js:21319
St @ _all.js:21319
s @ _all.js:21319
r @ _all.js:21319
d @ _all.js:21319
load (async)
(anonymous) @ _all.js:21319
St @ _all.js:21319
s @ _all.js:21319
loadScripts @ _all.js:21319
loadQueue @ _all.js:21319
(anonymous) @ _all.js:21319
waitFor @ _all.js:21319
(anonymous) @ _all.js:21319
(anonymous) @ _all.js:21319
St @ _all.js:21319
s @ _all.js:21319
loadScripts @ _all.js:21319
loadQueue @ _all.js:21319
(anonymous) @ _all.js:21319
Wb @ _all.js:21319
Kb @ _all.js:21319
render @ _all.js:21319
l @ _all.js:21319
(anonymous) @ _all.js:21319
St @ _all.js:21319
u @ _all.js:21319
i.bind @ _all.js:21319
bind @ _all.js:21319
init @ _all.js:21319
HTMLAreaBuilder.createEditor @ _all.js:1
HtmlArea.initEditor @ _all.js:1
(anonymous) @ _all.js:1
(anonymous) @ _all.js:1
Element.notifyRendered @ _all.js:1
(anonymous) @ _all.js:1
_fulfilled @ _all.js:20191
(anonymous) @ _all.js:20220
Promise.promise.promiseDispatch @ _all.js:20153
(anonymous) @ _all.js:19913
flush @ _all.js:19512
This user does not have administrator rights and rights to edit a lot of other content. Administrator users can edit this WYSIWYG with no troubles. The WYSIWYG does not contain any specific data, just <p> and <em> tags and a text inside of them.
This is very strange - based on the stack trace the error comes from the old editor. Can you describe a bit more what kind of permissions that user has? Which roles are applied to him? Does the error happen only for that user or all users with the same role?
This user has only two roles: Content Manager App and Administration Console Login. This user also has full access to an object, which he tries to modify.
If this can help somehow, the id of the body of the editor says it is “tinymce”.
This article was created about a year ago(2017-11-29) and we were running Enonic 6.12.x or 6.11.x when it was created. User, which tries to modify the article is an old one.
Also, this WYSIWYG is not a part or text component, it is an attribute of an object.
I have just tried with another user and I got the same error.
As I mentioned before, admin user has no issues with this and can edit this WYSIWYG.
Some of our customers misinterpreted our upgrade notes for 6.15 and thought they HAD to add the line to the config that switches to TinyMCE, but it should in fact be done only if you have issues with the new editor.
Anyway, can you check if you have a file called com.enonic.xp.app.contentstudio.cfg in the config folder of your XP installation and if you have this line there: htmlarea = tinymce? If you do, then comment this line and reload the page with the editor. This should switch to the new editor.
Is there a possibility, that the attribute of the object is still using an old editor? By attribute I mean the HTML area, which is declared in xml file of the content type?
These two screenshots were taken while editing the same object on the same instance. The difference is that the file new.png is the editor from a part and old.png is an attribute of a content-type.
And I assume when you log in as administrator you get the same behaviour (old editor in the Wizard, new in the Page Editor), but without console errors?
Btw, correct input type is “HtmlArea”, not “HTMLArea”. This doesn’t really explain the problem as it’s most likely case-insensitive but you might want to try changing it to “HtmlArea” to see if that makes any difference.
Overall, this is very strange. Any change of getting temporary access to your admin? If it’s ok, send me a private mail/message with credentials and I’ll look at it.
I double-checked and I’m almost certain that the reason is the incorrect input type (HTMLArea vs HtmlArea). We have a check in the code to support both editors: if input type equals “HtmlArea” and no special setting in the config - use the new editor, otherwise use the old one. Since “HTMLArea” doesn’t pass this check, it falls back to the old editor. We obviously should’ve made the check case-insensitive but oh well.
Changing “HTMLArea” to “HtmlArea” in the content type should do the trick.