ckeditor5 1.10.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3e06c4a4882429855d9570658be64f10fffd97371d0ae60e9aee2ecec08df00
4
- data.tar.gz: f48eabec0f1bcab9299be0f00094f2e1078a757582a705e57d504748943b5790
3
+ metadata.gz: cbd754782a22b999b5843eedf90b499ba82f44dfac2ceb51f3c46898800482e2
4
+ data.tar.gz: c7945b1c9efeb3579a70ac0aaa832bac46147c512b9de98dff3dbf5a3187afad
5
5
  SHA512:
6
- metadata.gz: c989f7723dadc126c356b579f50160b09f3c359af8a791a919bcff0595c7387241f89f5a63a100c482878d0f067c094f45619628094d6a8c0659d797d75cb514
7
- data.tar.gz: a411bbde271725fbaeddfc58023307837ffac5e26d4814ed13e922288846129973a2b297681076b480982485a91ed4b5c527056cf2b9b799cfbb321a5ed83762
6
+ metadata.gz: e1263373ca9e36adf9d63b8ff23d88933231cdacb8378cedc9f17819ae59924064e04bec14731e3907808af138ecd2afc4cd80cb2db9b943f221d1b8d9ccdf43
7
+ data.tar.gz: a8c822abfc9f0f191785d2cea17d5eb7d5d9696c2d3337c9fbdd4ff302f9ef1bf2b46fca90cc9b221f00c1a37c0d124c92fb74dde125dc5e8cd2aaf9b683f8bc
data/Gemfile CHANGED
@@ -6,11 +6,21 @@ gem 'bundler', '~> 2.5', '>= 2.5.21'
6
6
 
7
7
  group :development do
8
8
  gem 'brakeman', '~> 6.1', '>= 6.1.1', require: false
9
+ gem 'guard', '~> 2.19', '>= 2.19.0'
10
+ gem 'guard-process', '~> 1.2'
11
+ gem 'pry', '~> 0.15', '>= 0.15.0'
12
+ gem 'rails', '~> 7.0', '>= 7.0.0'
9
13
  gem 'rake', '~> 13.2', '>= 13.2.1'
10
14
  gem 'rspec', '~> 3.13'
15
+ gem 'rspec-expectations', '~> 3.13'
16
+ gem 'rspec-rails', '~> 7.0'
11
17
  gem 'rubocop', '~> 1.66', require: false
12
18
  gem 'rubocop-rails', '~> 2.26', '>= 2.26.2', require: false
13
19
  gem 'rubocop-rails-omakase', '~> 1.0.0', require: false
20
+ gem 'simple_form', '~> 5.3', '>= 5.3.0'
21
+ gem 'slim', '~> 5.2', '>= 5.2.0'
22
+ gem 'sprockets-rails', '~> 3.2', '>= 3.2.2'
23
+ gem 'sqlite3', '>= 1.4'
14
24
  end
15
25
 
16
26
  group :test, :development do
