ckeditor5 1.30.0 → 1.31.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3153496741eaf1fd9b8713998c1078e52d96c6e863ffe710d215e7e3b098816
4
- data.tar.gz: 35a1bc0b3e29d51876b4e906a38db93073a65a59ee3ab4436d5e394664bcd833
3
+ metadata.gz: d4d221350919d57a7f3036caa8030667ebe2ce85e1524cc07056c8e117371e5b
4
+ data.tar.gz: 9bbc7f800b867add38920511923aa01dc02a1ba2741d84b4215c92fd4442dd46
5
5
  SHA512:
6
- metadata.gz: 7e7d014c98e5c49572be2d2ccd2affcf57d9d91b0cd4f3ffd1cba2cc6834461075c5262aa112768d43ab5a0a9072dcded1fc7daf50beeb19e039b5ad2ff5b40d
7
- data.tar.gz: a0d7ddf8085a98b4dc9d60e1606b1a9721e3cf9625b24743aca9fba0eb89ca15036b4f1664ed4e9e6c3d98eb6fc0e86b59c80705096a053738d3204c0bcc9063
6
+ metadata.gz: f5778454b1336fddbb72c812d4950b647ab300a30a810eba6c06d2676951ea39482bcf2d805cd2f6bea9e6fe0a0d71c57fd7d3812dbe3c43bbfe6a37100d4731
7
+ data.tar.gz: 75f4692d347dc3b410589d09123fcd94f3e378c759a334166cb727bcc19014c486c51e0d8ba8df9eaa3f5d0ae3e91b41de9f7d1d83f3d2de37dff8c887fe0dd8
data/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  CKEditor 5 Ruby on Rails integration gem. Provides seamless integration of CKEditor 5 with Rails applications through web components and helper methods. This gem supports various editor types, including classic, inline, balloon, and decoupled editors. It also includes support for custom plugins, translations, and configuration options.
12
12
 
13
13
  > [!IMPORTANT]
