Class: Ruflet::UI::Controls::RufletComponents::CodeEditorControl

Inherits:
Control
  • Object
show all
Defined in:
lib/ruflet_ui/ruflet/ui/controls/materials/code_editor_control.rb

Constant Summary collapse

TYPE =
"code_editor".freeze
WIRE =
"CodeEditor".freeze
KEYWORDS =
[].freeze

Constants inherited from Control

Control::HOST_EXPANDED_TYPES, Control::SCHEMA_METADATA_CACHE

Instance Attribute Summary

Attributes inherited from Control

#children, #id, #props, #runtime_page, #type, #wire_id

Instance Method Summary collapse

Methods inherited from Control

#attach_handler, #emit, generate_id, #has_handler?, #merge_props, #on, #to_patch

Constructor Details

#initialize(id: nil, **props) ⇒ CodeEditorControl

Returns a new instance of CodeEditorControl.



12
13
14
15
16
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/code_editor_control.rb', line 12

def initialize(id: nil, **props)
  compact = {}
  props.each { |key, value| compact[key] = value unless value.nil? }
  super(type: TYPE, id: id, **compact)
end

Instance Method Details

#fold_at(line_number, timeout: 10, on_result: nil) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/ruflet_ui/ruflet/ui/controls/materials/code_editor_control.rb', line 24

def fold_at(line_number, timeout: 10, on_result: nil)
  invoke_editor(
    "fold_at",
    args: { "line_number" => line_number },
    timeout: timeout,
    on_result: on_result
  )
end