ckeditor5 1.17.2 → 1.17.4

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: 789a4ca2ac0428fa31866a6fd99433577137e9ccbe64e321e86c20126814dc80
4
- data.tar.gz: f4d3bc6f16777dd8dc03c4e62aada4c772021fc72bc99eeecbc668ac0dcc39b6
3
+ metadata.gz: 882d02a7893248e643ac6549d344940b08c946ef9e64193ca227551f4a9ed174
4
+ data.tar.gz: d6e17a5e168c474c76f53b1be819c5a3248b46cb41e6144097088123aefeba6f
5
5
  SHA512:
6
- metadata.gz: '02238ab74fc9982f48177b33bc20b59332ca58f9cb594868649e72ec5e504760d41e5a0ce4afee0cbeb5463335e34fb4303e5e30fd6b21abd96968a017ba715f'
7
- data.tar.gz: f4a331e7b9afca50f1063626a73c083ed521521333e7492eaf252bd30a360b435459fe5a8d321c4b5a4355c291272c2ee352a01bbd15d8c916434222fbdaa804
6
+ metadata.gz: 48ded629378991aa8fac441598dac72a8006dd7cf11c094ac910eb0fe295bc099594dc36921563a37796132b483b05d74dba5f760980d1ce7d833ba0f33fb182
7
+ data.tar.gz: 6ebf7b52994e7da6b52922f7cb970260deee6cc65c0a0e87f136f768e9d0abc5180431f2350a3608d22962ae888e58bf7bf410e2c310ff25fdde88dcdcc1c49e
@@ -43,7 +43,9 @@ module CKEditor5::Rails
43
43
  end
44
44
 
45
45
  def translations_js_url_imports
46
- translations.map do |lang|
46
+ translations.filter_map do |lang|
47
+ next if lang == :en
48
+
47
49
  url = create_cdn_url(import_name, version, "translations/#{lang}.js")
48
50
 
49
51
  Assets::JSUrlImportMeta.new(
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CKEditor5
4
4
  module Rails
5
- VERSION = '1.17.2'
5
+ VERSION = '1.17.4'
6
6
 
7
7
  DEFAULT_CKEDITOR_VERSION = '43.3.1'
8
8
  end
@@ -2,46 +2,53 @@
2
2
 
3
3
  require 'e2e/spec_helper'
4
4
 
5
+ TRANSLATIONS = {
6
+ 'en' => { 'Edit' => 'Edit', 'Insert' => 'Insert', 'Format' => 'Format' },
7
+ 'pl' => { 'Edit' => 'Zmiana', 'Insert' => 'Wstaw', 'Format' => 'Format' },
8
+ 'es' => { 'Edit' => 'Editar', 'Insert' => 'Insertar', 'Format' => 'Formato' },
9
+ 'ru' => { 'Edit' => 'Редактировать', 'Insert' => 'Вставить', 'Format' => 'Формат' },
10
+ 'de' => { 'Edit' => 'Bearbeiten', 'Insert' => 'Einfügen', 'Format' => 'Format' }
11
+ }.freeze
12
+
5
13
  RSpec.describe 'Editor localization', type: :system do
6
- describe 'setting locale via assets' do
7
- it 'displays menubar in Polish' do
8
- visit '/locale_via_assets'
14
+ shared_examples 'localized editor' do |locale|
15
+ it "displays menubar in #{locale}" do
16
+ visit path
9
17
 
10
18
  expect(page).to have_css('.ck-editor__main')
11
19
 
12
20
  within('.ck-menu-bar') do
13
- expect(page).to have_content('Zmiana')
14
- expect(page).to have_content('Wstaw')
15
- expect(page).to have_content('Format')
21
+ TRANSLATIONS[locale].each_value do |translation|
22
+ expect(page).to have_content(translation)
23
+ end
16
24
  end
17
25
  end
18
26
  end
19
27
 
20
- describe 'setting locale via editor prop' do
21
- it 'displays menubar in Spanish' do
22
- visit '/locale_via_editor'
23
-
24
- expect(page).to have_css('.ck-editor__main')
28
+ describe 'setting locale via assets' do
29
+ let(:path) { '/locale_via_assets' }
30
+ it_behaves_like 'localized editor', 'pl'
31
+ end
25
32
 
26
- within('.ck-menu-bar') do
27
- expect(page).to have_content('Editar')
28
- expect(page).to have_content('Insertar')
29
- expect(page).to have_content('Formato')
30
- end
31
- end
33
+ describe 'setting locale via editor prop' do
34
+ let(:path) { '/locale_via_editor' }
35
+ it_behaves_like 'localized editor', 'es'
32
36
  end
33
37
 
34
38
  describe 'setting locale via preset' do
35
- it 'displays menubar in Russian' do
36
- visit '/locale_via_preset'
39
+ let(:path) { '/locale_via_preset' }
40
+ it_behaves_like 'localized editor', 'ru'
41
+ end
37
42
 
38
- expect(page).to have_css('.ck-editor__main')
43
+ describe 'setting locale via Rails I18n' do
44
+ context 'using default I18n.locale' do
45
+ let(:path) { '/locale_via_rails_i18n' }
46
+ it_behaves_like 'localized editor', 'en'
47
+ end
39
48
 
40
- within('.ck-menu-bar') do
41
- expect(page).to have_content('Редактировать')
42
- expect(page).to have_content('Вставить')
43
- expect(page).to have_content('Формат')
44
- end
49
+ context 'using custom I18n.locale' do
50
+ let(:path) { '/locale_via_rails_i18n?locale=de' }
51
+ it_behaves_like 'localized editor', 'de'
45
52
  end
46
53
  end
47
54
  end
@@ -58,6 +58,28 @@ RSpec.describe CKEditor5::Rails::Cdn::CKEditorBundle do
58
58
  "#{cdn}/npm/#{import_name}@#{version}/build/translations/de.js"
59
59
  )
