tinymce-rails 3.5.11 → 3.5.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/tinymce/rails/configuration.rb +14 -45
- data/lib/tinymce/rails/helper.rb +5 -1
- data/lib/tinymce/rails/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac560f2e729eb866e2cc59ca5be33f7e43180f80
|
4
|
+
data.tar.gz: caa35ee4168e08bef7fe9b6b3c0dbc5e5303aba1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 491c7227f0c8606f147bcde6ec181156590e6731a0b4d3df990e2d675e6ee4076fb9008a227c7103d4a3a4dde74ab1ecf50cef70b94b06c13353cd7d04c85249
|
7
|
+
data.tar.gz: e971403a009579c5f5ab43c8d14d686ad9079bc5ab37196f5b1a872422fa709fcc09515e637f9a46597b4e9044dfded61d0fce27d2cbf7f0a24bda1a1b06f6d6
|
data/README.md
CHANGED
@@ -58,7 +58,7 @@ alternate:
|
|
58
58
|
- table
|
59
59
|
```
|
60
60
|
|
61
|
-
See the [TinyMCE 3 Documentation](http://
|
61
|
+
See the [TinyMCE 3 Documentation](http://archive.tinymce.com/wiki.php/Configuration3x) for a full list of configuration options.
|
62
62
|
|
63
63
|
|
64
64
|
**3. Include the TinyMCE assets**
|
@@ -7,7 +7,7 @@ module TinyMCE::Rails
|
|
7
7
|
self
|
8
8
|
end
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def self.defaults
|
12
12
|
{
|
13
13
|
"mode" => "specific_textareas",
|
@@ -15,22 +15,22 @@ module TinyMCE::Rails
|
|
15
15
|
"theme" => "advanced"
|
16
16
|
}
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
attr_reader :options
|
20
|
-
|
20
|
+
|
21
21
|
def initialize(options)
|
22
22
|
@options = options
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
def self.new_with_defaults(options={})
|
26
26
|
config = new(defaults)
|
27
27
|
config = config.merge(options) if options
|
28
28
|
config
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
def options_for_tinymce
|
32
32
|
result = {}
|
33
|
-
|
33
|
+
|
34
34
|
options.each do |key, value|
|
35
35
|
if value.is_a?(Array) && value.all? { |v| v.is_a?(String) }
|
36
36
|
result[key] = value.join(",")
|
@@ -40,12 +40,10 @@ module TinyMCE::Rails
|
|
40
40
|
result[key] = value
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
44
|
-
result["language"] ||= self.class.default_language
|
45
|
-
|
43
|
+
|
46
44
|
result
|
47
45
|
end
|
48
|
-
|
46
|
+
|
49
47
|
def to_javascript
|
50
48
|
pairs = options_for_tinymce.inject([]) do |result, (k, v)|
|
51
49
|
if v.respond_to?(:to_javascript)
|
@@ -53,54 +51,25 @@ module TinyMCE::Rails
|
|
53
51
|
elsif v.respond_to?(:to_json)
|
54
52
|
v = v.to_json
|
55
53
|
end
|
56
|
-
|
54
|
+
|
57
55
|
result << [k, v].join(": ")
|
58
56
|
end
|
59
|
-
|
57
|
+
|
60
58
|
"{\n#{pairs.join(",\n")}\n}"
|
61
59
|
end
|
62
|
-
|
60
|
+
|
63
61
|
def merge(options)
|
64
62
|
self.class.new(self.options.merge(options))
|
65
63
|
end
|
66
|
-
|
67
|
-
# Default language falls back to English if current locale is not available.
|
68
|
-
def self.default_language
|
69
|
-
available_languages.include?(I18n.locale.to_s) ? I18n.locale.to_s : "en"
|
70
|
-
end
|
71
|
-
|
72
|
-
# Searches asset paths for TinyMCE language files.
|
73
|
-
def self.available_languages
|
74
|
-
assets.paths.map { |path|
|
75
|
-
# Find all assets within tinymce/langs
|
76
|
-
entries = assets.entries(File.join(path, "tinymce/langs"))
|
77
|
-
entries.map { |entry|
|
78
|
-
if assets.respond_to?(:attributes_for)
|
79
|
-
assets.attributes_for(File.join(path, entry))
|
80
|
-
else
|
81
|
-
assets.find_asset(File.join("tinymce/langs", entry))
|
82
|
-
end
|
83
|
-
}.select { |asset|
|
84
|
-
# Select only JavaScript files
|
85
|
-
asset.logical_path =~ /\.js$/
|
86
|
-
}.map { |asset|
|
87
|
-
# Strip path and extension
|
88
|
-
asset.logical_path.sub(/^tinymce\/langs\//, "").sub(/\.js$/, "")
|
89
|
-
}
|
90
|
-
}.flatten.uniq
|
91
|
-
end
|
92
|
-
|
93
|
-
def self.assets
|
94
|
-
Rails.application.assets
|
95
|
-
end
|
64
|
+
|
96
65
|
end
|
97
|
-
|
66
|
+
|
98
67
|
class MultipleConfiguration < ActiveSupport::HashWithIndifferentAccess
|
99
68
|
def initialize(configurations={})
|
100
69
|
configurations = configurations.each_with_object({}) { |(name, options), h|
|
101
70
|
h[name] = Configuration.new_with_defaults(options)
|
102
71
|
}
|
103
|
-
|
72
|
+
|
104
73
|
super(configurations)
|
105
74
|
end
|
106
75
|
end
|
data/lib/tinymce/rails/helper.rb
CHANGED
@@ -38,10 +38,14 @@ module TinyMCE::Rails
|
|
38
38
|
|
39
39
|
base_configuration.merge(options)
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
# Includes TinyMCE javascript assets via a script tag.
|
43
43
|
def tinymce_assets
|
44
44
|
javascript_include_tag "tinymce"
|
45
45
|
end
|
46
|
+
|
47
|
+
# Allow methods to be called as module functions:
|
48
|
+
# e.g. TinyMCE::Rails.tinymce_javascript
|
49
|
+
module_function :tinymce, :tinymce_javascript, :tinymce_configuration
|
46
50
|
end
|
47
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tinymce-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.11
|
4
|
+
version: 3.5.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Pohlenz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -328,9 +328,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
328
328
|
version: '0'
|
329
329
|
requirements: []
|
330
330
|
rubyforge_project:
|
331
|
-
rubygems_version: 2.
|
331
|
+
rubygems_version: 2.5.1
|
332
332
|
signing_key:
|
333
333
|
specification_version: 4
|
334
334
|
summary: Rails asset pipeline integration for TinyMCE.
|
335
335
|
test_files: []
|
336
|
-
has_rdoc:
|