Class: Inkpen::Configuration
- Inherits:
-
Object
- Object
- Inkpen::Configuration
- Defined in:
- lib/inkpen/configuration.rb
Overview
Global configuration for Inkpen.
The Configuration class holds default settings that apply to all editor instances. Individual editors can override these defaults.
Constant Summary collapse
- CORE_EXTENSIONS =
Core text formatting extensions included by default.
These provide basic rich text editing capabilities.
%i[ bold italic strike underline highlight link heading bullet_list ordered_list blockquote code_block horizontal_rule hard_break typography ].freeze
- ADVANCED_EXTENSIONS =
Advanced extensions for enhanced editing features.
These provide Notion-like capabilities including databases, drag & drop, slash commands, and export functionality.
%i[ image table advanced_table inkpen_table slash_commands mention emoji search_replace footnotes placeholder typography highlight underline subscript superscript youtube character_count code_block_syntax task_list section document_section preformatted block_gutter drag_handle toggle_block columns callout block_commands enhanced_image file_attachment embed table_of_contents database export_commands ].freeze
Instance Attribute Summary collapse
-
#autosave ⇒ Boolean
Whether autosave is enabled by default.
-
#autosave_interval ⇒ Integer
Autosave interval in milliseconds.
-
#extensions ⇒ Array<Symbol>
List of enabled extensions.
-
#max_height ⇒ String?
Maximum editor height (CSS value).
-
#min_height ⇒ String?
Minimum editor height (CSS value).
-
#placeholder ⇒ String
Placeholder text for empty editors.
-
#toolbar ⇒ Symbol
Toolbar style (:floating, :fixed, :none).
Instance Method Summary collapse
-
#all_extensions ⇒ Array<Symbol>
Get all available extensions (core + advanced).
-
#disable_extension(name) ⇒ Symbol?
Disable a specific extension.
-
#enable_extension(name) ⇒ Array<Symbol>
Enable a specific extension.
-
#initialize ⇒ Configuration
constructor
Initialize configuration with sensible defaults.
Constructor Details
#initialize ⇒ Configuration
Initialize configuration with sensible defaults.
130 131 132 133 134 135 136 137 138 |
# File 'lib/inkpen/configuration.rb', line 130 def initialize @toolbar = :floating # :floating, :fixed, :none @extensions = CORE_EXTENSIONS.dup @placeholder = "Start writing..." @autosave = false @autosave_interval = 5000 # milliseconds @min_height = "200px" @max_height = nil end |
Instance Attribute Details
#autosave ⇒ Boolean
Returns whether autosave is enabled by default.
50 51 52 53 54 55 56 |
# File 'lib/inkpen/configuration.rb', line 50 attr_accessor :toolbar, :extensions, :placeholder, :autosave, :autosave_interval, :min_height, :max_height |
#autosave_interval ⇒ Integer
Returns autosave interval in milliseconds.
50 51 52 53 54 55 56 |
# File 'lib/inkpen/configuration.rb', line 50 attr_accessor :toolbar, :extensions, :placeholder, :autosave, :autosave_interval, :min_height, :max_height |
#extensions ⇒ Array<Symbol>
Returns list of enabled extensions.
50 51 52 53 54 55 56 |
# File 'lib/inkpen/configuration.rb', line 50 attr_accessor :toolbar, :extensions, :placeholder, :autosave, :autosave_interval, :min_height, :max_height |
#max_height ⇒ String?
Returns maximum editor height (CSS value).
50 51 52 53 54 55 56 |
# File 'lib/inkpen/configuration.rb', line 50 attr_accessor :toolbar, :extensions, :placeholder, :autosave, :autosave_interval, :min_height, :max_height |
#min_height ⇒ String?
Returns minimum editor height (CSS value).
50 51 52 53 54 55 56 |
# File 'lib/inkpen/configuration.rb', line 50 attr_accessor :toolbar, :extensions, :placeholder, :autosave, :autosave_interval, :min_height, :max_height |
#placeholder ⇒ String
Returns placeholder text for empty editors.
50 51 52 53 54 55 56 |
# File 'lib/inkpen/configuration.rb', line 50 attr_accessor :toolbar, :extensions, :placeholder, :autosave, :autosave_interval, :min_height, :max_height |
#toolbar ⇒ Symbol
Returns toolbar style (:floating, :fixed, :none).
50 51 52 |
# File 'lib/inkpen/configuration.rb', line 50 def @toolbar end |
Instance Method Details
#all_extensions ⇒ Array<Symbol>
Get all available extensions (core + advanced).
171 172 173 |
# File 'lib/inkpen/configuration.rb', line 171 def all_extensions CORE_EXTENSIONS + ADVANCED_EXTENSIONS end |
#disable_extension(name) ⇒ Symbol?
Disable a specific extension.
162 163 164 |
# File 'lib/inkpen/configuration.rb', line 162 def disable_extension(name) @extensions.delete(name.to_sym) end |
#enable_extension(name) ⇒ Array<Symbol>
Enable a specific extension.
149 150 151 |
# File 'lib/inkpen/configuration.rb', line 149 def enable_extension(name) @extensions << name.to_sym unless @extensions.include?(name.to_sym) end |