diff --git a/src/api/sheet.js b/src/api/sheet.js
index 3c4931e4b..50da7fca2 100644
--- a/src/api/sheet.js
+++ b/src/api/sheet.js
@@ -48,6 +48,16 @@ sheetApi.update = (sheetId, sheetToUpdate, autoSave) => {
})
}
+sheetApi.updateDraft = (sheetId, content) => {
+ return service({
+ url: `${baseUrl}/${sheetId}/status/draft/content`,
+ method: 'put',
+ data: {
+ content: content
+ }
+ })
+}
+
sheetApi.updateStatus = (sheetId, status) => {
return service({
url: `${baseUrl}/${sheetId}/${status}`,
diff --git a/src/components/editor/MarkdownEditor.vue b/src/components/editor/MarkdownEditor.vue
index 281144d7f..22e3532ba 100644
--- a/src/components/editor/MarkdownEditor.vue
+++ b/src/components/editor/MarkdownEditor.vue
@@ -2,7 +2,7 @@
+
+
+
diff --git a/src/store/modules/option.js b/src/store/modules/option.js
index 476f5b084..91937b7a6 100644
--- a/src/store/modules/option.js
+++ b/src/store/modules/option.js
@@ -12,7 +12,8 @@ const keys = [
'sheet_prefix',
'post_permalink_type',
'archives_prefix',
- 'path_suffix'
+ 'path_suffix',
+ 'default_editor'
]
const option = {
state: {
diff --git a/src/views/post/PostEdit.vue b/src/views/post/PostEdit.vue
index af60f60ec..e93cfbb4b 100644
--- a/src/views/post/PostEdit.vue
+++ b/src/views/post/PostEdit.vue
@@ -12,9 +12,16 @@
+
+
@@ -69,6 +76,7 @@ import PostSettingDrawer from './components/PostSettingDrawer'
import AttachmentDrawer from '../attachment/components/AttachmentDrawer'
import FooterToolBar from '@/components/FooterToolbar'
import MarkdownEditor from '@/components/editor/MarkdownEditor'
+import RichTextEditor from '@/components/editor/RichTextEditor'
import postApi from '@/api/post'
export default {
@@ -77,7 +85,8 @@ export default {
PostSettingDrawer,
FooterToolBar,
AttachmentDrawer,
- MarkdownEditor
+ MarkdownEditor,
+ RichTextEditor
},
data() {
return {
@@ -151,6 +160,9 @@ export default {
}
return '当前页面数据未保存,确定要离开吗?'
}
+ if (!this.postToStage.editorType) {
+ this.postToStage.editorType = this.options.default_editor
+ }
},
watch: {
temporaryContent: function(newValue, oldValue) {
@@ -190,6 +202,7 @@ export default {
.then(response => {
this.$log.debug('Updated post', response.data.data)
this.$message.success('保存草稿成功!')
+ this.postToStage = response.data.data
})
.finally(() => {
this.saving = false
diff --git a/src/views/sheet/SheetEdit.vue b/src/views/sheet/SheetEdit.vue
index 071994dae..31f4f059f 100644
--- a/src/views/sheet/SheetEdit.vue
+++ b/src/views/sheet/SheetEdit.vue
@@ -9,11 +9,19 @@
placeholder="请输入页面标题"
/>
+
+
+
@@ -33,7 +41,7 @@
保存草稿
{
- this.$log.debug('Updated sheet', response.data.data)
- this.$message.success('保存草稿成功!')
- })
- .finally(() => {
- this.saving = false
- })
+ if (draftOnly) {
+ sheetApi
+ .updateDraft(this.sheetToStage.id, this.sheetToStage.originalContent)
+ .then(response => {
+ this.$message.success('保存草稿成功!')
+ })
+ .finally(() => {
+ this.saving = false
+ })
+ } else {
+ sheetApi
+ .update(this.sheetToStage.id, this.sheetToStage, false)
+ .then(response => {
+ this.$log.debug('Updated sheet', response.data.data)
+ this.$message.success('保存草稿成功!')
+ this.sheetToStage = response.data.data
+ })
+ .finally(() => {
+ this.saving = false
+ })
+ }
} else {
sheetApi
.create(this.sheetToStage, false)
diff --git a/src/views/system/OptionForm.vue b/src/views/system/OptionForm.vue
index 6663b236d..37a8e7984 100644
--- a/src/views/system/OptionForm.vue
+++ b/src/views/system/OptionForm.vue
@@ -103,6 +103,12 @@
layout="vertical"
:wrapperCol="wrapperCol"
>
+
+
+ Markdown 编辑器
+ 富文本编辑器
+
+
创建时间