SCEditor icon indicating copy to clipboard operation
SCEditor copied to clipboard

Load theme file "default.min.css" only once and not for each SCEditor instance?

Open q2apro opened this issue 6 years ago • 4 comments

For each instance of SCEditor I am adding the options for the theme with default.min.css.

So when there are 3 instances with:

sceditor.create(textarea_content, {
   plugins: 'dragdrop,plaintext,autosave,undo',
   dragdrop: dragdropOptions,
   format: 'xhtml',
   style: '../minified/themes/content/default.min.css',
   locale: 'de',
   icons: 'monocons',
  // ...

SCeditor loads 3 times the default.min.css file.

How can we have it load only once (for performance)? (Actually i thought Chrome is caching the file load, but that does not seem to be the case.)

q2apro avatar Jul 05 '19 13:07 q2apro

I don't think that can be done because that style is loaded inside the iframe SCE is working in. Each editor instance has a different iframe for the WYSIWYG mode. So.... I don't think such cache can be done without bringing high compexity and potential problems related to CORS.

brunoais avatar Jul 06 '19 13:07 brunoais

In best case the browser will do the caching. But I see different requests in the developer console.

q2apro avatar Nov 18 '19 08:11 q2apro

Which browser? Both firefox and chrome show in the console even if using the cached versions

brunoais avatar Nov 18 '19 18:11 brunoais

Chrome. But in the developer console, by default there is "Disable cache" on. Turning it off it is visible that Chrome does cache the files.

But the requests remain (it seems). Loading is though 1 ms.

q2apro avatar Apr 19 '20 13:04 q2apro