Class: CKEditor5::Rails::Editor::PropsPlugin

Inherits:
PropsBasePlugin show all
Defined in:
lib/ckeditor5/rails/editor/props_plugin.rb

Instance Attribute Summary

Attributes inherited from PropsBasePlugin

#assets_bundle, #name

Instance Method Summary collapse

Methods inherited from PropsBasePlugin

normalize, #preload_assets_bundle

Constructor Details

#initialize(name, premium: false, **js_import_meta_attrs) ⇒ PropsPlugin

Returns a new instance of PropsPlugin.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ckeditor5/rails/editor/props_plugin.rb', line 7

def initialize(name, premium: false, **js_import_meta_attrs)
  super(name)

  js_import_meta_attrs[:import_name] ||= if premium
                                           'ckeditor5-premium-features'
                                         else
                                           'ckeditor5'
                                         end

  @js_import_meta = ::CKEditor5::Rails::Assets::JSImportMeta.new(
    import_as: js_import_meta_attrs[:window_name] ? nil : name,
    **js_import_meta_attrs
  )
end

Instance Method Details

#to_hObject



22
23
24
# File 'lib/ckeditor5/rails/editor/props_plugin.rb', line 22

def to_h
  @js_import_meta.to_h.merge(type: :external)
end