I see that the mimeType selector just beneath the <textarea> has pattern: plaintexteditor for anonymous users, while authenticated users have tinymce as the pattern.
you'll need to use the pattern assuming you're using z3c.form or something that adds pat-tinymce to to element: add_resource_on_request(request, 'mockup-patterns-tinymce').
tinymce is only the tinymce module--it won't bootstrap anything. mockup-patterns-tinymce will load the pattern so nodes with the class pat-tinymce will get initialized.
However, since this is an anonymous user, you might want control over how tinymce is initialized for them so you could go back to just including the tinymce files and do something like this.
I've been trying various combinations of requires and add_resource_on_request, but still have not been able to get the editor to load. The main errors I've been running in to are:
not well-formed JS errors on files like ++resource++mockup/tinymce/templates/link.xml, also happens with results.xml, selecttion.xml, image.xml, upload.xml, and preview.xml. This happens with only the following code in the JS:
Another JS error I tend to see is if I try to use add_resource_on_request(request, 'mockup-patterns-tinymce'), then default.js throws Mismatched anonymous define() module
So I don't know if there are any resources I should be loading that I'm missing. This is on Plone 5.0.5.
There was a small bug in the example I gave you because I didn't try it myself; however, that is fixed now and I just tested it with a fresh site and it works.
There was no actual element with the selector of ".pat-tinymce" so that's why it didn't do anything. You need to look at what you're trying to apply tinymce to.
It is actually using the textareamimetypeselector pattern. i'm not sure you want that for anon. I'm not very familiar with the details of the pattern. I think this is a bit complicated in how it integrates with z3c form and the pattern.
Should probably be more careful so you don't use that code for anon and make sure you're not re-initializing for logged in users.
It is actually using the textareamimetypeselector pattern. i'm not
sure you want that for anon. I'm not very familiar with the details of
the pattern. I think this is a bit complicated in how it integrates with
z3c form and the pattern.
OK, I'm looking over the rich text widget. All the docs I've found use plone.app.textfield.RichText, which is what is using the textareamimetypeselector. pattern. I switched the fields to use plone.app.z3cform.wysiwyg.WysiwygFieldWidget, which works with the JS you had originally suggested, but there is a deprecation warning that it will be removed in Plone 5.1.