samclarke / SCEditor

A lightweight HTML and BBCode WYSIWYG editor
http://www.sceditor.com/
Other
657 stars 187 forks source link

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

Open q2apro opened 5 years ago

q2apro commented 5 years ago

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.)

brunoais commented 5 years ago

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.

q2apro commented 4 years ago

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

brunoais commented 4 years ago

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

q2apro commented 4 years ago

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.