tinymce-rails 6.8.3 → 6.8.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -6
- data/app/assets/source/tinymce/tinymce.js +906 -883
- data/lib/tinymce/rails/asset_installer/copy_no_preserve.rb +1 -1
- data/lib/tinymce/rails/asset_installer.rb +4 -4
- data/lib/tinymce/rails/asset_manifest/json_manifest.rb +62 -0
- data/lib/tinymce/rails/asset_manifest/null_manifest.rb +12 -0
- data/lib/tinymce/rails/asset_manifest/propshaft_manifest.rb +43 -0
- data/lib/tinymce/rails/asset_manifest/yaml_manifest.rb +43 -0
- data/lib/tinymce/rails/asset_manifest.rb +7 -104
- data/lib/tinymce/rails/engine.rb +15 -2
- data/lib/tinymce/rails/helper.rb +19 -5
- data/lib/tinymce/rails/propshaft/asset.rb +11 -0
- data/lib/tinymce/rails/version.rb +2 -2
- data/lib/tinymce/rails.rb +2 -2
- data/vendor/assets/javascripts/tinymce/models/dom/model.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/accordion/plugin.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/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/directionality/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/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/image/plugin.js +1 -1
- 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/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/pagebreak/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/quickbars/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/table/plugin.js +1 -1
- data/vendor/assets/javascripts/tinymce/plugins/template/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/themes/silver/theme.js +382 -2
- data/vendor/assets/javascripts/tinymce/tinymce.js +382 -2
- metadata +11 -6
- /data/app/assets/{javascripts → sprockets}/tinymce/preinit.js.erb +0 -0
- /data/app/assets/{javascripts → sprockets}/tinymce.js +0 -0
- /data/vendor/assets/javascripts/tinymce/langs/{README.md → readme.md} +0 -0
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
require_relative "asset_manifest"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
require_relative "asset_installer/copy"
|
4
|
+
require_relative "asset_installer/copy_no_preserve"
|
5
|
+
require_relative "asset_installer/compile"
|
6
6
|
|
7
7
|
module TinyMCE
|
8
8
|
module Rails
|
@@ -0,0 +1,62 @@
|
|
1
|
+
module TinyMCE
|
2
|
+
module Rails
|
3
|
+
class JsonManifest < AssetManifest
|
4
|
+
def self.try(manifest_path, pattern=nil)
|
5
|
+
if pattern
|
6
|
+
paths = Dir[File.join(manifest_path, pattern)]
|
7
|
+
new(paths.first) if paths.any?
|
8
|
+
elsif File.file?(manifest_path)
|
9
|
+
new(manifest_path)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(file)
|
14
|
+
@file = file
|
15
|
+
@manifest = JSON.parse(File.read(file))
|
16
|
+
end
|
17
|
+
|
18
|
+
def append(logical_path, file)
|
19
|
+
stat = File.stat(file)
|
20
|
+
|
21
|
+
assets[logical_path] = logical_path
|
22
|
+
files[logical_path] = {
|
23
|
+
"logical_path" => logical_path,
|
24
|
+
"mtime" => stat.mtime.iso8601,
|
25
|
+
"size" => stat.size,
|
26
|
+
"digest" => nil
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
def remove(logical_path)
|
31
|
+
if digested = assets.delete(logical_path)
|
32
|
+
files.delete(digested)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def remove_digest(logical_path)
|
37
|
+
asset_path(logical_path) do |digested, logical_path|
|
38
|
+
assets[logical_path] = logical_path
|
39
|
+
files[logical_path] = files.delete(digested).tap { |f| f["digest"] = nil }
|
40
|
+
|
41
|
+
yield digested, logical_path if block_given?
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def assets
|
46
|
+
@manifest["assets"]
|
47
|
+
end
|
48
|
+
|
49
|
+
def files
|
50
|
+
@manifest["files"]
|
51
|
+
end
|
52
|
+
|
53
|
+
def dump
|
54
|
+
JSON.generate(@manifest)
|
55
|
+
end
|
56
|
+
|
57
|
+
def write
|
58
|
+
File.open(@file, "wb") { |f| f.write(dump) }
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module TinyMCE
|
2
|
+
module Rails
|
3
|
+
class PropshaftManifest < AssetManifest
|
4
|
+
def self.try(manifest_path)
|
5
|
+
json_file = File.join(manifest_path, ".manifest.json")
|
6
|
+
new(json_file) if File.exist?(json_file)
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(file)
|
10
|
+
@file = file
|
11
|
+
@manifest = JSON.parse(File.read(file))
|
12
|
+
end
|
13
|
+
|
14
|
+
def append(logical_path, file)
|
15
|
+
assets[logical_path] = logical_path
|
16
|
+
end
|
17
|
+
|
18
|
+
def remove(logical_path)
|
19
|
+
assets.delete(logical_path)
|
20
|
+
end
|
21
|
+
|
22
|
+
def remove_digest(logical_path)
|
23
|
+
asset_path(logical_path) do |digested, logical_path|
|
24
|
+
assets[logical_path] = logical_path
|
25
|
+
|
26
|
+
yield digested, logical_path if block_given?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def assets
|
31
|
+
@manifest
|
32
|
+
end
|
33
|
+
|
34
|
+
def dump
|
35
|
+
JSON.generate(@manifest)
|
36
|
+
end
|
37
|
+
|
38
|
+
def write
|
39
|
+
File.open(@file, "wb") { |f| f.write(dump) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module TinyMCE
|
2
|
+
module Rails
|
3
|
+
class YamlManifest < AssetManifest
|
4
|
+
def self.try(manifest_path)
|
5
|
+
yaml_file = File.join(manifest_path, "manifest.yml")
|
6
|
+
new(yaml_file) if File.exist?(yaml_file)
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(file)
|
10
|
+
@file = file
|
11
|
+
@manifest = YAML.load_file(file)
|
12
|
+
end
|
13
|
+
|
14
|
+
def append(logical_path, file)
|
15
|
+
assets[logical_path] = logical_path
|
16
|
+
end
|
17
|
+
|
18
|
+
def remove(logical_path)
|
19
|
+
assets.delete(logical_path)
|
20
|
+
end
|
21
|
+
|
22
|
+
def remove_digest(logical_path)
|
23
|
+
asset_path(logical_path) do |digested, logical_path|
|
24
|
+
assets[logical_path] = logical_path
|
25
|
+
|
26
|
+
yield digested, logical_path if block_given?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def assets
|
31
|
+
@manifest
|
32
|
+
end
|
33
|
+
|
34
|
+
def dump(io=nil)
|
35
|
+
YAML.dump(@manifest, io)
|
36
|
+
end
|
37
|
+
|
38
|
+
def write
|
39
|
+
File.open(@file, "wb") { |f| dump(f) }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -4,8 +4,10 @@ module TinyMCE
|
|
4
4
|
attr_reader :file
|
5
5
|
|
6
6
|
def self.load(manifest_path)
|
7
|
-
|
7
|
+
PropshaftManifest.try(manifest_path) ||
|
8
|
+
JsonManifest.try(manifest_path, ".sprockets-manifest*.json") ||
|
8
9
|
JsonManifest.try(manifest_path, "manifest*.json") ||
|
10
|
+
JsonManifest.try(manifest_path) ||
|
9
11
|
YamlManifest.try(manifest_path) ||
|
10
12
|
NullManifest.new
|
11
13
|
end
|
@@ -34,108 +36,9 @@ module TinyMCE
|
|
34
36
|
end
|
35
37
|
end
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
def initialize(file)
|
44
|
-
@file = file
|
45
|
-
@manifest = YAML.load_file(file)
|
46
|
-
end
|
47
|
-
|
48
|
-
def append(logical_path, file)
|
49
|
-
assets[logical_path] = logical_path
|
50
|
-
end
|
51
|
-
|
52
|
-
def remove(logical_path)
|
53
|
-
assets.delete(logical_path)
|
54
|
-
end
|
55
|
-
|
56
|
-
def remove_digest(logical_path)
|
57
|
-
asset_path(logical_path) do |digested, logical_path|
|
58
|
-
assets[logical_path] = logical_path
|
59
|
-
|
60
|
-
yield digested, logical_path if block_given?
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def assets
|
65
|
-
@manifest
|
66
|
-
end
|
67
|
-
|
68
|
-
def dump(io=nil)
|
69
|
-
YAML.dump(@manifest, io)
|
70
|
-
end
|
71
|
-
|
72
|
-
def write
|
73
|
-
File.open(@file, "wb") { |f| dump(f) }
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
class JsonManifest < AssetManifest
|
78
|
-
def self.try(manifest_path, pattern)
|
79
|
-
paths = Dir[File.join(manifest_path, pattern)]
|
80
|
-
new(paths.first) if paths.any?
|
81
|
-
end
|
82
|
-
|
83
|
-
def initialize(file)
|
84
|
-
@file = file
|
85
|
-
@manifest = JSON.parse(File.read(file))
|
86
|
-
end
|
87
|
-
|
88
|
-
def append(logical_path, file)
|
89
|
-
stat = File.stat(file)
|
90
|
-
|
91
|
-
assets[logical_path] = logical_path
|
92
|
-
files[logical_path] = {
|
93
|
-
"logical_path" => logical_path,
|
94
|
-
"mtime" => stat.mtime.iso8601,
|
95
|
-
"size" => stat.size,
|
96
|
-
"digest" => nil
|
97
|
-
}
|
98
|
-
end
|
99
|
-
|
100
|
-
def remove(logical_path)
|
101
|
-
if digested = assets.delete(logical_path)
|
102
|
-
files.delete(digested)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def remove_digest(logical_path)
|
107
|
-
asset_path(logical_path) do |digested, logical_path|
|
108
|
-
assets[logical_path] = logical_path
|
109
|
-
files[logical_path] = files.delete(digested).tap { |f| f["digest"] = nil }
|
110
|
-
|
111
|
-
yield digested, logical_path if block_given?
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def assets
|
116
|
-
@manifest["assets"]
|
117
|
-
end
|
118
|
-
|
119
|
-
def files
|
120
|
-
@manifest["files"]
|
121
|
-
end
|
122
|
-
|
123
|
-
def dump
|
124
|
-
JSON.generate(@manifest)
|
125
|
-
end
|
126
|
-
|
127
|
-
def write
|
128
|
-
File.open(@file, "wb") { |f| f.write(dump) }
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
class NullManifest < AssetManifest
|
133
|
-
def append(*); end
|
134
|
-
def remove(*); end
|
135
|
-
def remove_digest(*); end
|
136
|
-
def assets; {}; end
|
137
|
-
def each(*); end
|
138
|
-
def write; end
|
139
|
-
end
|
39
|
+
require_relative "asset_manifest/json_manifest"
|
40
|
+
require_relative "asset_manifest/null_manifest"
|
41
|
+
require_relative "asset_manifest/propshaft_manifest"
|
42
|
+
require_relative "asset_manifest/yaml_manifest"
|
140
43
|
end
|
141
44
|
end
|
data/lib/tinymce/rails/engine.rb
CHANGED
@@ -13,14 +13,27 @@ module TinyMCE::Rails
|
|
13
13
|
# :copy - copies across the TinyMCE assets statically
|
14
14
|
config.tinymce.install = :compile
|
15
15
|
|
16
|
+
# Set default attributes for script source tags (defaults to data-turbolinks-track="reload" for backwards compatibility)
|
17
|
+
config.tinymce.default_script_attributes = { "data-turbolinks-track" => "reload" }
|
18
|
+
|
16
19
|
initializer "precompile", :group => :all do |app|
|
17
20
|
if config.tinymce.install == :compile
|
18
21
|
app.config.assets.precompile << "tinymce-rails.manifest.js" # Sprockets 4 manifest
|
19
22
|
app.config.assets.precompile << "tinymce/*" # Sprockets 3
|
20
23
|
end
|
21
24
|
|
22
|
-
app.config.assets.precompile << "tinymce.js"
|
23
|
-
end
|
25
|
+
app.config.assets.precompile << "tinymce.js" << "tinymce-jquery.js"
|
26
|
+
end if defined?(Sprockets)
|
27
|
+
|
28
|
+
initializer "propshaft" do |app|
|
29
|
+
config.assets.excluded_paths << root.join("app/assets/sprockets")
|
30
|
+
|
31
|
+
if config.assets.server
|
32
|
+
# Monkey-patch Propshaft::Asset to enable access
|
33
|
+
# of TinyMCE assets without a hash digest.
|
34
|
+
require_relative "propshaft/asset"
|
35
|
+
end
|
36
|
+
end if defined?(Propshaft)
|
24
37
|
|
25
38
|
initializer "helper" do |app|
|
26
39
|
ActiveSupport.on_load(:action_view) do
|
data/lib/tinymce/rails/helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "active_support/core_ext/hash/keys"
|
2
2
|
|
3
3
|
module TinyMCE::Rails
|
4
4
|
module Helper
|
@@ -63,13 +63,27 @@ module TinyMCE::Rails
|
|
63
63
|
end
|
64
64
|
|
65
65
|
# Includes TinyMCE javascript assets via a script tag.
|
66
|
-
def tinymce_assets
|
67
|
-
|
66
|
+
def tinymce_assets(options=Rails.application.config.tinymce.default_script_attributes)
|
67
|
+
if defined?(Sprockets)
|
68
|
+
javascript_include_tag("tinymce", options)
|
69
|
+
else
|
70
|
+
safe_join([
|
71
|
+
tinymce_preinit,
|
72
|
+
javascript_include_tag("tinymce/tinymce", options),
|
73
|
+
javascript_include_tag("tinymce/rails", options)
|
74
|
+
], "\n")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Configures where dynamically loaded TinyMCE assets are located and named
|
79
|
+
def tinymce_preinit(base=TinyMCE::Rails::Engine.base)
|
80
|
+
js = "window.tinymce = window.tinymce || { base: '#{base}', suffix: '' };"
|
81
|
+
javascript_tag(js, nonce: true)
|
68
82
|
end
|
69
83
|
|
70
84
|
# Allow methods to be called as module functions:
|
71
85
|
# e.g. TinyMCE::Rails.tinymce_javascript
|
72
|
-
module_function :tinymce, :tinymce_javascript, :tinymce_configurations_javascript, :tinymce_configuration
|
73
|
-
public :tinymce, :tinymce_javascript, :tinymce_configurations_javascript, :tinymce_configuration
|
86
|
+
module_function :tinymce, :tinymce_javascript, :tinymce_configurations_javascript, :tinymce_configuration, :tinymce_preinit
|
87
|
+
public :tinymce, :tinymce_javascript, :tinymce_configurations_javascript, :tinymce_configuration, :tinymce_preinit
|
74
88
|
end
|
75
89
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "propshaft/asset"
|
2
|
+
|
3
|
+
class Propshaft::Asset
|
4
|
+
alias fresh_without_tinymce_exception? fresh?
|
5
|
+
|
6
|
+
# Allow TinyMCE assets to be accessed (in development mode) without a digest
|
7
|
+
def fresh?(digest)
|
8
|
+
fresh_without_tinymce_exception?(digest) ||
|
9
|
+
(digest.blank? && logical_path.to_s.starts_with?("tinymce/"))
|
10
|
+
end
|
11
|
+
end
|
data/lib/tinymce/rails.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module TinyMCE
|
2
2
|
module Rails
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "tinymce/rails/engine"
|
4
|
+
require "tinymce/rails/version"
|
5
5
|
require "tinymce/rails/configuration"
|
6
6
|
require "tinymce/rails/configuration_file"
|
7
7
|
require "tinymce/rails/helper"
|