Class: Rails::Domternal::Configuration
- Inherits:
-
Object
- Object
- Rails::Domternal::Configuration
- Defined in:
- lib/rails/domternal/configuration.rb
Instance Attribute Summary collapse
-
#allowed_mime_types ⇒ Object
Returns the value of attribute allowed_mime_types.
-
#asset_strategy ⇒ Object
:importmap, :jsbundling, or :cdn — how the install generator wires up JS.
-
#default_extensions ⇒ Object
Symbolic extension keys resolved client-side by app/assets/javascripts/domternal/extensions.js.
-
#max_file_size ⇒ Object
Returns the value of attribute max_file_size.
-
#npm_version ⇒ Object
npm dist-tag/version used when pinning packages from a CDN (importmap/:cdn strategies).
-
#primary_key_type ⇒ Object
Column types used by the CreateDomternalTables migration.
-
#record_id_type ⇒ Object
Returns the value of attribute record_id_type.
-
#sanitizer_allowed_attributes ⇒ Object
Returns the value of attribute sanitizer_allowed_attributes.
-
#sanitizer_allowed_tags ⇒ Object
HTML tags/attributes allowed through the safelist sanitizer applied to incoming bodies.
-
#theme ⇒ Object
:light, :dark, or :auto.
-
#toolbar ⇒ Object
:full, :minimal, :notion, or false.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/rails/domternal/configuration.rb', line 40 def initialize @default_extensions = %i[starter_kit image] @toolbar = :full @theme = :light @asset_strategy = :importmap @npm_version = "latest" @allowed_mime_types = %w[image/png image/jpeg image/gif image/webp image/svg+xml image/avif] @max_file_size = 10.megabytes @primary_key_type = nil @record_id_type = nil @sanitizer_allowed_tags = %w[ p br div span h1 h2 h3 h4 h5 h6 strong em b i u s del ins mark sub sup code pre ul ol li blockquote a img figure figcaption table thead tbody tr th td hr details summary ] @sanitizer_allowed_attributes = %w[ href src alt title width height loading crossorigin colspan rowspan align style class data-type data-id data-label ] end |
Instance Attribute Details
#allowed_mime_types ⇒ Object
Returns the value of attribute allowed_mime_types.
24 25 26 |
# File 'lib/rails/domternal/configuration.rb', line 24 def allowed_mime_types @allowed_mime_types end |
#asset_strategy ⇒ Object
:importmap, :jsbundling, or :cdn — how the install generator wires up JS. Informational at runtime; only the generator branches on it.
19 20 21 |
# File 'lib/rails/domternal/configuration.rb', line 19 def asset_strategy @asset_strategy end |
#default_extensions ⇒ Object
Symbolic extension keys resolved client-side by app/assets/javascripts/domternal/extensions.js
7 8 9 |
# File 'lib/rails/domternal/configuration.rb', line 7 def default_extensions @default_extensions end |
#max_file_size ⇒ Object
Returns the value of attribute max_file_size.
25 26 27 |
# File 'lib/rails/domternal/configuration.rb', line 25 def max_file_size @max_file_size end |
#npm_version ⇒ Object
npm dist-tag/version used when pinning packages from a CDN (importmap/:cdn strategies).
22 23 24 |
# File 'lib/rails/domternal/configuration.rb', line 22 def npm_version @npm_version end |
#primary_key_type ⇒ Object
Column types used by the CreateDomternalTables migration. Both default to the app's
config.generators primary_key_type, then to Rails' defaults.
Set record_id_type to :string if the models declaring has_rich_domternal don't all share one primary key type — a uuid-pk model and a bigint-pk model can't both be referenced by a typed polymorphic column. Only read at migration time.
33 34 35 |
# File 'lib/rails/domternal/configuration.rb', line 33 def primary_key_type @primary_key_type end |
#record_id_type ⇒ Object
Returns the value of attribute record_id_type.
34 35 36 |
# File 'lib/rails/domternal/configuration.rb', line 34 def record_id_type @record_id_type end |
#sanitizer_allowed_attributes ⇒ Object
Returns the value of attribute sanitizer_allowed_attributes.
38 39 40 |
# File 'lib/rails/domternal/configuration.rb', line 38 def sanitizer_allowed_attributes @sanitizer_allowed_attributes end |
#sanitizer_allowed_tags ⇒ Object
HTML tags/attributes allowed through the safelist sanitizer applied to incoming bodies.
37 38 39 |
# File 'lib/rails/domternal/configuration.rb', line 37 def @sanitizer_allowed_tags end |
#theme ⇒ Object
:light, :dark, or :auto
15 16 17 |
# File 'lib/rails/domternal/configuration.rb', line 15 def theme @theme end |
#toolbar ⇒ Object
:full, :minimal, :notion, or false. :notion swaps the fixed toolbar for a selection bubble menu + a "+" floating menu, matching the block handle/slash command UI the :block_controls extension adds — pair the two.
12 13 14 |
# File 'lib/rails/domternal/configuration.rb', line 12 def @toolbar end |