Skip to content

Commit

Permalink
Sticky trix toolbar (SpinaCMS#730)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bramjetten authored Jun 30, 2021
1 parent 0640b75 commit 974a670
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/components/spina/forms/trix_toolbar_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="relative trix-toolbar" id="<%= @trix_id %>">
<div class="relative sticky top-0 pt-4 bg-white trix-toolbar" id="<%= @trix_id %>">
<div class="flex items-center flex-wrap" data-controller="reveal">
<div class="flex items-center bg-gray-200 rounded overflow-hidden mb-3 mr-3">
<button type="button" class="text-gray-700 w-9 h-9 flex items-center justify-center" data-trix-attribute="bold" data-trix-key="b" title="${Trix.config.lang.bold}" tabindex="-1">
Expand Down
2 changes: 1 addition & 1 deletion app/views/spina/admin/parts/texts/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="mt-1 relative">
<%= f.hidden_field :content, id: "#{f.object.object_id}_input" %>

<div class="relative form-textarea p-4 shadow-sm max-w-5xl" data-controller="trix" id="<%= "insert_#{f.object.object_id}_trix-toolbar" %>" data-action="media-picker:done->trix#insertAttachment">
<div class="relative form-textarea p-4 pt-0 shadow-sm max-w-5xl" data-controller="trix" id="<%= "insert_#{f.object.object_id}_trix-toolbar" %>" data-action="media-picker:done->trix#insertAttachment">
<%= render Spina::Forms::TrixToolbarComponent.new("#{f.object.object_id}_trix-toolbar") %>

<trix-editor class="prose prose-sm focus:outline-none max-w-3xl xl:border-r border-dashed border-gray-200 pr-3" toolbar="<%= f.object.object_id %>_trix-toolbar" input="<%= f.object.object_id %>_input" data-trix-target="editor" data-action="trix-file-accept->trix#preventDefault"></trix-editor>
Expand Down
2 changes: 1 addition & 1 deletion app/views/spina/admin/settings/_wysiwyg_field.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="mt-1 relative">
<%= f.hidden_field attribute, id: "#{f.object.object_id}_input" %>

<div class="relative form-textarea p-4 shadow-sm max-w-5xl" data-controller="trix" id="<%= "insert_#{f.object.object_id}_trix-toolbar" %>" data-action="media-picker:done->trix#insertAttachment">
<div class="relative form-textarea p-4 pt-0 shadow-sm max-w-5xl" data-controller="trix" id="<%= "insert_#{f.object.object_id}_trix-toolbar" %>" data-action="media-picker:done->trix#insertAttachment">
<%= render Spina::Forms::TrixToolbarComponent.new("#{f.object.object_id}_trix-toolbar") %>

<trix-editor class="prose prose-sm focus:outline-none max-w-3xl xl:border-r border-dashed border-gray-200 pr-3" toolbar="<%= f.object.object_id %>_trix-toolbar" input="<%= f.object.object_id %>_input" data-trix-target="editor" data-action="trix-file-accept->trix#preventDefault"></trix-editor>
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/config/initializers/themes/demo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
name: 'testrepeater',
title: 'Testrepeater',
part_type: "Spina::Parts::Repeater",
parts: %w(line)
parts: %w(line body)
}]

theme.view_templates = [{
Expand Down

0 comments on commit 974a670

Please sign in to comment.