Module: CKEditor5::Rails::Presets::Concerns::PluginMethods
- Included in:
- Context::PresetBuilder, PresetBuilder
- Defined in:
- lib/ckeditor5/rails/presets/concerns/plugin_methods.rb
Instance Method Summary collapse
- #external_plugin(name, **kwargs) ⇒ Object
- #inline_plugin(name, code) ⇒ Object
- #plugin(name, **kwargs) ⇒ Object
- #plugins(*names, **kwargs, &block) ⇒ Object
Instance Method Details
#external_plugin(name, **kwargs) ⇒ Object
16 17 18 |
# File 'lib/ckeditor5/rails/presets/concerns/plugin_methods.rb', line 16 def external_plugin(name, **kwargs) register_plugin(Editor::PropsExternalPlugin.new(name, **kwargs)) end |
#inline_plugin(name, code) ⇒ Object
20 21 22 |
# File 'lib/ckeditor5/rails/presets/concerns/plugin_methods.rb', line 20 def inline_plugin(name, code) register_plugin(Editor::PropsInlinePlugin.new(name, code)) end |
#plugin(name, **kwargs) ⇒ Object
24 25 26 27 |
# File 'lib/ckeditor5/rails/presets/concerns/plugin_methods.rb', line 24 def plugin(name, **kwargs) premium(true) if kwargs[:premium] && respond_to?(:premium) register_plugin(PluginsBuilder.create_plugin(name, **kwargs)) end |
#plugins(*names, **kwargs, &block) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/ckeditor5/rails/presets/concerns/plugin_methods.rb', line 29 def plugins(*names, **kwargs, &block) config[:plugins] ||= [] names.each { |name| plugin(name, **kwargs) } unless names.empty? builder = PluginsBuilder.new(config[:plugins]) builder.instance_eval(&block) if block_given? builder end |