Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
e0ac84f4
Unverified
Commit
e0ac84f4
authored
Mar 30, 2019
by
Van
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
#12744
parent
cf40c6ef
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
94 deletions
+26
-94
src/main/resources/lang_en_US.properties
src/main/resources/lang_en_US.properties
+0
-1
src/main/resources/lang_zh_CN.properties
src/main/resources/lang_zh_CN.properties
+0
-1
src/main/webapp/admin/admin-label.ftl
src/main/webapp/admin/admin-label.ftl
+0
-1
src/main/webapp/js/admin/admin.js
src/main/webapp/js/admin/admin.js
+21
-32
src/main/webapp/js/admin/article.js
src/main/webapp/js/admin/article.js
+5
-59
No files found.
src/main/resources/lang_en_US.properties
View file @
e0ac84f4
...
...
@@ -266,7 +266,6 @@ blogSubtitle1Label=Blog Subtitle:
blogHost1Label
=
<a href="https://github.com/b3log/solo/issues/12716" target="_blank">Blog Domain</a>:
submmitCommentLabel
=
Commit Comment
saveLabel
=
Save
autoSaveLabel
=
Auto Save
tagLabel
=
Tag
tagsLabel
=
Tags
indexLabel
=
Index
...
...
src/main/resources/lang_zh_CN.properties
View file @
e0ac84f4
...
...
@@ -266,7 +266,6 @@ blogSubtitle1Label=\u535A\u5BA2\u5B50\u6807\u9898\uFF1A
blogHost1Label
=
<a href="https://github.com/b3log/solo/issues/12716" target="_blank">
\u
535A
\u
5BA2
\u
57DF
\u
540D</a>
\u
FF1A
submmitCommentLabel
=
\u
63D0
\u
4EA4
\u
8BC4
\u
8BBA
saveLabel
=
\u
4FDD
\u
5B58
autoSaveLabel
=
\u
81EA
\u
52A8
\u
4FDD
\u
5B58
tagLabel
=
\u6807\u
7B7E
tagsLabel
=
\u6807\u
7B7E
indexLabel
=
\u9996\u9875
...
...
src/main/webapp/admin/admin-label.ftl
View file @
e0ac84f4
...
...
@@ -98,7 +98,6 @@
Label.visitorUserLabel = "${visitorUserLabel}"
Label.categoryTooLongLabel = "${categoryTooLongLabel}"
Label.descriptionLabel = "${descriptionLabel}"
Label.autoSaveLabel = "${autoSaveLabel}"
Label.previewLabel = '${previewLabel}'
admin.init()
</script>
\ No newline at end of file
src/main/webapp/js/admin/admin.js
View file @
e0ac84f4
...
...
@@ -35,9 +35,9 @@ Util.htmlDecode = function (code) {
*/
Util
.
proessURL
=
function
(
url
)
{
if
(
!
/^
\w
+:
\/\/
/
.
test
(
url
))
{
url
=
"
http://
"
+
url
;
url
=
'
http://
'
+
url
}
return
url
;
return
url
}
var
Admin
=
function
()
{
...
...
@@ -133,37 +133,14 @@ $.extend(Admin.prototype, {
return
}
if
(
tab
!==
'
article
'
)
{
admin
.
article
.
clearDraftTimer
()
}
else
if
(
tab
===
'
article
'
)
{
admin
.
article
.
autoSaveDraftTimer
=
setInterval
(
function
()
{
admin
.
article
.
_autoSaveToDraft
()
},
admin
.
article
.
AUTOSAVETIME
)
}
// 离开编辑器时进行提示
try
{
// 除更新、发布、取消发布文章,编辑器中无内容外,离开编辑器需进行提示。
if
(
tab
!==
'
article
'
&&
admin
.
article
.
isConfirm
&&
admin
.
editors
.
articleEditor
.
getContent
().
replace
(
/
\s
/g
,
''
)
!==
''
&&
admin
.
article
.
content
!==
admin
.
editors
.
articleEditor
.
getContent
())
{
if
(
!
confirm
(
Label
.
editorLeaveLabel
))
{
window
.
location
.
hash
=
'
#article/article
'
return
}
}
// 不离开编辑器,hash 需变为 "#article/article",此时不需要做任何处理。
if
(
tab
===
'
article
'
&&
admin
.
article
.
isConfirm
&&
admin
.
editors
.
articleEditor
.
getContent
().
replace
(
/
\s
/g
,
''
)
!==
''
&&
admin
.
article
.
content
!==
admin
.
editors
.
articleEditor
.
getContent
())
{
return
}
}
catch
(
e
)
{
var
$articleContent
=
$
(
'
#articleContent
'
)
if
(
$articleContent
.
length
>
0
)
{
if
(
admin
.
editors
.
articleEditor
.
getContent
)
{
// 除更新、发布、取消发布文章,编辑器中无内容外,离开编辑器需进行提示。
if
(
tab
!==
'
article
'
&&
admin
.
article
.
isConfirm
&&
$articleContent
.
val
().
replace
(
/
\s
/g
,
''
)
!==
''
&&
admin
.
article
.
content
!==
$articleContent
.
val
())
{
admin
.
editors
.
articleEditor
.
getContent
().
replace
(
/
\s
/g
,
''
)
!==
''
&&
admin
.
article
.
content
!==
admin
.
editors
.
articleEditor
.
getContent
())
{
if
(
!
confirm
(
Label
.
editorLeaveLabel
))
{
window
.
location
.
hash
=
'
#article/article
'
return
...
...
@@ -171,11 +148,14 @@ $.extend(Admin.prototype, {
}
// 不离开编辑器,hash 需变为 "#article/article",此时不需要做任何处理。
if
(
tab
===
'
article
'
&&
admin
.
article
.
isConfirm
&&
$articleContent
.
val
().
replace
(
/
\s
/g
,
''
)
!==
''
&&
admin
.
article
.
content
!==
$articleContent
.
val
())
{
admin
.
editors
.
articleEditor
.
getContent
().
replace
(
/
\s
/g
,
''
)
!==
''
&&
admin
.
article
.
content
!==
admin
.
editors
.
articleEditor
.
getContent
())
{
return
}
}
}
catch
(
e
)
{
console
.
log
(
e
)
}
// clear article
...
...
@@ -252,6 +232,15 @@ $.extend(Admin.prototype, {
}
},
6000
)
$
(
'
#loadMsg
'
).
text
(
''
)
window
.
onbeforeunload
=
(
event
)
=>
{
if
(
window
.
location
.
hash
===
'
#article/article
'
)
{
if
(
event
)
{
event
.
returnValue
=
Label
.
editorLeaveLabel
}
return
Label
.
editorLeaveLabel
}
}
},
/**
* @description tools and article collapse
...
...
src/main/webapp/js/admin/article.js
View file @
e0ac84f4
...
...
@@ -30,10 +30,6 @@ admin.article = {
isArticle
:
undefined
,
},
content
:
''
,
// 自动保存草稿定时器
autoSaveDraftTimer
:
''
,
// 自动保存间隔
AUTOSAVETIME
:
1000
*
60
,
/**
* @description 获取文章并把值塞入发布文章页面
* @param {String} id 文章 id
...
...
@@ -133,9 +129,8 @@ admin.article = {
/**
* @@description 添加文章
* @param {Boolean} articleStatus 0:已发布,1:草稿
* @param {Boolean} isAuto 是否为自动保存
*/
add
:
function
(
articleStatus
,
isAuto
)
{
add
:
function
(
articleStatus
)
{
if
(
admin
.
article
.
validate
())
{
var
that
=
this
that
.
_addDisabled
()
...
...
@@ -180,20 +175,14 @@ admin.article = {
type
:
'
POST
'
,
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
)
{
if
(
isAuto
)
{
$
(
'
#tipMsg
'
).
text
(
Label
.
autoSaveLabel
)
admin
.
article
.
status
.
id
=
result
.
oId
return
}
success
:
function
(
result
)
{
$
(
'
#tipMsg
'
).
text
(
result
.
msg
)
if
(
!
result
.
sc
)
{
return
}
admin
.
article
.
status
.
id
=
undefined
if
(
articleStatus
===
0
)
{
admin
.
article
.
status
.
id
=
undefined
admin
.
selectTab
(
'
article/article-list
'
)
}
else
{
admin
.
selectTab
(
'
article/draft-list
'
)
...
...
@@ -211,9 +200,8 @@ admin.article = {
/**
* @description 更新文章
* @param {Boolean} articleStatus 0:已发布,1:草稿
* @param {Boolean} isAuto 是否为自动保存
*/
update
:
function
(
articleStatus
,
isAuto
)
{
update
:
function
(
articleStatus
)
{
if
(
admin
.
article
.
validate
())
{
var
that
=
this
that
.
_addDisabled
()
...
...
@@ -258,11 +246,6 @@ admin.article = {
cache
:
false
,
data
:
JSON
.
stringify
(
requestJSONObject
),
success
:
function
(
result
,
textStatus
)
{
if
(
isAuto
)
{
$
(
'
#tipMsg
'
).
text
(
Label
.
autoSaveLabel
)
return
}
$
(
'
#tipMsg
'
).
text
(
result
.
msg
)
if
(
!
result
.
sc
)
{
return
...
...
@@ -445,11 +428,6 @@ admin.article = {
resize
:
true
,
})
admin
.
article
.
clearDraftTimer
()
admin
.
article
.
autoSaveDraftTimer
=
setInterval
(
function
()
{
admin
.
article
.
_autoSaveToDraft
()
},
admin
.
article
.
AUTOSAVETIME
)
// thumbnail
$
(
'
#articleThumbnailBtn
'
).
click
(
function
()
{
$
.
ajax
({
// Gets all tags
...
...
@@ -469,32 +447,6 @@ admin.article = {
})
}).
click
()
},
/**
* @description 自动保存草稿件
*/
_autoSaveToDraft
:
function
()
{
if
(
$
(
'
#title
'
).
val
().
replace
(
/
\s
/g
,
''
)
===
''
||
admin
.
editors
.
articleEditor
.
getContent
().
replace
(
/
\s
/g
,
''
)
===
''
)
{
return
}
if
(
admin
.
article
.
status
.
id
)
{
if
(
!
admin
.
article
.
status
.
isArticle
)
{
admin
.
article
.
update
(
1
,
true
)
}
}
else
{
admin
.
article
.
add
(
1
,
true
)
admin
.
article
.
status
.
isArticle
=
false
}
},
/**
* @description 关闭定时器
*/
clearDraftTimer
:
function
()
{
if
(
admin
.
article
.
autoSaveDraftTimer
!==
''
)
{
window
.
clearInterval
(
admin
.
article
.
autoSaveDraftTimer
)
admin
.
article
.
autoSaveDraftTimer
=
''
}
},
/**
* @description 验证发布文章字段的合法性
*/
...
...
@@ -513,9 +465,8 @@ admin.article = {
},
/**
* @description 取消发布
* @param {Boolean} isAuto 是否为自动保存
*/
unPublish
:
function
(
isAuto
)
{
unPublish
:
function
()
{
var
that
=
this
that
.
_addDisabled
()
$
.
ajax
({
...
...
@@ -524,11 +475,6 @@ admin.article = {
type
:
'
PUT
'
,
cache
:
false
,
success
:
function
(
result
,
textStatus
)
{
if
(
isAuto
)
{
$
(
'
#tipMsg
'
).
text
(
Label
.
autoSaveLabel
)
return
}
$
(
'
#tipMsg
'
).
text
(
result
.
msg
)
if
(
!
result
.
sc
)
{
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment