Module: Tinymce::Hammer::Combiner

Defined in:
lib/tinymce/hammer/combiner.rb

Constant Summary collapse

REQUIRED =
true
OPTIONAL =
false
MARK_DONE =
true

Class Method Summary collapse

Class Method Details

.combined_jsObject

Combines the following files into a single .js file, and caches that file to disk (when action_controller.perform_caching == true).

  • tiny_mce.js (the main library)

  • each requested language file (like en.js)

  • each requested theme’s editor_template.js

  • each requested theme’s language files

  • each requested plugin’s editor_plugin.js

  • each requested plugin’s language files

On-top of combining .js files support js is added to the top and end of this file to alert tiny_mce that these files have been loaded into the dom and no XMLHttpRequests are required to load these dynamically.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/tinymce/hammer/combiner.rb', line 20

def self.combined_js

  init_content

  suffix = Tinymce::Hammer.src ? '_src' : ''

  # add the tiny mce library
  add_content("tiny_mce#{suffix}.js", REQUIRED)

  # add languages
  Tinymce::Hammer.languages.each do |lang|
    add_content("langs/#{lang}.js", REQUIRED, MARK_DONE)
  end

  # add themes (and their languages)
  Tinymce::Hammer.themes.each do |theme|
    add_content("themes/#{theme}/editor_template#{suffix}.js", REQUIRED, MARK_DONE)
    Tinymce::Hammer.languages.each do |lang|
      add_content("themes/#{theme}/langs/#{lang}.js", OPTIONAL, MARK_DONE)
    end
  end

  # add plugins (and their languages)
  Tinymce::Hammer.plugins.each do |plugin|
    add_content("plugins/#{plugin}/editor_plugin#{suffix}.js" , OPTIONAL, MARK_DONE)
    Tinymce::Hammer.languages.each do |lang|
      add_content("plugins/#{plugin}/langs/#{lang}.js", OPTIONAL, MARK_DONE)
    end
  end

  @content + @events.join("\n")

end