Sha256: 79babeb1c53a405a07f3ba476a94c109b049a7612e4543d19d4379eedaa4a210

Contents?: true

Size: 853 Bytes

Versions: 6

Compression:

Stored size: 853 Bytes

Contents

# frozen_string_literal: true

require_relative 'props_base_plugin'

module CKEditor5::Rails::Editor
  class PropsExternalPlugin < PropsBasePlugin
    attr_reader :stylesheets, :js_import_meta

    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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ckeditor5-1.19.5 lib/ckeditor5/rails/editor/props_external_plugin.rb
ckeditor5-1.19.4 lib/ckeditor5/rails/editor/props_external_plugin.rb
ckeditor5-1.19.3 lib/ckeditor5/rails/editor/props_external_plugin.rb
ckeditor5-1.19.2 lib/ckeditor5/rails/editor/props_external_plugin.rb
ckeditor5-1.19.1 lib/ckeditor5/rails/editor/props_external_plugin.rb
ckeditor5-1.19.0 lib/ckeditor5/rails/editor/props_external_plugin.rb