tinymce-rails 6.1.0 → 7.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -11
  3. data/app/assets/source/tinymce/tinymce.js +10358 -7311
  4. data/lib/tinymce/rails/asset_installer/copy_no_preserve.rb +1 -1
  5. data/lib/tinymce/rails/asset_installer.rb +4 -4
  6. data/lib/tinymce/rails/asset_manifest/json_manifest.rb +62 -0
  7. data/lib/tinymce/rails/asset_manifest/null_manifest.rb +12 -0
  8. data/lib/tinymce/rails/asset_manifest/propshaft_manifest.rb +43 -0
  9. data/lib/tinymce/rails/asset_manifest/yaml_manifest.rb +43 -0
  10. data/lib/tinymce/rails/asset_manifest.rb +7 -104
  11. data/lib/tinymce/rails/configuration.rb +6 -1
  12. data/lib/tinymce/rails/configuration_file.rb +2 -1
  13. data/lib/tinymce/rails/engine.rb +15 -2
  14. data/lib/tinymce/rails/helper.rb +19 -5
  15. data/lib/tinymce/rails/propshaft/asset.rb +11 -0
  16. data/lib/tinymce/rails/version.rb +2 -2
  17. data/lib/tinymce/rails.rb +2 -2
  18. data/vendor/assets/javascripts/tinymce/icons/default/icons.js +1 -1
  19. data/vendor/assets/javascripts/tinymce/langs/readme.md +3 -0
  20. data/vendor/assets/javascripts/tinymce/license.md +6 -0
  21. data/vendor/assets/javascripts/tinymce/models/dom/model.js +2 -2
  22. data/vendor/assets/javascripts/tinymce/plugins/accordion/plugin.js +4 -0
  23. data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +2 -2
  24. data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +2 -2
  25. data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +2 -2
  26. data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +2 -2
  27. data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +2 -2
  28. data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +2 -2
  29. data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +1 -1
  30. data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +2 -2
  31. data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +2 -2
  32. data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +2 -2
  33. data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +2 -2
  34. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ar.js +93 -0
  35. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/bg_BG.js +93 -0
  36. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ca.js +93 -0
  37. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/cs.js +93 -0
  38. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/da.js +93 -0
  39. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/de.js +93 -0
  40. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/el.js +93 -0
  41. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/en.js +93 -0
  42. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/es.js +93 -0
  43. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/eu.js +93 -0
  44. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/fa.js +93 -0
  45. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/fi.js +93 -0
  46. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/fr_FR.js +93 -0
  47. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/he_IL.js +93 -0
  48. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/hi.js +93 -0
  49. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/hr.js +93 -0
  50. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/hu_HU.js +93 -0
  51. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/id.js +93 -0
  52. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/it.js +93 -0
  53. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ja.js +93 -0
  54. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/kk.js +93 -0
  55. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ko_KR.js +93 -0
  56. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ms.js +93 -0
  57. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/nb_NO.js +93 -0
  58. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/nl.js +93 -0
  59. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/pl.js +93 -0
  60. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/pt_BR.js +93 -0
  61. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/pt_PT.js +93 -0
  62. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ro.js +93 -0
  63. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/ru.js +93 -0
  64. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/sk.js +93 -0
  65. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/sl_SI.js +93 -0
  66. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/sv_SE.js +93 -0
  67. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/th_TH.js +93 -0
  68. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/tr.js +93 -0
  69. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/uk.js +93 -0
  70. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/vi.js +93 -0
  71. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/zh_CN.js +87 -0
  72. data/vendor/assets/javascripts/tinymce/plugins/help/js/i18n/keynav/zh_TW.js +93 -0
  73. data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +2 -2
  74. data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +2 -2
  75. data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +2 -2
  76. data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +2 -2
  77. data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +2 -2
  78. data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +2 -2
  79. data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +2 -2
  80. data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +2 -2
  81. data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +2 -2
  82. data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +2 -2
  83. data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +2 -2
  84. data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +2 -2
  85. data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +2 -2
  86. data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +2 -2
  87. data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +2 -2
  88. data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +2 -2
  89. data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +2 -2
  90. data/vendor/assets/javascripts/tinymce/skins/content/dark/content.js +1 -0
  91. data/vendor/assets/javascripts/tinymce/skins/content/default/content.js +1 -0
  92. data/vendor/assets/javascripts/tinymce/skins/content/document/content.js +1 -0
  93. data/vendor/assets/javascripts/tinymce/skins/content/tinymce-5/content.js +1 -0
  94. data/vendor/assets/javascripts/tinymce/skins/content/tinymce-5-dark/content.js +1 -0
  95. data/vendor/assets/javascripts/tinymce/skins/content/writer/content.js +1 -0
  96. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.css +1 -1
  97. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.css +1 -1
  98. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.js +1 -0
  99. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.min.css +1 -1
  100. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.js +1 -0
  101. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.min.css +1 -1
  102. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.css +1 -1
  103. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.js +1 -0
  104. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +1 -1
  105. data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.shadowdom.js +1 -0
  106. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.css +1 -1
  107. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.css +1 -1
  108. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.js +1 -0
  109. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.min.css +1 -1
  110. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.js +1 -0
  111. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.min.css +1 -1
  112. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.css +1 -1
  113. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.js +1 -0
  114. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +1 -1
  115. data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.shadowdom.js +1 -0
  116. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.css +1 -1
  117. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.css +1 -1
  118. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.js +1 -0
  119. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.inline.min.css +1 -1
  120. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.js +1 -0
  121. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/content.min.css +1 -1
  122. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.css +1 -1
  123. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.js +1 -0
  124. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.min.css +1 -1
  125. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5/skin.shadowdom.js +1 -0
  126. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.css +1 -1
  127. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.css +1 -1
  128. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.js +1 -0
  129. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +1 -1
  130. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.js +1 -0
  131. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/content.min.css +1 -1
  132. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.css +1 -1
  133. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.js +1 -0
  134. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.min.css +1 -1
  135. data/vendor/assets/javascripts/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.js +1 -0
  136. data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +384 -2
  137. data/vendor/assets/javascripts/tinymce/tinymce.d.ts +934 -516
  138. data/vendor/assets/javascripts/tinymce/tinymce.js +383 -2
  139. metadata +75 -10
  140. data/LICENSE +0 -19
  141. data/vendor/assets/javascripts/tinymce/langs/README.md +0 -3
  142. data/vendor/assets/javascripts/tinymce/license.txt +0 -21
  143. data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +0 -4
  144. /data/app/assets/{javascripts → sprockets}/tinymce/preinit.js.erb +0 -0
  145. /data/app/assets/{javascripts → sprockets}/tinymce.js +0 -0
