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
SilverStripe 4.1.x and Silverstripe-S3 module - TinyMCE WYSIWYG doesn't load on initial CMS Load #2177
Comments
The |
As a note, I turned off and removed the S3 module and still have the same issue. So not 100% sure it is caused by that module. When trying to determine the cause of this. My site is setup with the following -
When referencing silverstripe/silverstripe-framework#8228 it seems like it may be because we are both using webpack for our front end code, but can't say if that is the cause or not either. I am in the process of doing a clean install and changing each step to replicate my previous site to see where it breaks. |
I am having the same issue, I am using webpack for my web build too so think something is conflicting. |
Hi guys, And surprising it is happening only with one single page in CMS. For reference I am using below version of silver-stripe and other modules
Any help on this is much appreciated. |
Also experiencing similar issue. However, I am using the S3 module, and not using Webpack. The TinyMCE script is being loaded from S3. Just currently trying to work out why that is placed into assets when all other admin JS isn't |
No reply from SS mods or contributors? Seems odd to avoid this as various people are having this issue... |
It looks to be a timing thing. The script I can see why it is generated as it references the site domain to setup a Just wondering what can be done about that. Not totally sure if this fits in with everyone else's experience if not using the S3 module. |
When reloading, the requirements system places the call for the script into the page source, as you would expect, therefore I assume everything blocks until all the scripts have loaded, and everything works. Navigating within the CMS, when you move to an area that requires the TinyMCE editor, the JavaScript requirements are pulled in via Ajax and an Is there any way of forcing the request for the TinyMCE script earlier, or delaying the editor from trying to initialise for a bit longer? |
Is there a way to configure the Requirements system to place the TinyMCE generated file to a local folder? There is some information on requirements about changing where combined assets are placed, but so far not making any headway with that. |
@JPMCC The behaviour of |
No idea. I can see the file contents are loaded by the browser, but obviously too late to prevent the I was just wondering if there was a way to override the tinymce file being placed in assets, but elsewhere - by using the method outlined int he requirements documentation. I know that kind of defeats the purpose of having assets somewhere like S3, but just clutching at straws at the moment. |
You might be able to override the asset handler for TinyMCE generated files. Totally untested code below, but it might provide a starting point: SilverStripe\Core\Injector\Injector:
League\Flysystem\Filesystem.localpublic:
class: League\Flysystem\Filesystem
constructor:
FilesystemAdapter: '%$SilverStripe\Assets\Flysystem\PublicAssetAdapter'
FilesystemConfig:
visibility: public
LocalGeneratedAssetHandler:
class: SilverStripe\Assets\Flysystem\GeneratedAssets
properties:
Filesystem: '%$League\Flysystem\Filesystem.localpublic'
SilverStripe\Forms\HTMLEditor\TinyMCECombinedGenerator:
properties:
AssetHandler: '%$LocalGeneratedAssetHandler' |
Thanks Loz, I think I was going down the same path based on the docs, but I think I'm still missing something. The |
Not sure the configuration is even being picked up :-(. Created a Therefore I'm assuming I am missing something pretty fundamental. All my other |
Maybe you need a YAML header to ensure it’s loaded last ---
After:
- '#corehtml'
---
SilverStripe\Core\Injector\Injector:
League\Flysystem\Filesystem.localpublic:
# ... |
yup, using
I'll try |
No luck. Really appreciate the help :). I may have to come back to this later. |
The following does seem to work in my testing - ---
After:
- '#corehtml'
---
SilverStripe\Core\Injector\Injector:
League\Flysystem\Filesystem.localpublic:
class: 'League\Flysystem\Filesystem'
constructor:
FilesystemAdapter: '%$App\TestAssetAdapter'
FilesystemConfig:
visibility: public
LocalGeneratedAssetHandler:
class: 'SilverStripe\Assets\Flysystem\GeneratedAssets'
properties:
Filesystem: '%$League\Flysystem\Filesystem.localpublic'
SilverStripe\Forms\HTMLEditor\TinyMCECombinedGenerator:
properties:
AssetHandler: '%$LocalGeneratedAssetHandler' namespace App;
use SilverStripe\Assets\Flysystem\PublicAssetAdapter;
class TestAssetAdapter extends PublicAssetAdapter
{
} Probably best at this point to hop on the forums or Slack to save adding any more to this issue 😄 |
@JPMCC has confirmed that the above will allow the TinyMCE JS to be written to the local filesystem rather than S3, which offers a workaround for the issue for now. As this definitely occurs with the S3 module installed, I’m going to move this issue to that repo. Even if it requires a fix in framework, it’s best to track the issue there as that module seems to be the only definite cause. For those experiencing this issue without S3 installed (@spark-green, @anishpixel?) I’m going to re-open silverstripe/silverstripe-framework#8228 as there’s less S3-related noise there. If you’re still experiencing this issue, please paste the output of |
This issue was moved to silverstripe/silverstripe-s3#18 |
I found this issue when having the same error. in my case it's not linked to s3 silverstripe/silverstripe-admin#996 so if it helps anyone ;-) |
Currently testing using v4.1.x and dev/master of silverstripe-s3.
I wasn't sure where the best place to log this issue but assuming it will probably need to be moved to a fix in silverstripe/framework as it is an issue with the HTMLEditorField, or possibly needs to go to the silverstripe-s3 repo.
Steps to reproduce
Create a clean install of SS4.x using the composer command -
Configure the site as normal and require silverstripe-s3
Complete configuration of S3
Go to your site/admin and login
Edit the Home Page- I get the following JS error -
Screen shot -
I notice though that in my network console it is trying to load the tinymce script from the amazon public directory, not the local server address - example :
vs
/assets/tinymce/tinymce-cms-92563982d3.js?=1527628916905
Since this is loading the tinymce script file from S3 not sure if that is the cause of a race condition, cross domain origin issue or ?
If I refresh the page in the browser (eg /admin/pages/edit/show/1), the CMS loads normally and the WYSIWYG loads normally. If I go to a different section of the CMS besides pages though such as say 'Settings' and then back to pages I get the same issue until I reload the site.
Is this possibly an issue as the file is being generated into the /public/assets directory instead of the /public/resources directory? If there is a way to exclude this file from loading on S3 or a way to change the write path for the tinymce js I can test this some more to try and confirm what exactly is causing the issue.
The text was updated successfully, but these errors were encountered: