mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-22 03:32:18 -05:00
25 lines
545 B
Ruby
25 lines
545 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Components::EditableSpan < Components::Base
|
|
def initialize(fieldname:, path:, text:)
|
|
@fieldname = fieldname
|
|
@path = path
|
|
@text = text
|
|
end
|
|
|
|
def view_template
|
|
span(
|
|
class: "editable p-1",
|
|
contenteditable: "plaintext-only",
|
|
data: {
|
|
editable_field: @fieldname,
|
|
editable_path: @path,
|
|
controller: "editable",
|
|
action: "focus->editable#onFocus blur->editable#onBlur keypress->editable#onKeypress"
|
|
}
|
|
) do
|
|
@text
|
|
end
|
|
end
|
|
end
|