ckeditor5 1.26.1 → 1.26.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -9
- data/lib/ckeditor5/rails/editor/helpers/config_helpers.rb +1 -4
- data/lib/ckeditor5/rails/presets/concerns/plugin_methods.rb +1 -19
- data/lib/ckeditor5/rails/presets/preset_builder.rb +1 -2
- data/lib/ckeditor5/rails/version.rb +2 -2
- data/spec/lib/ckeditor5/rails/editor/helpers/config_helpers_spec.rb +0 -17
- 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: 8e46c611bc11950481442cb335ae063943043937c9792b6eeedd731e030cdf1c
|
4
|
+
data.tar.gz: d16b561470173168c325457a00f5e83d5ca8689b0644f0d96533c05b7075193f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6769430ee90f270077c474bf1999e7d5fc4d2ec5c62918063e6503c39956e63a9f0bfb948de3dd376bc2bcb7212fc505a61e94cf04e46a1c2e85867d8e037e9a
|
7
|
+
data.tar.gz: 93071afc776e615781cc9ff845b631bc823653f229ee9dbba22ccc2f9e9b2c5b9813c4cfaf6d672dfc9764a8db6d205631cf992b2d94a16fe8aba9df230681ad
|
data/README.md
CHANGED
@@ -8,7 +8,10 @@
|
|
8
8
|

