Class: SMEditor::Config
- Inherits:
-
Object
- Object
- SMEditor::Config
- Defined in:
- lib/smeditor/rails/config.rb
Overview
Instance Attribute Summary collapse
-
#allowed_tags ⇒ Object
Tag allow-list for the server-side renderer.
-
#allowed_upload_types ⇒ Object
Content types the upload endpoint accepts.
-
#default_kit ⇒ Object
Which bundle the form helper boots: "starter" or "full".
-
#max_upload_size ⇒ Object
Hard ceiling on an uploaded file, in bytes.
-
#sanitize_output ⇒ Object
When true, smeditor_render sanitizes content before display.
-
#upload_path ⇒ Object
Upload endpoint used by the JavaScript adapter when uploads are enabled.
-
#uploads ⇒ Object
:none (default) or :active_storage — whether the gem mounts an upload endpoint.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/smeditor/rails/config.rb', line 31 def initialize @uploads = :none @sanitize_output = true @allowed_tags = %w[ p br h1 h2 h3 h4 h5 h6 strong em u s code pre blockquote ul ol li a img figure figcaption hr span table thead tbody tr td th ] @default_kit = "starter" @upload_path = "/smeditor/uploads" @max_upload_size = 10 * 1024 * 1024 @allowed_upload_types = %w[ image/png image/jpeg image/gif image/webp image/avif image/bmp ] end |
Instance Attribute Details
#allowed_tags ⇒ Object
Tag allow-list for the server-side renderer.
18 19 20 |
# File 'lib/smeditor/rails/config.rb', line 18 def @allowed_tags end |
#allowed_upload_types ⇒ Object
Content types the upload endpoint accepts. SVG is excluded on purpose — it can carry script and is served from the app's origin.
29 30 31 |
# File 'lib/smeditor/rails/config.rb', line 29 def allowed_upload_types @allowed_upload_types end |
#default_kit ⇒ Object
Which bundle the form helper boots: "starter" or "full".
20 21 22 |
# File 'lib/smeditor/rails/config.rb', line 20 def default_kit @default_kit end |
#max_upload_size ⇒ Object
Hard ceiling on an uploaded file, in bytes. The endpoint is reachable by anyone who can reach the host app unless the controller is subclassed with authentication, so it refuses anything larger.
26 27 28 |
# File 'lib/smeditor/rails/config.rb', line 26 def max_upload_size @max_upload_size end |
#sanitize_output ⇒ Object
When true, smeditor_render sanitizes content before display.
16 17 18 |
# File 'lib/smeditor/rails/config.rb', line 16 def sanitize_output @sanitize_output end |
#upload_path ⇒ Object
Upload endpoint used by the JavaScript adapter when uploads are enabled.
22 23 24 |
# File 'lib/smeditor/rails/config.rb', line 22 def upload_path @upload_path end |
#uploads ⇒ Object
:none (default) or :active_storage — whether the gem mounts an upload endpoint.
14 15 16 |
# File 'lib/smeditor/rails/config.rb', line 14 def uploads @uploads end |