ckeditor5 1.18.1 → 1.18.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ckeditor5/rails/assets/webcomponents/components/editor.mjs +5 -0
- data/lib/ckeditor5/rails/plugins/wproofreader.rb +40 -0
- data/lib/ckeditor5/rails/presets/preset_builder.rb +4 -1
- data/lib/ckeditor5/rails/version.rb +1 -1
- data/spec/lib/ckeditor5/rails/presets/preset_builder_spec.rb +6 -1
- 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: 60fcadf8181318c867cdb47b5baf04d0c3630faf3182145f1d3f37952778aeb9
|
4
|
+
data.tar.gz: c04696863a8b29644a37c6782b75dca5317a9bd2d0e166da05ae0cab357f1bc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d13f472504a89a4a8ebc13caa463546995ac8592da03aba6ec52a85705990e0cf5c4b8582cccf143ee560541406db5ca449782e22642c57cf0d91beeeaa4edd3
|
7
|
+
data.tar.gz: 7c2f98547ea4a7044f73ec6017f35dadae2842aa61ea91ba7961ec0e114cb81491c5e30dc90c1ec964d394e3e49b1b6a28beaeed24a3264154e4d9a6e3bc7cee
|
@@ -294,6 +294,11 @@ class CKEditorComponent extends HTMLElement {
|
|
294
294
|
instance = await Editor.create(content, config);
|
295
295
|
}
|
296
296
|
|
297
|
+
console.warn('CKEditor initialized:', {
|
298
|
+
instance,
|
299
|
+
watchdog, config: instance.config._config,
|
300
|
+
});
|
301
|
+
|
297
302
|
return {
|
298
303
|
contextId,
|
299
304
|
instance,
|
@@ -22,4 +22,44 @@ module CKEditor5::Rails::Plugins
|
|
22
22
|
)
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
# Sync I18n language from editor to WProofreader plugin
|
27
|
+
class WProofreaderSync < CKEditor5::Rails::Editor::PropsInlinePlugin
|
28
|
+
PLUGIN_CODE = <<~JS
|
29
|
+
const CORRECTION_LANGUAGES = [
|
30
|
+
'en_US', 'en_GB', 'pt_BR', 'da_DK',
|
31
|
+
'nl_NL', 'en_CA', 'fi_FI', 'fr_FR',
|
32
|
+
'fr_CA', 'de_DE', 'el_GR', 'it_IT',
|
33
|
+
'nb_NO', 'pt_PT', 'es_ES', 'sv_SE',
|
34
|
+
'uk_UA', 'auto'
|
35
|
+
];
|
36
|
+
|
37
|
+
export default function WProofreaderSync(editor) {
|
38
|
+
const wproofreaderConfig = editor.config.get('wproofreader');
|
39
|
+
const editorLangCode = (() => {
|
40
|
+
const config = editor.config.get('language');
|
41
|
+
|
42
|
+
return config.content || config.ui;
|
43
|
+
})();
|
44
|
+
|
45
|
+
if (!wproofreaderConfig || !editorLangCode) {
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
|
49
|
+
const lang = CORRECTION_LANGUAGES.find(
|
50
|
+
lang => lang.startsWith(editorLangCode.toLowerCase())
|
51
|
+
) || 'auto';
|
52
|
+
|
53
|
+
editor.config.set('wproofreader', {
|
54
|
+
lang,
|
55
|
+
localization: editorLangCode,
|
56
|
+
...wproofreaderConfig,
|
57
|
+
});
|
58
|
+
}
|
59
|
+
JS
|
60
|
+
|
61
|
+
def initialize
|
62
|
+
super(:WProofreaderSync, PLUGIN_CODE)
|
63
|
+
end
|
64
|
+
end
|
25
65
|
end
|
@@ -205,8 +205,11 @@ module CKEditor5::Rails
|
|
205
205
|
end
|
206
206
|
|
207
207
|
def wproofreader(version: nil, cdn: nil, **config)
|
208
|
-
plugin(Plugins::WProofreader.new(version: version, cdn: cdn))
|
209
208
|
configure :wproofreader, config
|
209
|
+
plugins do
|
210
|
+
prepend Plugins::WProofreaderSync.new
|
211
|
+
append Plugins::WProofreader.new(version: version, cdn: cdn)
|
212
|
+
end
|
210
213
|
end
|
211
214
|
|
212
215
|
private
|
@@ -384,7 +384,12 @@ RSpec.describe CKEditor5::Rails::Presets::PresetBuilder do
|
|
384
384
|
describe 'wproofreader' do
|
385
385
|
it 'configures WProofreader plugin' do
|
386
386
|
builder.wproofreader(version: '1.0.0', cdn: 'https://cdn.example.com')
|
387
|
-
|
387
|
+
|
388
|
+
sync_plugin = builder.config[:plugins].first
|
389
|
+
|
390
|
+
expect(sync_plugin).to be_a(CKEditor5::Rails::Plugins::WProofreaderSync)
|
391
|
+
|
392
|
+
plugin = builder.config[:plugins].last
|
388
393
|
|
389
394
|
expect(plugin).to be_a(CKEditor5::Rails::Editor::PropsExternalPlugin)
|
390
395
|
expect(plugin.name).to eq(:WProofreader)
|
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.18.
|
4
|
+
version: 1.18.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: 2024-11-
|
12
|
+
date: 2024-11-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|