From 7cc16c5038d7830940624cd137d1fabab03ae73f Mon Sep 17 00:00:00 2001 From: OldHawk Date: Sun, 10 Dec 2017 15:37:21 +0800 Subject: [PATCH] feat(forums): emoji in forum post form by enter colon #20 --- modules/core/client/app/init.js | 35 ++++++++++++++----- modules/core/client/less/md-table.less | 3 +- .../forums-topic.client.controller.js | 2 +- modules/forums/client/less/forum.less | 32 ++++++++--------- .../client/views/topic.client.view.html | 2 +- 5 files changed, 47 insertions(+), 27 deletions(-) diff --git a/modules/core/client/app/init.js b/modules/core/client/app/init.js index 4f08779b..029198f4 100644 --- a/modules/core/client/app/init.js +++ b/modules/core/client/app/init.js @@ -91,20 +91,39 @@ // return '' + text + ''; //}, heading: function (text, level) { - return '' - + replaceEmoji(text) - + '\n'; + return '' + replaceEmoji(text) + '\n'; + }, + blockquote: function (quote) { + return '
\n' + replaceEmoji(quote) + '
\n'; + }, + listitem: function (text) { + return '
  • ' + replaceEmoji(text) + '
  • \n'; }, table: function (header, body) { - return '' + header + '' + body + '
    '; + return '' + header + '' + body + '
    '; + }, + tablecell: function (content, flags) { + var type = flags.header ? 'th' : 'td'; + var tag = flags.align + ? '<' + type + ' style="text-align:' + flags.align + '">' + : '<' + type + '>'; + return tag + replaceEmoji(content) + '\n'; }, paragraph: function (text) { return '

    ' + replaceEmoji(text) + '

    '; }, + html: function (html) { + return replaceEmoji(html); + }, + strong: function (text) { + return '' + replaceEmoji(text) + ''; + }, + em: function (text) { + return '' + replaceEmoji(text) + ''; + }, + del: function (text) { + return '' + replaceEmoji(text) + ''; + }, text: function (text) { return replaceEmoji(text); } diff --git a/modules/core/client/less/md-table.less b/modules/core/client/less/md-table.less index 8f306e8a..05b742d2 100644 --- a/modules/core/client/less/md-table.less +++ b/modules/core/client/less/md-table.less @@ -11,9 +11,10 @@ border: solid 1px #e5e5e5 !important; color: #333 !important; tr { + height: auto; th { border: solid 1px #e5e5e5 !important; - padding: 5px 10px !important; + padding: 8px 10px !important; } } } diff --git a/modules/forums/client/controllers/forums-topic.client.controller.js b/modules/forums/client/controllers/forums-topic.client.controller.js index e09f2568..0b91fdaa 100644 --- a/modules/forums/client/controllers/forums-topic.client.controller.js +++ b/modules/forums/client/controllers/forums-topic.client.controller.js @@ -559,7 +559,7 @@ * @param obj, topic or reply object, need the content field */ vm.quoteAndReply = function (obj) { - var by = obj.user.displayName + ' at ' + $filter('date')(obj.updatedAt ? obj.updatedAt : obj.createdAt, 'yyyy-MM-dd HH:mm:ss'); + var by = obj.user.displayName + ' at ' + $filter('date')((obj.updatedAt ? obj.updatedAt : obj.createdAt), 'yyyy-MM-dd HH:mm'); by = '_' + by + '_' + '\n\n'; var list = []; diff --git a/modules/forums/client/less/forum.less b/modules/forums/client/less/forum.less index d1fe928d..cadf524a 100644 --- a/modules/forums/client/less/forum.less +++ b/modules/forums/client/less/forum.less @@ -248,18 +248,18 @@ .table-category { border-radius: 6px; } - table { + .table-valign-middle { border-spacing: 0; border-collapse: inherit; border: solid 3px @brand-primary; table-layout: fixed; - thead { + > thead { background-color: @brand-primary; border: solid 1px @brand-primary; color: #efefef; - tr { + > tr { height: 48px; - th { + > th { position: relative; border: solid 2px @brand-primary; padding: 13px 10px; @@ -273,16 +273,16 @@ } } } - tbody { - tr { - td { + > tbody { + > tr { + > td { border-top: none; white-space: normal !important; border-bottom: solid 2px lighten(@brand-primary, 45%); } } - tr:last-child { - td { + > tr:last-child { + > td { border-bottom: none; } } @@ -668,11 +668,10 @@ blockquote { color: #999; font-size: 14px; -} - -em { - color: lighten(@brand-primary, 10%); - font-size: 12px; + em { + color: lighten(@brand-primary, 10%); + font-size: 12px; + } } .search-group { @@ -773,10 +772,11 @@ em { } } -.ac-emoji{ +.ac-emoji { width: 30px; padding: 0 5px; } -.ac-emoji-text{ + +.ac-emoji-text { margin-left: 5px; } diff --git a/modules/forums/client/views/topic.client.view.html b/modules/forums/client/views/topic.client.view.html index e5a7eaf7..dc8baa2a 100644 --- a/modules/forums/client/views/topic.client.view.html +++ b/modules/forums/client/views/topic.client.view.html @@ -251,7 +251,7 @@
    - +