SRFA Posted May 5, 2019 Posted May 5, 2019 Hi, I am trying to use a piece of javascript to insert dynamically a button in the CKEditor toolbar. (Based on the Chevereto popup upload plugin.) After adding the html code in the global template before the </head> and refreshing all caches, when I go back to the front site, the button does appear at the first loading of the editor. However, it is not added on any other page loaded after that (at least for some time. Long inactivity acts as a kind of reset.) This made me suspect some cache issues. I did a couple of trials : the place of the script (before </head> or before </body>), the place of the includeJS as well (I noticed it changed in a recent version), and the browser/device, seem to make the behaviour kind of fluctuate. But as my trials may interfere with different levels of cache, it is pretty difficult to diagnose. All in all, I never managed to have the button stay. My guess is that some caching of CKEditor (possibly browser caching) prevents my script to "intercept" the editor toolbar, the editor being served from a cache instead of my site. I tried to play around with the cache buster key thing without success. I did all the basic sanity checks (turning off all other customizations & so) but it does not solve the issue. Only complete cache refresh +/- patience brings it back. I also investigated other solutions based on CKE plugins / custom buttons from the ACP, but these do not fit my needs. So, my questions are: 1) How can I totally prevent browser caching of the CKEditor, and not only on IPS-managed cachebust key refresh -- at least in order to test my hypothesis? 2) If it solves the problem: are there other workarounds, to avoid the loss of performance induced by never caching the CKEditor? 3) If not, are there other known causes for this problem and can they be circumvented? Many thanks for your help!
bfarber Posted May 6, 2019 Posted May 6, 2019 1) Your best bet is to open your browser developer tools, and on the network tab check "Disable cache" (in Chrome, at least), and then navigate your site for a bit. This will effectively tell the browser not to use any caches, which should allow you to test your theory. 2) I would strongly recommend simply creating a proper ckeditor plugin instead of trying to take the approach you're taking. 3) CKEditor caches tend to be fairly aggressive in my experience, so if it is a cache issue and the issue returns after you clear caches, I'm not too sure. Again, I'd investigate making a proper ckeditor plugin.
SRFA Posted May 6, 2019 Author Posted May 6, 2019 Thanks for the Chrome console trick! It invalidates the browser cache hypothesis indeed. But anyway you are right, even if the quick-and-dirty route was seducing, a proper plugin will be safer.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.