mirror of
https://github.com/doocs/md.git
synced 2024-11-24 19:10:34 +08:00
feat: optional edit area location (#267)
This commit is contained in:
parent
5767e384fb
commit
6f572ba5f3
@ -26,6 +26,13 @@
|
|||||||
></i>
|
></i>
|
||||||
暗黑模式
|
暗黑模式
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item divided @click.native="isEditOnLeftChanged">
|
||||||
|
<i
|
||||||
|
class="el-icon-check"
|
||||||
|
:style="{ opacity: isEditOnLeft ? 1 : 0 }"
|
||||||
|
></i>
|
||||||
|
左侧编辑
|
||||||
|
</el-dropdown-item>
|
||||||
</el-dropdown-menu>
|
</el-dropdown-menu>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<el-dropdown>
|
<el-dropdown>
|
||||||
@ -188,6 +195,7 @@ export default {
|
|||||||
config,
|
config,
|
||||||
citeStatus: false,
|
citeStatus: false,
|
||||||
isMacCodeBlock: true,
|
isMacCodeBlock: true,
|
||||||
|
isEditOnLeft: true,
|
||||||
showResetConfirm: false,
|
showResetConfirm: false,
|
||||||
selectFont: ``,
|
selectFont: ``,
|
||||||
selectSize: ``,
|
selectSize: ``,
|
||||||
@ -249,6 +257,7 @@ export default {
|
|||||||
nightMode: (state) => state.nightMode,
|
nightMode: (state) => state.nightMode,
|
||||||
currentCiteStatus: (state) => state.citeStatus,
|
currentCiteStatus: (state) => state.citeStatus,
|
||||||
currentIsMacCodeBlock: (state) => state.isMacCodeBlock,
|
currentIsMacCodeBlock: (state) => state.isMacCodeBlock,
|
||||||
|
currentIsEditOnLeft: (state) => state.isEditOnLeft,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -333,6 +342,10 @@ export default {
|
|||||||
this.setIsMacCodeBlock(this.isMacCodeBlock)
|
this.setIsMacCodeBlock(this.isMacCodeBlock)
|
||||||
this.$emit(`refresh`)
|
this.$emit(`refresh`)
|
||||||
},
|
},
|
||||||
|
isEditOnLeftChanged() {
|
||||||
|
this.isEditOnLeft = !this.isEditOnLeft
|
||||||
|
this.setIsEditOnLeft(this.isEditOnLeft)
|
||||||
|
},
|
||||||
// 复制到微信公众号
|
// 复制到微信公众号
|
||||||
copy() {
|
copy() {
|
||||||
this.$emit(`startCopy`)
|
this.$emit(`startCopy`)
|
||||||
@ -430,6 +443,7 @@ export default {
|
|||||||
`setCurrentCodeTheme`,
|
`setCurrentCodeTheme`,
|
||||||
`setWxRendererOptions`,
|
`setWxRendererOptions`,
|
||||||
`setIsMacCodeBlock`,
|
`setIsMacCodeBlock`,
|
||||||
|
`setIsEditOnLeft`,
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -439,6 +453,7 @@ export default {
|
|||||||
this.selectCodeTheme = this.codeTheme
|
this.selectCodeTheme = this.codeTheme
|
||||||
this.citeStatus = this.currentCiteStatus
|
this.citeStatus = this.currentCiteStatus
|
||||||
this.isMacCodeBlock = this.currentIsMacCodeBlock
|
this.isMacCodeBlock = this.currentIsMacCodeBlock
|
||||||
|
this.isEditOnLeft = this.currentIsEditOnLeft
|
||||||
|
|
||||||
const fileInput = this.$refs.fileInput
|
const fileInput = this.$refs.fileInput
|
||||||
fileInput.onchange = () => {
|
fileInput.onchange = () => {
|
||||||
|
@ -26,6 +26,7 @@ export const useStore = defineStore(`store`, {
|
|||||||
nightMode: false,
|
nightMode: false,
|
||||||
codeTheme: config.codeThemeOption[2].value,
|
codeTheme: config.codeThemeOption[2].value,
|
||||||
isMacCodeBlock: true,
|
isMacCodeBlock: true,
|
||||||
|
isEditOnLeft: true,
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
setEditorValue(data) {
|
setEditorValue(data) {
|
||||||
@ -61,6 +62,10 @@ export const useStore = defineStore(`store`, {
|
|||||||
this.isMacCodeBlock = data
|
this.isMacCodeBlock = data
|
||||||
localStorage.setItem(`isMacCodeBlock`, data)
|
localStorage.setItem(`isMacCodeBlock`, data)
|
||||||
},
|
},
|
||||||
|
setIsEditOnLeft(data) {
|
||||||
|
this.isEditOnLeft = data
|
||||||
|
localStorage.setItem(`isEditOnLeft`, data)
|
||||||
|
},
|
||||||
themeChanged() {
|
themeChanged() {
|
||||||
this.nightMode = !this.nightMode
|
this.nightMode = !this.nightMode
|
||||||
localStorage.setItem(`nightMode`, this.nightMode)
|
localStorage.setItem(`nightMode`, this.nightMode)
|
||||||
@ -79,6 +84,7 @@ export const useStore = defineStore(`store`, {
|
|||||||
this.isMacCodeBlock = !(
|
this.isMacCodeBlock = !(
|
||||||
localStorage.getItem(`isMacCodeBlock`) === `false`
|
localStorage.getItem(`isMacCodeBlock`) === `false`
|
||||||
)
|
)
|
||||||
|
this.isEditOnLeft = !(localStorage.getItem(`isEditOnLeft`) === `false`)
|
||||||
this.wxRenderer = new WxRenderer({
|
this.wxRenderer = new WxRenderer({
|
||||||
theme: setColor(this.currentColor),
|
theme: setColor(this.currentColor),
|
||||||
fonts: this.currentFont,
|
fonts: this.currentFont,
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
<el-main class="main-body">
|
<el-main class="main-body">
|
||||||
<el-row class="main-section">
|
<el-row class="main-section">
|
||||||
<el-col
|
<el-col
|
||||||
|
:style="{ order: store.isEditOnLeft ? 0 : 1 }"
|
||||||
:span="12"
|
:span="12"
|
||||||
class="codeMirror-wrapper"
|
class="codeMirror-wrapper"
|
||||||
ref="codeMirrorWrapper"
|
ref="codeMirrorWrapper"
|
||||||
@ -609,6 +610,13 @@ export default {
|
|||||||
window.PR.prettyPrint()
|
window.PR.prettyPrint()
|
||||||
}, 300)
|
}, 300)
|
||||||
},
|
},
|
||||||
|
setup() {
|
||||||
|
const store = useStore()
|
||||||
|
|
||||||
|
return {
|
||||||
|
store,
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user