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
Registers an external plugin loaded from a URL.
-
#inline_plugin(name, code) ⇒ Object
Registers an inline plugin with raw JavaScript code.
-
#plugin(name, **kwargs) ⇒ Object
Register a single plugin by name.
-
#plugins(*names, **kwargs, &block) ⇒ Object
Register multiple plugins and configure plugin settings.
Instance Method Details
#external_plugin(name, **kwargs) ⇒ Object
Registers an external plugin loaded from a URL
30 31 32 |
# File 'lib/ckeditor5/rails/presets/concerns/plugin_methods.rb', line 30 def external_plugin(name, **kwargs) register_plugin(Editor::PropsExternalPlugin.new(name, **kwargs)) end |
#inline_plugin(name, code) ⇒ Object
Registers an inline plugin with raw JavaScript code
52 53 54 |
# File 'lib/ckeditor5/rails/presets/concerns/plugin_methods.rb', line 52 def inline_plugin(name, code) register_plugin(Editor::PropsInlinePlugin.new(name, code)) end |
#plugin(name, **kwargs) ⇒ Object
Register a single plugin by name
66 67 68 69 |
# File 'lib/ckeditor5/rails/presets/concerns/plugin_methods.rb', line 66 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
Register multiple plugins and configure plugin settings
83 84 85 86 87 88 89 90 91 |
# File 'lib/ckeditor5/rails/presets/concerns/plugin_methods.rb', line 83 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 |