ckeditor5 1.36.2 → 1.36.3
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 +18 -14
- data/lib/ckeditor5/rails/version.rb +2 -2
- data/spec/e2e/features/ajax_form_integration_spec.rb +2 -5
- data/spec/e2e/features/context_spec.rb +2 -6
- data/spec/e2e/features/editor_types_spec.rb +3 -11
- data/spec/e2e/features/form_integration_spec.rb +1 -2
- data/spec/e2e/spec_helper.rb +1 -0
- data/spec/e2e/support/form_helpers.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f7bbaae8fee579e42642635dc2a378f4b275df97433203dc6b3b29ee339cc080
|
|
4
|
+
data.tar.gz: c4f5260ae103b12a6210a016fe7d6fbdd10b3c7cbb020657a4d24861b021ecf0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 00bcf95c57719c8b8a234fc95e572a7e98dfb8f06b4642fa6e57a1b6907f8fe3e689c220e42da6eea71289e3e6dffd5e394a2eb8af45af6ce308708b73b3920a
|
|
7
|
+
data.tar.gz: 0a4f77254438ead768f41f5a6556de2c013fde3bc53ba5b1623da29272893eef4c6c84043caf53ad608be000e156838993dcb46875a45c1dcda2d7a84209abb7
|
data/README.md
CHANGED
|
@@ -96,7 +96,7 @@ CKEditor5::Rails.configure do
|
|
|
96
96
|
|
|
97
97
|
# Optionally, you can specify version of CKEditor 5 to use.
|
|
98
98
|
# If it's not specified the default version specified in the gem will be used.
|
|
99
|
-
# version '48.0
|
|
99
|
+
# version '48.1.0'
|
|
100
100
|
|
|
101
101
|
# Upload images to the server using the simple upload adapter, instead of Base64 encoding.
|
|
102
102
|
# simple_upload_adapter
|
|
@@ -142,8 +142,12 @@ Explore various editor configurations with the interactive [demo application](ht
|
|
|
142
142
|
To run the demos locally, follow these steps:
|
|
143
143
|
|
|
144
144
|
```bash
|
|
145
|
-
|
|
146
|
-
bundle
|
|
145
|
+
npm install
|
|
146
|
+
bundle install
|
|
147
|
+
|
|
148
|
+
# Start the server
|
|
149
|
+
npm run npm_package:watch
|
|
150
|
+
bundle exec guard -g rails
|
|
147
151
|
```
|
|
148
152
|
|
|
149
153
|
Open [http://localhost:3000/](http://localhost:3000/) in a browser to start experimenting. Modify the code as needed.
|
|
@@ -240,16 +244,16 @@ For extending CKEditor's functionality, refer to the [plugins directory](https:/
|
|
|
240
244
|
|
|
241
245
|
## Presets 🎨
|
|
242
246
|
|
|
243
|
-
Presets are predefined configurations of CKEditor 5, allowing quick setup with specific features. The gem includes a `:default` preset with common features like bold, italic, underline, and link for the classic editor.
|
|
247
|
+
Presets are predefined configurations of CKEditor 5, allowing quick setup with specific features. The gem includes a [`:default`](/lib/ckeditor5/rails/presets/manager.rb) preset with common features like bold, italic, underline, and link for the classic editor.
|
|
244
248
|
|
|
245
|
-
You can create your own by defining it in the `config/initializers/ckeditor5.rb` file using the `config.presets.define` method. The example below illustrates the setup of a custom preset with a classic editor and a custom toolbar:
|
|
249
|
+
You can create your own by defining it in the [`config/initializers/ckeditor5.rb`](/sandbox/config/initializers/ckeditor5.rb) file using the [`config.presets.define`](/lib/ckeditor5/rails/presets/manager.rb) method. The example below illustrates the setup of a custom preset with a classic editor and a custom toolbar:
|
|
246
250
|
|
|
247
251
|
```rb
|
|
248
252
|
# config/initializers/ckeditor5.rb
|
|
249
253
|
|
|
250
254
|
CKEditor5::Rails.configure do
|
|
251
255
|
# It's possible to override the default preset right in the initializer.
|
|
252
|
-
version '48.0
|
|
256
|
+
version '48.1.0'
|
|
253
257
|
|
|
254
258
|
# New presets inherit properties from the default preset defined in the initializer.
|
|
255
259
|
# In this example, the custom preset inherits everything from default but disables the menubar:
|
|
@@ -259,7 +263,7 @@ CKEditor5::Rails.configure do
|
|
|
259
263
|
|
|
260
264
|
# In order to define preset from scratch, you can use the `inherit: false` option.
|
|
261
265
|
presets.define :blank_preset, inherit: false do
|
|
262
|
-
version '48.0
|
|
266
|
+
version '48.1.0'
|
|
263
267
|
|
|
264
268
|
# It tells the integration to fetch the newest security patches and bug fixes.
|
|
265
269
|
# It may be disabled, but it's highly recommended to keep it enabled to avoid
|
|
@@ -292,7 +296,7 @@ CKEditor5::Rails.configure do
|
|
|
292
296
|
end
|
|
293
297
|
```
|
|
294
298
|
|
|
295
|
-
In order to override existing presets, you can use the `presets.override` method. The method takes the name of the preset you want to override and a block with the old configuration. The example below shows how to hide the menubar in the default preset:
|
|
299
|
+
In order to override existing presets, you can use the [`presets.override`](/lib/ckeditor5/rails/presets/manager.rb) method. The method takes the name of the preset you want to override and a block with the old configuration. The example below shows how to hide the menubar in the default preset:
|
|
296
300
|
|
|
297
301
|
```rb
|
|
298
302
|
# config/initializers/ckeditor5.rb
|
|
@@ -308,7 +312,7 @@ CKEditor5::Rails.configure do
|
|
|
308
312
|
end
|
|
309
313
|
```
|
|
310
314
|
|
|
311
|
-
You can define presets in the controller using the `ckeditor5_preset` helper method. See it in the section below ([Controller / View helpers](#controller--view-helpers-)).
|
|
315
|
+
You can define presets in the controller using the [`ckeditor5_preset`](/lib/ckeditor5/rails/editor/helpers/config_helpers.rb) helper method. See it in the section below ([Controller / View helpers](#controller--view-helpers-)).
|
|
312
316
|
|
|
313
317
|
Configuration of the editor can be complex, and it's recommended to use the [CKEditor 5 online builder](https://ckeditor.com/ckeditor-5/online-builder/) to generate the configuration. It allows you to select the features you want to include and generate the configuration code in JavaScript format. Keep in mind that you need to convert the JavaScript configuration to Ruby format before using it in this gem.
|
|
314
318
|
|
|
@@ -383,7 +387,7 @@ Defines the version of CKEditor 5 to be used. The example below shows how to set
|
|
|
383
387
|
CKEditor5::Rails.configure do
|
|
384
388
|
# ... other configuration
|
|
385
389
|
|
|
386
|
-
version '48.0
|
|
390
|
+
version '48.1.0'
|
|
387
391
|
end
|
|
388
392
|
```
|
|
389
393
|
|
|
@@ -395,7 +399,7 @@ In order to disable default patches, you can pass the `apply_patches: false` key
|
|
|
395
399
|
CKEditor5::Rails.configure do
|
|
396
400
|
# ... other configuration
|
|
397
401
|
|
|
398
|
-
version '48.0
|
|
402
|
+
version '48.1.0', apply_patches: false
|
|
399
403
|
end
|
|
400
404
|
```
|
|
401
405
|
|
|
@@ -1375,7 +1379,7 @@ It may be useful when you want to define a preset based on the current user or r
|
|
|
1375
1379
|
class ApplicationController < ActionController::Base
|
|
1376
1380
|
def show
|
|
1377
1381
|
@preset = ckeditor5_preset do
|
|
1378
|
-
version '48.0
|
|
1382
|
+
version '48.1.0'
|
|
1379
1383
|
|
|
1380
1384
|
toolbar :sourceEditing, :|, :bold, :italic, :underline, :strikethrough,
|
|
1381
1385
|
:subscript, :superscript, :removeFormat, :|, :bulletedList, :numberedList,
|
|
@@ -1410,7 +1414,7 @@ If you want to override the preset defined in the initializer, you can search fo
|
|
|
1410
1414
|
class ApplicationController < ActionController::Base
|
|
1411
1415
|
def show
|
|
1412
1416
|
@preset = ckeditor5_preset(:default).override do
|
|
1413
|
-
version '48.0
|
|
1417
|
+
version '48.1.0'
|
|
1414
1418
|
|
|
1415
1419
|
toolbar :sourceEditing, :|, :bold, :italic, :underline, :strikethrough,
|
|
1416
1420
|
:subscript, :superscript, :removeFormat, :|, :bulletedList, :numberedList,
|
|
@@ -1583,7 +1587,7 @@ In that scenario it's recommended to add `gpl` method to the initializer along w
|
|
|
1583
1587
|
|
|
1584
1588
|
CKEditor5::Rails.configure do
|
|
1585
1589
|
gpl
|
|
1586
|
-
version '48.0
|
|
1590
|
+
version '48.1.0'
|
|
1587
1591
|
end
|
|
1588
1592
|
```
|
|
1589
1593
|
|
|
@@ -26,8 +26,7 @@ RSpec.describe 'AJAX Form Integration', type: :feature, js: true do
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it 'validates required fields' do
|
|
29
|
-
editable
|
|
30
|
-
editable.send_keys([[:control, 'a'], :backspace])
|
|
29
|
+
clear_editor_content(editable)
|
|
31
30
|
text_field.set('')
|
|
32
31
|
submit_button.click
|
|
33
32
|
|
|
@@ -38,9 +37,7 @@ RSpec.describe 'AJAX Form Integration', type: :feature, js: true do
|
|
|
38
37
|
it 'submits form and shows response' do
|
|
39
38
|
test_content = "Test content #{Time.now.to_i}"
|
|
40
39
|
|
|
41
|
-
editable
|
|
42
|
-
editable.send_keys([[:control, 'a'], :backspace])
|
|
43
|
-
editable.send_keys(test_content)
|
|
40
|
+
replace_editor_content(editable, test_content)
|
|
44
41
|
|
|
45
42
|
sleep 1
|
|
46
43
|
|
|
@@ -20,14 +20,10 @@ RSpec.describe 'CKEditor5 Context Integration', type: :feature, js: true do
|
|
|
20
20
|
editors = all('.ck-editor__editable', count: 2, wait: 10)
|
|
21
21
|
|
|
22
22
|
# Test first editor
|
|
23
|
-
editors[0]
|
|
24
|
-
editors[0].send_keys([[:control, 'a'], :backspace])
|
|
25
|
-
editors[0].send_keys('Modified Context Item 1')
|
|
23
|
+
replace_editor_content(editors[0], 'Modified Context Item 1')
|
|
26
24
|
|
|
27
25
|
# Test second editor
|
|
28
|
-
editors[1]
|
|
29
|
-
editors[1].send_keys([[:control, 'a'], :backspace])
|
|
30
|
-
editors[1].send_keys('Modified Context Item 2')
|
|
26
|
+
replace_editor_content(editors[1], 'Modified Context Item 2')
|
|
31
27
|
|
|
32
28
|
# Verify content
|
|
33
29
|
expect(editors[0].text).to eq('Modified Context Item 1')
|
|
@@ -29,9 +29,7 @@ RSpec.describe 'CKEditor5 Types Integration', type: :feature, js: true do
|
|
|
29
29
|
JS
|
|
30
30
|
|
|
31
31
|
# Clear editor and type text
|
|
32
|
-
editor
|
|
33
|
-
editor.send_keys([[:control, 'a'], :backspace])
|
|
34
|
-
editor.send_keys('Hello from keyboard!')
|
|
32
|
+
replace_editor_content(editor, 'Hello from keyboard!')
|
|
35
33
|
|
|
36
34
|
# Wait for change events and verify the last one
|
|
37
35
|
eventually do
|
|
@@ -68,12 +66,8 @@ RSpec.describe 'CKEditor5 Types Integration', type: :feature, js: true do
|
|
|
68
66
|
# Test each editable
|
|
69
67
|
expected_data = {}
|
|
70
68
|
editors.each_with_index do |editor, index|
|
|
71
|
-
editor.click
|
|
72
|
-
editor.send_keys([[:control, 'a'], :backspace])
|
|
73
|
-
|
|
74
69
|
content = "Content for #{editables[index]}"
|
|
75
|
-
|
|
76
|
-
editor.send_keys(content)
|
|
70
|
+
replace_editor_content(editor, content)
|
|
77
71
|
expected_data[editables[index]] = "<p>#{content}</p>"
|
|
78
72
|
end
|
|
79
73
|
|
|
@@ -178,9 +172,7 @@ RSpec.describe 'CKEditor5 Types Integration', type: :feature, js: true do
|
|
|
178
172
|
expect(page).to have_css('.ck-editor__editable', minimum: 3, wait: 10)
|
|
179
173
|
|
|
180
174
|
new_editable = find("[name='new-root']")
|
|
181
|
-
new_editable
|
|
182
|
-
new_editable.send_keys([[:control, 'a'], :backspace])
|
|
183
|
-
new_editable.send_keys('Content for new root')
|
|
175
|
+
replace_editor_content(new_editable, 'Content for new root')
|
|
184
176
|
|
|
185
177
|
eventually do
|
|
186
178
|
events = page.evaluate_script('window._newEditableEvents')
|
|
@@ -21,8 +21,7 @@ RSpec.describe 'Form Integration', type: :feature, js: true do
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it 'validates required fields' do
|
|
24
|
-
editable
|
|
25
|
-
editable.send_keys([[:control, 'a'], :backspace])
|
|
24
|
+
clear_editor_content(editable)
|
|
26
25
|
|
|
27
26
|
text_field.set('')
|
|
28
27
|
submit_button.click
|
data/spec/e2e/spec_helper.rb
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module FormHelpers
|
|
4
|
+
def clear_editor_content(editor)
|
|
5
|
+
editor.click
|
|
6
|
+
editor.send_keys([select_all_modifier, :backspace])
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def replace_editor_content(editor, new_content)
|
|
10
|
+
clear_editor_content(editor)
|
|
11
|
+
editor.send_keys(new_content)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def select_all_modifier
|
|
15
|
+
case RbConfig::CONFIG['host_os']
|
|
16
|
+
when /darwin/i
|
|
17
|
+
[:command, 'a']
|
|
18
|
+
else
|
|
19
|
+
[:control, 'a']
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
4
23
|
def setup_form_tracking(driver)
|
|
5
24
|
driver.execute_script <<~JS
|
|
6
25
|
window.lastSubmittedForm = null;
|
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.36.
|
|
4
|
+
version: 1.36.3
|
|
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: 2026-
|
|
12
|
+
date: 2026-05-14 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|