ckeditor5 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +142 -26
- data/lib/ckeditor5/rails/cdn/ckbox_bundle.rb +1 -1
- data/lib/ckeditor5/rails/cdn/ckeditor_bundle.rb +1 -1
- data/lib/ckeditor5/rails/cdn/helpers.rb +34 -2
- data/lib/ckeditor5/rails/editor/props.rb +1 -1
- data/lib/ckeditor5/rails/engine.rb +4 -6
- data/lib/ckeditor5/rails/presets.rb +67 -3
- data/lib/ckeditor5/rails/semver.rb +1 -1
- data/lib/ckeditor5/rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad357ef6b45ba35fdea777e70dae559476bd57040b23f49cfefa3581b4b3aafc
|
4
|
+
data.tar.gz: 89da75ef1325766ad4a2f0d81152822f8774b55efdf81bd76b8d9479332cb749
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4f599b202ef0c109e14ff12c25f09890808d53e2116b2d3b6e51dfbfc5f389ea1d62651aa1a493fb897838e56ca2f3345addee8eebd55f5c2b7126f55169ce3
|
7
|
+
data.tar.gz: fc254a7f703defae55c901a444329772e177dfbfc8d0ee4ea3864c6c516b1c36f64e21166ec2e787d79ce368e09981ad524f4187842f31b53b8084ab690ed13b
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ Usage in your Rails application:
|
|
28
28
|
<%= ckeditor5_editor style: 'width: 600px' %>
|
29
29
|
```
|
30
30
|
|
31
|
-
|
31
|
+
Result:
|
32
32
|
|
33
33
|
![CKEditor 5 Classic Editor in Ruby on Rails application](docs/intro-classic-editor.png)
|
34
34
|
|
@@ -39,8 +39,14 @@ Effect:
|
|
39
39
|
- [Table of Contents 📚](#table-of-contents-)
|
40
40
|
- [Presets 🎨](#presets-)
|
41
41
|
- [Available Configuration Methods ⚙️](#available-configuration-methods-️)
|
42
|
-
- [`
|
43
|
-
- [`
|
42
|
+
- [`version(version)` method](#versionversion-method)
|
43
|
+
- [`gpl` method](#gpl-method)
|
44
|
+
- [`premium` method](#premium-method)
|
45
|
+
- [`translations(*languages)` method](#translationslanguages-method)
|
46
|
+
- [`license_key(key)` method](#license_keykey-method)
|
47
|
+
- [`ckbox` method](#ckbox-method)
|
48
|
+
- [`type(type)` method](#typetype-method)
|
49
|
+
- [`plugins(*names, **kwargs)` method](#pluginsnames-kwargs-method)
|
44
50
|
- [`toolbar(*items, should_group_when_full: true)` method](#toolbaritems-should_group_when_full-true-method)
|
45
51
|
- [`menubar(visible: true)` method](#menubarvisible-true-method)
|
46
52
|
- [`language(ui, content:)` method](#languageui-content-method)
|
@@ -62,16 +68,16 @@ Effect:
|
|
62
68
|
|
63
69
|
Presets are predefined configurations of CKEditor 5, allowing quick setup with specific features. The gem includes a `:default` preset with common features like bold, italic, underline, and link for the classic editor.
|
64
70
|
|
65
|
-
You can
|
66
|
-
|
67
|
-
The example below shows how to define a custom preset with a classic editor and a custom toolbar:
|
71
|
+
You can create your own by defining it in the `config/initializers/ckeditor5.rb` file using the `config.presets.define` method. The example below illustrates the setup of a custom preset with a classic editor and a custom toolbar:
|
68
72
|
|
69
73
|
```rb
|
70
74
|
# config/initializers/ckeditor5.rb
|
71
75
|
|
72
76
|
CKEditor5::Rails::Engine.configure do |config|
|
73
77
|
config.presets.define :custom
|
74
|
-
|
78
|
+
gpl # Use GPL license
|
79
|
+
|
80
|
+
type :classic
|
75
81
|
|
76
82
|
menubar
|
77
83
|
|
@@ -93,7 +99,7 @@ CKEditor5::Rails::Engine.configure do |config|
|
|
93
99
|
end
|
94
100
|
```
|
95
101
|
|
96
|
-
In order to override existing presets, you can use the `config.presets.override` method. The method takes the name of the preset you want to override and a block with the
|
102
|
+
In order to override existing presets, you can use the `config.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:
|
97
103
|
|
98
104
|
```rb
|
99
105
|
# config/initializers/ckeditor5.rb
|
@@ -105,14 +111,98 @@ CKEditor5::Rails::Engine.configure do |config|
|
|
105
111
|
end
|
106
112
|
```
|
107
113
|
|
108
|
-
|
114
|
+
Configuration of the editor can be complex, and it's recommended to use the CKEditor 5 [online builder](https://ckeditor.com/ckeditor-5/online-builder/) to generate the configuration. It allows you to select the features you want to include and generate the configuration code in JavaScript format. Keep in mind that you need to convert the JavaScript configuration to Ruby format before using it in this gem.
|
109
115
|
|
110
116
|
### Available Configuration Methods ⚙️
|
111
117
|
|
112
118
|
<details>
|
113
119
|
<summary>Expand to show available methods 📖</summary>
|
114
120
|
|
115
|
-
#### `
|
121
|
+
#### `version(version)` method
|
122
|
+
|
123
|
+
Defines the version of CKEditor 5 to be used. The example below shows how to set the version to `43.2.0`:
|
124
|
+
|
125
|
+
```rb
|
126
|
+
# config/initializers/ckeditor5.rb
|
127
|
+
|
128
|
+
config.presets.define :custom do
|
129
|
+
# ... other configuration
|
130
|
+
|
131
|
+
version '43.2.0'
|
132
|
+
end
|
133
|
+
```
|
134
|
+
|
135
|
+
#### `gpl` method
|
136
|
+
|
137
|
+
Defines the license of CKEditor 5. The example below shows how to set the license to GPL:
|
138
|
+
|
139
|
+
```rb
|
140
|
+
# config/initializers/ckeditor5.rb
|
141
|
+
|
142
|
+
config.presets.define :custom do
|
143
|
+
# ... other configuration
|
144
|
+
|
145
|
+
gpl
|
146
|
+
end
|
147
|
+
```
|
148
|
+
|
149
|
+
#### `premium` method
|
150
|
+
|
151
|
+
Defines if premium package (`ckeditor5-premium-features`) should be used.
|
152
|
+
|
153
|
+
```rb
|
154
|
+
# config/initializers/ckeditor5.rb
|
155
|
+
|
156
|
+
config.presets.define :custom do
|
157
|
+
# ... other configuration
|
158
|
+
|
159
|
+
premium
|
160
|
+
end
|
161
|
+
```
|
162
|
+
|
163
|
+
#### `translations(*languages)` method
|
164
|
+
|
165
|
+
Defines the translations of CKEditor 5. You can pass the language codes as arguments. The example below shows how to set the Polish and Spanish translations:
|
166
|
+
|
167
|
+
```rb
|
168
|
+
# config/initializers/ckeditor5.rb
|
169
|
+
|
170
|
+
config.presets.define :custom do
|
171
|
+
# ... other configuration
|
172
|
+
|
173
|
+
translations :pl, :es
|
174
|
+
end
|
175
|
+
```
|
176
|
+
|
177
|
+
#### `license_key(key)` method
|
178
|
+
|
179
|
+
Defines the license key of CKEditor 5. It calls `premium` method internally. The example below shows how to set the license key:
|
180
|
+
|
181
|
+
```rb
|
182
|
+
# config/initializers/ckeditor5.rb
|
183
|
+
|
184
|
+
config.presets.define :custom do
|
185
|
+
# ... other configuration
|
186
|
+
|
187
|
+
license_key 'your-license-key'
|
188
|
+
end
|
189
|
+
```
|
190
|
+
|
191
|
+
#### `ckbox` method
|
192
|
+
|
193
|
+
Defines the CKBox plugin to be included in the editor. The example below shows how to include the CKBox plugin:
|
194
|
+
|
195
|
+
```rb
|
196
|
+
# config/initializers/ckeditor5.rb
|
197
|
+
|
198
|
+
config.presets.define :custom do
|
199
|
+
# ... other configuration
|
200
|
+
|
201
|
+
ckbox '2.5.4', theme: :lark
|
202
|
+
end
|
203
|
+
```
|
204
|
+
|
205
|
+
#### `type(type)` method
|
116
206
|
|
117
207
|
Defines the type of editor. Available options:
|
118
208
|
|
@@ -122,24 +212,28 @@ Defines the type of editor. Available options:
|
|
122
212
|
- `:balloon` - balloon editor
|
123
213
|
- `:multiroot` - editor with multiple editing areas
|
124
214
|
|
125
|
-
The example below
|
215
|
+
The example below sets the editor type to `multiroot` in the custom preset:
|
126
216
|
|
127
217
|
```rb
|
128
218
|
# config/initializers/ckeditor5.rb
|
129
219
|
|
130
220
|
config.presets.define :custom do
|
131
|
-
|
221
|
+
# ... other configuration
|
222
|
+
|
223
|
+
type :multiroot
|
132
224
|
end
|
133
225
|
```
|
134
226
|
|
135
|
-
#### `plugins(*names)` method
|
227
|
+
#### `plugins(*names, **kwargs)` method
|
136
228
|
|
137
|
-
Defines the plugins to be included in the editor. You can specify multiple plugins by passing their names as arguments.
|
229
|
+
Defines the plugins to be included in the editor. You can specify multiple plugins by passing their names as arguments. The keyword arguments are identical to the configuration of the `plugin` method defined below.
|
138
230
|
|
139
231
|
```rb
|
140
232
|
# config/initializers/ckeditor5.rb
|
141
233
|
|
142
234
|
config.presets.define :custom do
|
235
|
+
# ... other configuration
|
236
|
+
|
143
237
|
plugins :Bold, :Italic, :Underline, :Link
|
144
238
|
end
|
145
239
|
```
|
@@ -257,16 +351,16 @@ end
|
|
257
351
|
|
258
352
|
## Including CKEditor 5 assets 📦
|
259
353
|
|
260
|
-
To include CKEditor 5 assets in your application, you can use the `ckeditor5_assets` helper method. This method takes the version of CKEditor 5 as an argument and includes the necessary
|
354
|
+
To include CKEditor 5 assets in your application, you can use the `ckeditor5_assets` helper method. This method takes the version of CKEditor 5 as an argument and includes the necessary resources of the editor. Depending on the specified configuration, it includes the JS and CSS assets from the official CKEditor 5 CDN or one of the popular CDNs.
|
261
355
|
|
262
|
-
Keep in mind that you need to include the
|
356
|
+
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.
|
263
357
|
|
264
358
|
### Lazy loading 🚀
|
265
359
|
|
266
360
|
<details>
|
267
361
|
<summary>Loading JS and CSS Assets</summary>
|
268
362
|
|
269
|
-
All JS assets defined by the `ckeditor5_assets` helper method are loaded asynchronously
|
363
|
+
All JS assets defined by the `ckeditor5_assets` helper method are loaded **asynchronously**. It means that the assets are loaded in the background without blocking the rendering of the page. However, the CSS assets are loaded **synchronously** to prevent the flash of unstyled content and ensure that the editor is styled correctly.
|
270
364
|
|
271
365
|
It has been achieved by using web components, together with import maps, which are supported by modern browsers. The web components are used to define the editor and its plugins, while the import maps are used to define the dependencies between the assets.
|
272
366
|
|
@@ -286,6 +380,28 @@ If you want to use CKEditor 5 under the GPL license, you can include the assets
|
|
286
380
|
|
287
381
|
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.
|
288
382
|
|
383
|
+
Version is optional as long as you defined it in the `config/initializers/ckeditor5.rb` file. If you want to use the default version, you can omit the `version` keyword argument:
|
384
|
+
|
385
|
+
```erb
|
386
|
+
<!-- app/views/demos/index.html.erb -->
|
387
|
+
|
388
|
+
<% content_for :head do %>
|
389
|
+
<%= ckeditor5_assets %>
|
390
|
+
<% end %>
|
391
|
+
```
|
392
|
+
|
393
|
+
Set the version in the `config/initializers/ckeditor5.rb` file:
|
394
|
+
|
395
|
+
```rb
|
396
|
+
# config/initializers/ckeditor5.rb
|
397
|
+
|
398
|
+
CKEditor5::Rails::Engine.configure do
|
399
|
+
presets.override :default do
|
400
|
+
version '43.3.0'
|
401
|
+
end
|
402
|
+
end
|
403
|
+
```
|
404
|
+
|
289
405
|
In order to use `unpkg` CDN, you can pass the `cdn` keyword argument with the value `:unpkg`:
|
290
406
|
|
291
407
|
```erb
|
@@ -349,7 +465,7 @@ In this scenario, the assets are included from the official CKEditor 5 CDN which
|
|
349
465
|
|
350
466
|
## Editor placement 🏗️
|
351
467
|
|
352
|
-
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.
|
468
|
+
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.
|
353
469
|
|
354
470
|
### Classic editor 📝
|
355
471
|
|
@@ -365,7 +481,7 @@ The example below shows how to include the classic editor in your view:
|
|
365
481
|
<!-- app/views/demos/index.html.erb -->
|
366
482
|
|
367
483
|
<% content_for :head do %>
|
368
|
-
<%= ckeditor5_assets
|
484
|
+
<%= ckeditor5_assets %>
|
369
485
|
<% end %>
|
370
486
|
|
371
487
|
<%= ckeditor5_editor style: 'width: 600px' %>
|
@@ -379,7 +495,7 @@ While example above uses predefined `:default` preset, you can use your custom p
|
|
379
495
|
<!-- app/views/demos/index.html.erb -->
|
380
496
|
|
381
497
|
<% content_for :head do %>
|
382
|
-
<%= ckeditor5_assets
|
498
|
+
<%= ckeditor5_assets %>
|
383
499
|
<% end %>
|
384
500
|
|
385
501
|
<%= ckeditor5_editor preset: :custom, style: 'width: 600px' %>
|
@@ -391,7 +507,7 @@ If your configuration is even more complex, you can pass the `config` and `type`
|
|
391
507
|
<!-- app/views/demos/index.html.erb -->
|
392
508
|
|
393
509
|
<% content_for :head do %>
|
394
|
-
<%= ckeditor5_assets
|
510
|
+
<%= ckeditor5_assets %>
|
395
511
|
<% end %>
|
396
512
|
|
397
513
|
<%= ckeditor5_editor type: :classic, config: { plugins: [:Bold, :Italic], toolbar: [:Bold, :Italic] }, style: 'width: 600px' %>
|
@@ -403,7 +519,7 @@ If you want to override the configuration of the editor specified in default or
|
|
403
519
|
<!-- app/views/demos/index.html.erb -->
|
404
520
|
|
405
521
|
<% content_for :head do %>
|
406
|
-
<%= ckeditor5_assets
|
522
|
+
<%= ckeditor5_assets %>
|
407
523
|
<% end %>
|
408
524
|
|
409
525
|
<%= ckeditor5_editor extra_config: { toolbar: [:Bold, :Italic] }, style: 'width: 600px' %>
|
@@ -425,7 +541,7 @@ If you want to use a multiroot editor, you can pass the `type` keyword argument
|
|
425
541
|
<!-- app/views/demos/index.html.erb -->
|
426
542
|
|
427
543
|
<% content_for :head do %>
|
428
|
-
<%= ckeditor5_assets
|
544
|
+
<%= ckeditor5_assets %>
|
429
545
|
<% end %>
|
430
546
|
|
431
547
|
<%= ckeditor5_editor type: :multiroot, style: 'width: 600px' do %>
|
@@ -454,7 +570,7 @@ If you want to use an inline editor, you can pass the `type` keyword argument wi
|
|
454
570
|
<!-- app/views/demos/index.html.erb -->
|
455
571
|
|
456
572
|
<% content_for :head do %>
|
457
|
-
<%= ckeditor5_assets
|
573
|
+
<%= ckeditor5_assets %>
|
458
574
|
<% end %>
|
459
575
|
|
460
576
|
<%= ckeditor5_editor type: :inline, style: 'width: 600px' %>
|
@@ -472,7 +588,7 @@ If you want to use a balloon editor, you can pass the `type` keyword argument wi
|
|
472
588
|
<!-- app/views/demos/index.html.erb -->
|
473
589
|
|
474
590
|
<% content_for :head do %>
|
475
|
-
<%= ckeditor5_assets
|
591
|
+
<%= ckeditor5_assets %>
|
476
592
|
<% end %>
|
477
593
|
|
478
594
|
<%= ckeditor5_editor type: :balloon, style: 'width: 600px' %>
|
@@ -488,7 +604,7 @@ If you want to use a decoupled editor, you can pass the `type` keyword argument
|
|
488
604
|
|
489
605
|
```erb
|
490
606
|
<% content_for :head do %>
|
491
|
-
<%= ckeditor5_assets
|
607
|
+
<%= ckeditor5_assets %>
|
492
608
|
<% end %>
|
493
609
|
|
494
610
|
<style>
|
@@ -7,7 +7,7 @@ module CKEditor5::Rails
|
|
7
7
|
|
8
8
|
attr_reader :cdn, :version, :theme, :translations
|
9
9
|
|
10
|
-
def initialize(version, theme: :lark, cdn: Engine.
|
10
|
+
def initialize(version, theme: :lark, cdn: Engine.default_preset.cdn, translations: [])
|
11
11
|
raise ArgumentError, 'version must be semver' unless version.is_a?(Semver)
|
12
12
|
raise ArgumentError, 'theme must be a string' unless theme.is_a?(String)
|
13
13
|
raise ArgumentError, 'translations must be an array' unless translations.is_a?(Array)
|
@@ -7,7 +7,7 @@ module CKEditor5::Rails
|
|
7
7
|
|
8
8
|
attr_reader :version, :translations, :import_name
|
9
9
|
|
10
|
-
def initialize(version, import_name, cdn: Engine.
|
10
|
+
def initialize(version, import_name, cdn: Engine.default_preset.cdn, translations: [])
|
11
11
|
raise ArgumentError, 'version must be semver' unless version.is_a?(Semver)
|
12
12
|
raise ArgumentError, 'import_name must be a string' unless import_name.is_a?(String)
|
13
13
|
raise ArgumentError, 'translations must be an array' unless translations.is_a?(Array)
|
@@ -6,7 +6,17 @@ require_relative 'ckbox_bundle'
|
|
6
6
|
|
7
7
|
module CKEditor5::Rails
|
8
8
|
module Cdn::Helpers
|
9
|
-
def ckeditor5_cdn_assets(
|
9
|
+
def ckeditor5_cdn_assets(preset: :default, **kwargs)
|
10
|
+
merge_with_editor_preset(preset, **kwargs) => {
|
11
|
+
cdn:,
|
12
|
+
version:,
|
13
|
+
translations:,
|
14
|
+
ckbox:,
|
15
|
+
license_key:,
|
16
|
+
premium:,
|
17
|
+
**kwargs
|
18
|
+
}
|
19
|
+
|
10
20
|
bundle = build_base_cdn_bundle(cdn, version, translations)
|
11
21
|
bundle << build_premium_cdn_bundle(cdn, version, translations) if premium
|
12
22
|
bundle << build_ckbox_cdn_bundle(ckbox) if ckbox
|
@@ -29,12 +39,34 @@ module CKEditor5::Rails
|
|
29
39
|
if kwargs[:license_key] && kwargs[:license_key] != 'GPL'
|
30
40
|
ckeditor5_cloud_assets(**kwargs)
|
31
41
|
else
|
32
|
-
ckeditor5_cdn_assets(**kwargs.merge(cdn: Engine.
|
42
|
+
ckeditor5_cdn_assets(**kwargs.merge(cdn: Engine.default_preset.cdn))
|
33
43
|
end
|
34
44
|
end
|
35
45
|
|
36
46
|
private
|
37
47
|
|
48
|
+
def merge_with_editor_preset(preset, **kwargs)
|
49
|
+
found_preset = Engine.base.presets[preset]
|
50
|
+
|
51
|
+
if found_preset.blank?
|
52
|
+
raise ArgumentError,
|
53
|
+
"Poor thing. You forgot to define your #{preset} preset. " \
|
54
|
+
'Please define it in initializer. Thank you!'
|
55
|
+
end
|
56
|
+
|
57
|
+
hash = found_preset.to_h_with_overrides(**kwargs)
|
58
|
+
|
59
|
+
%i[version type].each do |key|
|
60
|
+
next if hash[key].present?
|
61
|
+
|
62
|
+
raise ArgumentError,
|
63
|
+
"Poor thing. You forgot to define #{key}. Make sure you passed `#{key}:` parameter to " \
|
64
|
+
"`ckeditor5_cdn_assets` or defined default one in your `#{preset}` preset!"
|
65
|
+
end
|
66
|
+
|
67
|
+
hash
|
68
|
+
end
|
69
|
+
|
38
70
|
def build_base_cdn_bundle(cdn, version, translations)
|
39
71
|
Cdn::CKEditorBundle.new(
|
40
72
|
Semver.new(version),
|
@@ -7,12 +7,6 @@ module CKEditor5::Rails
|
|
7
7
|
class Engine < ::Rails::Engine
|
8
8
|
config.ckeditor5 = ActiveSupport::OrderedOptions.new
|
9
9
|
|
10
|
-
# Specifies which CDN should be used to load CKEditor 5 using the ckeditor5_assets helper.
|
11
|
-
# It is possible to use the following CDNs:
|
12
|
-
# - :unpkg
|
13
|
-
# - :jsdelivr (default)
|
14
|
-
config.ckeditor5.default_cdn = :jsdelivr
|
15
|
-
|
16
10
|
# Specifies configuration of editors generated by gem.
|
17
11
|
config.ckeditor5.presets = PresetsManager.new
|
18
12
|
|
@@ -26,6 +20,10 @@ module CKEditor5::Rails
|
|
26
20
|
config.ckeditor5
|
27
21
|
end
|
28
22
|
|
23
|
+
def self.default_preset
|
24
|
+
config.ckeditor5.presets.default
|
25
|
+
end
|
26
|
+
|
29
27
|
def self.configure
|
30
28
|
yield config.ckeditor5
|
31
29
|
end
|
@@ -31,7 +31,9 @@ module CKEditor5::Rails
|
|
31
31
|
|
32
32
|
def define_default_preset
|
33
33
|
define :default do
|
34
|
-
|
34
|
+
gpl
|
35
|
+
|
36
|
+
type :classic
|
35
37
|
|
36
38
|
menubar
|
37
39
|
|
@@ -54,17 +56,79 @@ module CKEditor5::Rails
|
|
54
56
|
end
|
55
57
|
|
56
58
|
class PresetBuilder
|
57
|
-
attr_reader :
|
59
|
+
attr_reader :config
|
58
60
|
|
59
61
|
def initialize
|
62
|
+
@version = nil
|
63
|
+
@premium = false
|
64
|
+
@cdn = :jsdelivr
|
65
|
+
@translations = []
|
66
|
+
@license_key = nil
|
60
67
|
@type = :classic
|
68
|
+
@ckbox = nil
|
61
69
|
@config = {
|
62
70
|
plugins: [],
|
63
71
|
toolbar: []
|
64
72
|
}
|
65
73
|
end
|
66
74
|
|
67
|
-
def
|
75
|
+
def to_h_with_overrides(**overrides)
|
76
|
+
{
|
77
|
+
version: overrides.fetch(:version, version),
|
78
|
+
premium: overrides.fetch(:premium, premium),
|
79
|
+
cdn: overrides.fetch(:cdn, cdn),
|
80
|
+
translations: overrides.fetch(:translations, translations),
|
81
|
+
license_key: overrides.fetch(:license_key, license_key),
|
82
|
+
type: overrides.fetch(:type, type),
|
83
|
+
ckbox: overrides.fetch(:ckbox, ckbox),
|
84
|
+
config: config.merge(overrides.fetch(:config, {}))
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
def ckbox(version = nil, theme: :lark)
|
89
|
+
return @ckbox if version.nil?
|
90
|
+
|
91
|
+
@ckbox = { version: version, theme: theme }
|
92
|
+
end
|
93
|
+
|
94
|
+
def license_key(license_key = nil)
|
95
|
+
return @license_key if license_key.nil?
|
96
|
+
|
97
|
+
@license_key = license_key
|
98
|
+
end
|
99
|
+
|
100
|
+
def gpl
|
101
|
+
license_key('GPL')
|
102
|
+
premium(false)
|
103
|
+
end
|
104
|
+
|
105
|
+
def premium(premium = nil)
|
106
|
+
return @premium if premium.nil?
|
107
|
+
|
108
|
+
@premium = premium
|
109
|
+
end
|
110
|
+
|
111
|
+
def translations(*translations)
|
112
|
+
return @translations if translations.empty?
|
113
|
+
|
114
|
+
@translations = translations
|
115
|
+
end
|
116
|
+
|
117
|
+
def version(version = nil)
|
118
|
+
return @version.to_s if version.nil?
|
119
|
+
|
120
|
+
@version = Semver.new(version)
|
121
|
+
end
|
122
|
+
|
123
|
+
def cdn(cdn = nil)
|
124
|
+
return @cdn if cdn.nil?
|
125
|
+
|
126
|
+
@cdn = cdn
|
127
|
+
end
|
128
|
+
|
129
|
+
def type(type = nil)
|
130
|
+
return @type if type.nil?
|
131
|
+
|
68
132
|
raise ArgumentError, "Invalid editor type: #{type}" unless Editor::Props.valid_editor_type?(type)
|
69
133
|
|
70
134
|
@type = type
|