-
-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Will this library support TinyMCE 6, and if so, is there an expected release date. #426
Comments
It will support TinyMCE 6 when someone writes the missing bits 😄 Did you test with the latest 3.5 release or with the code in master? |
Does permission need to be given to bundle the new version? Given the new licence, I would assume not? I tried replacing with the latest version of tinyMCE with the latest code in the repo and it appears to work out of the box as best as I can tell. I had to tweak a test, to get tox to pass, I only tested against 39 and 310. Some of the language pack names have changed, so that was causing it to fail. |
Oh, would be great to document the license issue. If it happens we are stuck on TinyMCE 5, we may then deprecate this package and recommend an alternative (or several). |
We upgraded our site’s import to django-tinymce==3.5.0
As noted in my report, the strange thing for us is that the TinyMCE 6 widget renders when we run our Django site locally, but not when we deploy it to our production Linode/Ubuntu server.
When we run it on the server, we receive this error in a browser console:
init_tinymce.js:39 Uncaught TypeError: Cannot read properties of undefined (reading 'id_body')
at initTinyMCE (init_tinymce.js:39:27)
at init_tinymce.js:59:7
at NodeList.forEach (<anonymous>)
at HTMLDocument.<anonymous> (init_tinymce.js:58:43)
This code is within the page’s html, so there an id_body element:
<div class="form-row field-body">
<div>
<label class="required" for="id_body">Body:</label>
<textarea class="tinymce" cols="40" data-mce-conf="{"theme": "silver", "selector": "textarea.tinymce", "file_picker_callback": "djangoBrowser", "width": 1000, "height": 400, "plugins": ["advlist", "anchor", "charmap", "code", "fullscreen", "hr", "image", "imagetools", "importcss", "link", "lists", "nonbreaking", "powerpaste", "print", "searchreplace", "table", "visualchars", "wordcount"], "menubar": ["file", "edit", "insert", "view", "format", "table", "tools"], "toolbar": ["undo redo| bold italic | alignleft aligncenter alignright alignjustify | link anchor image code | print fullscreen", "cut copy paste pastetext | searchreplace | numlist bullist | outdent indent blockquote | hr charmap | visualchars nonbreaking"], "imagetools_toolbar": "rotateleft rotateright | flipv fliph | editimage imageoptions", "extended_valid_elements": "iframe[src|width|height|name|align|frameBorder],script[language|type|src],object[*],param[name|value]", "image_caption": false, "image_advtab": true, "powerpaste_allow_local_images": true, "powerpaste_word_import": "prompt", "powerpaste_html_import": "prompt", "relative_urls": false, "branding": false, "language": "en", "spellchecker_languages": "Afrikaans=af,Arabic / Algerian Arabic=ar,Asturian=as,Azerbaijani=az,Bulgarian=bg,Belarusian=be,Bengali=bn,Breton=br,Bosnian=bs,Catalan=ca,Czech=cs,Welsh=cy,Danish=da,German=de,Lower Sorbian=ds,Greek=el,+English / Australian English / British English=en,Esperanto=eo,Spanish / Argentinian Spanish / Colombian Spanish / Mexican Spanish / Nicaraguan Spanish / Venezuelan Spanish=es,Estonian=et,Basque=eu,Persian=fa,Finnish=fi,French=fr,Frisian=fy,Irish=ga,Scottish Gaelic=gd,Galician=gl,Hebrew=he,Hindi=hi,Croatian=hr,Upper Sorbian=hs,Hungarian=hu,Armenian=hy,Interlingua=ia,Indonesian=id,Igbo=ig,Ido=io,Icelandic=is,Italian=it,Japanese=ja,Georgian / Kabyle=ka,Kazakh=kk,Khmer=km,Kannada=kn,Korean=ko,Kyrgyz=ky,Luxembourgish=lb,Lithuanian=lt,Latvian=lv,Macedonian=mk,Malayalam=ml,Mongolian=mn,Marathi=mr,Burmese=my,Norwegian Bokm\u00e5l=nb,Nepali=ne,Dutch=nl,Norwegian Nynorsk=nn,Ossetic=os,Punjabi=pa,Polish=pl,Portuguese / Brazilian Portuguese=pt,Romanian=ro,Russian=ru,Slovak=sk,Slovenian=sl,Albanian=sq,Serbian / Serbian Latin=sr,Swedish=sv,Swahili=sw,Tamil=ta,Telugu=te,Tajik=tg,Thai=th,Turkmen=tk,Turkish=tr,Tatar=tt,Udmurt=ud,Ukrainian=uk,Urdu=ur,Uzbek=uz,Vietnamese=vi,Simplified Chinese / Traditional Chinese=zh", "directionality": "ltr", "mode": "exact", "strict_loading_mode": 1, "elements": "id_body"}" id="id_body" name="body" rows="10">
... Because the embedded video is intended for our internal Accounting personnel rather than for the public, I’m removing the textarea content ...
</textarea>
</div>
</div>
From: Claude Paroz ***@***.***>
Reply-To: jazzband/django-tinymce ***@***.***>
Date: Tuesday, March 14, 2023 at 1:21 PM
To: jazzband/django-tinymce ***@***.***>
Cc: Jim Phares ***@***.***>, Author ***@***.***>
Subject: Re: [jazzband/django-tinymce] Will this library support TinyMCE 6, and if so, is there an expected release date. (Issue #426)
You don't often get email from ***@***.*** Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
It will support TinyMCE 6 when someone writes the missing bits 😄
Did you test with the latest 3.5 release or with the code in master?
—
Reply to this email directly, view it on GitHub<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjazzband%2Fdjango-tinymce%2Fissues%2F426%23issuecomment-1468516789&data=05%7C01%7Cjim.phares%40pcusa.org%7C9564c6b4bae1466a83f108db24b0925d%7C99082a1a70af459fa6ac8ad01476a157%7C0%7C0%7C638144113037023072%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oMxub52hTvwozq4m22vS309WyNZPp0x5rZPDa%2B9Y6l8%3D&reserved=0>, or unsubscribe<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAACVSEFXSWIAIY6PJRU4GQLW4CSKFANCNFSM6AAAAAAV2UDAEQ&data=05%7C01%7Cjim.phares%40pcusa.org%7C9564c6b4bae1466a83f108db24b0925d%7C99082a1a70af459fa6ac8ad01476a157%7C0%7C0%7C638144113037023072%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=pJ2la1yriSvl13Ru9rhPM1Y5wPr8uNxQYL8BFFOWDYw%3D&reserved=0>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I’m sorry for not responding to yesterday’s email earlier; I didn’t see it until I saw this one.
I’m unsure what you’re asking here, but is your bundle question about using a self-hosted TinyMCE implementation?
If it is, that isn’t what we’re doing. We’re using the Tiny Cloud subscription implementation because we wanted premium features, most importantly spell checking.
From: Ryan Sevelj ***@***.***>
Reply-To: jazzband/django-tinymce ***@***.***>
Date: Wednesday, March 15, 2023 at 12:03 PM
To: jazzband/django-tinymce ***@***.***>
Cc: Jim Phares ***@***.***>, Author ***@***.***>
Subject: Re: [jazzband/django-tinymce] Will this library support TinyMCE 6, and if so, is there an expected release date. (Issue #426)
You don't often get email from ***@***.*** Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
Does permission need to be given to bundle the new version? Given the new licence, I would assume not?
I tried replacing with the latest version of tinyMCE with the latest code in the repo and it appears to work out of the box as best as I can tell. I had to tweak a test, to get tox to pass, I only tested against 39 and 310.
—
Reply to this email directly, view it on GitHub<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjazzband%2Fdjango-tinymce%2Fissues%2F426%23issuecomment-1470313451&data=05%7C01%7Cjim.phares%40pcusa.org%7Ce7a662fc773040dddf4d08db256ed006%7C99082a1a70af459fa6ac8ad01476a157%7C0%7C0%7C638144930093537562%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=oRfmJR7jF2ESMj54bdbqk2NoT59DoTW6ooErDMw6L9o%3D&reserved=0>, or unsubscribe<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAACVSECKGUPIY3ZD5MZIZNTW4HR45ANCNFSM6AAAAAAV2UDAEQ&data=05%7C01%7Cjim.phares%40pcusa.org%7Ce7a662fc773040dddf4d08db256ed006%7C99082a1a70af459fa6ac8ad01476a157%7C0%7C0%7C638144930093537562%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=q9e9%2BZwharOleiBUGvfEXXZQAatbmZAHodDCkOFiha0%3D&reserved=0>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
@pcusa-jim the code in master has changes that are not in the latest release on pip. Off the top of my head, the two files with changes that got it working for me were the widgets.py and init_tinymce.js. See #417 I am not sure if that will solve your problem, but it is what got version 6 working at my end. @claudep the new licence is MIT, so I don't think there will be a problem. |
Just some additional information for this, the way that images_upload_handler works is different. See: https://www.tiny.cloud/docs/tinymce/6/image/#images_upload_handler In the new example code, example_image_upload_handler is declared as a const, so is not a property of the window object. See for more info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const#description I am fairly new to coding and have virtually no JS experience, so I do no know how to rewrite this to make it work. I have played around with putting the example code into init_tinymce.js and modifying to suit, which works, but isn't easily user changeable, so not a good solution. I have spent all day trying to find a nice solution, but it is beyond my skill levels currently. |
https://www.tiny.cloud/docs/tinymce/6/migration-from-5x/ https://www.tiny.cloud/blog/upgrade-to-tinymce-6/
In this example, we're setting the tinymce_version option to '6' to indicate that we're using TinyMCE 6. We're also updating the external_plugins option to use the new plugin file for the Wiris Math and Chemistry plugins, and updating the toolbar option to use the new toolbar button names and ordering. Note that depending on your specific use case, you may need to make additional changes to your TinyMCE configuration to fully support TinyMCE 6. Download the latest version of TinyMCE 6 from the TinyMCE website (https://www.tiny.cloud/get-tiny/self-hosted/). Extract the contents of the downloaded package and update the relevant paths in your Django project. In your Django settings file, update the TINYMCE_JS_URL setting to point to the new tinymce.min.js file:
(OPTIONAL) If you were using the mobile theme in your previous setup, make sure to copy the mobile folder from the previous TinyMCE version to the new TinyMCE 6 folder. (OPTIONAL) If you were using plugins in your previous setup (e.g. django-tinymce-filebrowser), you may need to update The additional changes needed to fully support TinyMCE 6 in Django-tinymce will depend on your specific use case and the features you're using. Here are a few examples:
Overall, the key to fully supporting TinyMCE 6 in Django-tinymce is to carefully review the TinyMCE 6 documentation and update your configuration and code as needed to match the new features and changes in the latest version. |
Unfortunate, I wish the folks at TinyMCE would take on this project officially. This integration is nice but I can't justify starting a project using it. I just integrated the zip, and wrote LESS code than with this package. Unlike the tinymce-react integration, the layer of abstraction this integration provides actually makes things harder. This project is not in state where it can be recommended for any project. |
That’s not entirely fair; the custom model field makes it very easy to get a rich text editor for specific fields, without needing to define custom form or formfield_overrides everywhere. |
@rsevs3 Can you share with us all the steps and where in the code you made changes so far? One of us here might be able to help you. We need to somehow modify the following line in init_tinymce.js to fix this issue's original error:
Replace it with:
Just so you all know... ckeditor and tinymce are owned by the same company now. |
What do you mean by this? TinyMCE before version 6 uses LGPL-2.1, although it is not really clear whether this means django-tinymce/tinymce/static/tinymce/jquery.tinymce.min.js Lines 2 to 5 in 7756186
|
Thanks for this clarification. Now looks like all is left is someone biting the bullet and suggest a patch with the latest TinyMCE 6 code. |
PR #457 implements the migration to TinyMCE 6. Any test/review would be greatly appreciated! |
Seems to be working great as far as I can see. Great work! |
Thanks for checking ❤️ |
Fixed by f04e1c8 |
So we are waiting for a new release that uses tiny mce 6? |
Yes, that's it. I hope that we may get some feedback from people using the master branch. |
I'm sorry if this isn't the proper venue to ask a question like this, but we recently noted that TinyMCE 5x reaches End of Support on 4/2023 ( https://www.tiny.cloud/blog/tinymce-end-of-support/ ).
We tried configuring django-tinymce with TinyMce 6 to upgrade one of our sites, and it worked locally, but not on our server, where we receive the following JavaScript error:
Uncaught TypeError: Cannot read properties of undefined (reading 'id_body')
at initTinyMCE (init_tinymce.js:39:27)
at init_tinymce.js:59:7
at NodeList.forEach ()
at HTMLDocument. (init_tinymce.js:58:43)
There is an textarea#id_body in the admin page and, as noted, it renders as a TinyMce widget locally, but not when deployed as on a server. I suspect that the javascript is loading before the HTML, but I don't know how to resolve that. Any assistance that you can provide is appreciated.
The text was updated successfully, but these errors were encountered: