class CKEditor5::Rails::Editor::Props
def self.valid_editor_type?(type)
def self.valid_editor_type?(type) EDITOR_TYPES.key?(type) end
def initialize(context, type, config)
def initialize(context, type, config) raise ArgumentError, "Invalid editor type: #{type}" unless Props.valid_editor_type?(type) @context = context @type = type @config = config end
def serialize_config
def serialize_config config .except(:plugins) .merge(licenseKey: context[:license_key] || 'GPL') .to_json end
def serialize_plugins
def serialize_plugins (config[:plugins] || []).map { |plugin| PropsPlugin.normalize(plugin).to_h }.to_json end
def serialize_translations
def serialize_translations context[:bundle].translations_scripts.map { |script| script.import_meta.to_h }.to_json end
def serialized_attributes
def serialized_attributes { translations: serialize_translations, plugins: serialize_plugins, config: serialize_config } end
def to_attributes
def to_attributes { type: EDITOR_TYPES[@type], **serialized_attributes } end