@@ -1,4 +1,4 @@
1
- require "tinymce/rails/asset_installer/copy"
1
+ require_relative "copy"
2
2
 
3
3
  module TinyMCE
4
4
  module Rails
@@ -1,8 +1,8 @@
1
- require "tinymce/rails/asset_manifest"
1
+ require_relative "asset_manifest"
2
2
 
3
- require "tinymce/rails/asset_installer/copy"
4
- require "tinymce/rails/asset_installer/copy_no_preserve"
5
- require "tinymce/rails/asset_installer/compile"
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,12 @@
1
+ module TinyMCE
2
+ module Rails
3
+ class NullManifest < AssetManifest
4
+ def append(*); end
5
+ def remove(*); end
6
+ def remove_digest(*); end
7
+ def assets; {}; end
8
+ def each(*); end
9
+ def write; end
10
+ end
11
+ end
12
+ 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
- JsonManifest.try(manifest_path, ".sprockets-manifest*.json") ||
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
- class YamlManifest < AssetManifest
38
- def self.try(manifest_path)
39
- yaml_file = File.join(manifest_path, "manifest.yml")
40
- new(yaml_file) if File.exist?(yaml_file)
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
@@ -15,7 +15,7 @@ module TinyMCE::Rails
15
15
  }
16
16
  end
17
17
 
18
- FUNCTION_REGEX = /^function\s*\(/
18
+ FUNCTION_REGEX = /^function\s*\(([\w\d\s_,]*)\)\s*\{([^}]*)\}|\(([\w\d\s_,]*)\)\s*=>\s*\{([^}]*)\}/
19
19
  RELATIVE_PATH_REGEX = /^(\/|\.{1,2})\S*/
20
20
 
21
21
  COMMA = ",".freeze
@@ -98,10 +98,15 @@ module TinyMCE::Rails
98
98
  FUNCTION_REGEX =~ value.to_s
99
99
  end
100
100
 
101
+ def valid_property_name?(key)
102
+ key =~ /^(?![0-9])[a-zA-Z0-9$_]+$/
103
+ end
104
+
101
105
  def preprocess_options(options)
102
106
  result = {}
103
107
 
104
108
  options.each do |key, value|
109
+ key = "'#{key}'" unless valid_property_name?(key)
105
110
  result[key] = preprocess_option(key, value)
106
111
  end
107
112
 
@@ -43,7 +43,8 @@ module TinyMCE::Rails
43
43
  end
44
44
 
45
45
  def load_yaml(path)
46
- YAML::load(ERB.new(IO.read(path)).result)
46
+ result = ERB.new(IO.read(path)).result
47
+ YAML.respond_to?(:unsafe_load) ? YAML.unsafe_load(result) : YAML.load(result)
47
48
  end
48
49
  end
49
50
  end
@@ -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
@@ -1,4 +1,4 @@
1
- require 'active_support/core_ext/hash/keys'
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
- javascript_include_tag "tinymce", "data-turbolinks-track" => "reload"
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
@@ -1,6 +1,6 @@
1
1
  module TinyMCE
2
2
  module Rails
3
- VERSION = "6.1.0"
4
- TINYMCE_VERSION = "6.1.0"
3
+ VERSION = "7.6.0"
4
+ TINYMCE_VERSION = "7.6.0"
5
5
  end
6
6
  end
data/lib/tinymce/rails.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module TinyMCE
2
2
  module Rails
3
- require 'tinymce/rails/engine'
4
- require 'tinymce/rails/version'
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"