ckeditor5 1.1.0 → 1.1.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 +21 -0
- data/lib/ckeditor5/rails/presets.rb +15 -11
- 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: ba0f56261f0c699d67fce659fe6cd4cbc3fc2f288ebedf0fd908f4f6d9555001
|
4
|
+
data.tar.gz: 9c5b41693f3858a94841b7e6392bbd573a3bc83c3a936c7dd2fbdcfff42fda63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e12b59365223eeeee6cccef5e771ae2df9e17e9500275a871c8f7b41b6a39abe0cec725848f887ead1a3235d2d50447fdb8b99ead940d1dc50c5f795369d9354
|
7
|
+
data.tar.gz: b163824d28f9867b0bee31e273e5b0be6ad380891d43a1e48ed1fb4df0c38460a4cfddc5fcb7fdf1fa1430950b6cd3d47a6c4cbcf8c4067f5178660f6c991d15
|
data/README.md
CHANGED
@@ -138,6 +138,13 @@ In order to override existing presets, you can use the `config.presets.override`
|
|
138
138
|
CKEditor5::Rails::Engine.configure do |config|
|
139
139
|
config.presets.override :default do
|
140
140
|
menubar visible: false
|
141
|
+
|
142
|
+
toolbar do
|
143
|
+
remove :underline, :heading
|
144
|
+
|
145
|
+
# prepend :underline
|
146
|
+
# append :heading
|
147
|
+
end
|
141
148
|
end
|
142
149
|
end
|
143
150
|
```
|
@@ -305,6 +312,20 @@ config.presets.override :default do
|
|
305
312
|
end
|
306
313
|
```
|
307
314
|
|
315
|
+
If you want to remove items from the toolbar, you can use the `remove` method:
|
316
|
+
|
317
|
+
```rb
|
318
|
+
# config/initializers/ckeditor5.rb
|
319
|
+
|
320
|
+
config.presets.override :default do
|
321
|
+
# ... other configuration
|
322
|
+
|
323
|
+
toolbar do
|
324
|
+
remove :selectAll, :heading #, ...
|
325
|
+
end
|
326
|
+
end
|
327
|
+
```
|
328
|
+
|
308
329
|
#### `menubar(visible: true)` method
|
309
330
|
|
310
331
|
Defines the visibility of the menubar. By default, it's set to `true`.
|
@@ -187,29 +187,33 @@ module CKEditor5::Rails
|
|
187
187
|
@toolbar_config = toolbar_config
|
188
188
|
end
|
189
189
|
|
190
|
-
def
|
191
|
-
|
190
|
+
def items
|
191
|
+
@toolbar_config[:items]
|
192
|
+
end
|
193
|
+
|
194
|
+
def remove(*removed_items)
|
195
|
+
removed_items.each { |item| items.delete(item) }
|
196
|
+
end
|
192
197
|
|
198
|
+
def prepend(*prepended_items, before: nil)
|
193
199
|
if before
|
194
|
-
index =
|
200
|
+
index = items.index(before)
|
195
201
|
raise ArgumentError, "Item '#{before}' not found in toolbar" unless index
|
196
202
|
|
197
|
-
|
203
|
+
items.insert(index, *prepended_items)
|
198
204
|
else
|
199
|
-
|
205
|
+
items.insert(0, *prepended_items)
|
200
206
|
end
|
201
207
|
end
|
202
208
|
|
203
|
-
def append(*
|
204
|
-
toolbar_items = @toolbar_config[:items]
|
205
|
-
|
209
|
+
def append(*appended_items, after: nil)
|
206
210
|
if after
|
207
|
-
index =
|
211
|
+
index = items.index(after)
|
208
212
|
raise ArgumentError, "Item '#{after}' not found in toolbar" unless index
|
209
213
|
|
210
|
-
|
214
|
+
items.insert(index + 1, *appended_items)
|
211
215
|
else
|
212
|
-
|
216
|
+
items.push(*appended_items)
|
213
217
|
end
|
214
218
|
end
|
215
219
|
end
|