feat(torrents): emoji and markdown richTextbox in admin message sendl page

#20
This commit is contained in:
OldHawk
2017-12-11 11:37:12 +08:00
parent 90168515e3
commit d045e405c6
5 changed files with 37 additions and 10 deletions

View File

@@ -571,8 +571,8 @@
textarea {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
background-color: #fff;
min-height: 300px;
max-height: 800px;
min-height: 200px;
max-height: 600px;
padding: 5px;
}
.md-preview {

View File

@@ -15,6 +15,29 @@
vm.user = Authentication.user;
vm.messageType = 'system';
/**
* initComplete
*/
vm.initComplete = function () {
$('.message-textarea').textcomplete([
{ // emoji strategy
match: /\B:([\-+\w]*)$/,
search: function (term, callback) {
callback($.map(window.emojies, function (emoji) {
return emoji.indexOf(term) === 0 ? emoji : null;
}));
},
template: function (value) {
return '<img class="ac-emoji" src="/graphics/emojis/' + value + '.png" />' + '<span class="ac-emoji-text">' + value + '</span>';
},
replace: function (value) {
return ':' + value + ': ';
},
index: 1
}
]);
};
/**
* sendMessage
* @param isValid

View File

@@ -48,9 +48,10 @@
width: 30px;
}
.message-title {
font-weight: bold;
font-size: 14px;
word-break: break-all;
font-size: 18px;
margin: 5px 0;
width: max-content;
border-bottom: double #aaa;
}
.message-info {
font-size: 12px;

View File

@@ -33,13 +33,13 @@
</dd>
</div>
<div class="margin-bottom-10 form-group" show-errors>
<div class="margin-bottom-10 form-group" ng-init="vm.initComplete();" show-errors>
<dt class="h-line">{{ 'MESSAGES_FIELD.CONTENT' | translate}}</dt>
<dd class="h-line">
<textarea class="form-control message-textarea" id="content" name="content"
ng-model="vm.messageFields.content" required></textarea>
<textarea id="messageContent" name="messageContent" class="form-control message-textarea" ng-model="vm.messageFields.content"
mt-markdown-editor="messageContent" required></textarea>
<div ng-messages="vm.messageForm.content.$error" role="alert">
<div ng-messages="vm.messageForm.messageContent.$error" role="alert">
<p class="help-block error-text" ng-message="required">{{ 'MESSAGES_FIELD.CT_REQUIRED' | translate}}</p>
</div>
@@ -85,7 +85,7 @@
<tbody>
<tr class="message-item" ng-repeat="m in vm.adminMessages">
<td>
<h5 ng-bind="m.title"></h5>
<div class="message-title text-long"><span ng-bind="m.title"></span></div>
<p class="message-content" ng-bind-html="vm.getContentMarked(m);"></p>

View File

@@ -33,6 +33,9 @@
vm.searchTags = [];
vm.progress = 0;
/**
* initComplete
*/
vm.initComplete = function () {
$('.new_comment_textarea').textcomplete([
{ // emoji strategy