From bd50facd4b6c3a25d4cb12ca67d80cbcf204435d Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Thu, 23 Nov 2023 21:25:34 +0100 Subject: [PATCH] Preload tinymce assets Tinymce loads the editor content css and its plugins on initialize. Since we init tinymce only when its visible it takes long to init the editor. Using browser preload features to make sure the assets are already loaded. --- .../alchemy/admin/tinymce/_setup.html.erb | 11 ++++ lib/alchemy/tinymce.rb | 8 ++- spec/features/admin/tinymce_feature_spec.rb | 52 +++++++++++++++++++ spec/libraries/tinymce_spec.rb | 12 +++++ 4 files changed, 82 insertions(+), 1 deletion(-) diff --git a/app/views/alchemy/admin/tinymce/_setup.html.erb b/app/views/alchemy/admin/tinymce/_setup.html.erb index f56fa5cb6e..d3a387f431 100644 --- a/app/views/alchemy/admin/tinymce/_setup.html.erb +++ b/app/views/alchemy/admin/tinymce/_setup.html.erb @@ -1,3 +1,14 @@ +<% asset_host = ActionController::Base.config.asset_host %> + + + +<% if Alchemy::Tinymce.init[:content_css] %> + +<% end %> +<% Alchemy::Tinymce.preloadable_plugins.each do |plugin| %> + +<% end %> +