|
9
9
|
[](https://github.com/Mati365/ckeditor5-rails/issues)
|
10
10
|
|
11
|
-
|
11
|
+
CKEditor 5 Ruby on Rails integration gem. Provides seamless integration of CKEditor 5 with Rails applications through web components and helper methods. This gem supports various editor types, including classic, inline, balloon, and decoupled editors. It also includes support for custom plugins, translations, and configuration options.
|
12
|
+
|
13
|
+
> [!IMPORTANT]
|
14
|
+
> This gem is unofficial and not maintained by CKSource. For official CKEditor 5 documentation, visit [ckeditor.com](https://ckeditor.com/docs/ckeditor5/latest/). If you encounter any issues in integration, please report them on the [GitHub repository](https://github.com/Mati365/ckeditor5-rails/issues).
|
12
15
|
|
13
16
|
<p align="center">
|
14
17
|
<img src="docs/intro-classic-editor.png" alt="CKEditor 5 Classic Editor in Ruby on Rails application">
|
@@ -22,6 +25,10 @@ Add this line to your application's Gemfile:
|
|
22
25
|
gem 'ckeditor5'
|
23
26
|
```
|
24
27
|
|
28
|
+
> [!NOTE]
|
29
|
+
> This gem uses importmaps and does not require Webpacker or any other JavaScript bundler. It's compatible with Rails 6.0+ and `importmap-rails` gem.
|
30
|
+
> While installation is simplified, it's recommended to check if jsdelivr or unpkg CDN is accessible in your environment, otherwise, you may need to configure a custom CDN (or use a commercial one).
|
31
|
+
|
25
32
|
In your layout:
|
26
33
|
|
27
34
|
```erb
|
@@ -80,7 +87,7 @@ CKEditor5::Rails.configure do
|
|
80
87
|
|
81
88
|
# Optionally, you can specify version of CKEditor 5 to use.
|
82
89
|
# If it's not specified the default version specified in the gem will be used.
|
83
|
-
# version '44.
|
90
|
+
# version '44.2.0'
|
84
91
|
|
85
92
|
# Upload images to the server using the simple upload adapter, instead of Base64 encoding.
|
86
93
|
# simple_upload_adapter
|
@@ -201,7 +208,7 @@ You can create your own by defining it in the `config/initializers/ckeditor5.rb`
|
|
201
208
|
|
202
209
|
CKEditor5::Rails.configure do
|
203
210
|
# It's possible to override the default preset right in the initializer.
|
204
|
-
version '44.
|
211
|
+
version '44.2.0'
|
205
212
|
|
206
213
|
# New presets inherit properties from the default preset defined in the initializer.
|
207
214
|
# In this example, the custom preset inherits everything from default but disables the menubar:
|
@@ -211,7 +218,7 @@ CKEditor5::Rails.configure do
|
|
211
218
|
|
212
219
|
# In order to define preset from scratch, you can use the `inherit: false` option.
|
213
220
|
presets.define :blank_preset, inherit: false do
|
214
|
-
version '44.
|
221
|
+
version '44.2.0'
|
215
222
|
|
216
223
|
# It tells the integration to fetch the newest security patches and bug fixes.
|
217
224
|
# It may be disabled, but it's highly recommended to keep it enabled to avoid
|
@@ -333,7 +340,7 @@ Defines the version of CKEditor 5 to be used. The example below shows how to set
|
|
333
340
|
CKEditor5::Rails.configure do
|
334
341
|
# ... other configuration
|
335
342
|
|
336
|
-
version '44.
|
343
|
+
version '44.2.0'
|
337
344
|
end
|
338
345
|
```
|
339
346
|
|
@@ -345,7 +352,7 @@ In order to disable default patches, you can pass the `apply_patches: false` key
|
|
345
352
|
CKEditor5::Rails.configure do
|
346
353
|
# ... other configuration
|
347
354
|
|
348
|
-
version '44.
|
355
|
+
version '44.2.0', apply_patches: false
|
349
356
|
end
|
350
357
|
```
|
351
358
|
|
@@ -1229,7 +1236,7 @@ It may be useful when you want to define a preset based on the current user or r
|
|
1229
1236
|
class ApplicationController < ActionController::Base
|
1230
1237
|
def show
|
1231
1238
|
@preset = ckeditor5_preset do
|
1232
|
-
version '44.
|
1239
|
+
version '44.2.0'
|
1233
1240
|
|
1234
1241
|
toolbar :sourceEditing, :|, :bold, :italic, :underline, :strikethrough,
|
1235
1242
|
:subscript, :superscript, :removeFormat, :|, :bulletedList, :numberedList,
|
@@ -1264,7 +1271,7 @@ If you want to override the preset defined in the initializer, you can search fo
|
|
1264
1271
|
class ApplicationController < ActionController::Base
|
1265
1272
|
def show
|
1266
1273
|
@preset = ckeditor5_preset(:default).override do
|
1267
|
-
version '44.
|
1274
|
+
version '44.2.0'
|
1268
1275
|
|
1269
1276
|
toolbar :sourceEditing, :|, :bold, :italic, :underline, :strikethrough,
|
1270
1277
|
:subscript, :superscript, :removeFormat, :|, :bulletedList, :numberedList,
|
@@ -1437,7 +1444,7 @@ In that scenario it's recommended to add `gpl` method to the initializer along w
|
|
1437
1444
|
|
1438
1445
|
CKEditor5::Rails.configure do
|
1439
1446
|
gpl
|
1440
|
-
version '44.
|
1447
|
+
version '44.2.0'
|
1441
1448
|
end
|
1442
1449
|
```
|
1443
1450
|
|
@@ -50,10 +50,7 @@ module CKEditor5::Rails::Editor::Helpers
|
|
50
50
|
|
51
51
|
raise ArgumentError, 'Configuration block is required for preset definition' unless block_given?
|
52
52
|
|
53
|
-
CKEditor5::Rails::Presets::PresetBuilder.new(
|
54
|
-
disallow_inline_plugins: true,
|
55
|
-
&block
|
56
|
-
)
|
53
|
+
CKEditor5::Rails::Presets::PresetBuilder.new(&block)
|
57
54
|
end
|
58
55
|
end
|
59
56
|
end
|
@@ -9,13 +9,12 @@ module CKEditor5::Rails
|
|
9
9
|
module PluginMethods
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
12
|
-
class DisallowedInlinePluginError < ArgumentError; end
|
13
12
|
class MissingInlinePluginError < StandardError; end
|
14
13
|
class UnsupportedESModuleError < StandardError; end
|
15
14
|
class InvalidPatchPluginError < ArgumentError; end
|
16
15
|
|
17
16
|
included do
|
18
|
-
attr_reader :
|
17
|
+
attr_reader :disallow_inline_plugin_compression
|
19
18
|
end
|
20
19
|
|
21
20
|
# Registers an external plugin loaded from a URL
|
@@ -124,28 +123,11 @@ module CKEditor5::Rails
|
|
124
123
|
|
125
124
|
private
|
126
125
|
|
127
|
-
# Check if the plugin looks like an inline plugin
|
128
|
-
# @param plugin [Editor::PropsBasePlugin] Plugin instance
|
129
|
-
# @return [Boolean] True if the plugin is an inline plugin
|
130
|
-
def looks_like_unsafe_inline_plugin?(plugin)
|
131
|
-
plugin.respond_to?(:code) &&
|
132
|
-
plugin.code.present? &&
|
133
|
-
!plugin.is_a?(CKEditor5::Rails::Editor::PropsPatchPlugin)
|
134
|
-
end
|
135
|
-
|
136
126
|
# Register a plugin in the editor configuration.
|
137
127
|
#
|
138
|
-
# It will raise an error if inline plugins are not allowed and the plugin is an inline plugin.
|
139
|
-
# Most likely, this is being thrown when you use inline_plugin definition in a place where
|
140
|
-
# it's not allowed (e.g. in a preset definition placed in controller).
|
141
|
-
#
|
142
128
|
# @param plugin_obj [Editor::PropsBasePlugin] Plugin instance to register
|
143
129
|
# @return [Editor::PropsBasePlugin] The registered plugin
|
144
130
|
def register_plugin(plugin_obj)
|
145
|
-
if disallow_inline_plugins && looks_like_unsafe_inline_plugin?(plugin_obj)
|
146
|
-
raise DisallowedInlinePluginError, 'Inline plugins are not allowed here.'
|
147
|
-
end
|
148
|
-
|
149
131
|
config[:plugins] ||= []
|
150
132
|
config[:plugins] << plugin_obj
|
151
133
|
plugin_obj
|
@@ -38,23 +38,6 @@ RSpec.describe CKEditor5::Rails::Editor::Helpers::Config do
|
|
38
38
|
it 'yields the block to PresetBuilder' do
|
39
39
|
expect { |b| helper.ckeditor5_preset(&b) }.to yield_control
|
40
40
|
end
|
41
|
-
|
42
|
-
it 'does not allow inline plugins definition' do
|
43
|
-
expect do
|
44
|
-
helper.ckeditor5_preset do
|
45
|
-
inline_plugin :CustomPlugin, <<~JS
|
46
|
-
const { Plugin } = await import( 'ckeditor5' );
|
47
|
-
|
48
|
-
return class CustomPlugin extends Plugin {
|
49
|
-
static get pluginName() { return 'CustomPlugin'; }
|
50
|
-
}
|
51
|
-
JS
|
52
|
-
end
|
53
|
-
end.to raise_error(
|
54
|
-
CKEditor5::Rails::Presets::Concerns::PluginMethods::DisallowedInlinePluginError,
|
55
|
-
'Inline plugins are not allowed here.'
|
56
|
-
)
|
57
|
-
end
|
58
41
|
end
|
59
42
|
|
60
43
|
context 'when neither name nor block is provided' 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.26.
|
4
|
+
version: 1.26.2
|
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-02-
|
12
|
+
date: 2025-02-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|