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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b14779f0c4c2e4358c77ed004b6c5ef191b2ff766fc95ba6c8f0245f7314f206
4
- data.tar.gz: 0a47a7b166356002ef4b25879e420b42693bc1851596da4b4db1382d704fc875
3
+ metadata.gz: ba0f56261f0c699d67fce659fe6cd4cbc3fc2f288ebedf0fd908f4f6d9555001
4
+ data.tar.gz: 9c5b41693f3858a94841b7e6392bbd573a3bc83c3a936c7dd2fbdcfff42fda63
5
5
  SHA512:
6
- metadata.gz: c7d8727f46f14c759f181dc77e19d4778efdb34e19327667922df06a7dcaa65d2512a4106d9dc0cf2f8810c7cb03b51e8cf440bda521f2cd237f7535447ac644
7
- data.tar.gz: f6b08e3fa6292af226cdc2e29867ec5ffaa52cdba2a3ca6843735e4672e6d9411a7a30520b007a4cd267fa7dc69e380de8135831767d396674b4f768efc19737
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 prepend(*items, before: nil)
191
- toolbar_items = @toolbar_config[:items]
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 = toolbar_items.index(before)
200
+ index = items.index(before)
195
201
  raise ArgumentError, "Item '#{before}' not found in toolbar" unless index
196
202
 
197
- toolbar_items.insert(index, *items)
203
+ items.insert(index, *prepended_items)
198
204
  else
199
- toolbar_items.insert(0, *items)
205
+ items.insert(0, *prepended_items)
200
206
  end
201
207
  end
202
208
 
203
- def append(*items, after: nil)
204
- toolbar_items = @toolbar_config[:items]
205
-
209
+ def append(*appended_items, after: nil)
206
210
  if after
207
- index = toolbar_items.index(after)
211
+ index = items.index(after)
208
212
  raise ArgumentError, "Item '#{after}' not found in toolbar" unless index
209
213
 
210
- toolbar_items.insert(index + 1, *items)
214
+ items.insert(index + 1, *appended_items)
211
215
  else
212
- toolbar_items.push(*items)
216
+ items.push(*appended_items)
213
217
  end
214
218
  end
215
219
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CKEditor5::Rails
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
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.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mateusz Bagiński