Class: Inkpen::Extensions::TaskList
- Defined in:
- lib/inkpen/extensions/task_list.rb
Overview
Task List extension for TipTap.
Enables interactive checkbox/task list functionality. Users can create todo lists with checkable items that persist their state.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#checkbox_class ⇒ String
CSS class applied to the checkbox element.
-
#checked_class ⇒ String
CSS class applied to checked task items.
-
#html_attributes ⇒ Hash
HTML attributes for the task list element.
-
#item_class ⇒ String
CSS class applied to individual task items.
-
#item_html_attributes ⇒ Hash
HTML attributes for task item elements.
-
#keyboard_shortcut ⇒ String
Keyboard shortcut to create a task list.
-
#list_class ⇒ String
CSS class applied to task list container.
-
#name ⇒ Symbol
The unique name of this extension.
-
#nested? ⇒ Boolean
Whether task lists can be nested.
-
#text_toggle? ⇒ Boolean
Whether clicking on the text toggles the checkbox.
-
#to_config ⇒ Hash
Convert to configuration hash for JavaScript.
Methods inherited from Base
#enabled?, #initialize, #to_h, #to_json
Constructor Details
This class inherits a constructor from Inkpen::Extensions::Base
Instance Method Details
#checkbox_class ⇒ String
CSS class applied to the checkbox element.
75 76 77 |
# File 'lib/inkpen/extensions/task_list.rb', line 75 def checkbox_class .fetch(:checkbox_class, "inkpen-task-checkbox") end |
#checked_class ⇒ String
CSS class applied to checked task items.
66 67 68 |
# File 'lib/inkpen/extensions/task_list.rb', line 66 def checked_class .fetch(:checked_class, "inkpen-task-checked") end |
#html_attributes ⇒ Hash
HTML attributes for the task list element.
84 85 86 |
# File 'lib/inkpen/extensions/task_list.rb', line 84 def html_attributes .fetch(:html_attributes, { class: list_class }) end |
#item_class ⇒ String
CSS class applied to individual task items.
57 58 59 |
# File 'lib/inkpen/extensions/task_list.rb', line 57 def item_class .fetch(:item_class, "inkpen-task-item") end |
#item_html_attributes ⇒ Hash
HTML attributes for task item elements.
93 94 95 |
# File 'lib/inkpen/extensions/task_list.rb', line 93 def item_html_attributes .fetch(:item_html_attributes, { class: item_class }) end |
#keyboard_shortcut ⇒ String
Keyboard shortcut to create a task list.
111 112 113 |
# File 'lib/inkpen/extensions/task_list.rb', line 111 def keyboard_shortcut .fetch(:keyboard_shortcut, "Mod-Shift-9") end |
#list_class ⇒ String
CSS class applied to task list container.
48 49 50 |
# File 'lib/inkpen/extensions/task_list.rb', line 48 def list_class .fetch(:list_class, "inkpen-task-list") end |
#name ⇒ Symbol
The unique name of this extension.
30 31 32 |
# File 'lib/inkpen/extensions/task_list.rb', line 30 def name :task_list end |
#nested? ⇒ Boolean
Whether task lists can be nested.
39 40 41 |
# File 'lib/inkpen/extensions/task_list.rb', line 39 def nested? .fetch(:nested, true) end |
#text_toggle? ⇒ Boolean
Whether clicking on the text toggles the checkbox.
102 103 104 |
# File 'lib/inkpen/extensions/task_list.rb', line 102 def text_toggle? .fetch(:text_toggle, false) end |
#to_config ⇒ Hash
Convert to configuration hash for JavaScript.
120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/inkpen/extensions/task_list.rb', line 120 def to_config { nested: nested?, listClass: list_class, itemClass: item_class, checkedClass: checked_class, checkboxClass: checkbox_class, HTMLAttributes: html_attributes, itemHTMLAttributes: item_html_attributes, textToggle: text_toggle?, keyboardShortcut: keyboard_shortcut } end |