Commit 24d1bddb authored by Liang Ding's avatar Liang Ding

🎨 Fix #67

parent 57783b14
This diff is collapsed.
This diff is collapsed.
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
* @fileoverview editor * @fileoverview editor
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 1.4.1.0, Feb 23, 2020 * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.4.1.1, Feb 24, 2020
*/ */
admin.editors = {} admin.editors = {}
...@@ -40,6 +41,27 @@ $.extend(SoloEditor.prototype, { ...@@ -40,6 +41,27 @@ $.extend(SoloEditor.prototype, {
* @description 初始化编辑器 * @description 初始化编辑器
*/ */
init: function () { init: function () {
// 编辑器常用表情使用社区端的设置
$.ajax({
url: 'https://hacpai.com/apis/vcomment/users/emotions',
type: 'GET',
cache: true,
async: false,
xhrFields: {
withCredentials: true,
},
success: function (result) {
Label.emoji = {}
if (Array.isArray(result.data)) {
result.data.forEach(item => {
const key = Object.keys(item)[0]
Label.emoji[key] = item[key]
})
}
},
})
const options = { const options = {
typewriterMode: this.conf.typewriterMode, typewriterMode: this.conf.typewriterMode,
cache: true, cache: true,
...@@ -52,7 +74,7 @@ $.extend(SoloEditor.prototype, { ...@@ -52,7 +74,7 @@ $.extend(SoloEditor.prototype, {
enable: !Label.luteAvailable, enable: !Label.luteAvailable,
style: Label.hljsStyle, style: Label.hljsStyle,
}, },
parse: function(element) { parse: function (element) {
if (element.style.display === 'none') { if (element.style.display === 'none') {
return return
} }
...@@ -64,9 +86,7 @@ $.extend(SoloEditor.prototype, { ...@@ -64,9 +86,7 @@ $.extend(SoloEditor.prototype, {
url: Label.uploadURL, url: Label.uploadURL,
token: Label.uploadToken, token: Label.uploadToken,
filename: function (name) { filename: function (name) {
return name.replace(/[^(a-zA-Z0-9\u4e00-\u9fa5\.)]/g, ''). return name.replace(/[^(a-zA-Z0-9\u4e00-\u9fa5\.)]/g, '').replace(/[\?\\/:|<>\*\[\]\(\)\$%\{\}@~]/g, '').replace('/\\s/g', '')
replace(/[\?\\/:|<>\*\[\]\(\)\$%\{\}@~]/g, '').
replace('/\\s/g', '')
} }
}, },
height: this.conf.height, height: this.conf.height,
...@@ -75,6 +95,10 @@ $.extend(SoloEditor.prototype, { ...@@ -75,6 +95,10 @@ $.extend(SoloEditor.prototype, {
enable: this.conf.resize, enable: this.conf.resize,
}, },
lang: Label.localeString, lang: Label.localeString,
hint: {
emojiTail: `<a href="https://hacpai.com/settings/function" target="_blank">设置常用表情</a>`,
emoji: Label.emoji,
},
} }
if ($(window).width() < 768) { if ($(window).width() < 768) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment