Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
智布道
OneBlog
比较版本
2d5b6124c909b0061333cf401a8c39d36780387b...725d983c55c43eebf5a52225a3a73121d02dd78c
O
OneBlog
项目概览
智布道
/
OneBlog
9 个月 前同步成功
通知
11
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OneBlog
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
源分支
725d983c55c43eebf5a52225a3a73121d02dd78c
选择Git版本
...
目标分支
2d5b6124c909b0061333cf401a8c39d36780387b
选择Git版本
比较
Commits (13)
https://gitcode.net/u011197448/oneblog/-/commit/47d23c6f5f8fd37ed98fa25064119120142de333
:arrow_up: wangEditor 升级到 4.7.9
2021-10-28T18:41:25+08:00
yadong.zhang
yadong.zhang0415@gmail.com
https://gitcode.net/u011197448/oneblog/-/commit/d51b91d9cda24215251a401629e52a55e313a1cd
:sparkles: 新增 TinyMCE 编辑器 (#I4FOB0)
2021-10-28T18:42:41+08:00
yadong.zhang
yadong.zhang0415@gmail.com
https://gitcode.net/u011197448/oneblog/-/commit/2a3de0fa867c7eaddb3b2750d5ded792f090cc2a
:bug: 解决后台分页失败的问题 (#I4FPMK)
2021-10-28T19:25:54+08:00
yadong.zhang
yadong.zhang0415@gmail.com
https://gitcode.net/u011197448/oneblog/-/commit/922f81ec1e520d02b11e56a97aea21b33164efaf
:bug: fixed [#I165DP]
2021-10-28T19:57:22+08:00
yadong.zhang
yadong.zhang0415@gmail.com
https://gitcode.net/u011197448/oneblog/-/commit/dfdf1001694c94b1d982cf245996b0faee1fec1a
:bug: 修复【文章搬运工】抓取文章失败的问题
2021-10-28T20:25:25+08:00
yadong.zhang
yadong.zhang0415@gmail.com
https://gitcode.net/u011197448/oneblog/-/commit/109c935ed360ae8fde43ea3c0044b3a5b626fc31
:bug: 解决 NPE
2021-10-28T20:29:30+08:00
yadong.zhang
yadong.zhang0415@gmail.com
https://gitcode.net/u011197448/oneblog/-/commit/589e57d304fe4fa92e77360ff0e45794a47cde8e
:zap: 优化代码
2021-10-28T20:57:35+08:00
yadong.zhang
yadong.zhang0415@gmail.com
https://gitcode.net/u011197448/oneblog/-/commit/98484711857677145c176e7eb8291b980d911bbd
:memo: 编写文档
2021-10-28T20:57:51+08:00
yadong.zhang
yadong.zhang0415@gmail.com
https://gitcode.net/u011197448/oneblog/-/commit/587a3a1daa739a62ad939c072c462cd8bb621467
:bookmark: 升级到 2.3.2
2021-10-28T20:58:57+08:00
yadong.zhang
yadong.zhang0415@gmail.com
https://gitcode.net/u011197448/oneblog/-/commit/637f0a5fa9024b81c2a45480c3bef167ef33e20b
:bookmark: 升级到 2.3.2
2021-10-28T21:18:09+08:00
yadong.zhang
yadong.zhang0415@gmail.com
https://gitcode.net/u011197448/oneblog/-/commit/d81293ff733307602f8774c35f27438ea79bf69d
:bookmark: 更新 SQL
2021-10-28T22:02:09+08:00
yadong.zhang
yadong.zhang0415@gmail.com
https://gitcode.net/u011197448/oneblog/-/commit/db9b2a4caee640710c016e4fbcded120156284ca
:bug: Fixing a bug.
2021-10-28T22:46:58+08:00
yadong.zhang
yadong.zhang0415@gmail.com
https://gitcode.net/u011197448/oneblog/-/commit/725d983c55c43eebf5a52225a3a73121d02dd78c
:bug: Fixing a bug.
2021-10-28T22:58:38+08:00
yadong.zhang
yadong.zhang0415@gmail.com
展开全部
隐藏空白更改
内联
并排
Showing
35 changed file
with
438 addition
and
232 deletion
+438
-232
blog-admin/pom.xml
blog-admin/pom.xml
+1
-1
blog-admin/src/main/java/com/zyd/blog/controller/RenderController.java
...c/main/java/com/zyd/blog/controller/RenderController.java
+14
-14
blog-admin/src/main/java/com/zyd/blog/controller/RestCommentController.java
...n/java/com/zyd/blog/controller/RestCommentController.java
+3
-3
blog-admin/src/main/java/com/zyd/blog/core/config/PageHelperConfig.java
.../main/java/com/zyd/blog/core/config/PageHelperConfig.java
+33
-0
blog-admin/src/main/resources/static/assets/js/zhyd.core.js
blog-admin/src/main/resources/static/assets/js/zhyd.core.js
+110
-40
blog-admin/src/main/resources/static/assets/js/zhyd.publish-article.js
...c/main/resources/static/assets/js/zhyd.publish-article.js
+39
-14
blog-admin/src/main/resources/templates/article/list.ftl
blog-admin/src/main/resources/templates/article/list.ftl
+1
-1
blog-admin/src/main/resources/templates/article/publish-md.ftl
...admin/src/main/resources/templates/article/publish-md.ftl
+12
-2
blog-admin/src/main/resources/templates/article/publish-tiny.ftl
...min/src/main/resources/templates/article/publish-tiny.ftl
+80
-0
blog-admin/src/main/resources/templates/article/publish-we.ftl
...admin/src/main/resources/templates/article/publish-we.ftl
+13
-7
blog-admin/src/main/resources/templates/config.ftl
blog-admin/src/main/resources/templates/config.ftl
+15
-2
blog-admin/src/main/resources/templates/include/macros.ftl
blog-admin/src/main/resources/templates/include/macros.ftl
+1
-1
blog-admin/src/main/resources/templates/layout/footer.ftl
blog-admin/src/main/resources/templates/layout/footer.ftl
+8
-2
blog-admin/src/main/resources/templates/login.ftl
blog-admin/src/main/resources/templates/login.ftl
+1
-1
blog-admin/src/main/resources/templates/other/editor.ftl
blog-admin/src/main/resources/templates/other/editor.ftl
+26
-8
blog-codegen/pom.xml
blog-codegen/pom.xml
+1
-1
blog-core/pom.xml
blog-core/pom.xml
+1
-31
blog-core/src/main/java/com/zyd/blog/business/entity/Article.java
...e/src/main/java/com/zyd/blog/business/entity/Article.java
+10
-1
blog-core/src/main/java/com/zyd/blog/business/enums/ConfigKeyEnum.java
.../main/java/com/zyd/blog/business/enums/ConfigKeyEnum.java
+4
-0
blog-core/src/main/java/com/zyd/blog/business/service/impl/BizCommentServiceImpl.java
...zyd/blog/business/service/impl/BizCommentServiceImpl.java
+5
-3
blog-core/src/main/java/com/zyd/blog/business/service/impl/RemoverServiceImpl.java
...om/zyd/blog/business/service/impl/RemoverServiceImpl.java
+3
-1
blog-core/src/main/java/com/zyd/blog/framework/config/AsyncConfig.java
.../main/java/com/zyd/blog/framework/config/AsyncConfig.java
+1
-66
blog-core/src/main/java/com/zyd/blog/persistence/beans/BizArticle.java
.../main/java/com/zyd/blog/persistence/beans/BizArticle.java
+2
-0
blog-core/src/main/resources/config/application-center.yml
blog-core/src/main/resources/config/application-center.yml
+2
-2
blog-core/src/main/resources/mybatis/BizArticleMapper.xml
blog-core/src/main/resources/mybatis/BizArticleMapper.xml
+4
-0
blog-file/pom.xml
blog-file/pom.xml
+1
-1
blog-web/pom.xml
blog-web/pom.xml
+1
-1
blog-web/src/main/resources/templates/layout/footer.ftl
blog-web/src/main/resources/templates/layout/footer.ftl
+17
-17
blog-web/src/main/resources/templates/layout/header.ftl
blog-web/src/main/resources/templates/layout/header.ftl
+1
-1
docs/bin/version.txt
docs/bin/version.txt
+1
-1
docs/db/update.sql
docs/db/update.sql
+6
-0
docs/docker/mysql/dblog.sql
docs/docker/mysql/dblog.sql
+1
-0
docs/docker/mysql/init_data.sql
docs/docker/mysql/init_data.sql
+2
-2
pom.xml
pom.xml
+8
-8
update.md
update.md
+10
-0
未找到文件。
blog-admin/pom.xml
浏览文件 @
725d983c
...
...
@@ -12,7 +12,7 @@
<parent>
<groupId>
com.zyd
</groupId>
<artifactId>
blog
</artifactId>
<version>
2.3.
1
</version>
<version>
2.3.
2
</version>
</parent>
<dependencies>
...
...
blog-admin/src/main/java/com/zyd/blog/controller/RenderController.java
浏览文件 @
725d983c
...
...
@@ -17,6 +17,7 @@ import com.zyd.blog.business.enums.AdTypeEnum;
import
com.zyd.blog.business.service.BizArticleService
;
import
com.zyd.blog.core.BlogHunterConfigProvider
;
import
com.zyd.blog.core.websocket.server.ZydWebsocketServer
;
import
com.zyd.blog.framework.exception.ZhydException
;
import
com.zyd.blog.util.ResultUtil
;
import
me.zhyd.hunter.config.platform.Platform
;
import
me.zhyd.hunter.enums.ExitWayEnum
;
...
...
@@ -31,6 +32,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.servlet.ModelAndView
;
import
java.util.Arrays
;
/**
* 页面跳转类
*
...
...
@@ -86,17 +89,13 @@ public class RenderController {
}
@RequiresPermissions
(
"article:publish"
)
@BussinessLog
(
value
=
"进入发表文章页[html]"
)
@GetMapping
(
"/article/publish"
)
public
ModelAndView
publish
()
{
return
ResultUtil
.
view
(
"article/publish"
);
}
@RequiresPermissions
(
"article:publish"
)
@BussinessLog
(
value
=
"进入发表文章页[markdown]"
)
@GetMapping
(
"/article/publishMd"
)
public
ModelAndView
publishMd
()
{
return
ResultUtil
.
view
(
"article/publish-md"
);
@BussinessLog
(
value
=
"进入发表文章页[{1}]"
)
@GetMapping
(
"/article/publish-{type}"
)
public
ModelAndView
publish
(
@PathVariable
(
"type"
)
String
type
)
{
if
(!
Arrays
.
asList
(
"we"
,
"md"
,
"tiny"
).
contains
(
type
))
{
throw
new
ZhydException
(
"不支持的编辑器类型"
);
}
return
ResultUtil
.
view
(
"article/publish-"
+
type
);
}
@RequiresPermissions
(
"article:publish"
)
...
...
@@ -105,10 +104,11 @@ public class RenderController {
public
ModelAndView
edit
(
@PathVariable
(
"id"
)
Long
id
,
Model
model
)
{
model
.
addAttribute
(
"id"
,
id
);
Article
article
=
articleService
.
getByPrimaryKey
(
id
);
if
(
article
.
getIsMarkdown
())
{
return
ResultUtil
.
view
(
"article/publish-md"
);
if
(!
Arrays
.
asList
(
"we"
,
"md"
,
"tiny"
).
contains
(
article
.
getEditorType
()))
{
throw
new
ZhydException
(
"文章异常,未知的编辑器类型"
);
}
return
ResultUtil
.
view
(
"article/publish
"
);
return
ResultUtil
.
view
(
"article/publish
-"
+
article
.
getEditorType
()
);
}
@RequiresPermissions
(
"types"
)
...
...
blog-admin/src/main/java/com/zyd/blog/controller/RestCommentController.java
浏览文件 @
725d983c
...
...
@@ -52,7 +52,7 @@ public class RestCommentController {
public
ResponseVO
reply
(
Comment
comment
)
{
try
{
commentService
.
commentForAdmin
(
comment
);
}
catch
(
ZhydCommentException
e
){
}
catch
(
ZhydCommentException
e
)
{
return
ResultUtil
.
error
(
e
.
getMessage
());
}
return
ResultUtil
.
success
(
"成功"
);
...
...
@@ -97,11 +97,11 @@ public class RestCommentController {
public
ResponseVO
audit
(
Comment
comment
,
String
contentText
,
Boolean
sendEmail
)
{
try
{
commentService
.
updateSelective
(
comment
);
if
(!
StringUtils
.
isEmpty
(
contentText
))
{
if
(!
StringUtils
.
isEmpty
(
contentText
))
{
comment
.
setContent
(
contentText
);
commentService
.
commentForAdmin
(
comment
);
}
if
(
null
!=
sendEmail
&&
sendEmail
)
{
if
(
null
!=
sendEmail
&&
sendEmail
)
{
Comment
commentDB
=
commentService
.
getByPrimaryKey
(
comment
.
getId
());
mailService
.
send
(
commentDB
,
TemplateKeyEnum
.
TM_COMMENT_AUDIT
,
true
);
}
...
...
blog-admin/src/main/java/com/zyd/blog/core/config/PageHelperConfig.java
0 → 100644
浏览文件 @
725d983c
package
com.zyd.blog.core.config
;
import
com.github.pagehelper.PageInterceptor
;
import
com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.context.annotation.Configuration
;
import
javax.annotation.PostConstruct
;
import
java.util.List
;
/**
* 解决后台分页失败的问题
*
* @author yadong.zhang (yadong.zhang0415(a)gmail.com)
* @version 1.0.0
* @since 1.0.0
*/
@Configuration
@AutoConfigureAfter
(
PageHelperAutoConfiguration
.
class
)
public
class
PageHelperConfig
{
@Autowired
private
List
<
SqlSessionFactory
>
sqlSessionFactoryList
;
@PostConstruct
public
void
addMyInterceptor
()
{
PageInterceptor
pageInterceptor
=
new
PageInterceptor
();
for
(
SqlSessionFactory
sqlSessionFactory
:
sqlSessionFactoryList
)
{
sqlSessionFactory
.
getConfiguration
().
addInterceptor
(
pageInterceptor
);
}
}
}
blog-admin/src/main/resources/static/assets/js/zhyd.core.js
浏览文件 @
725d983c
...
...
@@ -85,7 +85,6 @@ var zhyd = window.zhyd || {
$
(
$bindBox
).
find
(
"
li
"
).
each
(
function
()
{
var
$li
=
$
(
this
);
console
.
log
(
222222
)
$li
.
bind
(
'
click
'
,
add
);
});
$
(
"
.bootstrap-tagsinput input
"
).
bind
(
'
keydown
'
,
function
(
event
)
{
...
...
@@ -168,13 +167,14 @@ var zhyd = window.zhyd || {
editor
=
new
E
(
config
.
container
);
// 配置编辑器 start
// 关闭粘贴样式的过滤
editor
.
customConfig
.
pasteFilterStyle
=
false
;
editor
.
customConfig
.
zIndex
=
100
;
editor
.
config
.
pasteFilterStyle
=
false
;
editor
.
config
.
zIndex
=
100
;
editor
.
config
.
withCredentials
=
true
;
if
(
config
.
textareaName
)
{
$
(
'
<textarea class="wangeditor-textarea" id="
'
+
config
.
textareaName
+
'
" name="
'
+
config
.
textareaName
+
'
" style="display: none" required="required"></textarea>
'
).
insertAfter
(
$
(
config
.
container
));
}
var
$contentBox
=
$
(
'
textarea[name=
'
+
config
.
textareaName
+
'
]
'
);
editor
.
c
ustomC
onfig
.
onchange
=
function
(
html
)
{
editor
.
config
.
onchange
=
function
(
html
)
{
// 监控变化,同步更新到 textarea
$contentBox
.
val
(
html
);
};
...
...
@@ -194,7 +194,6 @@ var zhyd = window.zhyd || {
// 配置编辑器 end
editor
.
create
();
// 注册全屏插件
zhyd
.
wangEditor
.
plugins
.
registerFullscreen
(
config
.
container
);
// 注册图片资源库
zhyd
.
wangEditor
.
plugins
.
registerMaterial
(
editor
,
$contentBox
);
...
...
@@ -207,52 +206,25 @@ var zhyd = window.zhyd || {
}
},
plugins
:
{
registerFullscreen
:
function
()
{
var
E
=
zhyd
.
wangEditor
.
_instance
;
// 全屏插件
E
.
fullscreen
=
{
init
:
function
(
editorBox
)
{
$
(
editorBox
+
"
.w-e-toolbar
"
).
append
(
'
<div class="w-e-menu"><a class="_wangEditor_btn_fullscreen" href="###" onclick="window.wangEditor.fullscreen.toggleFullscreen(
\'
'
+
editorBox
+
'
\'
)" data-toggle="tooltip" data-placement="bottom" title data-original-title="全屏编辑"><i class="fa fa-expand"></i></a></div>
'
)
},
toggleFullscreen
:
function
(
editorSelector
)
{
$
(
editorSelector
).
toggleClass
(
'
fullscreen-editor
'
);
var
$a
=
$
(
editorSelector
+
'
._wangEditor_btn_fullscreen
'
);
var
$i
=
$a
.
find
(
"
i:first-child
"
);
if
(
$i
.
hasClass
(
"
fa-expand
"
))
{
$a
.
attr
(
"
data-original-title
"
,
"
退出全屏
"
);
$i
.
removeClass
(
"
fa-expand
"
).
addClass
(
"
fa-compress
"
)
}
else
{
$a
.
attr
(
"
data-original-title
"
,
"
全屏编辑
"
);
$i
.
removeClass
(
"
fa-compress
"
).
addClass
(
"
fa-expand
"
)
}
}
};
// 初始化全屏插件
var
n
=
arguments
.
length
;
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
E
.
fullscreen
.
init
(
arguments
[
i
]);
}
},
registerUpload
:
function
(
editor
,
uploadUrl
,
uploadFileName
,
uploadType
,
callback
)
{
if
(
uploadUrl
)
{
// 上传图片到服务器
editor
.
c
ustomC
onfig
.
uploadImgServer
=
uploadUrl
;
editor
.
c
ustomC
onfig
.
uploadFileName
=
uploadFileName
;
editor
.
config
.
uploadImgServer
=
uploadUrl
;
editor
.
config
.
uploadFileName
=
uploadFileName
;
// 将图片大小限制为 50M
editor
.
c
ustomC
onfig
.
uploadImgMaxSize
=
50
*
1024
*
1024
;
editor
.
config
.
uploadImgMaxSize
=
50
*
1024
*
1024
;
// 超时时间
editor
.
c
ustomC
onfig
.
uploadImgTimeout
=
10000
;
editor
.
config
.
uploadImgTimeout
=
10000
;
// 自定义上传参数
editor
.
c
ustomC
onfig
.
uploadImgParams
=
{
editor
.
config
.
uploadImgParams
=
{
// 如果版本 <=v3.1.0 ,属性值会自动进行 encode ,此处无需 encode
// 如果版本 >=v3.1.1 ,属性值不会自动 encode ,如有需要自己手动 encode
uploadType
:
uploadType
};
editor
.
c
ustomC
onfig
.
customAlert
=
function
(
msg
)
{
editor
.
config
.
customAlert
=
function
(
msg
)
{
$
.
alert
.
error
(
msg
);
};
editor
.
c
ustomC
onfig
.
uploadImgHooks
=
{
editor
.
config
.
uploadImgHooks
=
{
error
:
function
(
xhr
,
editor
)
{
$
.
alert
.
error
(
"
图片上传出错
"
);
},
...
...
@@ -485,6 +457,104 @@ var zhyd = window.zhyd || {
}
}
},
tinymce
:
{
defaultConfig
:
{
selector
:
"
tinymceEditor
"
,
uploadUrl
:
""
,
uploadFileName
:
"
file
"
,
textareaName
:
"
content
"
,
},
init
:
function
(
options
)
{
var
$op
=
$
.
extend
(
zhyd
.
tinymce
.
defaultConfig
,
options
);
if
(
$op
.
textareaName
)
{
$
(
'
<textarea class="wangeditor-textarea" id="
'
+
$op
.
textareaName
+
'
" name="
'
+
$op
.
textareaName
+
'
" style="display: none" required="required"></textarea>
'
).
insertAfter
(
$
(
$op
.
selector
));
}
var
$contentBox
=
$
(
'
textarea[name=
'
+
$op
.
textareaName
+
'
]
'
);
tinymce
.
init
({
selector
:
$op
.
selector
,
toolbar_mode
:
'
floating
'
,
// width: 600,
height
:
500
,
plugins
:
[
'
powerpaste advlist autolink link image lists charmap print preview hr anchor pagebreak
'
,
'
searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking
'
,
'
table emoticons template paste help
'
],
menubar
:
'
file edit view insert format tools table
'
,
toolbar
:
'
undo redo | styleselect | code | bold italic | alignleft aligncenter alignright alignjustify |
'
+
'
bullist numlist outdent indent | link image | preview media fullscreen |
'
+
'
forecolor backcolor emoticons | help
'
,
content_langs
:
[
{
title
:
'
English
'
,
code
:
'
en
'
},
{
title
:
'
Chinese
'
,
code
:
'
zh
'
}
],
// language: 'zh_CN',
// directionality: 'rtl',
custom_undo_redo_levels
:
10
,
images_upload_url
:
$op
.
uploadUrl
,
images_upload_credentials
:
true
,
automatic_uploads
:
false
,
images_upload_handler
:
example_image_upload_handler
,
init_instance_callback
:
function
(
editor
)
{
editor
.
on
(
'
SetContent
'
,
function
(
e
)
{
$contentBox
.
val
(
zhyd
.
tinymce
.
getHtml
())
});
editor
.
on
(
'
Change
'
,
function
(
e
)
{
$contentBox
.
val
(
zhyd
.
tinymce
.
getHtml
())
});
}
});
function
example_image_upload_handler
(
blobInfo
,
success
,
failure
,
progress
)
{
var
xhr
,
formData
;
xhr
=
new
XMLHttpRequest
();
xhr
.
withCredentials
=
false
;
xhr
.
open
(
'
POST
'
,
$op
.
uploadUrl
);
xhr
.
upload
.
onprogress
=
function
(
e
)
{
progress
(
e
.
loaded
/
e
.
total
*
100
);
};
xhr
.
onload
=
function
()
{
var
json
;
if
(
xhr
.
status
===
403
)
{
failure
(
'
HTTP Error:
'
+
xhr
.
status
,
{
remove
:
true
});
return
;
}
if
(
xhr
.
status
<
200
||
xhr
.
status
>=
300
)
{
failure
(
'
HTTP Error:
'
+
xhr
.
status
);
return
;
}
json
=
JSON
.
parse
(
xhr
.
responseText
);
if
(
!
json
||
typeof
json
.
data
!=
'
string
'
)
{
failure
(
'
Invalid JSON:
'
+
xhr
.
responseText
);
return
;
}
success
(
json
.
data
);
};
xhr
.
onerror
=
function
()
{
failure
(
'
Image upload failed due to a XHR Transport error. Code:
'
+
xhr
.
status
);
};
formData
=
new
FormData
();
formData
.
append
(
$op
.
uploadFileName
,
blobInfo
.
blob
(),
blobInfo
.
filename
());
xhr
.
send
(
formData
);
}
},
getHtml
:
function
()
{
// 只有一个编辑器
return
tinymce
.
activeEditor
.
getContent
();
// 多个编辑器
// return tinymce.editors[0].getContent();
// 不带HTML标记的纯文本内容
// var activeEditor = tinymce.activeEditor;
// var editBody = activeEditor.getBody();
// activeEditor.selection.select(editBody);
// var text = activeEditor.selection.getContent( {'format' : 'text' });
},
setHtml
:
function
(
html
)
{
// 只有一个编辑器
return
tinymce
.
activeEditor
.
setContent
(
html
);
// 多个编辑器
// return tinymce.editors[0].setContent(html);
}
},
mask
:
{
_box
:
'
<div class="mask {{maskType}}"><div class="masker"><i class="{{icon}}"></i></div><h3 class="text">{{text}}</h3></div>
'
,
_icon
:
{
...
...
@@ -605,7 +675,7 @@ $(document).ready(function () {
/**
* 切换编辑器
*/
$
(
"
#
changeEditor
"
).
click
(
function
()
{
$
(
"
.
changeEditor
"
).
click
(
function
()
{
var
$this
=
$
(
this
);
$
.
alert
.
confirm
(
"
确定要切换编辑器吗?切换后本页内容将可能会丢失?
"
,
function
()
{
window
.
location
.
href
=
$this
.
data
(
"
href
"
);
...
...
blog-admin/src/main/resources/static/assets/js/zhyd.publish-article.js
浏览文件 @
725d983c
...
...
@@ -31,18 +31,37 @@ if(articleId){
if
(
info
[
'
coverImage
'
]){
$
(
"
.coverImage
"
).
attr
(
'
src
'
,
info
[
'
coverImage
'
]);
}
var
contentMd
=
info
[
'
contentMd
'
];
if
(
contentMd
){
$
(
"
#contentMd
"
).
val
(
contentMd
);
if
(
simplemde
){
simplemde
.
value
(
contentMd
);
var
contentHtml
=
''
;
if
(
editorType
===
'
md
'
)
{
var
contentMd
=
info
[
'
contentMd
'
];
if
(
contentMd
){
$
(
"
#contentMd
"
).
val
(
contentMd
);
if
(
simplemde
){
simplemde
.
value
(
contentMd
);
}
}
contentHtml
=
info
[
'
content
'
];
if
(
contentHtml
){
$
(
"
#content
"
).
val
(
contentHtml
);
if
(
editor
){
editor
.
txt
.
html
(
contentHtml
);
}
}
}
if
(
editorType
===
'
tiny
'
)
{
contentHtml
=
info
[
'
content
'
];
if
(
contentHtml
){
$
(
"
#content
"
).
val
(
contentHtml
);
zhyd
.
tinymce
.
setHtml
(
contentHtml
);
}
}
var
contentHtml
=
info
[
'
content
'
];
if
(
contentHtml
){
$
(
"
#content
"
).
val
(
contentHtml
);
if
(
editor
){
editor
.
txt
.
html
(
contentHtml
);
if
(
editorType
===
'
we
'
)
{
contentHtml
=
info
[
'
content
'
];
if
(
contentHtml
){
$
(
"
#content
"
).
val
(
contentHtml
);
if
(
editor
){
editor
.
txt
.
html
(
contentHtml
);
}
}
}
$publishForm
.
find
(
"
input[type!=checkbox], select, textarea
"
).
each
(
function
()
{
...
...
@@ -71,10 +90,16 @@ $(".publishBtn").click(function () {
$
.
alert
.
error
(
"
请填写SEO相关的内容,填写后更容易被收录哦
"
);
return
;
}
var
isMarkdown
=
$
(
"
input[name=isMarkdown]
"
).
val
();
if
(
isMarkdown
==
1
||
isMarkdown
==
'
true
'
){
$
(
"
#contentMd
"
).
val
(
simplemde
.
value
());
$
(
"
#content
"
).
val
(
simplemde
.
markdown
(
simplemde
.
value
()));
if
(
editorType
===
'
md
'
)
{
var
isMarkdown
=
$
(
"
input[name=isMarkdown]
"
).
val
();
if
(
isMarkdown
==
1
||
isMarkdown
==
'
true
'
){
$
(
"
#contentMd
"
).
val
(
simplemde
.
value
());
$
(
"
#content
"
).
val
(
simplemde
.
markdown
(
simplemde
.
value
()));
}
}
if
(
editorType
===
'
tiny
'
)
{
$
(
"
#content
"
).
val
(
zhyd
.
tinymce
.
getHtml
());
}
$publishForm
.
ajaxSubmit
({
...
...
blog-admin/src/main/resources/templates/article/list.ftl
浏览文件 @
725d983c
...
...
@@ -29,7 +29,7 @@
<div class="<#--table-responsive-->">
<div class="btn-group hidden-xs" id="toolbar">
<@shiro.hasPermission name="article:publish">
<a class="btn btn-success" title="发表文章" href="
${(config.articleEditor! == 'md')?string('/article/publishMd', '/article/publish')
}"> <i class="fa fa-pencil fa-fw"></i> </a>
<a class="btn btn-success" title="发表文章" href="
/article/publish-${config.articleEditor!'we'
}"> <i class="fa fa-pencil fa-fw"></i> </a>
</@shiro.hasPermission>
<@shiro.hasPermission name="article:batchDelete">
<button id="btn_delete_ids" type="button" class="btn btn-danger" title="删除选中">
...
...
blog-admin/src/main/resources/templates/article/publish-md.ftl
浏览文件 @
725d983c
...
...
@@ -22,20 +22,29 @@
<ol class="breadcrumb">
<li><a href="/">首页</a></li>
<li><a href="/articles">文章列表</a></li>
<li class="active">发布文章-
Markdown编辑器
</li>
<li class="active">发布文章-
<a href="https://simplemde.com/" target="_blank">Markdown 编辑器</a>
</li>
</ol>
</@breadcrumb>
<div class="x_panel">
<div class="x_title">
<h2>发布文章 <small>可以通过右上角“系统配置”-“文章编辑器”选择默认的文章发布编辑器</small></h2>
<#if !id??>
<div class="pull-right"><small>切换到 <a class="pointer" id="changeEditor" data-href="/article/publish">wangEditor编辑器</a></small></div>
<ul class="nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a class="changeEditor" data-href="/article/publish-we">WangEditor 编辑器</a></li>
<li><a class="changeEditor" data-href="/article/publish-tiny">TinyMCE 编辑器</a></li>
</ul>
</li>
</ul>
</#if>
<div class="clearfix"></div>
</div>
<div class="x_content">
<input type="hidden" name="id">
<input type="hidden" name="isMarkdown" value="1">
<input type="hidden" name="editorType" value="md">
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 col-xs-1" for="title">标题 <span class="required">*</span></label>
<div class="col-md-8 col-sm-8 col-xs-8">
...
...
@@ -84,6 +93,7 @@
};
zhyd.simpleMDE.init(op);
articleId = '${id}';
editorType = 'md';
</script>
<script src="/assets/js/zhyd.publish-article.js"></script>
</@footer>
blog-admin/src/main/resources/templates/article/publish-tiny.ftl
0 → 100644
浏览文件 @
725d983c
<#include "/include/macros.ftl">
<@header>
</@header>
<div class="clearfix"></div>
<form id="publishForm" class="form-horizontal form-label-left" novalidate>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<@breadcrumb>
<ol class="breadcrumb">
<li><a href="/">首页</a></li>
<li><a href="/articles">文章列表</a></li>
<li class="active">发布文章-<a href="https://www.tiny.cloud/" target="_blank">TinyMCE 编辑器</a></li>
</ol>
</@breadcrumb>
<div class="x_panel">
<div class="x_title">
<h2>发布文章 <small>可以通过右上角“系统配置”-“文章编辑器”选择默认的文章发布编辑器</small></h2>
<#if !id??>
<ul class="nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a class="changeEditor" data-href="/article/publish-md">Markdown 编辑器</a></li>
<li><a class="changeEditor" data-href="/article/publish-we">WangEditor 编辑器</a></li>
</ul>
</li>
</ul>
</#if>
<div class="clearfix"></div>
</div>
<div class="x_content">
<input type="hidden" name="id">
<input type="hidden" name="isMarkdown" value="0">
<input type="hidden" name="editorType" value="tiny">
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 col-xs-1" for="title">标题 <span class="required">*</span></label>
<div class="col-md-8 col-sm-8 col-xs-8">
<input type="text" class="form-control col-md-7 col-xs-12" name="title" id="title" required="required" placeholder="请输入标题"/>
</div>
<div class="col-md-1 col-sm-1 col-xs-1">
<div class="checkbox">
<label>
<input type="checkbox" class="square" checked name="original"> 原创
</label>
</div>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 col-xs-12" for="content">内容 <span class="required">*</span></label>
<div class="col-md-10 col-sm-10 col-xs-10">
<div id="tinyEditor"></div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-1 col-sm-1 col-xs-12"></label>
<div class="col-md-10 col-sm-10 col-xs-12">
<button type="button" class="btn btn-success to-choose-info"><i class="fa fa-pencil"> 发布文章</i></button>
</div>
</div>
</div>
</div>
</div>
</div>
<@publishModal></@publishModal>
</form>
</div>
<@chooseImgModal></@chooseImgModal>
<@footer>
<script>
zhyd.tinymce.init({
selector: "#tinyEditor",
uploadUrl: "/api/uploadFile",
uploadFileName: "file",
textareaName: "content",
})
articleId = '${id}';
editorType = 'tiny';
</script>
<script src="/assets/js/zhyd.publish-article.js"></script>
</@footer>
blog-admin/src/main/resources/templates/article/publish.ftl
→
blog-admin/src/main/resources/templates/article/publish
-we
.ftl
浏览文件 @
725d983c
...
...
@@ -10,19 +10,28 @@
<ol class="breadcrumb">
<li><a href="/">首页</a></li>
<li><a href="/articles">文章列表</a></li>
<li class="active">发布文章-
wangEditor编辑器
</li>
<li class="active">发布文章-
<a href="https://www.wangeditor.com/" target="_blank">wangEditor 编辑器</a>
</li>
</ol>
</@breadcrumb>
<div class="x_panel">
<div class="x_title">
<h2>发布文章 <small>可以通过右上角“系统配置”-“文章编辑器”选择默认的文章发布编辑器</small></h2>
<#if !id??>
<div class="pull-right"><small>切换到 <a class="pointer" id="changeEditor" data-href="/article/publishMd">Markdown编辑器</a></small></div>
<ul class="nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a class="changeEditor" data-href="/article/publish-md">Markdown 编辑器</a></li>
<li><a class="changeEditor" data-href="/article/publish-tiny">TinyMCE 编辑器</a></li>
</ul>
</li>
</ul>
</#if>
<div class="clearfix"></div>
</div>
<div class="x_content">
<input type="hidden" name="isMarkdown" value="0">
<input type="hidden" name="editorType" value="we">
<input type="hidden" name="id">
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 col-xs-12" for="title">标题 <span class="required">*</span></label>
...
...
@@ -40,7 +49,7 @@
<div class="item form-group">
<label class="control-label col-md-1 col-sm-1 col-xs-12" for="password">内容 <span class="required">*</span></label>
<div class="col-md-11 col-sm-11 col-xs-12">
<div id="editor"
style="width: 100%;height: 150px;"
></div>
<div id="editor" ></div>
</div>
</div>
<div class="form-group">
...
...
@@ -59,6 +68,7 @@
<@footer>
<script>
articleId = '${id}';
editorType = 'we';
$(function () {
zhyd.wangEditor.init({
container: "#editor",
...
...
@@ -66,10 +76,6 @@
uploadUrl: "/api/uploadFile",
uploadFileName: "file",
uploadType: "article",
customCss: {
"height": "100%",
"max-height": "115px"
}
})
});
</script>
...
...
blog-admin/src/main/resources/templates/config.ftl
浏览文件 @
725d983c
...
...
@@ -385,11 +385,24 @@
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="articleEditor">默认文章编辑器 <i class="fa fa-question-circle" title="文章编辑器"></i></label>
<div class="col-md-6 col-sm-6 col-xs-12 fixed-radio-checkbox">
<select name="articleEditor" id="articleEditor" class="form-control">
<option value="md">Markdown编辑器</option>
<option value="we">WangEditor编辑器</option>
<option value="md">Markdown 编辑器</option>
<option value="we">WangEditor 编辑器</option>
<option value="tiny">TinyMCE 编辑器</option>
</select>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="tinyMCEKey">TinyMCE API Key</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" class="form-control col-md-7 col-xs-12" name="tinyMCEKey" id="tinyMCEKey" placeholder="请输入TinyMCE API Key"/>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12"></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<small>获取地址:<a href="https://www.tiny.cloud/my-account/dashboard/" target="_blank">点击获取 TinyMCE API Key</a></small>
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="comment"></label>
...
...
blog-admin/src/main/resources/templates/include/macros.ftl
浏览文件 @
725d983c
...
...
@@ -71,7 +71,7 @@
<
#if
footerHtml
>
<footer>
<div
class=
"pull-right"
>
Gentelella - Bootstrap Admin Template by
<a
href=
"https://colorlib.com
"
>
Colorlib
</a>
<a
href=
"https://colorlib.com/polygon/gentelella/index.html"
target=
"_blank"
>
Gentelella
</a>
- Bootstrap Admin Template by
<a
href=
"https://colorlib.com"
target=
"_blank
"
>
Colorlib
</a>
</div>
<div
class=
"clearfix"
></div>
</footer>
...
...
blog-admin/src/main/resources/templates/layout/footer.ftl
浏览文件 @
725d983c
...
...
@@ -25,9 +25,15 @@
<script src="https://cdn.jsdelivr.net/npm/@ztree/ztree_v3@3.5.37/js/jquery.ztree.core.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@ztree/ztree_v3@3.5.37/js/jquery.ztree.excheck.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/switchery-npm@0.8.2/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/wangeditor@
3.1.1/release
/wangEditor.min.js" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/wangeditor@
4.7.9/dist
/wangEditor.min.js" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/@adactive/bootstrap-tagsinput@0.8.2/dist/bootstrap-tagsinput.min.js"></script>
<script src="https://www.layuicdn.com/layui/layui.js"></script>
<#--<script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/5/tinymce.min.js"></script>-->
<#if config.tinyMCEKey?exists>
<script src="https://cdn.tiny.cloud/1/${config.tinyMCEKey!}/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script>
<#else>
<script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/5/tinymce.min.js"></script>
</#if>
<#--
<script src="https://cdnjs.cloudflare.com/ajax/libs/pnotify/3.2.1/pnotify.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pnotify/3.2.1/pnotify.buttons.js"></script>
...
...
@@ -41,4 +47,4 @@
<script src="/assets/js/zhyd.upload-preview.js"></script>
<script src="/assets/js/gentelella.core.js"></script>
<script src="/assets/js/zhyd.core.js"></script>
<script src="/assets/js/zhyd.table.js"></script>
\ No newline at end of file
<script src="/assets/js/zhyd.table.js"></script>
blog-admin/src/main/resources/templates/login.ftl
浏览文件 @
725d983c
...
...
@@ -59,7 +59,7 @@
<div
class=
"separator"
>
<div
class=
"clearfix"
></div>
<div>
Gentelella - Bootstrap Admin Template by
<a
href=
"https://colorlib.com
"
>
Colorlib
</a>
<a
href=
"https://colorlib.com/polygon/gentelella/index.html"
target=
"_blank"
>
Gentelella
</a>
- Bootstrap Admin Template by
<a
href=
"https://colorlib.com"
target=
"_blank
"
>
Colorlib
</a>
</div>
</div>
</form>
...
...
blog-admin/src/main/resources/templates/other/editor.ftl
浏览文件 @
725d983c
...
...
@@ -17,14 +17,14 @@
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>
wangEditor富文本编辑器用例
<small><a href="http://www.wangeditor.com/" target="_blank">http://www.wangeditor.com/</a></small>
<h2>
编辑器用例
</h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="form-group row">
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="name">菜单和编辑器区域分开 </label>
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="name">菜单和编辑器区域分开
wangEditor
</label>
<div class="col-md-8 col-sm-8 col-xs-12">
<div id="toolbar" class="toolbar"></div>
<div style="padding: 5px 0; color: #ccc">中间隔离带</div>
...
...
@@ -34,7 +34,7 @@
</div>
</div>
<div class="form-group row">
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="name">普通的编辑器 </label>
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="name">普通的编辑器
wangEditor
</label>
<div class="col-md-8 col-sm-8 col-xs-12">
<div id="div2">
<p>第二个 demo(常规)</p>
...
...
@@ -43,7 +43,7 @@
</div>
<br>
<div class="form-group row">
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="name">oneBlog系统定制的编辑器 </label>
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="name">oneBlog系统定制的编辑器
wangEditor
</label>
<div class="col-md-8 col-sm-8 col-xs-12">
<div id="editor">
<p>第三个 demo(oneBlog系统单独定制,支持文件上传)</p>
...
...
@@ -62,6 +62,12 @@
</div>
</div>
</div>
<div class="form-group row">
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="name">oneBlog系统定制的编辑器 TinyMCE</label>
<div class="col-md-8 col-sm-8 col-xs-12">
<div id="editor3"></div>
</div>
</div>
</div>
</div>
</div>
...
...
@@ -71,11 +77,11 @@
<script type="text/javascript">
var E = window.wangEditor
var editor1 = new E('#toolbar', '#div1');
editor1.c
ustomC
onfig.zIndex = 10;
editor1.config.zIndex = 10;
editor1.create();
var editor2 = new E('#div2');
editor2.c
ustomC
onfig.zIndex = 10;
editor2.config.zIndex = 10;
editor2.create();
$("#div2").find(".w-e-text-container").css("height","100px");
...
...
@@ -92,5 +98,17 @@
"max-height": "600px"
}
})
zhyd.tinymce.init({
selector: "#editor",
uploadUrl: "/api/uploadFile",
uploadFileName: "file",
textareaName: "content2",
})
setTimeout(function (){
console.log(tinymce.activeEditor.getContent())
console.log($('textarea[name=content2]').val())
}, 10000)
</script>
</@footer>
\ No newline at end of file
</@footer>
blog-codegen/pom.xml
浏览文件 @
725d983c
...
...
@@ -12,7 +12,7 @@
<parent>
<groupId>
com.zyd
</groupId>
<artifactId>
blog
</artifactId>
<version>
2.3.
1
</version>
<version>
2.3.
2
</version>
</parent>
<dependencies>
...
...
blog-core/pom.xml
浏览文件 @
725d983c
...
...
@@ -12,7 +12,7 @@
<parent>
<groupId>
com.zyd
</groupId>
<artifactId>
blog
</artifactId>
<version>
2.3.
1
</version>
<version>
2.3.
2
</version>
</parent>
<dependencies>
...
...
@@ -199,36 +199,6 @@
<groupId>
me.zhyd.hunter
</groupId>
<artifactId>
blog-hunter
</artifactId>
<version>
${blog-hunter.version}
</version>
<exclusions>
<exclusion>
<groupId>
org.hibernate.validator
</groupId>
<artifactId>
hibernate-validator
</artifactId>
</exclusion>
<exclusion>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.jsoup
</groupId>
<artifactId>
jsoup
</artifactId>
</exclusion>
<exclusion>
<groupId>
org.slf4j
</groupId>
<artifactId>
slf4j-api
</artifactId>
</exclusion>
<exclusion>
<artifactId>
lombok
</artifactId>
<groupId>
org.projectlombok
</groupId>
</exclusion>
<exclusion>
<artifactId>
commons-collections
</artifactId>
<groupId>
commons-collections
</groupId>
</exclusion>
<exclusion>
<artifactId>
commons-io
</artifactId>
<groupId>
commons-io
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.zyd
</groupId>
...
...
blog-core/src/main/java/com/zyd/blog/business/entity/Article.java
浏览文件 @
725d983c
...
...
@@ -76,11 +76,13 @@ public class Article {
this
.
bizArticle
.
setQrcodePath
(
qrcodePath
);
}
@Deprecated
public
boolean
getIsMarkdown
()
{
Boolean
value
=
this
.
bizArticle
.
getIsMarkdown
();
return
null
!=
value
&&
value
;
}
@Deprecated
public
void
setIsMarkdown
(
boolean
isMarkdown
)
{
this
.
bizArticle
.
setIsMarkdown
(
isMarkdown
);
}
...
...
@@ -149,7 +151,6 @@ public class Article {
this
.
bizArticle
.
setOriginal
(
original
);
}
public
String
getDescription
()
{
return
this
.
bizArticle
.
getDescription
();
}
...
...
@@ -158,6 +159,14 @@ public class Article {
this
.
bizArticle
.
setDescription
(
description
);
}
public
String
getEditorType
()
{
return
this
.
bizArticle
.
getEditorType
();
}
public
void
setEditorType
(
String
editorType
)
{
this
.
bizArticle
.
setEditorType
(
editorType
);
}
public
String
getKeywords
()
{
return
this
.
bizArticle
.
getKeywords
();
}
...
...
blog-core/src/main/java/com/zyd/blog/business/enums/ConfigKeyEnum.java
浏览文件 @
725d983c
...
...
@@ -181,6 +181,10 @@ public enum ConfigKeyEnum {
* 文章编辑器
*/
ARTICLE_EDITOR
(
"articleEditor"
),
/**
* TinyMCE API Key
*/
TINY_MCE_KEY
(
"tinyMCEKey"
),
/**
* 网站安装时间,默认为执行init_data.sql的时间
...
...
blog-core/src/main/java/com/zyd/blog/business/service/impl/BizCommentServiceImpl.java
浏览文件 @
725d983c
...
...
@@ -284,9 +284,11 @@ public class BizCommentServiceImpl implements BizCommentService {
try
{
String
locationJson
=
RestClientUtil
.
get
(
UrlBuildUtil
.
getLocationByIp
(
comment
.
getIp
(),
(
String
)
config
.
get
(
ConfigKeyEnum
.
BAIDU_API_AK
.
getKey
())));
JSONObject
localtionContent
=
JSONObject
.
parseObject
(
locationJson
).
getJSONObject
(
"content"
);
JSONObject
point
=
localtionContent
.
getJSONObject
(
"point"
);
comment
.
setLat
(
point
.
getString
(
"y"
));
comment
.
setLng
(
point
.
getString
(
"x"
));
if
(
localtionContent
.
containsKey
(
"point"
))
{
JSONObject
point
=
localtionContent
.
getJSONObject
(
"point"
);
comment
.
setLat
(
point
.
getString
(
"y"
));
comment
.
setLng
(
point
.
getString
(
"x"
));
}
if
(
localtionContent
.
containsKey
(
"address_detail"
))
{
JSONObject
addressDetail
=
localtionContent
.
getJSONObject
(
"address_detail"
);
...
...
blog-core/src/main/java/com/zyd/blog/business/service/impl/RemoverServiceImpl.java
浏览文件 @
725d983c
...
...
@@ -89,7 +89,8 @@ public class RemoverServiceImpl implements RemoverService {
private
void
saveArticles
(
Long
typeId
,
HunterConfig
config
,
HunterPrintWriter
writerUtil
,
CopyOnWriteArrayList
<
VirtualArticle
>
list
)
{
// 获取数据库中的标签列表
Map
<
String
,
Long
>
originalTags
=
tagsService
.
listAll
().
stream
().
collect
(
Collectors
.
toMap
(
tag
->
tag
.
getName
().
toUpperCase
(),
Tags:
:
getId
));
List
<
Tags
>
tags
=
tagsService
.
listAll
();
Map
<
String
,
Long
>
originalTags
=
tags
.
stream
().
collect
(
Collectors
.
toMap
(
tag
->
tag
.
getName
().
toUpperCase
(),
Tags:
:
getId
));
User
user
=
SessionUtil
.
getUser
();
// 添加文章到数据库
...
...
@@ -115,6 +116,7 @@ public class RemoverServiceImpl implements RemoverService {
article
.
setIsMarkdown
(
false
);
article
.
setDescription
(
virtualArticle
.
getDescription
());
article
.
setKeywords
(
virtualArticle
.
getKeywords
());
article
.
setEditorType
(
"we"
);
article
=
articleService
.
insert
(
article
);
writerUtil
.
print
(
String
.
format
(
"[ save ] Succeed! <a href=\"%s\" target=\"_blank\">%s</a>"
,
virtualArticle
.
getSource
(),
article
.
getTitle
()));
return
article
;
...
...
blog-core/src/main/java/com/zyd/blog/framework/config/AsyncConfig.java
浏览文件 @
725d983c
package
com.zyd.blog.framework.config
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.AsyncConfigurer
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.util.concurrent.ListenableFuture
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
java.lang.reflect.Method
;
import
java.util.concurrent.Callable
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.Future
;
/**
* 异步线程配置
...
...
@@ -28,58 +16,5 @@ import java.util.concurrent.Future;
@Slf4j
@Configuration
@EnableAsync
public
class
AsyncConfig
implements
AsyncConfigurer
{
@Override
@Bean
public
Executor
getAsyncExecutor
()
{
return
new
ContextAwarePoolExecutor
();
}
@Override
public
AsyncUncaughtExceptionHandler
getAsyncUncaughtExceptionHandler
()
{
return
new
SpringAsyncExceptionHandler
();
}
class
SpringAsyncExceptionHandler
implements
AsyncUncaughtExceptionHandler
{
@Override
public
void
handleUncaughtException
(
Throwable
throwable
,
Method
method
,
Object
...
objects
)
{
log
.
error
(
"异步线程发生异常!Method [{}],Error Message [{}]"
,
method
.
getName
(),
throwable
.
getMessage
());
}
}
public
class
ContextAwarePoolExecutor
extends
ThreadPoolTaskExecutor
{
@Override
public
<
T
>
Future
<
T
>
submit
(
Callable
<
T
>
task
)
{
return
super
.
submit
(
new
ContextAwareCallable
(
task
,
RequestContextHolder
.
currentRequestAttributes
()));
}
@Override
public
<
T
>
ListenableFuture
<
T
>
submitListenable
(
Callable
<
T
>
task
)
{
return
super
.
submitListenable
(
new
ContextAwareCallable
(
task
,
RequestContextHolder
.
currentRequestAttributes
()));
}
}
public
class
ContextAwareCallable
<
T
>
implements
Callable
<
T
>
{
private
Callable
<
T
>
task
;
private
RequestAttributes
context
;
public
ContextAwareCallable
(
Callable
<
T
>
task
,
RequestAttributes
context
)
{
this
.
task
=
task
;
this
.
context
=
context
;
}
@Override
public
T
call
()
throws
Exception
{
if
(
context
!=
null
)
{
RequestContextHolder
.
setRequestAttributes
(
context
);
}
try
{
return
task
.
call
();
}
finally
{
RequestContextHolder
.
resetRequestAttributes
();
}
}
}
public
class
AsyncConfig
{
}
blog-core/src/main/java/com/zyd/blog/persistence/beans/BizArticle.java
浏览文件 @
725d983c
...
...
@@ -25,6 +25,7 @@ public class BizArticle extends AbstractDO {
private
Long
userId
;
private
String
coverImage
;
private
String
qrcodePath
;
@Deprecated
private
Boolean
isMarkdown
;
private
String
content
;
private
String
contentMd
;
...
...
@@ -37,6 +38,7 @@ public class BizArticle extends AbstractDO {
private
String
keywords
;
private
Boolean
comment
;
private
String
password
;
private
String
editorType
;
@Transient
private
Integer
lookCount
;
@Transient
...
...
blog-core/src/main/resources/config/application-center.yml
浏览文件 @
725d983c
...
...
@@ -69,7 +69,7 @@ mybatis:
mapper-locations
:
classpath:/mybatis/*.xml
configuration
:
default-enum-type-handler
:
org.apache.ibatis.type.EnumTypeHandler
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
#
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# mapper
mapper
:
mappers
:
...
...
@@ -86,5 +86,5 @@ pagehelper:
params
:
count=countSql
app
:
version
:
v2.3.
1
version
:
v2.3.
2
enableRedisCache
:
${ONEBLOG_ENABLE_REDIS_CACHE:false}
blog-core/src/main/resources/mybatis/BizArticleMapper.xml
浏览文件 @
725d983c
...
...
@@ -17,6 +17,7 @@
<result
property=
"recommended"
jdbcType=
"BIT"
column=
"recommended"
/>
<result
property=
"original"
jdbcType=
"BIT"
column=
"original"
/>
<result
property=
"description"
jdbcType=
"VARCHAR"
column=
"description"
/>
<result
property=
"editorType"
jdbcType=
"VARCHAR"
column=
"editor_type"
/>
<result
property=
"keywords"
jdbcType=
"VARCHAR"
column=
"keywords"
/>
<result
property=
"createTime"
jdbcType=
"TIMESTAMP"
column=
"create_time"
/>
<result
property=
"updateTime"
jdbcType=
"TIMESTAMP"
column=
"update_time"
/>
...
...
@@ -55,6 +56,7 @@
a.description,
a.keywords,
a.`comment`,
a.`editor_type`,
a.`password`,
a.create_time,
a.update_time,
...
...
@@ -152,6 +154,7 @@
a.`status`,
a.recommended,
a.original,
a.editor_type,
a.description,
a.keywords,
a.`comment`,
...
...
@@ -218,6 +221,7 @@
a.`status`,
a.recommended,
a.original,
a.editor_type,
a.description,
a.keywords,
a.`comment`,
...
...
blog-file/pom.xml
浏览文件 @
725d983c
...
...
@@ -12,7 +12,7 @@
<parent>
<groupId>
com.zyd
</groupId>
<artifactId>
blog
</artifactId>
<version>
2.3.
1
</version>
<version>
2.3.
2
</version>
</parent>
<properties>
...
...
blog-web/pom.xml
浏览文件 @
725d983c
...
...
@@ -12,7 +12,7 @@
<parent>
<groupId>
com.zyd
</groupId>
<artifactId>
blog
</artifactId>
<version>
2.3.
1
</version>
<version>
2.3.
2
</version>
</parent>
<dependencies>
...
...
blog-web/src/main/resources/templates/layout/footer.ftl
浏览文件 @
725d983c
...
...
@@ -120,7 +120,7 @@
<li><a href="${config.siteUrl}/disclaimer" title="免责声明" data-toggle="tooltip" data-placement="bottom"><i class="fa fa-file-o fa-fw"></i>免责声明</a></li>
</ul>
</p>
<p>托管于<a href="https://promotion.aliyun.com/ntms/act/ambassador/sharetouser.html?userCode=wylo59db" target="_blank" title="阿里云-为了无法计算的价值" data-toggle="tooltip" data-placement="bottom" rel="external nofollow">阿里云</a> & <a href="https://portal.qiniu.com/signup?code=3l8yx2v0f21ci" target="_blank" title="七牛云-国内领先的企业级云服务商" data-toggle="tooltip" data-placement="bottom" rel="external nofollow">七牛云</a><#if config.recordNumber!> · <a href="http
://www.miitbeian.gov.cn/publish/query/indexFirst.action
" target="_blank" title="查看备案信息" data-toggle="tooltip" data-placement="bottom" rel="external nofollow">${config.recordNumber}</a></#if></p>
<p>托管于<a href="https://promotion.aliyun.com/ntms/act/ambassador/sharetouser.html?userCode=wylo59db" target="_blank" title="阿里云-为了无法计算的价值" data-toggle="tooltip" data-placement="bottom" rel="external nofollow">阿里云</a> & <a href="https://portal.qiniu.com/signup?code=3l8yx2v0f21ci" target="_blank" title="七牛云-国内领先的企业级云服务商" data-toggle="tooltip" data-placement="bottom" rel="external nofollow">七牛云</a><#if config.recordNumber!> · <a href="http
s://beian.miit.gov.cn/#/Integrated/index
" target="_blank" title="查看备案信息" data-toggle="tooltip" data-placement="bottom" rel="external nofollow">${config.recordNumber}</a></#if></p>
</div>
<div class="col col-md-4"></div>
</div>
...
...
@@ -170,25 +170,25 @@
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/mustache@2.3.0/mustache.min.js"></script>
<script type="text/javascript">
var appConfig = {
siteName:
'${config.siteName}'
,
wwwPath:
'${config.siteUrl}'
,
cmsPath:
'${config.cmsUrl}'
,
staticPath:
'${config.staticWebSite}'
,
lazyloadPath:
'${config.lazyloadPath}'
,
fileStoragePath:
'${config.fileStoragePath}'
,
wxPraiseCode:
'${config.wxPraiseCode}' || '${config.staticWebSite}/img/default.png'
,
zfbPraiseCode:
'${config.zfbPraiseCode}' || '${config.staticWebSite}/img/default.png'
,
anonymous:
'${config.anonymous}'
,
editorPlaceholder:
'${config.editorPlaceholder}'
,
editorAlert:
'${config.editorAlert}'
,
dynamicTitle:
'${config.dynamicTitle}'
,
bubbleWord:
'${config.bubbleWord}'
,
siteName:
"${config.siteName}"
,
wwwPath:
"${config.siteUrl}"
,
cmsPath:
"${config.cmsUrl}"
,
staticPath:
"${config.staticWebSite}"
,
lazyloadPath:
"${config.lazyloadPath}"
,
fileStoragePath:
"${config.fileStoragePath}"
,
wxPraiseCode:
"${config.wxPraiseCode}" || "${config.staticWebSite}/img/default.png"
,
zfbPraiseCode:
"${config.zfbPraiseCode}" || "${config.staticWebSite}/img/default.png"
,
anonymous:
"${config.anonymous}"
,
editorPlaceholder:
"${config.editorPlaceholder}"
,
editorAlert:
"${config.editorAlert}"
,
dynamicTitle:
"${config.dynamicTitle}"
,
bubbleWord:
"${config.bubbleWord}"
,
};
var oauthConfig = {
loginUserId:
'${user.id}'
,
loginUserName:
'${user.username}'
,
loginUserAvatar:
'${user.avatar}'
loginUserId:
"${user.id}"
,
loginUserName:
"${user.username}"
,
loginUserAvatar:
"${user.avatar}"
}
</script>
<script type="text/javascript" src="${config.staticWebSite}/js/zhyd.core.js"></script>
...
...
blog-web/src/main/resources/templates/layout/header.ftl
浏览文件 @
725d983c
...
...
@@ -40,7 +40,7 @@
</div>
<div class="modal-body">
<div class="oauth">
<ul class="list-unstyled list-inline oauth-list">
<ul class="list-unstyled list-inline oauth-list"
style="text-align: center;"
>
<@zhydTag method="listAvailableOAuthPlatforms">
<#if listAvailableOAuthPlatforms?? && listAvailableOAuthPlatforms?size gt 0>
<#list listAvailableOAuthPlatforms as item>
...
...
docs/bin/version.txt
浏览文件 @
725d983c
2.3.
1
2.3.
2
docs/db/update.sql
浏览文件 @
725d983c
...
...
@@ -33,3 +33,9 @@ INSERT INTO `dblog`.`sys_resources` VALUES (87, '新增广告', 'button', NULL,
INSERT
INTO
`dblog`
.
`sys_resources`
VALUES
(
88
,
'批量删除广告'
,
'button'
,
NULL
,
'bizAd:batchDelete'
,
86
,
3
,
0
,
1
,
NULL
,
now
(),
now
());
INSERT
INTO
`dblog`
.
`sys_resources`
VALUES
(
89
,
'编辑广告'
,
'button'
,
NULL
,
'bizAd:edit,bizAd:get'
,
86
,
4
,
0
,
1
,
NULL
,
now
(),
now
());
INSERT
INTO
`dblog`
.
`sys_resources`
VALUES
(
90
,
'删除广告'
,
'button'
,
NULL
,
'bizAd:delete'
,
86
,
5
,
0
,
1
,
NULL
,
now
(),
now
());
#
20211028
ALTER
TABLE
`dblog`
.
`biz_article`
ADD
COLUMN
`editor_type`
varchar
(
10
)
NULL
COMMENT
'当前文章适用的编辑器类型'
AFTER
`cover_image`
;
#
修改旧文章的编辑器类型
UPDATE
`dblog`
.
`biz_article`
SET
`editor_type`
=
'we'
WHERE
is_markdown
is
null
||
is_markdown
=
0
;
UPDATE
`dblog`
.
`biz_article`
SET
`editor_type`
=
'md'
WHERE
is_markdown
=
1
;
docs/docker/mysql/dblog.sql
浏览文件 @
725d983c
...
...
@@ -29,6 +29,7 @@ CREATE TABLE `biz_article` (
`title`
varchar
(
255
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_unicode_ci
NULL
DEFAULT
NULL
COMMENT
'文章标题'
,
`user_id`
bigint
(
20
)
UNSIGNED
NOT
NULL
COMMENT
'用户ID'
,
`cover_image`
varchar
(
255
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_unicode_ci
NULL
DEFAULT
NULL
COMMENT
'文章封面图片'
,
`editor_type`
varchar
(
10
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_unicode_ci
NULL
DEFAULT
NULL
COMMENT
'当前文章适用的编辑器类型'
,
`qrcode_path`
varchar
(
255
)
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_unicode_ci
NULL
DEFAULT
NULL
COMMENT
'文章专属二维码地址'
,
`is_markdown`
tinyint
(
1
)
UNSIGNED
NULL
DEFAULT
1
,
`content`
mediumtext
CHARACTER
SET
utf8mb4
COLLATE
utf8mb4_unicode_ci
NULL
COMMENT
'文章内容'
,
...
...
docs/docker/mysql/init_data.sql
浏览文件 @
725d983c
此差异已折叠。
点击以展开。
pom.xml
浏览文件 @
725d983c
...
...
@@ -5,7 +5,7 @@
<groupId>
com.zyd
</groupId>
<artifactId>
blog
</artifactId>
<version>
2.3.
1
</version>
<version>
2.3.
2
</version>
<packaging>
pom
</packaging>
<modules>
<module>
blog-core
</module>
...
...
@@ -31,7 +31,7 @@
<java.version>
1.8
</java.version>
<maven.test.skip>
true
</maven.test.skip>
<webmagic.version>
0.7.3
</webmagic.version>
<jsoup.version>
1.1
4
.2
</jsoup.version>
<jsoup.version>
1.1
0
.2
</jsoup.version>
<javax.validation.version>
2.0.1.Final
</javax.validation.version>
<hibernate.validator.version>
7.0.1.Final
</hibernate.validator.version>
<excel4j.version>
2.1.4-Final
</excel4j.version>
...
...
@@ -48,7 +48,7 @@
<useragentutils.version>
1.21
</useragentutils.version>
<braum.version>
1.0.0-alpha
</braum.version>
<hutool.version>
5.5.7
</hutool.version>
<spring.web.version>
5.1.
4
.RELEASE
</spring.web.version>
<spring.web.version>
5.1.
17
.RELEASE
</spring.web.version>
<aliyun.oss.version>
2.8.3
</aliyun.oss.version>
<blog-hunter.version>
1.0.4
</blog-hunter.version>
<jap.version>
1.0.4
</jap.version>
...
...
@@ -59,27 +59,27 @@
<dependency>
<groupId>
com.zyd
</groupId>
<artifactId>
blog-core
</artifactId>
<version>
2.3.
1
</version>
<version>
2.3.
2
</version>
</dependency>
<dependency>
<groupId>
com.zyd
</groupId>
<artifactId>
blog-admin
</artifactId>
<version>
2.3.
1
</version>
<version>
2.3.
2
</version>
</dependency>
<dependency>
<groupId>
com.zyd
</groupId>
<artifactId>
blog-web
</artifactId>
<version>
2.3.
1
</version>
<version>
2.3.
2
</version>
</dependency>
<dependency>
<groupId>
com.zyd
</groupId>
<artifactId>
blog-file
</artifactId>
<version>
2.3.
1
</version>
<version>
2.3.
2
</version>
</dependency>
<dependency>
<groupId>
com.zyd
</groupId>
<artifactId>
blog-codegen
</artifactId>
<version>
2.3.
1
</version>
<version>
2.3.
2
</version>
</dependency>
</dependencies>
</dependencyManagement>
...
...
update.md
浏览文件 @
725d983c
...
...
@@ -3,6 +3,16 @@
----
### 2021-10-29
-
wangEditor 升级到 4.7.9
-
修复【文章搬运工】抓取文章失败的问题
-
新增 TinyMCE 编辑器 (
[
#I4FOB0
](
https://gitee.com/yadong.zhang/DBlog/issues/I4FOB0
)
)
-
解决后台分页失败的问题 (
[
#I4FPMK
](
https://gitee.com/yadong.zhang/DBlog/issues/I4FPMK
)
)
-
fixed
[
#I165DP
](
https://gitee.com/yadong.zhang/DBlog/issues/I165DP
)
-
fixed
[
#I11TNT
](
https://gitee.com/yadong.zhang/DBlog/issues/I11TNT
)
-
fixed
[
#IZ7BD
](
https://gitee.com/yadong.zhang/DBlog/issues/IZ7BD
)
### 2021-10-27
-
**增加代码生成模块 `blog-codegen`,新业务支持一键生成所有代码**
...
...