60
60
  end
61
+
62
+ context 'when handling English translation' do
63
+ before { bundle.translations << :en }
64
+
65
+ it 'excludes English translation file' do
66
+ translation_urls = bundle.scripts.select(&:translation?).map(&:url)
67
+ expect(translation_urls).not_to include(
68
+ "#{cdn}/npm/#{import_name}@#{version}/build/translations/en.js"
69
+ )
70
+ end
71
+ end
72
+
73
+ context 'when adding additional translations' do
74
+ before { bundle.translations << :ru }
75
+
76
+ it 'includes new non-English translations' do
77
+ translation_urls = bundle.scripts.select(&:translation?).map(&:url)
78
+ expect(translation_urls).to include(
79
+ "#{cdn}/npm/#{import_name}@#{version}/build/translations/ru.js"
80
+ )
81
+ end
82
+ end
61
83
  end
62
84
 
63
85
  describe '#stylesheets' do
@@ -22,7 +22,7 @@ RSpec.describe CKEditor5::Rails::Hooks::Form do
22
22
  name: 'post[content]',
23
23
  id: 'post_content',
24
24
  type: 'ClassicEditor',
25
- translations: '[{"import_name":"ckeditor5/translations/en.js"}]',
25
+ translations: '[]',
26
26
  watchdog: 'true'
27
27
  }
28
28
 
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.17.2
4
+ version: 1.17.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Bagiński
@@ -116,7 +116,11 @@ files:
116
116
  homepage: https://github.com/Mati365/ckeditor5-rails
117
117
  licenses:
118
118
  - GPL-2.0
119
- metadata: {}
119
+ metadata:
120
+ homepage_uri: https://github.com/Mati365/ckeditor5-rails
121
+ documentation_uri: https://github.com/Mati365/ckeditor5-rails
122
+ source_code_uri: https://github.com/Mati365/ckeditor5-rails
123
+ bug_tracker_uri: https://github.com/Mati365/ckeditor5-rails/issues
120
124
  post_install_message:
121
125
  rdoc_options: []
122
126
  require_paths: