lib/trix/form.rb in trix-0.9.5 vs lib/trix/form.rb in trix-0.9.6

- old
+ new

@@ -1,15 +1,20 @@ +require 'action_view' +require 'active_support/core_ext' + module TrixEditorHelper - cattr_accessor(:id, instance_accessor: false) { 0 } + mattr_accessor(:id, instance_accessor: false) + class_variable_set('@@id', 0) def trix_editor_tag(name, value = nil, options = {}) options.symbolize_keys! attributes = { class: "formatted_content #{options[:class]}".squish } attributes[:autofocus] = true if options[:autofocus] attributes[:placeholder] = options[:placeholder] if options[:placeholder] + attributes[:spellcheck] = options[:spellcheck] if options[:spellcheck] attributes[:input] = options[:input] || "trix_input_#{TrixEditorHelper.id += 1}" attributes[:toolbar] = options[:toolbar] if options[:toolbar] editor_tag = content_tag('trix-editor', '', attributes) input_tag = hidden_field_tag(name, value, id: attributes[:input]) @@ -23,10 +28,10 @@ include TrixEditorHelper module Tags class TrixEditor < Base include TrixEditorHelper - delegate :dom_id, to: ActionView::RecordIdentifier + delegate :dom_id, to: :'@template_object' def render options = @options.stringify_keys add_default_name_and_id(options) options['input'] ||= dom_id(object, [options['id'], :trix_input].compact.join('_'))