14
- > This gem is unofficial and not maintained by CKSource. For official CKEditor 5 documentation, visit [ckeditor.com](https://ckeditor.com/docs/ckeditor5/latest/). If you encounter any issues in integration, please report them on the [GitHub repository](https://github.com/Mati365/ckeditor5-rails/issues).
14
+ > This gem is unofficial and not maintained by CKSource. For official CKEditor 5 documentation, visit [ckeditor.com](https://ckeditor.com/docs/ckeditor5/latest/). If you encounter any issues in editor, please report them on the [GitHub repository](https://github.com/ckeditor/ckeditor5/issues).
15
15
 
16
16
  <p align="center">
17
17
  <img src="docs/intro-classic-editor.png" alt="CKEditor 5 Classic Editor in Ruby on Rails application">
@@ -52,9 +52,9 @@ module CKEditor5::Rails::Assets
52
52
  private
53
53
 
54
54
  def window_scripts_tags(nonce: nil)
55
- scripts = bundle.scripts.filter_map do |script|
55
+ scripts = bundle.scripts.map do |script|
56
56
  tag.script(src: script.url, nonce: nonce, crossorigin: 'anonymous') if script.window?
57
- end
57
+ end.compact
58
58
 
59
59
  safe_join(scripts)
60
60
  end
@@ -43,7 +43,7 @@ module CKEditor5::Rails
43
43
  end
44
44
 
45
45
  def translations_js_url_imports
46
- translations.filter_map do |lang|
46
+ translations.map do |lang|
47
47
  next if lang == :en
48
48
 
49
49
  url = create_cdn_url(import_name, version, "translations/#{lang}.js")
@@ -53,7 +53,7 @@ module CKEditor5::Rails
53
53
  import_name: "#{import_name}/translations/#{lang}.js",
54
54
  translation: true
55
55
  )
56
- end
56
+ end.compact
57
57
  end
58
58
  end
59
59
  end
@@ -4,13 +4,11 @@ module CKEditor5::Rails
4
4
  module Cdn::Concerns
5
5
  module BundleBuilder
6
6
  def create_preset_bundle(preset)
7
- preset => {
8
- cdn:,
9
- version:,
10
- translations:,
11
- ckbox:,
12
- premium:
13
- }
7
+ cdn = preset.cdn
8
+ version = preset.version
9
+ translations = preset.translations
10
+ ckbox = preset.ckbox
11
+ premium = preset.premium
14
12
 
15
13
  bundle = build_base_cdn_bundle(cdn, version, translations)
16
14
  bundle << build_premium_cdn_bundle(cdn, version, translations) if premium
@@ -30,9 +30,14 @@ module CKEditor5::Rails::Editor
30
30
 
31
31
  def to_attributes
32
32
  {
33
- type: EDITOR_TYPES[@type],
34
- **serialized_attributes
33
+ bundle: bundle.to_json,
34
+ plugins: serialize_plugins,
35
+ config: serialize_config,
36
+ watchdog: watchdog,
37
+ type: EDITOR_TYPES[@type]
35
38
  }
39
+ .merge(editable_height ? { 'editable-height': editable_height } : {})
40
+ .transform_keys(&:to_sym)
36
41
  end
37
42
 
38
43
  def self.valid_editor_type?(type)
@@ -43,16 +48,6 @@ module CKEditor5::Rails::Editor
43
48
 
44
49
  attr_reader :bundle, :watchdog, :type, :config, :editable_height
45
50
 
46
- def serialized_attributes
47
- {
48
- bundle: bundle.to_json,
49
- plugins: serialize_plugins,
50
- config: serialize_config,
51
- watchdog: watchdog
52
- }
53
- .merge(editable_height ? { 'editable-height' => editable_height } : {})
54
- end
55
-
56
51
  def serialize_plugins
57
52
  (config[:plugins] || []).map { |plugin| PropsBasePlugin.normalize(plugin).to_h }.to_json
58
53
  end
@@ -5,7 +5,7 @@ require_relative '../editor/props_inline_plugin'
5
5
  module CKEditor5::Rails::Plugins
6
6
  class CustomTranslationsLoader < CKEditor5::Rails::Editor::PropsInlinePlugin
7
7
  def initialize(translations, **kwargs) # rubocop:disable Metrics/MethodLength
8
- code = <<~JS.freeze
8
+ code = <<~JS
9
9
  const { Plugin } = await import('ckeditor5');
10
10
 
11
11
  function resolveTranslationReferences(uiLanguage, config, visited = new WeakSet()) {
@@ -37,12 +37,6 @@ module CKEditor5::Rails
37
37
  instance_eval(&block) if block_given?
38
38
  end
39
39
 
40
- def deconstruct_keys(keys)
41
- keys.index_with do |key|
42
- public_send(key)
43
- end
44
- end
45
-
46
40
  # @example Copy preset and modify it
47
41
  # original = PresetBuilder.new
48
42
  # copied = original.initialize_copy(original)
@@ -20,8 +20,7 @@ module CKEditor5::Rails::Presets
20
20
  # group = Group.new('Emoji', label: 'Emoticons')
21
21
  # group.item('smiley', '😊')
22
22
  class Group
23
- attr_reader :name, :label
24
- private attr_reader :items
23
+ attr_reader :name, :label, :items
25
24
 
26
25
  # Initialize a new special characters group
27
26
  #
@@ -3,7 +3,7 @@
3
3
  module CKEditor5
4
4
  module Rails
5
5
  class Semver
6
- SEMVER_PATTERN = /\A\d+\.\d+\.\d+\z/
6
+ SEMVER_PATTERN = /\A\d+\.\d+\.\d+\z/.freeze
7
7
 
8
8
  attr_reader :major, :minor, :patch
9
9
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CKEditor5
4
4
  module Rails
5
- VERSION = '1.30.0'
5
+ VERSION = '1.31.1'
6
6
 
7
7
  DEFAULT_CKEDITOR_VERSION = '45.0.0'
8
8
  end
@@ -47,4 +47,4 @@ RSpec.configure do |config|
47
47
  end
48
48
  end
49
49
 
50
- Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require f }
50
+ Dir[File.expand_path('support/**/*.rb', __dir__)].sort.each { |f| require f }
@@ -202,17 +202,6 @@ RSpec.describe CKEditor5::Rails::Cdn::Helpers do
202
202
  end
203
203
  end
204
204
 
205
- context 'with missing required parameters' do
206
- before do
207
- allow(helper).to receive(:merge_with_editor_preset).and_return({})
208
- end
209
-
210
- it 'raises error about missing required parameters' do
211
- expect { helper.ckeditor5_assets(preset: :default) }
212
- .to raise_error(NoMatchingPatternKeyError)
213
- end
214
- end
215
-
216
205
  context 'destructure non-matching preset override' do
217
206
  before do
218
207
  RSpec::Mocks.space.proxy_for(CKEditor5::Rails::Engine).reset
@@ -36,7 +36,7 @@ RSpec.describe CKEditor5::Rails::Editor::Props do
36
36
  subject(:props) { described_class.new(type, config, bundle: bundle, editable_height: '500px') }
37
37
 
38
38
  it 'includes editable-height attribute' do
39
- expect(props.to_attributes['editable-height']).to eq('500px')
39
+ expect(props.to_attributes[:'editable-height']).to eq('500px')
40
40
  end
41
41
  end
42
42
 
@@ -77,12 +77,12 @@ RSpec.describe CKEditor5::Rails::Editor::Props do
77
77
 
78
78
  it 'accepts integer values' do
79
79
  props = described_class.new(type, config, bundle: bundle, editable_height: 500)
80
- expect(props.to_attributes['editable-height']).to eq('500px')
80
+ expect(props.to_attributes[:'editable-height']).to eq('500px')
81
81
  end
82
82
 
83
83
  it 'accepts pixel string values' do
84
84
  props = described_class.new(type, config, bundle: bundle, editable_height: '500px')
85
- expect(props.to_attributes['editable-height']).to eq('500px')
85
+ expect(props.to_attributes[:'editable-height']).to eq('500px')
86
86
  end
87
87
 
88
88
  it 'raises error for invalid values' do
data/spec/spec_helper.rb CHANGED
@@ -34,7 +34,7 @@ require 'rspec/rails'
34
34
  require 'rspec/expectations'
35
35
  require 'rspec-html-matchers'
36
36
 
37
- Dir[File.expand_path('support/**/*.rb', __dir__)].each { |f| require f }
37
+ Dir[File.expand_path('support/**/*.rb', __dir__)].sort.each { |f| require f }
38
38
 
39
39
  Rails.application.initialize! unless Rails.application.initialized?
40
40
 
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.30.0
4
+ version: 1.31.1
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: 2025-04-11 00:00:00.000000000 Z
12
+ date: 2025-05-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -17,7 +17,7 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '6.0'
20
+ version: '5.2'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
23
  version: '9.0'
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- version: '6.0'
30
+ version: '5.2'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '9.0'
@@ -163,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: 3.0.0
166
+ version: 2.5.0
167
167
  required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  requirements:
169
169
  - - ">="