hihilll
修改 vendor/flarum/markdown/js/dist/forum.js
搜索:app.initializers.add
将搜索到的内容(一直到最后)替换为下面的内容:
app.initializers.add("flarum-markdown",(function(e){var t=1;Object(i.extend)(l.a.prototype,"init",(function(){this.textareaId="textarea"+t++})),Object(i.extend)(l.a.prototype,"view",(function(e){e.children[0].attrs.id=this.textareaId})),Object(i.extend)(l.a.prototype,"configTextarea",(function(e,t,n,i){if(!n){var r=new s.a(t);r.disableInline(),r.ignoreTab(),i.onunload=function(){r.destroy()}}})),Object(i.extend)(l.a.prototype,"toolbarItems",(function(t){var n=function(t){return e.translator.trans("flarum-markdown.forum.composer."+t+"_tooltip")};t.add("markdown",m(h,{for:this.textareaId},m(w,{title:n("header"),icon:"fas fa-heading",style:{prefix:"### "}}),m(w,{title:n("bold"),icon:"fas fa-bold",style:{prefix:"**",suffix:"**",trimFirst:!0},hotkey:"b"}),m(w,{title:n("italic"),icon:"fas fa-italic",style:{prefix:"_",suffix:"_",trimFirst:!0},hotkey:"i"}),m(w,{title:n("textsize"),icon:"fas fa-text-height",style:{prefix: '[size=15]', suffix: '[/size]'}}),m(w,{title:n("underline"),icon:"fas fa-underline",style:{prefix: '[u]', suffix: '[/u]'}}),m(w,{title:n("deleteline"),icon:"fas fa-strikethrough",style:{prefix: '~~', suffix: '~~'}}),m(w,{title:n("highlight"),icon:"fas fa-highlighter",style:{prefix: '[hl]', suffix: '[/hl]'}}),m(w,{title:n("newline"),icon:"fab fa-stack-exchange",style:{prefix: '***' }}),m(w,{title:n("textcolor"),icon:"fas fa-palette",style:{prefix: '[color=#536D92]', suffix: '[/color]'}}),m(w,{title:n("quote"),icon:"fas fa-quote-left",style:{prefix:"> ",multiline:!0,surroundWithNewlines:!0}}),m(w,{title:n("code"),icon:"fab fa-canadian-maple-leaf",style:{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"}}),m(w,{title:n("codebeauty"),icon:"fas fa-code",style:{prefix:"[code]",suffix:"[/code]" }}),m(w,{title:n("link"),icon:"fas fa-link",style:{prefix:"[链接说明",suffix:"](链接地址)",replaceNext:"https://",scanFor:"https?://"}}),m(w,{title:n("image"),icon:"fas fa-image",style:{prefix:"![图片说明",suffix:"](图片地址)",replaceNext:"https://",scanFor:"https?://"}}),m(w,{title:n("left"),icon:"fas fa-align-left",style:{prefix: '[left]', suffix: '[/left]'}}),m(w,{title:n("center"),icon:"fas fa-align-center",style:{prefix: '[center]', suffix: '[/center]'}}),m(w,{title:n("right"),icon:"fas fa-align-right",style:{prefix: '[right]', suffix: '[/right]'}}),m(w,{title:n("unordered_list"),icon:"fas fa-list-alt",style:{prefix:"- ",multiline:!0,surroundWithNewlines:!0}}),m(w,{title:n("ordered_list"),icon:"fas fa-list-ol",style:{prefix:"1. ",multiline:!0,orderedList:!0,surroundWithNewlines:!0}}),m(w,{title:n("login"),icon:"fas fa-sign-in-alt",style:{prefix: '[login]', suffix: '[/login]'}}),m(w,{title:n("reply"),icon:"fas fa-reply",style:{prefix: '[reply]', suffix: '[/reply]'}}),),100)}))}))}]);
//# sourceMappingURL=forum.js.map
然后,到 vendor/littlegolden/flarum-lang-simplified-chinese/locale/flarum-markdown.yml
复制下面内容全部替换:
# https://github.com/flarum/lang-english/blob/master/locale/flarum-markdown.yml
# 8a76061 on 14 Sep 2019
# 2020年2月3日00:32:56 +0800
flarum-markdown:
##
# UNIQUE KEYS - The following keys are used in only one location each.
##
# Translations in this namespace are used by the forum user interface.
forum:
# These translations are used by the composer (emoji autocompletion function).
composer:
left_tooltip: 左对齐
center_tooltip: 文字居中
right_tooltip: 右对齐
justify_tooltip: 两端对齐
newline_tooltip: 分割线
underline_tooltip: 下划线
deleteline_tooltip: 删除线
highlight_tooltip: 强调
textcolor_tooltip: 字体颜色
bold_tooltip: 粗体
code_tooltip: 行内代码
codebeauty_tooltip: 多色代码
header_tooltip: 标题文本
textsize_tooltip: 文字大小
image_tooltip: 图片
italic_tooltip: 斜体
link_tooltip: 链接
ordered_list_tooltip: 有序列表
quote_tooltip: 引用
unordered_list_tooltip: 无序列表
login_tooltip: 登录可见
reply_tooltip: 回复可见
如果有些插件没安装,使用部分编辑功能是没有效果的,按需修改。