add an optional blinking cursor to console formatting
parent
90130014dd
commit
d9758157b9
|
@ -56,6 +56,7 @@ class Settings::PreferencesController < Settings::BaseController
|
|||
:setting_roar_lifespan,
|
||||
:setting_delayed_roars,
|
||||
:setting_delayed_for,
|
||||
:setting_show_cursor,
|
||||
|
||||
:setting_default_privacy,
|
||||
:setting_default_sensitive,
|
||||
|
|
|
@ -19,6 +19,12 @@
|
|||
color: darken($secondary-text-color, 20%);
|
||||
}
|
||||
}
|
||||
span.cursor {
|
||||
color: lighten($dark-text-color, 20%);
|
||||
font-family: $font-monospace, monospace;
|
||||
/* animation: t_blink 1s linear infinite; */
|
||||
}
|
||||
/* span.cursor::before { content: " █" } */
|
||||
}
|
||||
|
||||
.composer--reply > .content {
|
||||
|
@ -99,3 +105,8 @@ div.drawer__inner__admin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes t_blink {
|
||||
from { opacity: 1 }
|
||||
to { opacity: 0 }
|
||||
}
|
||||
|
|
|
@ -249,7 +249,8 @@ class Formatter
|
|||
end
|
||||
|
||||
def format_console(html)
|
||||
"<pre><code>#{html}</code></pre>"
|
||||
cursor = '<span class="cursor"></span>'
|
||||
"<pre><code>#{html.strip.sub(/<\/p>\Z/, cursor)}</p></code></pre>"
|
||||
end
|
||||
|
||||
def format_markdown(html)
|
||||
|
|
|
@ -40,6 +40,7 @@ class UserSettingsDecorator
|
|||
user.settings['roar_lifespan'] = roar_lifespan_preference if change?('setting_roar_lifespan')
|
||||
user.settings['delayed_roars'] = delayed_roars_preference if change?('setting_delayed_roars')
|
||||
user.settings['delayed_for'] = delayed_for_preference if change?('setting_delayed_for')
|
||||
user.settings['show_cursor'] = show_cursor_preference if change?('setting_show_cursor')
|
||||
|
||||
user.settings['notification_emails'] = merged_notification_emails if change?('notification_emails')
|
||||
user.settings['interactions'] = merged_interactions if change?('interactions')
|
||||
|
@ -141,6 +142,10 @@ class UserSettingsDecorator
|
|||
settings['setting_delayed_for']
|
||||
end
|
||||
|
||||
def show_cursor_preference
|
||||
settings['setting_show_cursor']
|
||||
end
|
||||
|
||||
def delayed_roars_preference
|
||||
settings['setting_delayed_roars']
|
||||
end
|
||||
|
|
|
@ -154,6 +154,7 @@ class Account < ApplicationRecord
|
|||
:hides_filtered_gap?,
|
||||
:hides_mascot?,
|
||||
:hides_captions?,
|
||||
:shows_cursor?,
|
||||
|
||||
to: :user,
|
||||
prefix: true,
|
||||
|
|
|
@ -128,6 +128,7 @@ class User < ApplicationRecord
|
|||
:roar_lifespan,
|
||||
:delayed_roars,
|
||||
:delayed_for,
|
||||
:show_cursor,
|
||||
|
||||
:auto_play_gif,
|
||||
:default_sensitive,
|
||||
|
@ -314,6 +315,10 @@ class User < ApplicationRecord
|
|||
@_delayed_for ||= (settings.delayed_for || 60)
|
||||
end
|
||||
|
||||
def shows_cursor?
|
||||
@show_cursor ||= (settings.show_cursor || false)
|
||||
end
|
||||
|
||||
def defaults_to_local_only?
|
||||
@defaults_to_local_only ||= (settings.default_local || false)
|
||||
end
|
||||
|
|
|
@ -81,5 +81,10 @@
|
|||
.status__content .emojione { width: 24px !important; height: 24px !important }
|
||||
.status__content .hoverplay:hover { padding-left: 24px !important }
|
||||
|
||||
-if current_account&.user_shows_cursor?
|
||||
:css
|
||||
span.cursor { animation: t_blink 1s linear infinite }
|
||||
span.cursor::before { content: " █" }
|
||||
|
||||
%body{ class: body_classes }
|
||||
= content_for?(:content) ? yield(:content) : yield
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
= f.input :setting_default_content_type, collection: ['text/x-bbcode+markdown', 'text/markdown', 'text/x-bbcode', 'text/html', 'text/plain', 'text/console'], wrapper: :with_label, include_blank: false, label_method: lambda { |item| safe_join([t("simple_form.labels.defaults.setting_default_content_type_#{item.split('/')[1].gsub(/[+-]/, '_')}"), content_tag(:span, t("simple_form.hints.defaults.setting_default_content_type_#{item.split('/')[1].gsub(/[+-]/, '_')}_html"), class: 'hint')]) }, required: false, as: :radio_buttons, collection_wrapper_tag: 'ul', item_wrapper_tag: 'li'
|
||||
|
||||
|
||||
.fields-group
|
||||
= f.input :setting_default_local, as: :boolean, wrapper: :with_label
|
||||
= f.input :setting_always_local, as: :boolean, wrapper: :with_label
|
||||
= f.input :setting_default_sensitive, as: :boolean, wrapper: :with_label
|
||||
|
@ -72,6 +74,7 @@
|
|||
= f.input :setting_larger_buttons, as: :boolean, wrapper: :with_label
|
||||
= f.input :setting_larger_drawer, as: :boolean, wrapper: :with_label
|
||||
= f.input :setting_larger_emoji, as: :boolean, wrapper: :with_label
|
||||
= f.input :setting_show_cursor, as: :boolean, wrapper: :with_label
|
||||
|
||||
.fields-group
|
||||
= f.input :setting_hide_mascot, as: :boolean, wrapper: :with_label
|
||||
|
|
|
@ -31,7 +31,7 @@ en:
|
|||
setting_default_content_type_html_html: "<strong><strong>Bold</strong></strong>, <u><u>Underline</u></u>, <em><em>Italic</em></em>, <code><code>Console</code></code>, ..."
|
||||
setting_default_content_type_markdown_html: "<strong>**Bold**</strong>, <u>_Underline_</u>, <em>*Italic*</em>, <code>`Console`</code>, ..."
|
||||
setting_default_content_type_plain_html: No formatting.
|
||||
setting_default_content_type_console_html: <code>Plain-text console formatting.<code>
|
||||
setting_default_content_type_console_html: <code>Plain-text console formatting.</code>
|
||||
setting_default_content_type_x_bbcode_html: "<strong>[b]Bold[/b]</strong>, <u>[u]Underline[/u]</u>, <em>[i]Italic[/i]</em>, <code>[code]Console[/code]</code>, ..."
|
||||
setting_default_content_type_x_bbcode_markdown_html: "<strong>**Bold**</strong>, <u>[u]Underline[/u]</u>, <em>*Italic*</em>, <code>[code]Console[/code]</code>, ..."
|
||||
setting_default_language: The language of your roars can be detected automatically, but it's not always accurate
|
||||
|
@ -117,6 +117,7 @@ en:
|
|||
setting_default_content_type_console: Console
|
||||
setting_default_content_type_x_bbcode: BBCode
|
||||
setting_default_content_type_x_bbcode_markdown: BBdown
|
||||
setting_show_cursor: Show cursor (console format only)
|
||||
setting_default_language: Posting language
|
||||
setting_default_privacy: Post privacy
|
||||
setting_roar_lifespan: Auto-delete new roars after
|
||||
|
|
Loading…
Reference in New Issue