ckeditor5 1.24.9 → 1.24.10

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: 1e3979d3dd215de48789d30f772f4919f0e5fafff9a159f6944deab41ba9ce42
4
- data.tar.gz: 1519e054bfcd633deb13683dd65e40cb28249ba5c0cfb0e2f1da3c025c329a95
3
+ metadata.gz: bbaa06c0cde62bfe01904bb70ca7c8e0f4db04610d2f71543d1fbd657182e781
4
+ data.tar.gz: 36ac98e55c8d927fc094cac0b60dd23284a0667ca0d3387b0858d980bc0f33bd
5
5
  SHA512:
6
- metadata.gz: e860202c101db6c46f924264b7b4389ada039267bf7f249097a0b060532930c07fdc7e1cc5405ee826163e069a1186479b5911299561e992ca93360e4f6e7226
7
- data.tar.gz: 4e3794dac5d1285ff2c82694aaa9ae3b2c9f539c777ed89ad4bdbc06e18da1045c63422bbbbd92796607abdbd4f7460dd8693fb756b29c145548912a3b4866dd
6
+ metadata.gz: 525255ffbc1aadedfe42eea761822f123f3f4de0617e19a443dcb3051d95841ced3f3fda0c8d73241094c84c4e6eac410f26b33ea9ebd1271d9ddd15ab52bcf3
7
+ data.tar.gz: 85f17299ba06f3187f7211eb345e93c4d5e7efbd6c2772fb855df883c7af732fd61ce8f32c788899fba3012fcb90770627c33b52182a280b70329a88f8361ce6
data/README.md CHANGED
@@ -794,6 +794,23 @@ CKEditor5::Rails.configure do
794
794
  plugin :YourPlugin, window_name: 'YourPlugin'
795
795
  end
796
796
  ```
797
+
798
+ If there is no `window.YourPlugin` object, the plugin will dispatch window event to load. To handle this event, you can use the `window.addEventListener` method:
799
+
800
+ ```js
801
+ window.addEventListener('ckeditor:request-cjs-plugin:YourPlugin', () => {
802
+ window.YourPlugin = (async () => {
803
+ const { Plugin } = await import('ckeditor5');
804
+
805
+ return class YourPlugin extends Plugin {
806
+ // Your plugin code
807
+ };
808
+ })();
809
+ });
810
+ ```
811
+
812
+ ⚠️ The event handler must be attached before the plugin is requested. If the plugin is requested before the event handler is attached, the plugin will not be loaded.
813
+
797
814
  </details>
798
815
 
799
816
  #### `plugins(*names, **kwargs)` method
@@ -1865,7 +1882,7 @@ end
1865
1882
 
1866
1883
  ```js
1867
1884
  // app/javascript/custom_plugins/highlight.js
1868
- import { Plugin, Command, ButtonView } from 'ckeditor5';
1885
+ const { Plugin, Command, ButtonView } = await import('ckeditor5');
1869
1886
 
1870
1887
  return class MyCustomPlugin extends Plugin {
1871
1888
  static get pluginName() {
@@ -7,16 +7,20 @@ module CKEditor5::Rails::Editor
7
7
  def initialize(name, premium: false, **js_import_meta_attrs)
8
8
  super(name)
9
9
 
10
- js_import_meta_attrs[:import_name] ||= if premium
11
- 'ckeditor5-premium-features'
12
- else
13
- 'ckeditor5'
14
- end
10
+ if js_import_meta_attrs[:window_name]
11
+ @js_import_meta = ::CKEditor5::Rails::Assets::JSImportMeta.new(**js_import_meta_attrs)
12
+ else
13
+ js_import_meta_attrs[:import_name] ||= if premium
14
+ 'ckeditor5-premium-features'
15
+ else
16
+ 'ckeditor5'
17
+ end
15
18
 
16
- @js_import_meta = ::CKEditor5::Rails::Assets::JSImportMeta.new(
17
- import_as: js_import_meta_attrs[:window_name] ? nil : name,
18
- **js_import_meta_attrs
19
- )
19
+ @js_import_meta = ::CKEditor5::Rails::Assets::JSImportMeta.new(
20
+ import_as: name,
21
+ **js_import_meta_attrs
22
+ )
23
+ end
20
24
  end
21
25
 
22
26
  # Compress a little bit default plugins to make output smaller
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CKEditor5
4
4
  module Rails
5
- VERSION = '1.24.9'
5
+ VERSION = '1.24.10'
6
6
 
7
7
  DEFAULT_CKEDITOR_VERSION = '44.1.0'
8
8
  end
@@ -96,6 +96,15 @@ RSpec.describe 'CKEditor5 Types Integration', type: :feature, js: true do
96
96
  expect(plugin_exists).to be true
97
97
  end
98
98
  end
99
+
100
+ it 'initializes the window plugin' do
101
+ visit 'classic'
102
+
103
+ eventually do
104
+ plugin_exists = page.evaluate_script('window.__customWindowPlugin !== undefined')
105
+ expect(plugin_exists).to be true
106
+ end
107
+ end
99
108
  end
100
109
 
101
110
  describe 'Decoupled Editor' do
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.9
4
+ version: 1.24.10
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: 2025-01-17 00:00:00.000000000 Z
12
+ date: 2025-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails