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
06f47bf5
Unverified
Commit
06f47bf5
authored
Apr 06, 2020
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
支持配置编辑器模式 #95
parent
538802c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
4 deletions
+25
-4
src/main/java/org/b3log/solo/model/Option.java
src/main/java/org/b3log/solo/model/Option.java
+12
-1
src/main/java/org/b3log/solo/service/InitService.java
src/main/java/org/b3log/solo/service/InitService.java
+7
-1
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
...in/java/org/b3log/solo/service/PreferenceMgmtService.java
+6
-2
No files found.
src/main/java/org/b3log/solo/model/Option.java
View file @
06f47bf5
...
@@ -26,7 +26,7 @@ import org.json.JSONObject;
...
@@ -26,7 +26,7 @@ import org.json.JSONObject;
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://hacpai.com/member/hzchendou">hzchendou</a>
* @author <a href="https://hacpai.com/member/hzchendou">hzchendou</a>
* @version 1.6.0.
5, Jan 25
, 2020
* @version 1.6.0.
6, Apr 6
, 2020
* @since 0.6.0
* @since 0.6.0
*/
*/
public
final
class
Option
{
public
final
class
Option
{
...
@@ -53,6 +53,17 @@ public final class Option {
...
@@ -53,6 +53,17 @@ public final class Option {
// oId constants
// oId constants
/**
* Key of editor mode. 支持配置编辑器模式 https://github.com/88250/solo/issues/95
* <ul>
* <li>wysiwyg:所见即所得</li>
* <li>ir:即时渲染</li>
* <li>sv:分屏预览</li>
* </ul>
* 模式细节介绍详见 <a href="https://github.com/Vanessa219/vditor">Vditor</a> 编辑器文档。
*/
public
static
final
String
ID_C_EDITOR_MODE
=
"editorMode"
;
/**
/**
* Key of inline math allow digit after open marker flag. 内联数学公式是否允许起始 $ 后紧跟数字 https://github.com/88250/solo/issues/54
* Key of inline math allow digit after open marker flag. 内联数学公式是否允许起始 $ 后紧跟数字 https://github.com/88250/solo/issues/54
*/
*/
...
...
src/main/java/org/b3log/solo/service/InitService.java
View file @
06f47bf5
...
@@ -53,7 +53,7 @@ import java.util.List;
...
@@ -53,7 +53,7 @@ import java.util.List;
* Solo initialization service.
* Solo initialization service.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.5.2.3
8, Jan 24
, 2020
* @version 1.5.2.3
9, Apr 6
, 2020
* @since 0.4.0
* @since 0.4.0
*/
*/
@Service
@Service
...
@@ -472,6 +472,12 @@ public class InitService {
...
@@ -472,6 +472,12 @@ public class InitService {
private
void
initOptions
(
final
JSONObject
requestJSONObject
)
throws
Exception
{
private
void
initOptions
(
final
JSONObject
requestJSONObject
)
throws
Exception
{
LOGGER
.
debug
(
"Initializing preference...."
);
LOGGER
.
debug
(
"Initializing preference...."
);
final
JSONObject
editorModeOpt
=
new
JSONObject
();
editorModeOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_EDITOR_MODE
);
editorModeOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
editorModeOpt
.
put
(
Option
.
OPTION_VALUE
,
"wysiwyg"
);
optionRepository
.
add
(
editorModeOpt
);
final
JSONObject
IMADAOMOpt
=
new
JSONObject
();
final
JSONObject
IMADAOMOpt
=
new
JSONObject
();
IMADAOMOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_IMADAOM
);
IMADAOMOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_IMADAOM
);
IMADAOMOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
IMADAOMOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
...
...
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
View file @
06f47bf5
...
@@ -40,7 +40,7 @@ import java.util.Locale;
...
@@ -40,7 +40,7 @@ import java.util.Locale;
* Preference management service.
* Preference management service.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.4.0.
5, Jan 25
, 2020
* @version 1.4.0.
6, Apr 6
, 2020
* @since 0.4.0
* @since 0.4.0
*/
*/
@Service
@Service
...
@@ -253,6 +253,9 @@ public class PreferenceMgmtService {
...
@@ -253,6 +253,9 @@ public class PreferenceMgmtService {
emptyPreferenceOptSave
(
Option
.
ID_C_IMADAOM
,
IMADAOMVal
);
emptyPreferenceOptSave
(
Option
.
ID_C_IMADAOM
,
IMADAOMVal
);
Markdowns
.
IMADAOM
=
"true"
.
equalsIgnoreCase
(
IMADAOMVal
);
Markdowns
.
IMADAOM
=
"true"
.
equalsIgnoreCase
(
IMADAOMVal
);
final
String
editorModeVal
=
preference
.
optString
(
Option
.
ID_C_EDITOR_MODE
);
emptyPreferenceOptSave
(
Option
.
ID_C_EDITOR_MODE
,
editorModeVal
);
transaction
.
commit
();
transaction
.
commit
();
Markdowns
.
clearCache
();
Markdowns
.
clearCache
();
...
@@ -268,7 +271,8 @@ public class PreferenceMgmtService {
...
@@ -268,7 +271,8 @@ public class PreferenceMgmtService {
LOGGER
.
log
(
Level
.
DEBUG
,
"Updates preference successfully"
);
LOGGER
.
log
(
Level
.
DEBUG
,
"Updates preference successfully"
);
}
}
private
void
emptyPreferenceOptSave
(
final
String
optID
,
final
String
val
)
throws
Exception
{
private
void
emptyPreferenceOptSave
(
final
String
optID
,
final
String
val
)
throws
Exception
{
// 该方法用于向后兼容,如果数据库中不存在该配置项则创建再保存
JSONObject
opt
=
optionRepository
.
get
(
optID
);
JSONObject
opt
=
optionRepository
.
get
(
optID
);
if
(
null
==
opt
)
{
if
(
null
==
opt
)
{
opt
=
new
JSONObject
();
opt
=
new
JSONObject
();
...
...
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