data/README.md CHANGED
@@ -117,6 +117,7 @@ Voilà! You have CKEditor 5 integrated with your Rails application. 🎉
117
117
  - [`editor-error` event](#editor-error-event)
118
118
  - [`editor-change` event](#editor-change-event)
119
119
  - [Inline event handling](#inline-event-handling)
120
+ - [Gem Development 🛠](#gem-development-)
120
121
  - [Trademarks 📜](#trademarks-)
121
122
  - [License 📜](#license-)
122
123
 
@@ -1314,7 +1315,21 @@ You can also define event handlers directly in the view using the `oneditorchang
1314
1315
  }
1315
1316
  </script>
1316
1317
 
1317
- <%= ckeditor5_editor style: 'width: 600px', id: 'editor', oneditorchange: 'onEditorChange', oneditorerror: 'onEditorError', oneditorready: 'onEditorReady' %>
1318
+ <%= ckeditor5_editor id: 'editor',
1319
+ oneditorchange: 'onEditorChange',
1320
+ oneditorerror: 'onEditorError',
1321
+ oneditorready: 'onEditorReady'
1322
+ %>
1323
+ ```
1324
+
1325
+ ## Gem Development 🛠
1326
+
1327
+ If you want to contribute to the gem, you can clone the repository and run the following commands:
1328
+
1329
+ ```sh
1330
+ gem install bundler -v 2.5.22
1331
+ bundle install
1332
+ bundle exec guard
1318
1333
  ```
1319
1334
 
1320
1335
  ## Trademarks 📜
@@ -43,7 +43,7 @@ module CKEditor5::Rails::Assets
43
43
 
44
44
  def window_scripts_tags
45
45
  @window_scripts_tags ||= safe_join(bundle.scripts.filter_map do |script|
46
- tag.script(src: script.url, nonce: true, async: true) if script.window?
46
+ tag.script(src: script.url, nonce: true, async: true, crossorigin: 'anonymous') if script.window?
47
47
  end)
48
48
  end
49
49
 
@@ -8,38 +8,47 @@ module CKEditor5::Rails
8
8
  attr_reader :cdn, :version, :theme, :translations
9
9
 
10
10
  def initialize(version, theme: :lark, cdn: Engine.default_preset.cdn, translations: [])
11
- raise ArgumentError, 'version must be semver' unless version.is_a?(Semver)
12
- raise ArgumentError, 'theme must be a string' unless theme.is_a?(String)
13
- raise ArgumentError, 'translations must be an array' unless translations.is_a?(Array)
14
-
15
11
  super()
16
12
 
17
13
  @cdn = cdn
18
14
  @version = version
19
15
  @theme = theme
20
16
  @translations = translations
17
+
18
+ validate!
21
19
  end
22
20
 
23
21
  def scripts
24
22
  @scripts ||= [
25
23
  Assets::JSExportsMeta.new(
26
- create_cdn_url('ckbox', 'ckbox.js', version),
27
- *translations_js_exports_meta
24
+ create_cdn_url('ckbox', version, 'ckbox.js'),
25
+ *translations_js_exports_meta,
26
+ window_name: 'CKBox'
28
27
  )
29
28
  ]
30
29
  end
31
30
 
32
31
  def stylesheets
33
32
  @stylesheets ||= [
34
- create_cdn_url('ckbox', "styles/themes/#{theme}.css", version)
33
+ create_cdn_url('ckbox', version, "styles/themes/#{theme}.css")
35
34
  ]
36
35
  end
37
36
 
38
37
  private
39
38
 
39
+ def validate!
40
+ raise ArgumentError, 'version must be semver' unless version.is_a?(Semver)
41
+ raise ArgumentError, 'translations must be an array' unless translations.is_a?(Array)
42
+
43
+ return if theme.is_a?(String) || theme.is_a?(Symbol)
44
+
45
+ raise ArgumentError,
46
+ 'theme must be a string or symbol'
47
+ end
48
+
40
49
  def translations_js_exports_meta
41
50
  translations.map do |lang|
42
- url = create_cdn_url('ckbox', "translations/#{lang}.js", version)
51
+ url = create_cdn_url('ckbox', version, "translations/#{lang}.js")
43
52
 
44
53
  Assets::JSExportsMeta.new(url, window_name: 'CKBOX_TRANSLATIONS', translation: true)
45
54
  end
@@ -20,9 +20,11 @@ module CKEditor5::Rails::Cdn
20
20
 
21
21
  CDN_COMMERCIAL_GENERATORS = {
22
22
  cloud: lambda { |bundle, version, path|
23
- domain = bundle == 'ckbox' ? 'ckbox.io' : 'ckeditor.com'
23
+ "https://cdn.ckeditor.com/#{bundle}/#{version}/#{path}"
24
+ },
24
25
 
25
- "https://cdn.#{domain}/#{bundle}/#{version}/#{path}"
26
+ ckbox: lambda { |bundle, version, path|
27
+ "https://cdn.ckbox.io/#{bundle}/#{version}/#{path}"
26
28
  }
27
29
  }.freeze
28
30
 
@@ -31,11 +33,11 @@ module CKEditor5::Rails::Cdn
31
33
  end
32
34
 
33
35
  def create_cdn_url(bundle, version, path)
34
- generator = CDN_THIRD_PARTY_GENERATORS[cdn] || CDN_COMMERCIAL_GENERATORS[cdn] || cdn
36
+ executor = CDN_THIRD_PARTY_GENERATORS[cdn] || CDN_COMMERCIAL_GENERATORS[cdn] || cdn
35
37
 
36
- raise ArgumentError, "Unknown provider: #{cdn}" unless generator
38
+ raise ArgumentError, "Unknown provider: #{cdn}" if executor.blank? || !executor.respond_to?(:call)
37
39
 
38
- generator.call(bundle, version, path)
40
+ executor.call(bundle, version, path)
39
41
  end
40
42
  end
41
43
  end
@@ -56,7 +56,10 @@ module CKEditor5::Rails
56
56
  def ckbox(version = nil, theme: :lark)
57
57
  return @ckbox if version.nil?
58
58
 
59
- @ckbox = { version: version, theme: theme }
59
+ @ckbox = {
60
+ version: version,
61
+ theme: theme
62
+ }
60
63
  end
61
64
 
62
65
  def license_key(license_key = nil)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module CKEditor5
4
4
  module Rails
5
- VERSION = '1.10.0'
5
+ VERSION = '1.11.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ckeditor5
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Bagiński
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-11-19 00:00:00.000000000 Z
12
+ date: 2024-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails