mirror of https://github.com/halo-dev/halo
🎨 更换编辑器
parent
40af072f95
commit
7d452d5ca9
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -2,7 +2,7 @@
|
||||||
<#include "module/_macro.ftl">
|
<#include "module/_macro.ftl">
|
||||||
<@head>${options.blog_title!} | <@spring.message code='admin.pages.edit.title' /></@head>
|
<@head>${options.blog_title!} | <@spring.message code='admin.pages.edit.title' /></@head>
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<link rel="stylesheet" href="/static/halo-backend/plugins/simplemde/simplemde.min.css">
|
<link rel="stylesheet" href="/static/halo-backend/plugins/easymde/easymde.min.css">
|
||||||
<link rel="stylesheet" href="/static/halo-backend/plugins/datetimepicker/css/bootstrap-datetimepicker.min.css">
|
<link rel="stylesheet" href="/static/halo-backend/plugins/datetimepicker/css/bootstrap-datetimepicker.min.css">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#postTitle{font-weight: 400;}
|
#postTitle{font-weight: 400;}
|
||||||
|
@ -145,7 +145,13 @@
|
||||||
</#if>
|
</#if>
|
||||||
|
|
||||||
MathJax.Hub.Config({
|
MathJax.Hub.Config({
|
||||||
tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
|
showProcessingMessages: false,
|
||||||
|
messageStyle: "none",
|
||||||
|
tex2jax: {
|
||||||
|
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
||||||
|
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
|
||||||
|
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre','code','a']
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var QUEUE = MathJax.Hub.queue;
|
var QUEUE = MathJax.Hub.queue;
|
||||||
|
@ -153,7 +159,7 @@
|
||||||
/**
|
/**
|
||||||
* 加载编辑器
|
* 加载编辑器
|
||||||
*/
|
*/
|
||||||
var simplemde = new SimpleMDE({
|
var easyMDE = new EasyMDE({
|
||||||
element: document.getElementById("editorarea"),
|
element: document.getElementById("editorarea"),
|
||||||
autoDownloadFontAwesome: false,
|
autoDownloadFontAwesome: false,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
|
@ -181,7 +187,7 @@
|
||||||
* 方法来自https://gitee.com/supperzh/zb-blog/blob/master/src/main/resources/templates/article/publish.html#L255
|
* 方法来自https://gitee.com/supperzh/zb-blog/blob/master/src/main/resources/templates/article/publish.html#L255
|
||||||
*/
|
*/
|
||||||
$(function () {
|
$(function () {
|
||||||
inlineAttachment.editors.codemirror4.attach(simplemde.codemirror, {
|
inlineAttachment.editors.codemirror4.attach(easyMDE.codemirror, {
|
||||||
uploadUrl: "/admin/attachments/upload"
|
uploadUrl: "/admin/attachments/upload"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -235,7 +241,7 @@
|
||||||
'postStatus': status,
|
'postStatus': status,
|
||||||
'postTitle': postTitle.val(),
|
'postTitle': postTitle.val(),
|
||||||
'postUrl' : postUrl.html().toString(),
|
'postUrl' : postUrl.html().toString(),
|
||||||
'postContentMd': simplemde.value(),
|
'postContentMd': easyMDE.value(),
|
||||||
'postThumbnail': $('#selectImg').attr('src'),
|
'postThumbnail': $('#selectImg').attr('src'),
|
||||||
'allowComment' : $('#allowComment').val(),
|
'allowComment' : $('#allowComment').val(),
|
||||||
'customTpl' : $("#customTpl").val(),
|
'customTpl' : $("#customTpl").val(),
|
||||||
|
@ -243,7 +249,7 @@
|
||||||
},function (data) {
|
},function (data) {
|
||||||
if(data.code===1){
|
if(data.code===1){
|
||||||
//清除自动保存的内容
|
//清除自动保存的内容
|
||||||
simplemde.clearAutosavedValue();
|
easyMDE.clearAutosavedValue();
|
||||||
halo.showMsgAndRedirect(data.msg,'success',1000,'/admin/page',"${options.admin_pjax!'true'}");
|
halo.showMsgAndRedirect(data.msg,'success',1000,'/admin/page',"${options.admin_pjax!'true'}");
|
||||||
}else{
|
}else{
|
||||||
halo.showMsg(data.msg,'error',2000);
|
halo.showMsg(data.msg,'error',2000);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<#include "module/_macro.ftl">
|
<#include "module/_macro.ftl">
|
||||||
<@head>${options.blog_title!} | <@spring.message code='admin.posts.edit.title' /></@head>
|
<@head>${options.blog_title!} | <@spring.message code='admin.posts.edit.title' /></@head>
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<link rel="stylesheet" href="/static/halo-backend/plugins/simplemde/simplemde.min.css">
|
<link rel="stylesheet" href="/static/halo-backend/plugins/easymde/easymde.min.css">
|
||||||
<link rel="stylesheet" href="/static/halo-backend/plugins/jquery-tageditor/jquery.tag-editor.css">
|
<link rel="stylesheet" href="/static/halo-backend/plugins/jquery-tageditor/jquery.tag-editor.css">
|
||||||
<link rel="stylesheet" href="/static/halo-backend/plugins/datetimepicker/css/bootstrap-datetimepicker.min.css">
|
<link rel="stylesheet" href="/static/halo-backend/plugins/datetimepicker/css/bootstrap-datetimepicker.min.css">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
@ -170,7 +170,13 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
MathJax.Hub.Config({
|
MathJax.Hub.Config({
|
||||||
tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
|
showProcessingMessages: false,
|
||||||
|
messageStyle: "none",
|
||||||
|
tex2jax: {
|
||||||
|
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
||||||
|
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
|
||||||
|
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre','code','a']
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var QUEUE = MathJax.Hub.queue;
|
var QUEUE = MathJax.Hub.queue;
|
||||||
|
@ -178,7 +184,7 @@
|
||||||
/**
|
/**
|
||||||
* 加载编辑器
|
* 加载编辑器
|
||||||
*/
|
*/
|
||||||
var simplemde = new SimpleMDE({
|
var easyMDE = new EasyMDE({
|
||||||
element: document.getElementById("editorarea"),
|
element: document.getElementById("editorarea"),
|
||||||
autoDownloadFontAwesome: false,
|
autoDownloadFontAwesome: false,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
|
@ -206,7 +212,7 @@
|
||||||
* 方法来自https://gitee.com/supperzh/zb-blog/blob/master/src/main/resources/templates/article/publish.html#L255
|
* 方法来自https://gitee.com/supperzh/zb-blog/blob/master/src/main/resources/templates/article/publish.html#L255
|
||||||
*/
|
*/
|
||||||
$(function () {
|
$(function () {
|
||||||
inlineAttachment.editors.codemirror4.attach(simplemde.codemirror, {
|
inlineAttachment.editors.codemirror4.attach(easyMDE.codemirror, {
|
||||||
progressText: "![上传中...]()",
|
progressText: "![上传中...]()",
|
||||||
uploadUrl: "/admin/attachments/upload"
|
uploadUrl: "/admin/attachments/upload"
|
||||||
});
|
});
|
||||||
|
@ -299,7 +305,7 @@
|
||||||
'postStatus': status,
|
'postStatus': status,
|
||||||
'postTitle': postTitle.val(),
|
'postTitle': postTitle.val(),
|
||||||
'postUrl' : postUrl.html().toString(),
|
'postUrl' : postUrl.html().toString(),
|
||||||
'postContentMd': simplemde.value(),
|
'postContentMd': easyMDE.value(),
|
||||||
'postThumbnail': $('#selectImg').attr('src'),
|
'postThumbnail': $('#selectImg').attr('src'),
|
||||||
'cateList' : cateList.toString(),
|
'cateList' : cateList.toString(),
|
||||||
'tagList' : $('#tagList').tagEditor('getTags')[0].tags.toString(),
|
'tagList' : $('#tagList').tagEditor('getTags')[0].tags.toString(),
|
||||||
|
@ -309,7 +315,7 @@
|
||||||
},function (data) {
|
},function (data) {
|
||||||
if(data.code === 1){
|
if(data.code === 1){
|
||||||
//清除自动保存的内容
|
//清除自动保存的内容
|
||||||
simplemde.clearAutosavedValue();
|
easyMDE.clearAutosavedValue();
|
||||||
halo.showMsgAndRedirect(data.msg,'success',1000,'/admin/posts',"${options.admin_pjax!'true'}");
|
halo.showMsgAndRedirect(data.msg,'success',1000,'/admin/posts',"${options.admin_pjax!'true'}");
|
||||||
}else{
|
}else{
|
||||||
halo.showMsg(data.msg,'error',2000);
|
halo.showMsg(data.msg,'error',2000);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<#include "module/_macro.ftl">
|
<#include "module/_macro.ftl">
|
||||||
<@head>${options.blog_title!} | <@spring.message code='admin.posts.edit.title' /></@head>
|
<@head>${options.blog_title!} | <@spring.message code='admin.posts.edit.title' /></@head>
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<link rel="stylesheet" href="/static/halo-backend/plugins/simplemde/simplemde.min.css">
|
<link rel="stylesheet" href="/static/halo-backend/plugins/easymde/easymde.min.css">
|
||||||
<link rel="stylesheet" href="/static/halo-backend/plugins/jquery-tageditor/jquery.tag-editor.css">
|
<link rel="stylesheet" href="/static/halo-backend/plugins/jquery-tageditor/jquery.tag-editor.css">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#postTitle{font-weight: 400;}
|
#postTitle{font-weight: 400;}
|
||||||
|
@ -156,7 +156,13 @@
|
||||||
<script type="application/javascript" id="footer_script">
|
<script type="application/javascript" id="footer_script">
|
||||||
|
|
||||||
MathJax.Hub.Config({
|
MathJax.Hub.Config({
|
||||||
tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]}
|
showProcessingMessages: false,
|
||||||
|
messageStyle: "none",
|
||||||
|
tex2jax: {
|
||||||
|
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
||||||
|
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
|
||||||
|
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre','code','a']
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var QUEUE = MathJax.Hub.queue;
|
var QUEUE = MathJax.Hub.queue;
|
||||||
|
@ -164,13 +170,13 @@
|
||||||
/**
|
/**
|
||||||
* 加载编辑器
|
* 加载编辑器
|
||||||
*/
|
*/
|
||||||
var simplemde = new SimpleMDE({
|
var easyMDE = new EasyMDE({
|
||||||
element: document.getElementById("editorarea"),
|
element: document.getElementById("editorarea"),
|
||||||
autoDownloadFontAwesome: false,
|
autoDownloadFontAwesome: false,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
autosave: {
|
autosave: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
uniqueId: "editor-temp",
|
uniqueId: "editor-temp-0",
|
||||||
delay: 10000
|
delay: 10000
|
||||||
},
|
},
|
||||||
renderingConfig: {
|
renderingConfig: {
|
||||||
|
@ -192,7 +198,7 @@
|
||||||
* 方法来自https://gitee.com/supperzh/zb-blog/blob/master/src/main/resources/templates/article/publish.html#L255
|
* 方法来自https://gitee.com/supperzh/zb-blog/blob/master/src/main/resources/templates/article/publish.html#L255
|
||||||
*/
|
*/
|
||||||
$(function () {
|
$(function () {
|
||||||
inlineAttachment.editors.codemirror4.attach(simplemde.codemirror, {
|
inlineAttachment.editors.codemirror4.attach(easyMDE.codemirror, {
|
||||||
progressText: "![上传中...]()",
|
progressText: "![上传中...]()",
|
||||||
uploadUrl: "/admin/attachments/upload"
|
uploadUrl: "/admin/attachments/upload"
|
||||||
});
|
});
|
||||||
|
@ -276,7 +282,7 @@
|
||||||
'postStatus': status,
|
'postStatus': status,
|
||||||
'postTitle': postTitle.val(),
|
'postTitle': postTitle.val(),
|
||||||
'postUrl' : postUrl.html().toString(),
|
'postUrl' : postUrl.html().toString(),
|
||||||
'postContentMd': simplemde.value(),
|
'postContentMd': easyMDE.value(),
|
||||||
'postThumbnail': $('#selectImg').attr('src'),
|
'postThumbnail': $('#selectImg').attr('src'),
|
||||||
'cateList' : cateList.toString(),
|
'cateList' : cateList.toString(),
|
||||||
'tagList' : $('#tagList').tagEditor('getTags')[0].tags.toString(),
|
'tagList' : $('#tagList').tagEditor('getTags')[0].tags.toString(),
|
||||||
|
@ -285,7 +291,7 @@
|
||||||
},function (data) {
|
},function (data) {
|
||||||
if(data.code === 1){
|
if(data.code === 1){
|
||||||
//清除自动保存的内容
|
//清除自动保存的内容
|
||||||
simplemde.clearAutosavedValue();
|
easyMDE.clearAutosavedValue();
|
||||||
halo.showMsgAndRedirect(data.msg,'success',1000,'/admin/posts',"${options.admin_pjax!'true'}");
|
halo.showMsgAndRedirect(data.msg,'success',1000,'/admin/posts',"${options.admin_pjax!'true'}");
|
||||||
}else{
|
}else{
|
||||||
halo.showMsg(data.msg,'error',2000);
|
halo.showMsg(data.msg,'error',2000);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<#include "module/_macro.ftl">
|
<#include "module/_macro.ftl">
|
||||||
<@head>${options.blog_title!} | <@spring.message code='admin.themes.edit.title' /></@head>
|
<@head>${options.blog_title!} | <@spring.message code='admin.themes.edit.title' /></@head>
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<link rel="stylesheet" href="/static/halo-backend/plugins/simplemde/simplemde.min.css">
|
<link rel="stylesheet" href="/static/halo-backend/plugins/easymde/easymde.min.css">
|
||||||
<section class="content-header" id="animated-header">
|
<section class="content-header" id="animated-header">
|
||||||
<h1 style="display: inline-block;"><@spring.message code='admin.themes.edit.title' /></h1>
|
<h1 style="display: inline-block;"><@spring.message code='admin.themes.edit.title' /></h1>
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
/**
|
/**
|
||||||
* 加载编辑器
|
* 加载编辑器
|
||||||
*/
|
*/
|
||||||
var simplemde = new SimpleMDE({
|
var easyMDE = new EasyMDE({
|
||||||
element: document.getElementById("tplContent"),
|
element: document.getElementById("tplContent"),
|
||||||
autoDownloadFontAwesome: false,
|
autoDownloadFontAwesome: false,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
|
@ -111,11 +111,11 @@
|
||||||
var tplNameTitle = $('#tplNameTitle');
|
var tplNameTitle = $('#tplNameTitle');
|
||||||
if (tplName && tplName !== '') {
|
if (tplName && tplName !== '') {
|
||||||
$.get('/admin/themes/getTpl',{'tplName': tplName},function (data) {
|
$.get('/admin/themes/getTpl',{'tplName': tplName},function (data) {
|
||||||
simplemde.value(data);
|
easyMDE.value(data);
|
||||||
tplNameTitle.html(tplName);
|
tplNameTitle.html(tplName);
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
simplemde.value('');
|
easyMDE.value('');
|
||||||
tplNameTitle.html('');
|
tplNameTitle.html('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@
|
||||||
function saveTpl() {
|
function saveTpl() {
|
||||||
$.post('/admin/themes/editor/save',{
|
$.post('/admin/themes/editor/save',{
|
||||||
'tplName': $('#tplNameTitle').html(),
|
'tplName': $('#tplNameTitle').html(),
|
||||||
'tplContent': simplemde.value()
|
'tplContent': easyMDE.value()
|
||||||
},function (data) {
|
},function (data) {
|
||||||
if(data.code === 1){
|
if(data.code === 1){
|
||||||
halo.showMsg(data.msg,'success',1000);
|
halo.showMsg(data.msg,'success',1000);
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
<#if (options.blog_locale!'zh_CN') == 'zh_CN'>
|
<#if (options.blog_locale!'zh_CN') == 'zh_CN'>
|
||||||
<script src="/static/halo-backend/plugins/fileinput/zh.min.js"></script>
|
<script src="/static/halo-backend/plugins/fileinput/zh.min.js"></script>
|
||||||
</#if>
|
</#if>
|
||||||
<script src="/static/halo-backend/plugins/simplemde/simplemde.min.js"></script>
|
<script src="/static/halo-backend/plugins/easymde/easymde.min.js"></script>
|
||||||
<script src="/static/halo-backend/plugins/inline-attachment/codemirror-4.inline-attachment.min.js"></script>
|
<script src="/static/halo-backend/plugins/inline-attachment/codemirror-4.inline-attachment.min.js"></script>
|
||||||
<script src="/static/halo-backend/plugins/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
<script src="/static/halo-backend/plugins/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
|
||||||
<script src="/static/halo-backend/plugins/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
|
<script src="/static/halo-backend/plugins/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
|
||||||
|
|
Loading…
Reference in New Issue