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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9184e1a6bf967675351b71689cfa463a952da108633fe2caea1e34b395982ce5
4
- data.tar.gz: dc3d3788a52f475a98dd261a46e665e2319e484f048160575015a7665a2d1aaa
3
+ metadata.gz: 60fcadf8181318c867cdb47b5baf04d0c3630faf3182145f1d3f37952778aeb9
4
+ data.tar.gz: c04696863a8b29644a37c6782b75dca5317a9bd2d0e166da05ae0cab357f1bc0
5
5
  SHA512:
6
- metadata.gz: 2c32427cf348ec273278e231366caad8bef0b7444ba5fd2212e396c9de57e8d929a75dd7ea3f5deee6f9d9b0eff3bc3cf63736e33ccad09977006306af0c8fc7
7
- data.tar.gz: 6e3ed52c3909d8987a9e7ff0938d1f299b73e5b8d241e61bf00030e41ff7868d8e6a87a4a56a5bdcbdd6de0629e7a670a46014d8a0249ba68846a0bccecc22d0
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CKEditor5
4
4
  module Rails
5
- VERSION = '1.18.1'
5
+ VERSION = '1.18.3'
6
6
 
7
7
  DEFAULT_CKEDITOR_VERSION = '43.3.1'
8
8
  end
@@ -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
- plugin = builder.config[:plugins].first
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.1
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-27 00:00:00.000000000 Z
12
+ date: 2024-11-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails