ckeditor5 1.27.2 → 1.28.0

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: 33d6497e8df86eb181f2ef10d462941c777e42a1896c8fd972c957383cdbda3b
4
- data.tar.gz: d4a752edc043709ae4cf442ba65a276d44a5296a0fbd4e040370656fa383164f
3
+ metadata.gz: 39c0b30fe11a1a335c30f52c445b61480286c61271c74114989f1cca4bed2ef7
4
+ data.tar.gz: 2b11f4b5e0a642fd277b05113f4e01bf0549be9ae99106b0bbf300e6f9b709ab
5
5
  SHA512:
6
- metadata.gz: 1748af28f3bbfb57eff0ef29d59e309ee0a8a16909e789f6ae6b861ef5cfc40ff8aa2d433851a8f365ee2186000e117df957749362648f253b494a884a7d3690
7
- data.tar.gz: 04bc6c662455fb4393b429843f00a4f75e91ee30c54eb68fc16394ba32d09dfc023b530ea801558dbe3dfa9311bb637010cc9da8c43351749d9ee9a82ae61402
6
+ metadata.gz: 95dbd7fdd830669bd3e9598cfd99ae59455080b49a990c04bc52c4aa3ff79d76875fff04d02375540e293c64c0b51cf6b687df7d1524c7d825fbef7bffe38ee3
7
+ data.tar.gz: 827c5a2e54a22d9d6be3fdf41d5fe51537b94667769e1dae5cfa9b0cc80075b3a16496c9d1ac3c147002ab1e8bb807551cbe085c76b3e13f1a0336287a2d2e6f
data/README.md CHANGED
@@ -127,6 +127,7 @@ For extending CKEditor's functionality, refer to the [plugins directory](https:/
127
127
  - [Available Configuration Methods ⚙️](#available-configuration-methods-️)
128
128
  - [`cdn(cdn = nil, &block)` method](#cdncdn--nil-block-method)
129
129
  - [`version(version, apply_patches: true)` method](#versionversion-apply_patches-true-method)
130
+ - [`automatic_upgrades(enabled: true)` method](#automatic_upgradesenabled-true-method)
130
131
  - [`gpl` method](#gpl-method)
131
132
  - [`license_key(key)` method](#license_keykey-method)
132
133
  - [`premium` method](#premium-method)
@@ -145,7 +146,6 @@ For extending CKEditor's functionality, refer to the [plugins directory](https:/
145
146
  - [`inline_plugin(name, code)` method](#inline_pluginname-code-method)
146
147
  - [`external_plugin(name, script:, import_as: nil, window_name: nil, stylesheets: [])` method](#external_pluginname-script-import_as-nil-window_name-nil-stylesheets--method)
147
148
  - [`patch_plugin(plugin)`](#patch_pluginplugin)
148
- - [`apply_integration_patches` method](#apply_integration_patches-method)
149
149
  - [`simple_upload_adapter(url)` method](#simple_upload_adapterurl-method)
150
150
  - [`special_characters(&block)` method](#special_charactersblock-method)
151
151
  - [`wproofreader(version: nil, cdn: nil, **config)` method](#wproofreaderversion-nil-cdn-nil-config-method)
@@ -346,22 +346,6 @@ CKEditor5::Rails.configure do
346
346
  end
347
347
  ```
348
348
 
349
- In order to disable default patches, you can pass the `apply_patches: false` keyword argument to the `version` method.
350
-
351
- ```rb
352
- # config/initializers/ckeditor5.rb
353
-
354
- CKEditor5::Rails.configure do
355
- # ... other configuration
356
-
357
- version '44.3.0', apply_patches: false
358
- end
359
- ```
360
-
361
- The patches are defined in the `lib/ckeditor5/rails/plugins/patches` directory. If you want to apply custom patches, you can use the `patch_plugin` method.
362
-
363
- ```rb
364
-
365
349
  </details>
366
350
 
367
351
  #### `automatic_upgrades(enabled: true)` method
@@ -1053,29 +1037,6 @@ end
1053
1037
  ```
1054
1038
  </details>
1055
1039
 
1056
- #### `apply_integration_patches` method
1057
-
1058
- <details>
1059
- <summary>Apply patches to the specific versions of CKEditor 5</summary>
1060
-
1061
- <br />
1062
-
1063
- Defines a method that applies patches to the specific versions of CKEditor 5. The example below shows how to apply patches to the `44.1.0` version:
1064
-
1065
- ```rb
1066
- # config/initializers/ckeditor5.rb
1067
-
1068
- CKEditor5::Rails.configure do
1069
- # ... other configuration
1070
-
1071
- apply_integration_patches
1072
- end
1073
- ```
1074
-
1075
- It's useful when you want to apply patches to the specific versions of CKEditor 5. The patches are defined in the `lib/ckeditor5/rails/plugins/patches` directory.
1076
-
1077
- </details>
1078
-
1079
1040
  #### `simple_upload_adapter(url)` method
1080
1041
 
1081
1042
  <details>
@@ -20,9 +20,11 @@ module CKEditor5::Rails
20
20
  Engine.presets.to_h.values.flat_map { |p| p.plugins.items }
21
21
  end
22
22
 
23
- initializers = plugins.filter_map do |plugin|
24
- next unless plugin.is_a?(Editor::PropsInlinePlugin)
25
-
23
+ # Filter inline plugins and deduplicate by name in one chain
24
+ initializers = plugins
25
+ .select { |plugin| plugin.is_a?(Editor::PropsInlinePlugin) }
26
+ .uniq(&:name)
27
+ .map do |plugin|
26
28
  Editor::InlinePluginWindowInitializer.new(plugin).to_html(
27
29
  nonce: content_security_policy_nonce
28
30
  )
@@ -55,7 +55,7 @@ module CKEditor5::Rails
55
55
  #
56
56
  # @example Using preset builder object
57
57
  # <% @preset = ckeditor5_preset do
58
- # version '43.3.1'
58
+ # version '44.3.0'
59
59
  # toolbar :bold, :italic
60
60
  # plugins :Bold, :Italic
61
61
  # end %>
@@ -12,7 +12,7 @@ module CKEditor5::Rails
12
12
  #
13
13
  # @example Basic preset definition
14
14
  # preset = PresetBuilder.new do
15
- # version '43.3.1'
15
+ # version '44.3.0'
16
16
  # gpl
17
17
  # type :classic
18
18
  # toolbar :bold, :italic
@@ -35,7 +35,7 @@ module CKEditor5::Rails
35
35
  # @param block [Proc] Optional configuration block
36
36
  # @example Initialize with block
37
37
  # PresetBuilder.new do
38
- # version '43.3.1'
38
+ # version '44.3.0'
39
39
  # toolbar :bold, :italic
40
40
  # end
41
41
  def initialize(&block)
@@ -44,7 +44,7 @@ module CKEditor5::Rails::Editor::Helpers
44
44
  #
45
45
  # @example Creating a custom preset in controller
46
46
  # @preset = ckeditor5_preset do
47
- # version '43.3.1'
47
+ # version '44.3.0'
48
48
  # toolbar :sourceEditing, :|, :bold, :italic
49
49
  # plugins :Essentials, :Paragraph, :Bold, :Italic
50
50
  # end
@@ -3,7 +3,10 @@
3
3
  require 'rails/engine'
4
4
 
5
5
  require_relative 'presets/manager'
6
- require_relative 'plugins'
6
+ require_relative 'plugins/simple_upload_adapter'
7
+ require_relative 'plugins/wproofreader'
8
+ require_relative 'plugins/special_characters_bootstrap'
9
+ require_relative 'plugins/custom_translations_loader'
7
10
 
8
11
  module CKEditor5::Rails
9
12
  class PresetNotFoundError < ArgumentError; end
@@ -27,7 +27,7 @@ module CKEditor5::Rails::Presets
27
27
  # end
28
28
  # @example Define preset from scratch
29
29
  # presets.define :blank, inherit: false do
30
- # version '43.3.1'
30
+ # version '44.3.0'
31
31
  # gpl
32
32
  # type :classic
33
33
  # end
@@ -78,7 +78,7 @@ module CKEditor5::Rails::Presets
78
78
  # @example Basic configuration
79
79
  # CKEditor5::Rails.configure do
80
80
  # presets.define :default do
81
- # version '43.3.1'
81
+ # version '44.3.0'
82
82
  # gpl
83
83
  # type :classic
84
84
  # menubar
@@ -6,14 +6,14 @@ require_relative 'special_characters_builder'
6
6
 
7
7
  module CKEditor5::Rails
8
8
  module Presets
9
- class PresetBuilder # rubocop:disable Metrics/ClassLength
9
+ class PresetBuilder
10
10
  include Editor::Helpers::Config
11
11
  include Concerns::ConfigurationMethods
12
12
  include Concerns::PluginMethods
13
13
 
14
14
  # @example Basic initialization
15
15
  # PresetBuilder.new do
16
- # version '43.3.1'
16
+ # version '44.3.0'
17
17
  # gpl
18
18
  # type :classic
19
19
  # end
@@ -174,15 +174,12 @@ module CKEditor5::Rails
174
174
 
175
175
  # Set or get editor version
176
176
  # @param version [String, nil] Editor version to set
177
- # @param apply_patches [Boolean] Whether to apply integration patches after setting version
178
177
  # @example Set specific version
179
- # version '43.3.1'
180
- # @example Set version without applying patches
181
- # version '43.3.1', apply_patches: false
178
+ # version '44.3.0'
182
179
  # @example Get current version
183
180
  # version # => "43.3.1"
184
181
  # @return [String, nil] Current version string or nil if not set
185
- def version(version = nil, apply_patches: true)
182
+ def version(version = nil)
186
183
  return @version&.to_s if version.nil?
187
184
 
188
185
  if @automatic_upgrades && version
@@ -195,13 +192,6 @@ module CKEditor5::Rails
195
192
  # If there is no license key set, and the version if newer than 44.0.0, switch to GPL
196
193
  # as the license key is now required in all versions
197
194
  gpl if license_key.nil? && @version.major >= 44
198
- apply_integration_patches if apply_patches
199
- end
200
-
201
- # Apply integration patches for the current version
202
- # @return [void]
203
- def apply_integration_patches
204
- patch_plugin(Plugins::Patches::FixColorPickerRaceCondition.new)
205
195
  end
206
196
 
207
197
  # Enable or disable automatic version upgrades
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CKEditor5
4
4
  module Rails
5
- VERSION = '1.27.2'
5
+ VERSION = '1.28.0'
6
6
 
7
7
  DEFAULT_CKEDITOR_VERSION = '44.3.0'
8
8
  end
@@ -20,7 +20,7 @@ RSpec.describe CKEditor5::Rails::Cdn::Helpers do
20
20
  let(:helper) { test_class.new }
21
21
  let(:preset) do
22
22
  CKEditor5::Rails::Presets::PresetBuilder.new do
23
- version '34.1.0', apply_patches: false
23
+ version '34.1.0'
24
24
  type :classic
25
25
  translations :pl
26
26
  cdn :cloud
@@ -151,7 +151,7 @@ RSpec.describe CKEditor5::Rails::Cdn::Helpers do
151
151
  context 'when overriding preset values' do
152
152
  let(:preset) do
153
153
  CKEditor5::Rails::Presets::PresetBuilder.new do
154
- version '34.1.0', apply_patches: false
154
+ version '34.1.0'
155
155
  type :classic
156
156
  language :pl
157
157
  cdn :cloud
@@ -20,7 +20,7 @@ RSpec.describe CKEditor5::Rails::Presets::Manager do
20
20
  it 'creates new preset based on default' do
21
21
  manager.define(:custom) do
22
22
  automatic_upgrades enabled: false
23
- version '36.0.0', apply_patches: false
23
+ version '36.0.0'
24
24
  end
25
25
 
26
26
  expect(manager[:custom].version).to eq('36.0.0')
@@ -32,7 +32,7 @@ RSpec.describe CKEditor5::Rails::Presets::Manager do
32
32
  it 'creates completely new preset' do
33
33
  manager.define(:custom, inherit: false) do
34
34
  automatic_upgrades enabled: false
35
- version '36.0.0', apply_patches: false
35
+ version '36.0.0'
36
36
  end
37
37
 
38
38
  expect(manager[:custom].version).to eq('36.0.0')
@@ -709,7 +709,7 @@ RSpec.describe CKEditor5::Rails::Presets::PresetBuilder do
709
709
  it 'applies patch when applicable' do
710
710
  allow(patch_plugin).to receive(:applicable_for_version?).and_return(true)
711
711
 
712
- builder.version('35.0.0', apply_patches: false)
712
+ builder.version('35.0.0')
713
713
  builder.patch_plugin(patch_plugin)
714
714
 
715
715
  plugin_names = builder.config[:plugins].map(&:name)
@@ -733,19 +733,4 @@ RSpec.describe CKEditor5::Rails::Presets::PresetBuilder do
733
733
  expect(plugin_names).to include(:TestPatch)
734
734
  end
735
735
  end
736
-
737
- describe '#apply_integration_patches' do
738
- it 'applies known integration patches' do
739
- builder.version('35.0.0', apply_patches: false)
740
- expect { builder.apply_integration_patches }
741
- .to change { builder.config[:plugins].count }
742
- .by(1)
743
- end
744
-
745
- it 'apply patches when version is not set' do
746
- expect { builder.apply_integration_patches }
747
- .to change { builder.config[:plugins].count }
748
- .by(1)
749
- end
750
- end
751
736
  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.27.2
4
+ version: 1.28.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: 2025-03-06 00:00:00.000000000 Z
12
+ date: 2025-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -89,9 +89,7 @@ files:
89
89
  - lib/ckeditor5/rails/hooks/form.rb
90
90
  - lib/ckeditor5/rails/hooks/importmap.rb
91
91
  - lib/ckeditor5/rails/hooks/simple_form.rb
92
- - lib/ckeditor5/rails/plugins.rb
93
92
  - lib/ckeditor5/rails/plugins/custom_translations_loader.rb
94
- - lib/ckeditor5/rails/plugins/patches/fix_color_picker_race_condition.rb
95
93
  - lib/ckeditor5/rails/plugins/simple_upload_adapter.rb
96
94
  - lib/ckeditor5/rails/plugins/special_characters_bootstrap.rb
97
95
  - lib/ckeditor5/rails/plugins/wproofreader.rb
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../editor/props_patch_plugin'
4
-
5
- module CKEditor5::Rails::Plugins::Patches
6
- # Fixes focus management issues in the CKEditor5 color picker component
7
- # by ensuring proper focus handling when the color picker is opened.
8
- #
9
- # The patch modifies the ColorPickerView's focus behavior to properly
10
- # focus either the hex input field (when visible) or the first slider.
11
- #
12
- # @see https://github.com/ckeditor/ckeditor5/issues/17069
13
- class FixColorPickerRaceCondition < CKEditor5::Rails::Editor::PropsPatchPlugin
14
- PLUGIN_CODE = <<~JS
15
- const { Plugin, ColorPickerView, debounce } = await import( 'ckeditor5' );
16
-
17
- return class FixColorPickerRaceCondition extends Plugin {
18
- static get pluginName() {
19
- return 'FixColorPickerRaceCondition';
20
- }
21
-
22
- constructor(editor) {
23
- super(editor);
24
- this.editor = editor;
25
- this.#applyPatch();
26
- }
27
-
28
- #applyPatch() {
29
- const { focus } = ColorPickerView.prototype;
30
-
31
- ColorPickerView.prototype.focus = function() {
32
- try {
33
- if (!this._config.hideInput) {
34
- this.hexInputRow.children.get( 1 ).focus();
35
- }
36
-
37
- this.slidersView.first.focus();
38
- } catch (error) {
39
- focus.apply(this, arguments);
40
- }
41
- }
42
- }
43
- }
44
- JS
45
-
46
- def initialize
47
- super(:FixColorPickerRaceCondition, PLUGIN_CODE, max_version: '44.4.0')
48
- compress!
49
- end
50
- end
51
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module CKEditor5::Rails::Plugins
4
- module Patches
5
- end
6
- end
7
-
8
- # Core plugins
9
- require_relative 'plugins/simple_upload_adapter'
10
- require_relative 'plugins/wproofreader'
11
- require_relative 'plugins/special_characters_bootstrap'
12
- require_relative 'plugins/custom_translations_loader'
13
-
14
- # Plugin patches and fixes
15
- require_relative 'plugins/patches/fix_color_picker_race_condition'