AlchemyCMS/alchemy_cms

View on GitHub
app/views/alchemy/admin/tinymce/_setup.html.erb

Summary

Maintainability
Test Coverage
<% asset_host = ActionController::Base.config.asset_host %>

<link rel="preload" href="<%= asset_host %><%= assets_prefix %>/tinymce/skins/ui/alchemy/skin.min.css" as="style" />
<% if Alchemy::Tinymce.init[:content_css] %>
  <link rel="preload" href="<%= asset_host %><%= Alchemy::Tinymce.init[:content_css] %>" as="style" />
<% end %>
<% Alchemy::Tinymce.preloadable_plugins.each do |plugin| %>
  <link rel="preload" href="<%= asset_host %><%= assets_prefix %>/tinymce/plugins/<%= plugin %>/plugin.min.js" as="script">
<% end %>

<script>
  // Setting TinyMCE path.
  var tinyMCEPreInit = {
    <% if ActionController::Base.config.asset_host_set? %>
    base: '<%= asset_url(assets_prefix + '/tinymce') %>',
    <% else %>
    base: '<%= asset_path(assets_prefix + '/tinymce') %>',
    <% end %>
    suffix: '.min'
  };
  // Holds the default Alchemy TinyMCE configuration
  Alchemy.TinymceDefaults = {
    plugins: '<%= Alchemy::Tinymce.plugins.join(',') %>',
    <% Alchemy::Tinymce.init.each do |k, v| %>
    <%= k %>: <%== v.to_json %>,
    <% end %>
  };
</script>