Sha256: 065207b2d066a51858fc2dcb5a62c289669499efccdac9ab9c09f54cc31b2ed4

Contents?: true

Size: 558 Bytes

Versions: 15

Compression:

Stored size: 558 Bytes

Contents

# frozen_string_literal: true

module CKEditor5::Rails
  module Context
    class Props
      def initialize(config)
        @config = config
      end

      def to_attributes
        {
          plugins: serialize_plugins,
          config: serialize_config
        }
      end

      private

      attr_reader :config

      def serialize_plugins
        (config[:plugins] || []).map { |plugin| Editor::PropsPlugin.normalize(plugin).to_h }.to_json
      end

      def serialize_config
        config.except(:plugins).to_json
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ckeditor5-1.16.1 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.15.10 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.15.9 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.15.8 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.15.7 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.15.2 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.15.1 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.15.0 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.14.1 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.14.0 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.12.0 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.11.1 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.11.0 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.10.0 lib/ckeditor5/rails/context/props.rb
ckeditor5-1.9.0 lib/ckeditor5/rails/context/props.rb