From 008b899422519e8692d9f2852d0905bf3483bfb0 Mon Sep 17 00:00:00 2001 From: Augier Date: Thu, 1 Dec 2016 12:04:42 +0100 Subject: [PATCH 1/3] Markdown editor on publisher, conversations and mobile comments --- app/assets/javascripts/mobile/mobile.js | 6 +++-- .../javascripts/mobile/mobile_comments.js | 2 ++ .../mobile/mobile_conversations.js | 1 + app/assets/javascripts/mobile/publisher.js | 2 ++ app/assets/stylesheets/markdown-editor.scss | 1 + .../stylesheets/mobile/markdown_editor.scss | 22 +++++++++++++++++++ app/assets/stylesheets/mobile/mobile.scss | 2 ++ 7 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 app/assets/stylesheets/mobile/markdown_editor.scss diff --git a/app/assets/javascripts/mobile/mobile.js b/app/assets/javascripts/mobile/mobile.js index f0fb64c39..0bb660573 100644 --- a/app/assets/javascripts/mobile/mobile.js +++ b/app/assets/javascripts/mobile/mobile.js @@ -1,9 +1,9 @@ -// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later - /* Copyright (c) 2010-2011, Diaspora Inc. This file is * licensed under the Affero General Public License version 3 or later. See * the COPYRIGHT file. */ +// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later + //= require jquery-textchange //= require charcount //= require js-routes @@ -18,6 +18,8 @@ //= require helpers/i18n //= require helpers/profile_photo_uploader //= require helpers/tags_autocomplete +//= require bootstrap-markdown/bootstrap-markdown +//= require helpers/markdown_editor //= require widgets/timeago //= require mobile/mobile_application //= require mobile/mobile_file_uploader diff --git a/app/assets/javascripts/mobile/mobile_comments.js b/app/assets/javascripts/mobile/mobile_comments.js index 0dbfa662f..a10c60639 100644 --- a/app/assets/javascripts/mobile/mobile_comments.js +++ b/app/assets/javascripts/mobile/mobile_comments.js @@ -11,6 +11,8 @@ initialize: function() { var self = this; + new Diaspora.MarkdownEditor(".comment_box"); + this.stream().on("tap click", "a.show-comments", function(evt){ evt.preventDefault(); self.toggleComments($(this)); diff --git a/app/assets/javascripts/mobile/mobile_conversations.js b/app/assets/javascripts/mobile/mobile_conversations.js index bf88bb5ff..5d42b5813 100644 --- a/app/assets/javascripts/mobile/mobile_conversations.js +++ b/app/assets/javascripts/mobile/mobile_conversations.js @@ -1,6 +1,7 @@ (function() { Diaspora.Mobile.Conversations = { initialize: function() { + new Diaspora.MarkdownEditor(".conversation-message-text"); if (Diaspora.Page !== "ConversationsNew") { return; } $(document).on("ajax:success", "form#new-conversation", this.conversationCreateSuccess); $(document).on("ajax:error", "form#new-conversation", this.conversationCreateError); diff --git a/app/assets/javascripts/mobile/publisher.js b/app/assets/javascripts/mobile/publisher.js index 6954631cf..f50c6aa71 100644 --- a/app/assets/javascripts/mobile/publisher.js +++ b/app/assets/javascripts/mobile/publisher.js @@ -46,4 +46,6 @@ $(document).ready(function(){ evt.preventDefault(); $("#new_status_message").submit(); }); + + new Diaspora.MarkdownEditor("#status_message_text"); }); diff --git a/app/assets/stylesheets/markdown-editor.scss b/app/assets/stylesheets/markdown-editor.scss index d2657f5ad..e5e3b5a77 100644 --- a/app/assets/stylesheets/markdown-editor.scss +++ b/app/assets/stylesheets/markdown-editor.scss @@ -42,6 +42,7 @@ .btn-group { margin-bottom: 8px; + &:first-child { margin-left: 0; } [class^="entypo-"], [class*="entypo-"] { diff --git a/app/assets/stylesheets/mobile/markdown_editor.scss b/app/assets/stylesheets/mobile/markdown_editor.scss new file mode 100644 index 000000000..1c804f263 --- /dev/null +++ b/app/assets/stylesheets/mobile/markdown_editor.scss @@ -0,0 +1,22 @@ +.md-editor { + border: 1px solid $light-grey; + border-radius: $btn-border-radius-base; + overflow: hidden; + + &.active { border-color: $text-grey; } + + &::after, + &::before { + clear: both; + content: ' '; + display: table; + } + + textarea { + border: 0; + border-radius: 0; + min-height: 6rem; + resize: none; + width: 100%; + } +} diff --git a/app/assets/stylesheets/mobile/mobile.scss b/app/assets/stylesheets/mobile/mobile.scss index 38aca56f8..7911cddab 100644 --- a/app/assets/stylesheets/mobile/mobile.scss +++ b/app/assets/stylesheets/mobile/mobile.scss @@ -16,6 +16,8 @@ @import "mobile/stream_element"; @import "mobile/comments"; @import 'mobile/openid_connect_error_page'; +@import 'markdown-editor'; +@import 'mobile/markdown_editor'; @import 'typography'; From d4ed3bce4ddae3ff0337e52e42edaac36c00c831 Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Fri, 11 Aug 2017 11:01:23 +0200 Subject: [PATCH 2/3] Remove unnecessary markdown editor CSS --- .../stylesheets/mobile/markdown_editor.scss | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/app/assets/stylesheets/mobile/markdown_editor.scss b/app/assets/stylesheets/mobile/markdown_editor.scss index 1c804f263..b39f5a0ba 100644 --- a/app/assets/stylesheets/mobile/markdown_editor.scss +++ b/app/assets/stylesheets/mobile/markdown_editor.scss @@ -1,22 +1,6 @@ .md-editor { border: 1px solid $light-grey; border-radius: $btn-border-radius-base; - overflow: hidden; &.active { border-color: $text-grey; } - - &::after, - &::before { - clear: both; - content: ' '; - display: table; - } - - textarea { - border: 0; - border-radius: 0; - min-height: 6rem; - resize: none; - width: 100%; - } } From f4cdec03c71f1da006cef129c5c603e04d3e1e3e Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Fri, 11 Aug 2017 11:02:47 +0200 Subject: [PATCH 3/3] Remove obsolete conversation and new status message CSS --- app/assets/stylesheets/mobile/mobile.scss | 41 ----------------------- 1 file changed, 41 deletions(-) diff --git a/app/assets/stylesheets/mobile/mobile.scss b/app/assets/stylesheets/mobile/mobile.scss index 7911cddab..dc9958164 100644 --- a/app/assets/stylesheets/mobile/mobile.scss +++ b/app/assets/stylesheets/mobile/mobile.scss @@ -44,8 +44,6 @@ h3 { margin-top: 0; } .clear { clear: both; } #main { padding: 56px 10px 0 10px; } -textarea { resize: vertical; } - .avatar { border-radius: 4px; } @@ -405,11 +403,6 @@ footer { .counter { font-size: 14px; } - - textarea { - min-width: 100%; - max-width: 100%; - } } select { @@ -540,13 +533,6 @@ form#new_conversation.new_conversation { } } -textarea#conversation_text { - font-size: larger; - width: 100%; - min-width: 100%; - max-width: 100%; -} - .registrations_error, .registrations_notice { color: #DF0101; @@ -715,33 +701,6 @@ select#aspect_ids_ { position: relative; padding-right: 10px; - #hide_publisher { - opacity: 0.3; - z-index: 5; - padding: 3px; - position: absolute; - right: 6px; - top: 0; - - &:hover { - opacity: 1; - } - } - - &.active { - border: 1px solid $border-dark-grey; - } - - textarea { - z-index: 2; - border: none; - - &:focus { - outline: 0; - background: transparent; - } - } - &.with_attachments { padding-bottom: 55px; border: 1px solid $border-medium-grey;