fix: ckeditor - beautify html before saving
This commit is contained in:
@@ -19,6 +19,7 @@ import _ from 'lodash'
|
|||||||
import { get, sync } from 'vuex-pathify'
|
import { get, sync } from 'vuex-pathify'
|
||||||
import DecoupledEditor from '@requarks/ckeditor5'
|
import DecoupledEditor from '@requarks/ckeditor5'
|
||||||
import EditorConflict from './ckeditor/conflict.vue'
|
import EditorConflict from './ckeditor/conflict.vue'
|
||||||
|
import { html as beautify } from 'js-beautify/js/lib/beautifier.min.js'
|
||||||
|
|
||||||
/* global siteLangs */
|
/* global siteLangs */
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.editor.model.document.on('change:data', _.debounce(evt => {
|
this.editor.model.document.on('change:data', _.debounce(evt => {
|
||||||
this.$store.set('editor/content', this.editor.getData())
|
this.$store.set('editor/content', beautify(this.editor.getData(), { indent_size: 2, end_with_newline: true }))
|
||||||
}, 300))
|
}, 300))
|
||||||
|
|
||||||
this.$root.$on('editorInsert', opts => {
|
this.$root.$on('editorInsert', opts => {
|
||||||
|
|||||||
@@ -248,6 +248,7 @@
|
|||||||
"i18next-xhr-backend": "3.2.2",
|
"i18next-xhr-backend": "3.2.2",
|
||||||
"ignore-loader": "0.1.2",
|
"ignore-loader": "0.1.2",
|
||||||
"jest": "25.4.0",
|
"jest": "25.4.0",
|
||||||
|
"js-beautify": "1.11.0",
|
||||||
"js-cookie": "2.2.1",
|
"js-cookie": "2.2.1",
|
||||||
"mermaid": "8.5.0",
|
"mermaid": "8.5.0",
|
||||||
"mini-css-extract-plugin": "0.9.0",
|
"mini-css-extract-plugin": "0.9.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user