Sha256: 3c78ac236bdac8ef602e95d55b1ffa71697ed3e9327310fb2f6e4884661c3ef9

Contents?: true

Size: 739 Bytes

Versions: 3

Compression:

Stored size: 739 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_urls
      @stylesheets + [@js_import_meta.url]
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ckeditor5-1.18.3 lib/ckeditor5/rails/editor/props_external_plugin.rb
ckeditor5-1.18.1 lib/ckeditor5/rails/editor/props_external_plugin.rb
ckeditor5-1.18.0 lib/ckeditor5/rails/editor/props_external_plugin.rb