diff --git a/package.json b/package.json index 0760581c..7f2264fb 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@codemirror/basic-setup": "^0.19.1", "@codemirror/lang-html": "^0.19.4", "@codemirror/lang-java": "^0.19.1", - "@halo-dev/admin-api": "^1.0.0-alpha.48", + "@halo-dev/admin-api": "^1.0.0-alpha.49", "@halo-dev/editor": "^3.0.0-alpha.1", "ant-design-vue": "^1.7.8", "dayjs": "^1.10.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 344a8d1a..307dec26 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,7 +6,7 @@ specifiers: '@codemirror/basic-setup': ^0.19.1 '@codemirror/lang-html': ^0.19.4 '@codemirror/lang-java': ^0.19.1 - '@halo-dev/admin-api': ^1.0.0-alpha.48 + '@halo-dev/admin-api': ^1.0.0-alpha.49 '@halo-dev/editor': ^3.0.0-alpha.1 '@vue/cli-plugin-babel': ~5.0.0-rc.2 '@vue/cli-plugin-eslint': ~5.0.0-rc.2 @@ -51,7 +51,7 @@ dependencies: '@codemirror/basic-setup': 0.19.1 '@codemirror/lang-html': 0.19.4 '@codemirror/lang-java': 0.19.1 - '@halo-dev/admin-api': 1.0.0-alpha.48 + '@halo-dev/admin-api': 1.0.0-alpha.49 '@halo-dev/editor': 3.0.0-alpha.1 ant-design-vue: 1.7.8_9065e7474e033a8e4b95615fc8e6c36c dayjs: 1.10.7 @@ -1568,11 +1568,11 @@ packages: - supports-color dev: true - /@halo-dev/admin-api/1.0.0-alpha.48: - resolution: {integrity: sha512-TmNrskgq8BbiufmA/lSGDK7jJPzReUdsM6hTBRcItxzByLLFH0+1WSdSb4dkAppZV7BA/AfY0ilfDNFpqTOfvQ==} + /@halo-dev/admin-api/1.0.0-alpha.49: + resolution: {integrity: sha512-549LNmiVDyjLfg9uvVYYCCJmfge8+hrNDk4Q9M0BUT9XB9xeQcV0S06Tz2MKR/3IAZhq8h2V3g5gIqaY7N9e9A==} engines: {node: '>=12'} dependencies: - '@halo-dev/rest-api-client': 1.0.0-alpha.48 + '@halo-dev/rest-api-client': 1.0.0-alpha.49 tslib: 2.3.1 transitivePeerDependencies: - debug @@ -1607,18 +1607,18 @@ packages: vue: 2.6.14 dev: false - /@halo-dev/logger/1.0.0-alpha.48: - resolution: {integrity: sha512-1Gl8YP+XqMrRJlfMVIm9zc/nQMDKIMaOAo4tIpxmJIBpR17h/lc5PPW3NH3vWMN0JNpT4wys2MFL8LQ1H9WZKA==} + /@halo-dev/logger/1.0.0-alpha.49: + resolution: {integrity: sha512-gshHffq0ntrPjAHCwRt6J3NJYvQfnlZsRgbBjnFyI5TQOSB5uFZ2dcxRAc75wDLTRFi2Brpsdm//odRe7PWGpg==} engines: {node: '>=12.0.0'} dependencies: tslib: 2.3.1 dev: false - /@halo-dev/rest-api-client/1.0.0-alpha.48: - resolution: {integrity: sha512-HFKQOfV5I9L72SENanUQ4wQFlF2ZJFgpr0czZ2nHqcrgMSVa4GSNK7dKGCbU819NPZcKyfGXcD5sa9htqwQ9Cg==} + /@halo-dev/rest-api-client/1.0.0-alpha.49: + resolution: {integrity: sha512-tv2y4EvfJt55iAuUASKjqVv3Qt6xhh4oTG/qO+vr+Z+DEcMos+iX/fpeZwHW5/LmR0wdercBncOEP1qgOX9L0g==} engines: {node: '>=12'} dependencies: - '@halo-dev/logger': 1.0.0-alpha.48 + '@halo-dev/logger': 1.0.0-alpha.49 axios: 0.24.0 form-data: 4.0.0 js-base64: 3.7.2 diff --git a/src/views/post/PostEdit.vue b/src/views/post/PostEdit.vue index 7d19547e..473eedb8 100644 --- a/src/views/post/PostEdit.vue +++ b/src/views/post/PostEdit.vue @@ -120,7 +120,12 @@ export default { if (this.postToStage.id) { // Update the post content try { - const { data } = await apiClient.post.updateDraftById(this.postToStage.id, this.postToStage.originalContent) + const { data } = await apiClient.post.updateDraftById( + this.postToStage.id, + this.postToStage.originalContent, + this.postToStage.content, + true + ) this.postToStage.inProgress = data.inProgress this.handleRestoreSavedStatus() this.$message.success({ @@ -141,6 +146,8 @@ export default { } // Create the post try { + this.postToStage.keepRaw = true + const { data } = await apiClient.post.create(this.postToStage) this.postToStage = data this.handleRestoreSavedStatus() @@ -162,7 +169,12 @@ export default { this.previewSaving = true if (this.postToStage.id) { // Update the post content - const { data } = await apiClient.post.updateDraftById(this.postToStage.id, this.postToStage.originalContent) + const { data } = await apiClient.post.updateDraftById( + this.postToStage.id, + this.postToStage.originalContent, + this.postToStage.content, + true + ) this.postToStage.inProgress = data.inProgress } else { await this.handleCreatePost() @@ -187,9 +199,10 @@ export default { handleRestoreSavedStatus() { this.contentChanges = 0 }, - onContentChange({ originalContent }) { + onContentChange({ originalContent, renderContent }) { this.contentChanges++ this.postToStage.originalContent = originalContent + this.postToStage.content = renderContent }, onPostSavedCallback() { this.contentChanges = 0 diff --git a/src/views/post/components/PostSettingModal.vue b/src/views/post/components/PostSettingModal.vue index 8124b460..01d1d017 100644 --- a/src/views/post/components/PostSettingModal.vue +++ b/src/views/post/components/PostSettingModal.vue @@ -298,6 +298,7 @@ export default { } this.form.model.status = preStatus + this.form.model.keepRaw = true const { id, status } = this.form.model try { this.form[status === 'PUBLISHED' ? 'saving' : 'draftSaving'] = true diff --git a/src/views/sheet/SheetEdit.vue b/src/views/sheet/SheetEdit.vue index 910d4b80..1c071be7 100644 --- a/src/views/sheet/SheetEdit.vue +++ b/src/views/sheet/SheetEdit.vue @@ -123,7 +123,9 @@ export default { try { const { data } = await apiClient.sheet.updateDraftById( this.sheetToStage.id, - this.sheetToStage.originalContent + this.sheetToStage.originalContent, + this.sheetToStage.content, + true ) this.sheetToStage.inProgress = data.inProgress this.handleRestoreSavedStatus() @@ -144,6 +146,7 @@ export default { this.sheetToStage.title = datetimeFormat(new Date(), 'YYYY-MM-DD-HH-mm-ss') } try { + this.sheetToStage.keepRaw = true const { data } = await apiClient.sheet.create(this.sheetToStage) this.sheetToStage = data this.handleRestoreSavedStatus() @@ -164,7 +167,12 @@ export default { this.previewSaving = true if (this.sheetToStage.id) { // Update the sheet content - const { data } = await apiClient.sheet.updateDraftById(this.sheetToStage.id, this.sheetToStage.originalContent) + const { data } = await apiClient.sheet.updateDraftById( + this.sheetToStage.id, + this.sheetToStage.originalContent, + this.sheetToStage.content, + true + ) this.sheetToStage.inProgress = data.inProgress } else { await this.handleCreateSheet() @@ -189,9 +197,10 @@ export default { handleRestoreSavedStatus() { this.contentChanges = 0 }, - onContentChange({ originalContent }) { + onContentChange({ originalContent, renderContent }) { this.contentChanges++ this.sheetToStage.originalContent = originalContent + this.sheetToStage.content = renderContent }, onSheetSavedCallback() { this.contentChanges = 0 diff --git a/src/views/sheet/components/SheetSettingModal.vue b/src/views/sheet/components/SheetSettingModal.vue index ed54c59a..adab98e9 100644 --- a/src/views/sheet/components/SheetSettingModal.vue +++ b/src/views/sheet/components/SheetSettingModal.vue @@ -258,6 +258,7 @@ export default { return } this.form.model.status = preStatus + this.form.model.keepRaw = true const { id, status } = this.form.model try { this.form[status === 'PUBLISHED' ? 'saving' : 'draftSaving'] = true