ckeditor5 1.24.1 → 1.24.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: afb2870df1641fcf9fc15b9a7951c80e887991808078d56cc9ec67febad405c3
|
|
4
|
+
data.tar.gz: 725cb66917c42b51c48ecbc41161359ff73e81de17c0a0f95e6ddcc3b58bb7bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5c8729eb7e323a8f240d4877171d64e27a5dab46567921c1372f57b9be635b4eac0d4e9492fd6693b0ef448533ca56a233498fe570866f734f2da5377c4140b3
|
|
7
|
+
data.tar.gz: 3ed9851296ad8cce6282a0c9262120436118552c7166490059bafd29ad82e83f8930c93a3464a780672b4c38aa9468b34a36cf1e8e613cfc34114b8523c22942
|
|
@@ -427,6 +427,29 @@ RSpec.describe CKEditor5::Rails::Cdn::Helpers do
|
|
|
427
427
|
expect(result).to have_tag('script', with: { nonce: 'test-nonce' })
|
|
428
428
|
end
|
|
429
429
|
|
|
430
|
+
context 'event listener' do
|
|
431
|
+
it 'adds event listeners for ckeditor:request-cjs-plugin' do
|
|
432
|
+
result = helper.ckeditor5_inline_plugins_tags(preset)
|
|
433
|
+
|
|
434
|
+
expect(result).to include("window.addEventListener('ckeditor:request-cjs-plugin:Plugin1'")
|
|
435
|
+
expect(result).to include("window.addEventListener('ckeditor:request-cjs-plugin:Plugin2'")
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
it 'adds event listeners only once' do
|
|
439
|
+
result = helper.ckeditor5_inline_plugins_tags(preset)
|
|
440
|
+
|
|
441
|
+
expect(result.scan("window.addEventListener('ckeditor:request-cjs-plugin:Plugin1'").count).to eq(1)
|
|
442
|
+
expect(result.scan("window.addEventListener('ckeditor:request-cjs-plugin:Plugin2'").count).to eq(1)
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
it('each event listener has once option') do
|
|
446
|
+
result = helper.ckeditor5_inline_plugins_tags(preset)
|
|
447
|
+
|
|
448
|
+
expect(result).to include('{ once: true }')
|
|
449
|
+
expect(result.scan('{ once: true }').length).to eq(2)
|
|
450
|
+
end
|
|
451
|
+
end
|
|
452
|
+
|
|
430
453
|
context 'with preset having no inline plugins' do
|
|
431
454
|
let(:empty_preset) do
|
|
432
455
|
CKEditor5::Rails::Presets::PresetBuilder.new do
|
|
@@ -36,3 +36,35 @@ RSpec.describe CKEditor5::Rails::Editor::PropsInlinePlugin do
|
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
|
+
|
|
40
|
+
RSpec.describe CKEditor5::Rails::Editor::InlinePluginWindowInitializer do
|
|
41
|
+
let(:plugin) do
|
|
42
|
+
CKEditor5::Rails::Editor::PropsInlinePlugin.new(:CustomPlugin, 'const plugin = {}')
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
subject(:initializer) { described_class.new(plugin) }
|
|
46
|
+
|
|
47
|
+
describe '#to_html' do
|
|
48
|
+
it 'generates script tag with event listener' do
|
|
49
|
+
result = initializer.to_html
|
|
50
|
+
|
|
51
|
+
expect(result).to be_html_safe
|
|
52
|
+
expect(result).to include('script')
|
|
53
|
+
expect(result).to include("window.addEventListener('ckeditor:request-cjs-plugin:CustomPlugin'")
|
|
54
|
+
expect(result).to include("window['CustomPlugin']")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'adds nonce attribute when provided' do
|
|
58
|
+
result = initializer.to_html(nonce: 'test-nonce')
|
|
59
|
+
|
|
60
|
+
expect(result).to include('nonce="test-nonce"')
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it 'wraps plugin code in event handler' do
|
|
64
|
+
result = initializer.to_html
|
|
65
|
+
|
|
66
|
+
expect(result).to include('const plugin = {}')
|
|
67
|
+
expect(result).to include('{ once: true }')
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
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.24.
|
|
4
|
+
version: 1.24.2
|
|
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-12-
|
|
12
|
+
date: 2024-12-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|