ckeditor5 1.1.2 → 1.1.4

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: 0aee8586159157d2581cefe62cc87ea58d822db618c0f0dd9ceee5c0d3fdba46
4
- data.tar.gz: 550633bd1bb74e54909f19447f7ced3bff0f6bd10324b44c9076641eb65e08e7
3
+ metadata.gz: 89a0fa3d794be4e336b4e34cc90c002a8541d9ea9ecfabf60dffa03a3f73a47b
4
+ data.tar.gz: aa199b3c554e9edb37f2a024e5879d5d22acaa476737567475adfc9e55f40497
5
5
  SHA512:
6
- metadata.gz: ba63dc4631e0703b8d719b7b2c21efc97183455550e6eb6406f96f8e789baaf1ed7dd202d0711ca100f39e906b386c026ef8515042d6441bce465baf6de8b10a
7
- data.tar.gz: 15a0df8fd18291bc5d47e9a15df2d0192316512b38a85ec07c4bc047895d1111a6bd92afa2c09bdab639f31485a039538d7390048e39d66ea22bf51373e22e38
6
+ metadata.gz: 300ea7854e40c3c3c0b408c326217c47071a26956bf51ac5b77dd91b74ca7eefc4676554750d7228b03ee3b9a5e71c25f439029caca8d5f9f02cd6465feb8962
7
+ data.tar.gz: dd8e4262483b486714caaabd71801444fd9619c2d0e85dbeec2847fd86f0092e9f3bb994a5fa3da7e7d5a8740b2e1347d8c1e5a127b8eb32bd7ca408377eb4da
data/README.md CHANGED
@@ -74,23 +74,23 @@ Voilà! You have CKEditor 5 integrated with your Rails application. 🎉
74
74
  - [GPL usage 🆓](#gpl-usage-)
75
75
  - [Commercial usage 💰](#commercial-usage-)
76
76
  - [Editor placement 🏗️](#editor-placement-️)
77
+ - [Setting Initial Content 📝](#setting-initial-content-)
77
78
  - [Classic editor 📝](#classic-editor-)
78
79
  - [Multiroot editor 🌳](#multiroot-editor-)
79
80
  - [Inline editor 📝](#inline-editor-)
80
81
  - [Balloon editor 🎈](#balloon-editor-)
81
82
  - [Decoupled editor 🌐](#decoupled-editor-)
82
83
  - [How to access editor instance? 🤔](#how-to-access-editor-instance-)
83
- - [Events fired by the editor 🔊](#events-fired-by-the-editor-)
84
- - [`editor-ready` event](#editor-ready-event)
85
- - [`editor-error` event](#editor-error-event)
86
84
  - [Common Tasks and Solutions 💡](#common-tasks-and-solutions-)
87
- - [Setting Initial Content 📝](#setting-initial-content-)
88
85
  - [Setting Editor Language 🌐](#setting-editor-language-)
89
86
  - [Integrating with Forms 📋](#integrating-with-forms-)
90
87
  - [Rails form builder integration](#rails-form-builder-integration)
91
88
  - [Simple form integration](#simple-form-integration)
92
89
  - [Custom Styling 🎨](#custom-styling-)
93
90
  - [Custom plugins 🧩](#custom-plugins-)
91
+ - [Events fired by the editor 🔊](#events-fired-by-the-editor-)
92
+ - [`editor-ready` event](#editor-ready-event)
93
+ - [`editor-error` event](#editor-error-event)
94
94
  - [License 📜](#license-)
95
95
 
96
96
  ## Presets 🎨
@@ -583,6 +583,28 @@ In this scenario, the assets are included from the official CKEditor 5 CDN which
583
583
 
584
584
  The `ckeditor5_editor` helper renders CKEditor 5 instances in your views. Before using it, ensure you've included the necessary assets in your page's head section otherwise the editor won't work as there are no CKEditor 5 JavaScript and CSS files loaded.
585
585
 
586
+ ### Setting Initial Content 📝
587
+
588
+ You can set the initial content of the editor using the `initial_data` keyword argument or by passing the content directly to the `ckeditor5_editor` helper block.
589
+
590
+ The example below shows how to set the initial content of the editor using the `initial_data` keyword argument:
591
+
592
+ ```erb
593
+ <!-- app/views/demos/index.html.erb -->
594
+
595
+ <%= ckeditor5_editor initial_data: "<p>Initial content</p>" %>
596
+ ```
597
+
598
+ The example below shows how to set the initial content of the editor using the `ckeditor5_editor` helper block.
599
+
600
+ ```erb
601
+ <!-- app/views/demos/index.html.erb -->
602
+
603
+ <%= ckeditor5_editor do %>
604
+ <p>Initial content</p>
605
+ <% end %>
606
+ ```
607
+
586
608
  ### Classic editor 📝
587
609
 
588
610
  The classic editor is the most common type of editor. It provides a toolbar with various formatting options like bold, italic, underline, and link.
@@ -776,50 +798,10 @@ document.getElementById('editor').runAfterEditorReady(editor => {
776
798
  });
777
799
  ```
778
800
 
779
- ## Events fired by the editor 🔊
780
-
781
- ### `editor-ready` event
782
-
783
- The event is fired when the initialization of the editor is completed. You can listen to it using the `editor-ready` event.
784
-
785
- ```js
786
- document.getElementById('editor').addEventListener('editor-ready', () => {
787
- console.log('Editor is ready');
788
- });
789
- ```
790
-
791
- ### `editor-error` event
792
-
793
- The event is fired when the initialization of the editor fails. You can listen to it using the `editor-error` event.
794
-
795
- ```js
796
- document.getElementById('editor').addEventListener('editor-error', () => {
797
- console.log('Editor has an error');
798
- });
799
- ```
800
-
801
801
  ## Common Tasks and Solutions 💡
802
802
 
803
803
  This section covers frequent questions and scenarios when working with CKEditor 5 in Rails applications.
804
804
 
805
- ### Setting Initial Content 📝
806
-
807
- You can set the initial content of the editor using the `initial_data` keyword argument or by passing the content directly to the `ckeditor5_editor` helper block.
808
-
809
- The example below shows how to set the initial content of the editor using the `initial_data` keyword argument:
810
-
811
- ```erb
812
- <%= ckeditor5_editor initial_data: "<p>Initial content</p>" %>
813
- ```
814
-
815
- The example below shows how to set the initial content of the editor using the `ckeditor5_editor` helper block.
816
-
817
- ```erb
818
- <%= ckeditor5_editor do %>
819
- <p>Initial content</p>
820
- <% end %>
821
- ```
822
-
823
805
  ### Setting Editor Language 🌐
824
806
 
825
807
  You can set the language of the editor using the `language` method in the `config/initializers/ckeditor5.rb` file. The `translations` method fetches the translations files, while the `language` method sets the default language of the editor.
@@ -838,6 +820,8 @@ You can integrate CKEditor 5 with Rails form builders like `form_for` or `simple
838
820
  #### Rails form builder integration
839
821
 
840
822
  ```erb
823
+ <!-- app/views/demos/index.html.erb -->
824
+
841
825
  <%= form_for @post do |f| %>
842
826
  <%= f.label :content %>
843
827
  <%= f.ckeditor5 :content, required: true, style: 'width: 700px', initial_data: 'Hello World!' %>
@@ -847,6 +831,8 @@ You can integrate CKEditor 5 with Rails form builders like `form_for` or `simple
847
831
  #### Simple form integration
848
832
 
849
833
  ```erb
834
+ <!-- app/views/demos/index.html.erb -->
835
+
850
836
  <%= simple_form_for :demo, url: '/demos', html: { novalidate: false } do |f| %>
851
837
  <div class="form-group">
852
838
  <%= f.input :content, as: :ckeditor5, initial_data: 'Hello, World 12!', input_html: { style: 'width: 600px' }, required: true %>
@@ -860,8 +846,12 @@ You can integrate CKEditor 5 with Rails form builders like `form_for` or `simple
860
846
 
861
847
  ### Custom Styling 🎨
862
848
 
849
+ You can pass the `style`, `class` and `id` keyword arguments to the `ckeditor5_editor` helper to define the styling of the editor. The example below shows how to set the height, margin, and CSS class of the editor:
850
+
863
851
  ```erb
864
- <%= ckeditor5_editor style: 'height: 400px; margin: 20px;' %>
852
+ <!-- app/views/demos/index.html.erb -->
853
+
854
+ <%= ckeditor5_editor style: 'height: 400px; margin: 20px;', class: 'your_css_class', id: 'your_id' %>
865
855
  ```
866
856
 
867
857
  ### Custom plugins 🧩
@@ -1034,6 +1024,28 @@ class HighlightCommand extends Command {
1034
1024
 
1035
1025
  </details>
1036
1026
 
1027
+ ## Events fired by the editor 🔊
1028
+
1029
+ ### `editor-ready` event
1030
+
1031
+ The event is fired when the initialization of the editor is completed. You can listen to it using the `editor-ready` event.
1032
+
1033
+ ```js
1034
+ document.getElementById('editor').addEventListener('editor-ready', () => {
1035
+ console.log('Editor is ready');
1036
+ });
1037
+ ```
1038
+
1039
+ ### `editor-error` event
1040
+
1041
+ The event is fired when the initialization of the editor fails. You can listen to it using the `editor-error` event.
1042
+
1043
+ ```js
1044
+ document.getElementById('editor').addEventListener('editor-error', () => {
1045
+ console.log('Editor has an error');
1046
+ });
1047
+ ```
1048
+
1037
1049
  ## License 📜
1038
1050
 
1039
1051
  The MIT License (MIT)
@@ -310,6 +310,7 @@ class CKEditorComponent extends HTMLElement {
310
310
  const syncInput = () => {
311
311
  this.style.position = 'relative';
312
312
 
313
+ textarea.innerHTML = '';
313
314
  textarea.value = this.instance.getData();
314
315
  textarea.tabIndex = -1;
315
316
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CKEditor5::Rails
4
- VERSION = '1.1.2'
4
+ VERSION = '1.1.4'
5
5
  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.1.2
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Bagiński