Class: CKEditor5::Rails::Editor::PropsExternalPlugin

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

Direct Known Subclasses

Plugins::WProofreader

Instance Attribute Summary collapse

Attributes inherited from PropsBasePlugin

#assets_bundle, #name

Instance Method Summary collapse

Methods inherited from PropsBasePlugin

normalize

Constructor Details

#initialize(name, script:, import_as: nil, window_name: nil, stylesheets: []) ⇒ PropsExternalPlugin

Returns a new instance of PropsExternalPlugin.



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

def initialize(name, script:, import_as: nil, window_name: nil, stylesheets: [])
  super(name)

  @stylesheets = stylesheets
  @js_import_meta = CKEditor5::Rails::Assets::JSUrlImportMeta.new(
    script,
    import_name: script,
    import_as: import_as,
    window_name: window_name
  )
end

Instance Attribute Details

#js_import_metaObject (readonly)

Returns the value of attribute js_import_meta.



7
8
9
# File 'lib/ckeditor5/rails/editor/props_external_plugin.rb', line 7

def js_import_meta
  @js_import_meta
end

#stylesheetsObject (readonly)

Returns the value of attribute stylesheets.



7
8
9
# File 'lib/ckeditor5/rails/editor/props_external_plugin.rb', line 7

def stylesheets
  @stylesheets
end

Instance Method Details

#preload_assets_bundleObject



21
22
23
24
25
26
# File 'lib/ckeditor5/rails/editor/props_external_plugin.rb', line 21

def preload_assets_bundle
  @preload_assets_bundle ||= CKEditor5::Rails::Assets::AssetsBundle.new(
    scripts: [@js_import_meta],
    stylesheets: @stylesheets
  )
end

#to_hObject



28
29
30
# File 'lib/ckeditor5/rails/editor/props_external_plugin.rb', line 28

def to_h
  @js_import_meta.to_h.merge(stylesheets: @stylesheets)
end