Skip to content

Add rows parameter to editor #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Marksmith accepts a few configuration options.

### Field options

The field supports a few of the regular options like `disabled`, `placeholder`, `autofocus`, `style`, `class`, `data`, and `value`, but also a custom one.
The field supports a few of the regular options like `disabled`, `placeholder`, `autofocus`, `style`, `class`, `data`, `rows` and `value`, but also a custom one.

`extra_preview_params` - Sends extra params to the preview renderer.

Expand Down
5 changes: 4 additions & 1 deletion app/models/marksmith/editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class Marksmith::Editor
:style,
:gallery,
:kwargs,
:id
:id,
:rows

def initialize(name:,
upload_url: nil,
Expand All @@ -31,6 +32,7 @@ def initialize(name:,
value: nil,
id: "marksmith-instance-#{rand(1000..9999)}",
gallery: {},
rows: 11,
**kwargs)
@name = name
@kwargs = kwargs
Expand All @@ -50,6 +52,7 @@ def initialize(name:,
@value = value
@id = id
@gallery = gallery
@rows = rows
end

def gallery_enabled
Expand Down
5 changes: 3 additions & 2 deletions app/views/marksmith/shared/_editor_pane.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<%= text_area_tag editor.field_name, editor.value,
id: editor.textarea_id,
class: class_names(
"ms:flex ms:flex-1 ms:border-none ms:resize-none ms:focus:outline-none ms:font-mono ms:focus:ring-0 ms:leading-normal ms:p-2 ms:text-sm ms:field-sizing-content ms:min-h-60",
"ms:flex ms:flex-1 ms:border-none ms:resize-none ms:focus:outline-none ms:font-mono ms:focus:ring-0 ms:leading-normal ms:p-2 ms:text-sm ms:field-sizing-content",
"ms:dark:bg-neutral-800 ms:dark:text-neutral-200",
editor.classes
),
Expand All @@ -14,7 +14,8 @@
disabled: editor.disabled,
placeholder: editor.placeholder,
autofocus: editor.autofocus,
style: editor.style
style: editor.style,
rows: editor.rows
%>
<% toolbar_button_classes = "ms:cursor-pointer ms:hover:bg-neutral-200 ms:px-1 ms:py-px ms:rounded ms:text-sm ms:dark:text-neutral-300 ms:dark:hover:bg-neutral-600" %>
<div class="ms:flex ms:flex-1 ms:flex-grow ms:space-x-2 ms:py-1 ms:border-t ms:border-neutral-500 ms:px-2 ms:font-sans ms:text-sm ms:p-2 ms:dark:bg-neutral-800 ms:dark:text-neutral-300 ms:rounded-b-md">
Expand Down