Skip to content

Commit

Permalink
Bundle alchemy_link plugin into tinymce bundle
Browse files Browse the repository at this point in the history
Reduces HTTP requests and one less JS to compile
with Sprockets.

(cherry picked from commit bab9a27)

# Conflicts:
#	vendor/javascript/tinymce.min.js
  • Loading branch information
tvdeyen committed Jan 3, 2025
1 parent 8bcb861 commit 2147751
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 6 deletions.
2 changes: 0 additions & 2 deletions app/assets/config/alchemy_manifest.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//= link alchemy/admin/all.js
//= link alchemy/preview.js
//= link tinymce/plugins/alchemy_link/plugin.min.js
//= link tinymce/icons/remixicons/icons.js
//= link_tree ../builds/alchemy/
//= link_tree ../builds/tinymce/
//= link_tree ../images/alchemy/
Expand Down
2 changes: 2 additions & 0 deletions bundles/tinymce.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import tinymce from "tinymce"

/* Default icons are required. After that, import custom icons if applicable */
import "tinymce/icons/default"
import "tinymce/icons/remixicons"

/* Required TinyMCE components */
import "tinymce/themes/silver"
Expand All @@ -16,5 +17,6 @@ import "tinymce/plugins/directionality"
import "tinymce/plugins/fullscreen"
import "tinymce/plugins/link"
import "tinymce/plugins/lists"
import "tinymce/plugins/alchemy_link"

export default tinymce
3 changes: 2 additions & 1 deletion lib/alchemy/tinymce.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Tinymce
mattr_accessor :languages, :plugins

DEFAULT_PLUGINS = %w[
alchemy_link
anchor
charmap
code
Expand All @@ -14,7 +15,7 @@ module Tinymce
lists
]

@@plugins = DEFAULT_PLUGINS + %w[alchemy_link]
@@plugins = DEFAULT_PLUGINS
@@init = {
skin: "alchemy",
content_css: "/assets/tinymce/skins/content/alchemy/content.min.css",
Expand Down
8 changes: 7 additions & 1 deletion rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ export default [
name: "tinymce",
format: "esm"
},
plugins: [resolve(), commonjs(), terser()]
plugins: [
resolve({
modulePaths: ["app/javascript"]
}),
commonjs(),
terser()
]
}
]
1 change: 0 additions & 1 deletion spec/libraries/tinymce_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module Alchemy

it "returns all plugins without default plugins" do
is_expected.to eq %w[
alchemy_link
foo
]
end
Expand Down
2 changes: 1 addition & 1 deletion vendor/javascript/tinymce.min.js

Large diffs are not rendered by default.

0 comments on commit 2147751

Please sign in to comment.