ckeditor5 1.27.3 → 1.28.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 +4 -4
- data/README.md +1 -40
- data/lib/ckeditor5/rails/assets/assets_bundle.rb +22 -4
- data/lib/ckeditor5/rails/cdn/helpers.rb +1 -1
- data/lib/ckeditor5/rails/context/preset_builder.rb +2 -2
- data/lib/ckeditor5/rails/editor/helpers/config_helpers.rb +1 -1
- data/lib/ckeditor5/rails/editor/props_inline_plugin.rb +1 -1
- data/lib/ckeditor5/rails/engine.rb +4 -1
- data/lib/ckeditor5/rails/presets/manager.rb +2 -2
- data/lib/ckeditor5/rails/presets/preset_builder.rb +4 -14
- data/lib/ckeditor5/rails/version.rb +1 -1
- data/spec/lib/ckeditor5/rails/cdn/helpers_spec.rb +2 -2
- data/spec/lib/ckeditor5/rails/presets/manager_spec.rb +2 -2
- data/spec/lib/ckeditor5/rails/presets/preset_builder_spec.rb +1 -16
- metadata +2 -4
- data/lib/ckeditor5/rails/plugins/patches/fix_color_picker_race_condition.rb +0 -51
- data/lib/ckeditor5/rails/plugins.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c28d638338e7bdb2e029d6eb1a81a65126dfbe16b31828563e5d7a0efc3a51e
|
4
|
+
data.tar.gz: c87327aa99851db71ff50f0d12c606c58194b3840a4c13eb99e7ca22c6e87734
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 015fd8f7850a4620aa13d62c8ffee059a417fb8d6e2808f3699753843eb99eeb7c281ee03c949e0bf3458690a406d9854e56190bc0960dd1e2729f4ef56a008b
|
7
|
+
data.tar.gz: 914079678cd53137163f389df3d6a2a42992b7c1f9d84cdd6cd628b878973210eb442de79c5bea4b8cc7e01b0f05534afe0763fdd56534e3c4041c8703d20776
|
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>
|
@@ -32,16 +32,34 @@ module CKEditor5::Rails::Assets
|
|
32
32
|
|
33
33
|
def to_json(*_args)
|
34
34
|
{
|
35
|
-
scripts: scripts.map(&:to_h),
|
36
|
-
stylesheets: stylesheets
|
35
|
+
scripts: unique_scripts(scripts).map(&:to_h),
|
36
|
+
stylesheets: unique_stylesheets(stylesheets)
|
37
37
|
}.to_json
|
38
38
|
end
|
39
39
|
|
40
40
|
def <<(other)
|
41
41
|
raise TypeError, 'other must be an instance of AssetsBundle' unless other.is_a?(AssetsBundle)
|
42
42
|
|
43
|
-
@scripts = scripts + other.scripts
|
44
|
-
@stylesheets = stylesheets + other.stylesheets
|
43
|
+
@scripts = unique_scripts(scripts + other.scripts)
|
44
|
+
@stylesheets = unique_stylesheets(stylesheets + other.stylesheets)
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def unique_scripts(scripts_array)
|
50
|
+
with_url, without_url = scripts_array.partition { |script| script.respond_to?(:url) && script.url }
|
51
|
+
unique_with_url = with_url.uniq { |script| drop_version_from_url(script.url) }
|
52
|
+
unique_with_url + without_url
|
53
|
+
end
|
54
|
+
|
55
|
+
def unique_stylesheets(stylesheets_array)
|
56
|
+
stylesheets_array.uniq { |stylesheet| drop_version_from_url(stylesheet) }
|
57
|
+
end
|
58
|
+
|
59
|
+
def drop_version_from_url(url)
|
60
|
+
url.to_s
|
61
|
+
.gsub(%r{/v?\d+\.\d+\.\d+(-[a-z0-9.]+)?/}, '/')
|
62
|
+
.gsub(%r{@\d+\.\d+\.\d+(-[a-z0-9.]+)?/?}, '')
|
45
63
|
end
|
46
64
|
end
|
47
65
|
|
@@ -12,7 +12,7 @@ module CKEditor5::Rails
|
|
12
12
|
#
|
13
13
|
# @example Basic preset definition
|
14
14
|
# preset = PresetBuilder.new do
|
15
|
-
# version '
|
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 '
|
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 '
|
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 '
|
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 '
|
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
|
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 '
|
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 '
|
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
|
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
|
@@ -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'
|
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'
|
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'
|
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'
|
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'
|
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.
|
4
|
+
version: 1.28.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-03-
|
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'
|