tinymce-rails 4.6.7 → 4.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/source/tinymce/tinymce.js +29238 -42942
- data/lib/tinymce/rails/asset_installer.rb +9 -9
- data/lib/tinymce/rails/asset_installer/compile.rb +6 -6
- data/lib/tinymce/rails/asset_installer/copy.rb +8 -8
- data/lib/tinymce/rails/asset_manifest.rb +25 -25
- data/lib/tinymce/rails/configuration.rb +29 -15
- data/lib/tinymce/rails/configuration_file.rb +11 -11
- data/lib/tinymce/rails/version.rb +2 -2
- data/vendor/assets/javascripts/tinymce/jquery.tinymce.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/bbcode/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/colorpicker/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/contextmenu/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullpage/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/imagetools/plugin.js +2 -2
- data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/legacyoutput/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/noneditable/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/print/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/spellchecker/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
- data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/textcolor/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/textpattern/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/toc/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/skins/lightgray/content.inline.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/lightgray/content.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/lightgray/content.mobile.min.css +1 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/tinymce-mobile.woff +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/skin.min.css +1 -1
- data/vendor/assets/javascripts/tinymce/skins/lightgray/skin.mobile.min.css +2 -0
- data/vendor/assets/javascripts/tinymce/themes/inlite/theme.js +5 -1
- data/vendor/assets/javascripts/tinymce/themes/mobile/theme.js +8 -0
- data/vendor/assets/javascripts/tinymce/themes/modern/theme.js +5 -1
- data/vendor/assets/javascripts/tinymce/tinymce.js +13 -17
- metadata +6 -2
@@ -9,20 +9,20 @@ module TinyMCE
|
|
9
9
|
class AssetInstaller
|
10
10
|
attr_reader :assets, :target, :strategy
|
11
11
|
attr_accessor :logger
|
12
|
-
|
12
|
+
|
13
13
|
def initialize(assets, target, manifest_path)
|
14
14
|
@assets = assets
|
15
15
|
@target = target
|
16
16
|
@manifest_path = manifest_path || target
|
17
|
-
|
17
|
+
|
18
18
|
@logger = Logger.new($stderr)
|
19
19
|
@logger.level = Logger::INFO
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def install
|
23
23
|
(strategy || Copy).new(self).call
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def log_level
|
27
27
|
@logger.level
|
28
28
|
end
|
@@ -34,7 +34,7 @@ module TinyMCE
|
|
34
34
|
@logger.level = Logger.const_get(level.to_s.upcase)
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def strategy=(strategy)
|
39
39
|
if strategy.is_a?(Class)
|
40
40
|
@strategy = strategy
|
@@ -42,20 +42,20 @@ module TinyMCE
|
|
42
42
|
@strategy = self.class.const_get(strategy.to_s.classify)
|
43
43
|
end
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
def manifest
|
47
47
|
@manifest ||= AssetManifest.load(@manifest_path)
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
def logical_path(file)
|
51
51
|
file.relative_path_from(@assets.parent).to_s
|
52
52
|
end
|
53
|
-
|
53
|
+
|
54
54
|
def with_asset(src, dest)
|
55
55
|
if src != dest
|
56
56
|
src = File.join(@target, src)
|
57
57
|
dest = File.join(@target, dest)
|
58
|
-
|
58
|
+
|
59
59
|
yield src, dest if File.exists?(src)
|
60
60
|
end
|
61
61
|
end
|
@@ -3,15 +3,15 @@ module TinyMCE
|
|
3
3
|
class AssetInstaller
|
4
4
|
class Compile
|
5
5
|
delegate :target, :manifest, :logger, :logical_path, :with_asset, :to => :@installer
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(installer)
|
8
8
|
@installer = installer
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def call
|
12
12
|
symlink_assets
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
private
|
16
16
|
def symlink_assets
|
17
17
|
manifest.each(/^tinymce\//) do |asset|
|
@@ -20,17 +20,17 @@ module TinyMCE
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def symlink_asset(src, dest)
|
25
25
|
with_asset(src, dest) do |src, dest|
|
26
26
|
create_symlink(src, dest)
|
27
27
|
create_symlink("#{src}.gz", "#{dest}.gz") if File.exists?("#{src}.gz")
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def create_symlink(src, dest)
|
32
32
|
target = File.basename(src)
|
33
|
-
|
33
|
+
|
34
34
|
unless File.exists?(dest) && File.symlink?(dest) && File.readlink(dest) == target
|
35
35
|
logger.info "Creating symlink #{dest}"
|
36
36
|
FileUtils.ln_s(target, dest, :force => true)
|
@@ -3,19 +3,19 @@ module TinyMCE
|
|
3
3
|
class AssetInstaller
|
4
4
|
class Copy
|
5
5
|
delegate :assets, :target, :manifest, :logger, :logical_path, :with_asset, :to => :@installer
|
6
|
-
|
6
|
+
|
7
7
|
def initialize(installer)
|
8
8
|
@installer = installer
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def call
|
12
12
|
cleanup_assets
|
13
13
|
copy_assets
|
14
14
|
append_to_manifest
|
15
|
-
|
15
|
+
|
16
16
|
manifest.write
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
private
|
20
20
|
def cleanup_assets
|
21
21
|
manifest.each(/^tinymce\//) do |asset|
|
@@ -24,25 +24,25 @@ module TinyMCE
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def copy_assets
|
29
29
|
logger.info "Copying assets (preserving modes) to #{File.join(target, "tinymce")}"
|
30
30
|
FileUtils.cp_r(assets, target, :preserve => true)
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
def append_to_manifest
|
34
34
|
asset_files.each do |file|
|
35
35
|
manifest.append(logical_path(file), file)
|
36
36
|
end
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def move_asset(src, dest)
|
40
40
|
with_asset(src, dest) do |src, dest|
|
41
41
|
logger.info "Removing digest from #{src}"
|
42
42
|
FileUtils.mv(src, dest, :force => true)
|
43
43
|
end
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
def asset_files
|
47
47
|
Pathname.glob("#{assets}/**/*").select(&:file?)
|
48
48
|
end
|
@@ -9,7 +9,7 @@ module TinyMCE
|
|
9
9
|
YamlManifest.try(manifest_path) ||
|
10
10
|
NullManifest.new
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
def each(pattern)
|
14
14
|
assets.each_key do |asset|
|
15
15
|
if asset =~ pattern && !index_asset?(asset)
|
@@ -17,77 +17,77 @@ module TinyMCE
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def asset_path(logical_path)
|
22
22
|
if digested = assets[logical_path]
|
23
23
|
yield digested, logical_path if block_given?
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def to_s
|
28
28
|
dump
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
protected
|
32
32
|
def index_asset?(asset)
|
33
33
|
asset =~ /\/index[^\/]*\.\w+$/
|
34
34
|
end
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
class YamlManifest < AssetManifest
|
38
38
|
def self.try(manifest_path)
|
39
39
|
yaml_file = File.join(manifest_path, "manifest.yml")
|
40
40
|
new(yaml_file) if File.exists?(yaml_file)
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
def initialize(file)
|
44
44
|
@file = file
|
45
45
|
@manifest = YAML.load_file(file)
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
def append(logical_path, file)
|
49
49
|
assets[logical_path] = logical_path
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
def remove(logical_path)
|
53
53
|
assets.delete(logical_path)
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
def remove_digest(logical_path)
|
57
57
|
asset_path(logical_path) do |digested, logical_path|
|
58
58
|
assets[logical_path] = logical_path
|
59
|
-
|
59
|
+
|
60
60
|
yield digested, logical_path if block_given?
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
def assets
|
65
65
|
@manifest
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
def dump(io=nil)
|
69
69
|
YAML.dump(@manifest, io)
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
def write
|
73
73
|
File.open(@file, "wb") { |f| dump(f) }
|
74
74
|
end
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
class JsonManifest < AssetManifest
|
78
78
|
def self.try(manifest_path, pattern)
|
79
79
|
paths = Dir[File.join(manifest_path, pattern)]
|
80
80
|
new(paths.first) if paths.any?
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
def initialize(file)
|
84
84
|
@file = file
|
85
85
|
@manifest = JSON.parse(File.read(file))
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
def append(logical_path, file)
|
89
89
|
stat = File.stat(file)
|
90
|
-
|
90
|
+
|
91
91
|
assets[logical_path] = logical_path
|
92
92
|
files[logical_path] = {
|
93
93
|
"logical_path" => logical_path,
|
@@ -96,39 +96,39 @@ module TinyMCE
|
|
96
96
|
"digest" => nil
|
97
97
|
}
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
def remove(logical_path)
|
101
101
|
if digested = assets.delete(logical_path)
|
102
102
|
files.delete(digested)
|
103
103
|
end
|
104
104
|
end
|
105
|
-
|
105
|
+
|
106
106
|
def remove_digest(logical_path)
|
107
107
|
asset_path(logical_path) do |digested, logical_path|
|
108
108
|
assets[logical_path] = logical_path
|
109
109
|
files[logical_path] = files.delete(digested).tap { |f| f["digest"] = nil }
|
110
|
-
|
110
|
+
|
111
111
|
yield digested, logical_path if block_given?
|
112
112
|
end
|
113
113
|
end
|
114
|
-
|
114
|
+
|
115
115
|
def assets
|
116
116
|
@manifest["assets"]
|
117
117
|
end
|
118
|
-
|
118
|
+
|
119
119
|
def files
|
120
120
|
@manifest["files"]
|
121
121
|
end
|
122
|
-
|
122
|
+
|
123
123
|
def dump
|
124
124
|
JSON.generate(@manifest)
|
125
125
|
end
|
126
|
-
|
126
|
+
|
127
127
|
def write
|
128
128
|
File.open(@file, "wb") { |f| f.write(dump) }
|
129
129
|
end
|
130
130
|
end
|
131
|
-
|
131
|
+
|
132
132
|
class NullManifest < AssetManifest
|
133
133
|
def append(*); end
|
134
134
|
def remove(*); end
|
@@ -7,17 +7,17 @@ module TinyMCE::Rails
|
|
7
7
|
self
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def self.defaults
|
12
12
|
{
|
13
13
|
"selector" => "textarea.tinymce"
|
14
14
|
}
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
COMMA = ",".freeze
|
18
18
|
SPACE = " ".freeze
|
19
19
|
SEMICOLON = ";".freeze
|
20
|
-
|
20
|
+
|
21
21
|
OPTION_SEPARATORS = {
|
22
22
|
"plugins" => COMMA,
|
23
23
|
"custom_elements" => COMMA,
|
@@ -39,22 +39,32 @@ module TinyMCE::Rails
|
|
39
39
|
"paste_retain_style_properties" => SPACE,
|
40
40
|
"spellchecker_languages" => COMMA
|
41
41
|
}
|
42
|
-
|
42
|
+
|
43
|
+
OPTION_TRANSFORMERS = {
|
44
|
+
# Check for files provided in the content_css option to replace them with their actual path.
|
45
|
+
# If no corresponding stylesheet is found for a file, it will remain unchanged.
|
46
|
+
"content_css" => ->(value) {
|
47
|
+
value.split(OPTION_SEPARATORS["content_css"]).map do |file|
|
48
|
+
ActionController::Base.helpers.stylesheet_path(file.strip) || file
|
49
|
+
end.join(OPTION_SEPARATORS["content_css"])
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
43
53
|
attr_reader :options
|
44
|
-
|
54
|
+
|
45
55
|
def initialize(options)
|
46
56
|
@options = options
|
47
57
|
end
|
48
|
-
|
58
|
+
|
49
59
|
def self.new_with_defaults(options={})
|
50
60
|
config = new(defaults)
|
51
61
|
config = config.merge(options) if options
|
52
62
|
config
|
53
63
|
end
|
54
|
-
|
64
|
+
|
55
65
|
def options_for_tinymce
|
56
66
|
result = {}
|
57
|
-
|
67
|
+
|
58
68
|
options.each do |key, value|
|
59
69
|
if OPTION_SEPARATORS[key] && value.is_a?(Array)
|
60
70
|
result[key] = value.join(OPTION_SEPARATORS[key])
|
@@ -63,11 +73,15 @@ module TinyMCE::Rails
|
|
63
73
|
else
|
64
74
|
result[key] = value
|
65
75
|
end
|
76
|
+
|
77
|
+
if OPTION_TRANSFORMERS[key]
|
78
|
+
result[key] = OPTION_TRANSFORMERS[key].call result[key]
|
79
|
+
end
|
66
80
|
end
|
67
|
-
|
81
|
+
|
68
82
|
result
|
69
83
|
end
|
70
|
-
|
84
|
+
|
71
85
|
def to_javascript
|
72
86
|
pairs = options_for_tinymce.inject([]) do |result, (k, v)|
|
73
87
|
if v.respond_to?(:to_javascript)
|
@@ -75,24 +89,24 @@ module TinyMCE::Rails
|
|
75
89
|
elsif v.respond_to?(:to_json)
|
76
90
|
v = v.to_json
|
77
91
|
end
|
78
|
-
|
92
|
+
|
79
93
|
result << [k, v].join(": ")
|
80
94
|
end
|
81
|
-
|
95
|
+
|
82
96
|
"{\n #{pairs.join(",\n ")}\n}"
|
83
97
|
end
|
84
|
-
|
98
|
+
|
85
99
|
def merge(options)
|
86
100
|
self.class.new(self.options.merge(options))
|
87
101
|
end
|
88
102
|
end
|
89
|
-
|
103
|
+
|
90
104
|
class MultipleConfiguration < ActiveSupport::HashWithIndifferentAccess
|
91
105
|
def initialize(configurations={})
|
92
106
|
configurations = configurations.each_with_object({}) { |(name, options), h|
|
93
107
|
h[name] = Configuration.new_with_defaults(options)
|
94
108
|
}
|
95
|
-
|
109
|
+
|
96
110
|
super(configurations)
|
97
111
|
end
|
98
112
|
end
|
@@ -1,47 +1,47 @@
|
|
1
1
|
module TinyMCE::Rails
|
2
2
|
class ConfigurationFile
|
3
3
|
attr_reader :path
|
4
|
-
|
4
|
+
|
5
5
|
def initialize(path)
|
6
6
|
@path = path
|
7
7
|
end
|
8
|
-
|
8
|
+
|
9
9
|
def configuration
|
10
10
|
@configuration = load_configuration if reload?
|
11
11
|
@configuration
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def reload?
|
15
15
|
@configuration.nil? || (reloadable? && changed?)
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def changed?
|
19
19
|
@last_loaded != last_updated
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
private
|
23
23
|
def reloadable?
|
24
24
|
!::Rails.application.config.cache_classes
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def last_updated
|
28
28
|
File.exists?(path) && File.mtime(path)
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def load_configuration
|
32
32
|
@last_loaded = last_updated
|
33
|
-
|
33
|
+
|
34
34
|
return Configuration.new_with_defaults if !File.exists?(path)
|
35
|
-
|
35
|
+
|
36
36
|
options = load_yaml(path)
|
37
|
-
|
37
|
+
|
38
38
|
if options && options.has_key?('default')
|
39
39
|
MultipleConfiguration.new(options)
|
40
40
|
else
|
41
41
|
Configuration.new_with_defaults(options)
|
42
42
|
end
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
def load_yaml(path)
|
46
46
|
YAML::load(ERB.new(IO.read(path)).result)
|
47
47
|
end
|