Sha256: 5ab15c3970eb8a9fb04a998d7400ec3deb07c5f5ab49259fad5c4b541cf727ae

Contents?: true

Size: 939 Bytes

Versions: 4

Compression:

Stored size: 939 Bytes

Contents

# frozen_string_literal: true

require_relative 'props_base_plugin'

module CKEditor5::Rails::Editor
  class PropsPlugin < PropsBasePlugin
    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

    # Compress a little bit default plugins to make output smaller
    def to_h
      if @js_import_meta.import_name == 'ckeditor5'
        @js_import_meta.import_as.to_s
      else
        @js_import_meta.to_h
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/ckeditor5-1.24.9/lib/ckeditor5/rails/editor/props_plugin.rb
ckeditor5-1.24.9 lib/ckeditor5/rails/editor/props_plugin.rb
ckeditor5-1.24.8 lib/ckeditor5/rails/editor/props_plugin.rb
ckeditor5-1.24.6 lib/ckeditor5/rails/editor/props_plugin.rb