ckeditor5 1.4.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +151 -64
- data/lib/ckeditor5/rails/engine.rb +19 -2
- data/lib/ckeditor5/rails/presets/manager.rb +11 -4
- data/lib/ckeditor5/rails/version.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffcf4f20d7134eefdd8ed70322d880862886c260c5b68295154e5932eb7aed8f
|
4
|
+
data.tar.gz: 63c20e49867be66eee43e90a0b473e13971648216675927408d82265f483d8b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5d9f8eb254a1210c9792ddfea0885f58b4c11c9d049a14ee9e269f753204f7a10e3eacade18f502497becb02544f7440641414f6dd1495798428ef10fa40c47
|
7
|
+
data.tar.gz: 88fb52bde4a26017c7e122ac71dcaad9568ccbd1a4163f41a55cbf5d9f67ee19a2acdc8f7a37edfde92444fbbc230a34f20bfde005630d95cd7f29b52085b16b
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# CKEditor 5 Rails Integration ✨
|
2
2
|
|
3
|
-
[![License:
|
3
|
+
[![License: GPL v2](https://img.shields.io/badge/License-GPL_v2-blue.svg?style=flat-square)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
|
4
4
|
![Gem Version](https://img.shields.io/gem/v/ckeditor5?style=flat-square)
|
5
5
|
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-green.svg?style=flat-square)](http://makeapullrequest.com)
|
6
6
|
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/mati365/ckeditor5-rails?style=flat-square)
|
@@ -20,15 +20,13 @@ Add this line to your application's Gemfile:
|
|
20
20
|
gem 'ckeditor5'
|
21
21
|
```
|
22
22
|
|
23
|
-
In your config:
|
23
|
+
In your config (the default config is defined [here](https://github.com/Mati365/ckeditor5-rails/blob/main/lib/ckeditor5/rails/presets/manager.rb)):
|
24
24
|
|
25
25
|
```rb
|
26
26
|
# config/initializers/ckeditor5.rb
|
27
27
|
|
28
|
-
CKEditor5::Rails.configure do
|
29
|
-
|
30
|
-
version '43.3.0'
|
31
|
-
end
|
28
|
+
CKEditor5::Rails.configure do
|
29
|
+
version '43.3.0'
|
32
30
|
end
|
33
31
|
```
|
34
32
|
|
@@ -69,6 +67,10 @@ Voilà! You have CKEditor 5 integrated with your Rails application. 🎉
|
|
69
67
|
- [`plugins(*names, **kwargs)` method](#pluginsnames-kwargs-method)
|
70
68
|
- [`inline_plugin(name, code)` method](#inline_pluginname-code-method)
|
71
69
|
- [Including CKEditor 5 assets 📦](#including-ckeditor-5-assets-)
|
70
|
+
- [Format 📝](#format-)
|
71
|
+
- [Using default preset](#using-default-preset)
|
72
|
+
- [Custom preset](#custom-preset)
|
73
|
+
- [Inline preset definition](#inline-preset-definition)
|
72
74
|
- [Lazy loading 🚀](#lazy-loading-)
|
73
75
|
- [GPL usage 🆓](#gpl-usage-)
|
74
76
|
- [Commercial usage 💰](#commercial-usage-)
|
@@ -91,6 +93,7 @@ Voilà! You have CKEditor 5 integrated with your Rails application. 🎉
|
|
91
93
|
- [Events fired by the editor 🔊](#events-fired-by-the-editor-)
|
92
94
|
- [`editor-ready` event](#editor-ready-event)
|
93
95
|
- [`editor-error` event](#editor-error-event)
|
96
|
+
- [Trademarks 📜](#trademarks-)
|
94
97
|
- [License 📜](#license-)
|
95
98
|
|
96
99
|
## Presets 🎨
|
@@ -102,8 +105,20 @@ You can create your own by defining it in the `config/initializers/ckeditor5.rb`
|
|
102
105
|
```rb
|
103
106
|
# config/initializers/ckeditor5.rb
|
104
107
|
|
105
|
-
CKEditor5::Rails.configure do
|
106
|
-
|
108
|
+
CKEditor5::Rails.configure do
|
109
|
+
# It's possible to override the default preset right in the initializer.
|
110
|
+
version '43.3.0'
|
111
|
+
|
112
|
+
# New presets inherit properties from the default preset defined in the initializer.
|
113
|
+
# In this example, the custom preset inherits everything from default but disables the menubar:
|
114
|
+
presets.define :inherited_custom
|
115
|
+
menubar visible: false
|
116
|
+
end
|
117
|
+
|
118
|
+
# In order to define preset from scratch, you can use the `inherit: false` option.
|
119
|
+
presets.define :blank_preset, inherit: false do
|
120
|
+
version '44.0.0'
|
121
|
+
|
107
122
|
gpl
|
108
123
|
type :classic
|
109
124
|
|
@@ -130,13 +145,13 @@ CKEditor5::Rails.configure do |config|
|
|
130
145
|
end
|
131
146
|
```
|
132
147
|
|
133
|
-
In order to override existing presets, you can use the `
|
148
|
+
In order to override existing presets, you can use the `presets.override` method. The method takes the name of the preset you want to override and a block with the old configuration. The example below shows how to hide the menubar in the default preset:
|
134
149
|
|
135
150
|
```rb
|
136
151
|
# config/initializers/ckeditor5.rb
|
137
152
|
|
138
|
-
CKEditor5::Rails.configure do
|
139
|
-
|
153
|
+
CKEditor5::Rails.configure do
|
154
|
+
presets.override :custom do
|
140
155
|
menubar visible: false
|
141
156
|
|
142
157
|
toolbar do
|
@@ -160,7 +175,7 @@ Defines the CDN to be used for CKEditor 5 assets. The example below shows how to
|
|
160
175
|
```rb
|
161
176
|
# config/initializers/ckeditor5.rb
|
162
177
|
|
163
|
-
|
178
|
+
CKEditor5::Rails.configure do
|
164
179
|
# ... other configuration
|
165
180
|
|
166
181
|
cdn :jsdelivr
|
@@ -172,7 +187,7 @@ It also allows you to define a custom CDN by passing a block with the bundle, ve
|
|
172
187
|
```rb
|
173
188
|
# config/initializers/ckeditor5.rb
|
174
189
|
|
175
|
-
|
190
|
+
CKEditor5::Rails.configure do
|
176
191
|
# ... other configuration
|
177
192
|
|
178
193
|
cdn do |bundle, version, path|
|
@@ -190,7 +205,7 @@ Defines the version of CKEditor 5 to be used. The example below shows how to set
|
|
190
205
|
```rb
|
191
206
|
# config/initializers/ckeditor5.rb
|
192
207
|
|
193
|
-
|
208
|
+
CKEditor5::Rails.configure do
|
194
209
|
# ... other configuration
|
195
210
|
|
196
211
|
version '43.2.0'
|
@@ -204,7 +219,7 @@ Defines the license of CKEditor 5. The example below shows how to set the licens
|
|
204
219
|
```rb
|
205
220
|
# config/initializers/ckeditor5.rb
|
206
221
|
|
207
|
-
|
222
|
+
CKEditor5::Rails.configure do
|
208
223
|
# ... other configuration
|
209
224
|
|
210
225
|
gpl
|
@@ -218,7 +233,7 @@ Defines the license key of CKEditor 5. It calls `premium` method internally. The
|
|
218
233
|
```rb
|
219
234
|
# config/initializers/ckeditor5.rb
|
220
235
|
|
221
|
-
|
236
|
+
CKEditor5::Rails.configure do
|
222
237
|
# ... other configuration
|
223
238
|
|
224
239
|
license_key 'your-license-key'
|
@@ -232,7 +247,7 @@ Defines if premium package should be included in JS assets. The example below sh
|
|
232
247
|
```rb
|
233
248
|
# config/initializers/ckeditor5.rb
|
234
249
|
|
235
|
-
|
250
|
+
CKEditor5::Rails.configure do
|
236
251
|
# ... other configuration
|
237
252
|
|
238
253
|
premium
|
@@ -246,7 +261,7 @@ Defines the translations of CKEditor 5. You can pass the language codes as argum
|
|
246
261
|
```rb
|
247
262
|
# config/initializers/ckeditor5.rb
|
248
263
|
|
249
|
-
|
264
|
+
CKEditor5::Rails.configure do
|
250
265
|
# ... other configuration
|
251
266
|
|
252
267
|
translations :pl, :es
|
@@ -258,9 +273,10 @@ end
|
|
258
273
|
```rb
|
259
274
|
# config/initializers/ckeditor5.rb
|
260
275
|
|
261
|
-
|
262
|
-
|
276
|
+
CKEditor5::Rails.configure do
|
277
|
+
# ... other configuration
|
263
278
|
|
279
|
+
translations :pl
|
264
280
|
language :pl
|
265
281
|
end
|
266
282
|
```
|
@@ -272,7 +288,7 @@ Defines the CKBox plugin to be included in the editor. The example below shows h
|
|
272
288
|
```rb
|
273
289
|
# config/initializers/ckeditor5.rb
|
274
290
|
|
275
|
-
|
291
|
+
CKEditor5::Rails.configure do
|
276
292
|
# ... other configuration
|
277
293
|
|
278
294
|
ckbox '2.5.4', theme: :lark
|
@@ -294,7 +310,7 @@ The example below sets the editor type to `multiroot` in the custom preset:
|
|
294
310
|
```rb
|
295
311
|
# config/initializers/ckeditor5.rb
|
296
312
|
|
297
|
-
|
313
|
+
CKEditor5::Rails.configure do
|
298
314
|
# ... other configuration
|
299
315
|
|
300
316
|
type :multiroot
|
@@ -313,7 +329,7 @@ The `should_group_when_full` keyword argument determines whether the toolbar sho
|
|
313
329
|
```rb
|
314
330
|
# config/initializers/ckeditor5.rb
|
315
331
|
|
316
|
-
|
332
|
+
CKEditor5::Rails.configure do
|
317
333
|
# ... other configuration
|
318
334
|
|
319
335
|
toolbar :undo, :redo, :|, :heading, :|, :bold, :italic, :underline, :|,
|
@@ -329,7 +345,7 @@ If you want to add or prepend items to the existing toolbar, you can use the blo
|
|
329
345
|
```rb
|
330
346
|
# config/initializers/ckeditor5.rb
|
331
347
|
|
332
|
-
|
348
|
+
CKEditor5::Rails.configure do
|
333
349
|
# ... other configuration
|
334
350
|
|
335
351
|
toolbar do
|
@@ -344,7 +360,7 @@ If you want to remove items from the toolbar, you can use the `remove` method:
|
|
344
360
|
```rb
|
345
361
|
# config/initializers/ckeditor5.rb
|
346
362
|
|
347
|
-
|
363
|
+
CKEditor5::Rails.configure do
|
348
364
|
# ... other configuration
|
349
365
|
|
350
366
|
toolbar do
|
@@ -360,7 +376,7 @@ Defines the visibility of the menubar. By default, it's set to `true`.
|
|
360
376
|
```rb
|
361
377
|
# config/initializers/ckeditor5.rb
|
362
378
|
|
363
|
-
|
379
|
+
CKEditor5::Rails.configure do
|
364
380
|
# ... other configuration
|
365
381
|
|
366
382
|
toolbar :undo, :redo, :|, :heading, :|, :bold, :italic, :underline, :|,
|
@@ -376,7 +392,7 @@ Defines the language of the editor. You can pass the language code as an argumen
|
|
376
392
|
```rb
|
377
393
|
# config/initializers/ckeditor5.rb
|
378
394
|
|
379
|
-
|
395
|
+
CKEditor5::Rails.configure do
|
380
396
|
# ... other configuration
|
381
397
|
|
382
398
|
language :pl
|
@@ -388,7 +404,7 @@ In order to set the language for the content, you can pass the `content` keyword
|
|
388
404
|
```rb
|
389
405
|
# config/initializers/ckeditor5.rb
|
390
406
|
|
391
|
-
|
407
|
+
CKEditor5::Rails.configure do
|
392
408
|
# ... other configuration
|
393
409
|
|
394
410
|
language :en, content: :pl
|
@@ -402,7 +418,7 @@ Allows you to set custom configuration options. You can pass the name of the opt
|
|
402
418
|
```rb
|
403
419
|
# config/initializers/ckeditor5.rb
|
404
420
|
|
405
|
-
|
421
|
+
CKEditor5::Rails.configure do
|
406
422
|
# ... other configuration
|
407
423
|
|
408
424
|
configure :link, {
|
@@ -420,7 +436,7 @@ The example below show how to import Bold plugin from the `ckeditor5` npm packag
|
|
420
436
|
```rb
|
421
437
|
# config/initializers/ckeditor5.rb
|
422
438
|
|
423
|
-
|
439
|
+
CKEditor5::Rails.configure do
|
424
440
|
# ... other configuration
|
425
441
|
|
426
442
|
plugin :Bold
|
@@ -432,7 +448,7 @@ In order to import a plugin from a custom ESM package, you can pass the `import_
|
|
432
448
|
```rb
|
433
449
|
# config/initializers/ckeditor5.rb
|
434
450
|
|
435
|
-
|
451
|
+
CKEditor5::Rails.configure do
|
436
452
|
# ... other configuration
|
437
453
|
|
438
454
|
plugin :YourPlugin, import_name: 'your-package'
|
@@ -444,7 +460,7 @@ In order to import a plugin from a custom Window entry, you can pass the `window
|
|
444
460
|
```rb
|
445
461
|
# config/initializers/ckeditor5.rb
|
446
462
|
|
447
|
-
|
463
|
+
CKEditor5::Rails.configure do
|
448
464
|
# ... other configuration
|
449
465
|
|
450
466
|
plugin :YourPlugin, window_name: 'YourPlugin'
|
@@ -458,7 +474,7 @@ Defines the plugins to be included in the editor. You can specify multiple plugi
|
|
458
474
|
```rb
|
459
475
|
# config/initializers/ckeditor5.rb
|
460
476
|
|
461
|
-
|
477
|
+
CKEditor5::Rails.configure do
|
462
478
|
# ... other configuration
|
463
479
|
|
464
480
|
plugins :Bold, :Italic, :Underline, :Link
|
@@ -472,7 +488,7 @@ Use with caution as this is an inline definition of the plugin code, and you can
|
|
472
488
|
```rb
|
473
489
|
# config/initializers/ckeditor5.rb
|
474
490
|
|
475
|
-
|
491
|
+
CKEditor5::Rails.configure do
|
476
492
|
# ... other configuration
|
477
493
|
|
478
494
|
inline_plugin :MyCustomPlugin, <<~JS
|
@@ -498,6 +514,72 @@ To include CKEditor 5 assets in your application, you can use the `ckeditor5_ass
|
|
498
514
|
|
499
515
|
Keep in mind that you need to include the helper result in the `head` section of your layout. In examples below, we use `content_for` helper to include the assets in the `head` section of the view.
|
500
516
|
|
517
|
+
### Format 📝
|
518
|
+
|
519
|
+
#### Using default preset
|
520
|
+
|
521
|
+
The example below users the default preset defined [here](https://github.com/Mati365/ckeditor5-rails/blob/main/lib/ckeditor5/rails/presets/manager.rb).
|
522
|
+
|
523
|
+
```erb
|
524
|
+
<!-- app/views/demos/index.html.erb -->
|
525
|
+
|
526
|
+
<% content_for :head do %>
|
527
|
+
<%= ckeditor5_assets %>
|
528
|
+
<% end %>
|
529
|
+
```
|
530
|
+
|
531
|
+
If you want to fetch some additional translations, you can extend your initializer with the following configuration:
|
532
|
+
|
533
|
+
```rb
|
534
|
+
# config/initializers/ckeditor5.rb
|
535
|
+
|
536
|
+
CKEditor5::Rails.configure do
|
537
|
+
# ... rest of the configuration
|
538
|
+
|
539
|
+
translations :pl, :es
|
540
|
+
end
|
541
|
+
```
|
542
|
+
|
543
|
+
#### Custom preset
|
544
|
+
|
545
|
+
To specify a custom preset, you need to pass the `preset` keyword argument with the name of the preset. The example below shows how to include the assets for the custom preset:
|
546
|
+
|
547
|
+
```erb
|
548
|
+
<!-- app/views/demos/index.html.erb -->
|
549
|
+
|
550
|
+
<% content_for :head do %>
|
551
|
+
<%= ckeditor5_assets preset: :custom %>
|
552
|
+
<% end %>
|
553
|
+
```
|
554
|
+
|
555
|
+
In order to define such preset, you can use the following configuration:
|
556
|
+
|
557
|
+
```rb
|
558
|
+
# config/initializers/ckeditor5.rb
|
559
|
+
|
560
|
+
CKEditor5::Rails.configure do
|
561
|
+
# ... rest of the configuration
|
562
|
+
|
563
|
+
presets.define :custom do
|
564
|
+
# ... your preset configuration
|
565
|
+
|
566
|
+
translations :pl, :es
|
567
|
+
end
|
568
|
+
end
|
569
|
+
```
|
570
|
+
|
571
|
+
#### Inline preset definition
|
572
|
+
|
573
|
+
It's possible to define the preset directly in the `ckeditor5_assets` helper method. It allows you to dynamically specify version, cdn provider or even translations in the view. The example below inherits the default preset and adds Polish translations and other options:
|
574
|
+
|
575
|
+
```erb
|
576
|
+
<!-- app/views/demos/index.html.erb -->
|
577
|
+
|
578
|
+
<% content_for :head do %>
|
579
|
+
<%= ckeditor5_assets version: '43.3.0', cdn: :jsdelivr, translations: [:pl], license_key: '<YOUR KEY> OR GPL' %>
|
580
|
+
<% end %>
|
581
|
+
```
|
582
|
+
|
501
583
|
### Lazy loading 🚀
|
502
584
|
|
503
585
|
<details>
|
@@ -511,41 +593,42 @@ It has been achieved by using web components, together with import maps, which a
|
|
511
593
|
|
512
594
|
### GPL usage 🆓
|
513
595
|
|
514
|
-
If you want to use CKEditor 5 under the GPL license, you can include the assets using the `ckeditor5_assets` without passing any arguments.
|
596
|
+
If you want to use CKEditor 5 under the GPL license, you can include the assets using the `ckeditor5_assets` without passing any arguments. It'll include the necessary assets for the GPL license from one of the most popular CDNs. In our scenario, we use the `jsdelivr` CDN which is the default one.
|
597
|
+
|
598
|
+
Example:
|
515
599
|
|
516
600
|
```erb
|
517
601
|
<!-- app/views/demos/index.html.erb -->
|
518
602
|
|
519
603
|
<% content_for :head do %>
|
520
|
-
<%= ckeditor5_assets
|
604
|
+
<%= ckeditor5_assets %>
|
521
605
|
<% end %>
|
522
606
|
```
|
523
607
|
|
524
|
-
|
608
|
+
In that scenario it's recommended to add `gpl` method to the initializer along with the version:
|
525
609
|
|
526
|
-
|
527
|
-
|
528
|
-
```erb
|
529
|
-
<!-- app/views/demos/index.html.erb -->
|
610
|
+
```rb
|
611
|
+
# config/initializers/ckeditor5.rb
|
530
612
|
|
531
|
-
|
532
|
-
|
533
|
-
|
613
|
+
CKEditor5::Rails.configure do
|
614
|
+
gpl
|
615
|
+
version '43.3.0'
|
616
|
+
end
|
534
617
|
```
|
535
618
|
|
536
|
-
|
619
|
+
In order to use `unpkg` CDN, you can extend your initializer with the following configuration:
|
537
620
|
|
538
621
|
```rb
|
539
622
|
# config/initializers/ckeditor5.rb
|
540
623
|
|
541
624
|
CKEditor5::Rails.configure do
|
542
|
-
|
543
|
-
|
544
|
-
|
625
|
+
# ... rest of the configuration
|
626
|
+
|
627
|
+
cdn :unpkg
|
545
628
|
end
|
546
629
|
```
|
547
630
|
|
548
|
-
|
631
|
+
However, you can also specify the CDN directly in the view:
|
549
632
|
|
550
633
|
```erb
|
551
634
|
<!-- app/views/demos/index.html.erb -->
|
@@ -565,31 +648,27 @@ or using helper function:
|
|
565
648
|
<% end %>
|
566
649
|
```
|
567
650
|
|
568
|
-
|
569
|
-
|
570
|
-
```erb
|
571
|
-
<!-- app/views/demos/index.html.erb -->
|
572
|
-
|
573
|
-
<% content_for :head do %>
|
574
|
-
<%= ckeditor5_assets translations: [:pl] %>
|
575
|
-
<% end %>
|
576
|
-
```
|
651
|
+
### Commercial usage 💰
|
577
652
|
|
578
|
-
|
653
|
+
If you want to use CKEditor 5 under a commercial license, you have to specify license key. It can be done in the initializer:
|
579
654
|
|
580
655
|
```rb
|
581
656
|
# config/initializers/ckeditor5.rb
|
582
657
|
|
583
658
|
CKEditor5::Rails.configure do
|
584
|
-
|
585
|
-
language :pl
|
586
|
-
end
|
659
|
+
license_key 'your-license-key'
|
587
660
|
end
|
588
661
|
```
|
589
662
|
|
590
|
-
|
663
|
+
```erb
|
664
|
+
<!-- app/views/demos/index.html.erb -->
|
591
665
|
|
592
|
-
|
666
|
+
<% content_for :head do %>
|
667
|
+
<%= ckeditor5_assets %>
|
668
|
+
<% end %>
|
669
|
+
```
|
670
|
+
|
671
|
+
or directly in the view:
|
593
672
|
|
594
673
|
```erb
|
595
674
|
<!-- app/views/demos/index.html.erb -->
|
@@ -1073,6 +1152,14 @@ document.getElementById('editor').addEventListener('editor-error', () => {
|
|
1073
1152
|
});
|
1074
1153
|
```
|
1075
1154
|
|
1155
|
+
## Trademarks 📜
|
1156
|
+
|
1157
|
+
CKEditor® is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com/) All rights reserved. For more information about the license of CKEditor® please visit [CKEditor's licensing page](https://ckeditor.com/legal/ckeditor-oss-license/).
|
1158
|
+
|
1159
|
+
This gem is not owned by CKSource and does not use the CKEditor® trademark for commercial purposes. It should not be associated with or considered an official CKSource product.
|
1160
|
+
|
1076
1161
|
## License 📜
|
1077
1162
|
|
1078
1163
|
This project is licensed under the terms of the [GNU General Public License v2.0](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html). See the [LICENSE](LICENSE) file for details.
|
1164
|
+
|
1165
|
+
This project uses CKEditor 5 which is licensed under the terms of [GNU General Public License Version 2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). For more information about CKEditor 5 licensing, please see their [official documentation](https://ckeditor.com/legal/ckeditor-oss-license/).
|
@@ -33,8 +33,25 @@ module CKEditor5::Rails
|
|
33
33
|
config.ckeditor5.presets.default
|
34
34
|
end
|
35
35
|
|
36
|
-
def configure
|
37
|
-
|
36
|
+
def configure(&block)
|
37
|
+
proxy = ConfigurationProxy.new(config.ckeditor5)
|
38
|
+
proxy.instance_eval(&block)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class ConfigurationProxy
|
43
|
+
delegate :presets, to: :@configuration
|
44
|
+
|
45
|
+
delegate :version, :gpl, :premium, :cdn, :translations, :license_key,
|
46
|
+
:type, :menubar, :toolbar, :plugins, :plugin, :inline_plugin,
|
47
|
+
:language, :ckbox, :configure, to: :default_preset
|
48
|
+
|
49
|
+
def initialize(configuration)
|
50
|
+
@configuration = configuration
|
51
|
+
end
|
52
|
+
|
53
|
+
def default_preset
|
54
|
+
presets.default
|
38
55
|
end
|
39
56
|
end
|
40
57
|
end
|
@@ -12,8 +12,13 @@ module CKEditor5::Rails::Presets
|
|
12
12
|
define_default_preset
|
13
13
|
end
|
14
14
|
|
15
|
-
def define(name, &block)
|
16
|
-
preset =
|
15
|
+
def define(name, inherit: true, &block)
|
16
|
+
preset = if inherit && default.present?
|
17
|
+
default.clone
|
18
|
+
else
|
19
|
+
PresetBuilder.new
|
20
|
+
end
|
21
|
+
|
17
22
|
preset.instance_eval(&block)
|
18
23
|
@presets[name] = preset
|
19
24
|
end
|
@@ -22,12 +27,14 @@ module CKEditor5::Rails::Presets
|
|
22
27
|
@presets[name].instance_eval(&block)
|
23
28
|
end
|
24
29
|
|
30
|
+
alias extend override
|
31
|
+
|
25
32
|
def default
|
26
|
-
@presets[:default]
|
33
|
+
@presets[:default]
|
27
34
|
end
|
28
35
|
|
29
36
|
def [](name)
|
30
|
-
@presets[name]
|
37
|
+
@presets[name]
|
31
38
|
end
|
32
39
|
|
33
40
|
private
|
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.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz Bagiński
|
@@ -9,28 +9,28 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-11-
|
12
|
+
date: 2024-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '7.0'
|
21
18
|
- - ">="
|
22
19
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
20
|
+
version: '6.0'
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '8.0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
-
- - "~>"
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: '7.0'
|
31
28
|
- - ">="
|
32
29
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
30
|
+
version: '6.0'
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '8.0'
|
34
34
|
description:
|
35
35
|
email: cziken58@gmail.com
|
36
36
|
executables: []
|