mirror of https://github.com/halo-dev/halo
Refactor post editor toolbars.
parent
a98566e4cd
commit
8f5db967e3
|
@ -0,0 +1,25 @@
|
||||||
|
const toolbars = {
|
||||||
|
bold: true, // 粗体
|
||||||
|
italic: true, // 斜体
|
||||||
|
header: true, // 标题
|
||||||
|
underline: true, // 下划线
|
||||||
|
strikethrough: true, // 中划线
|
||||||
|
quote: true, // 引用
|
||||||
|
ol: true, // 有序列表
|
||||||
|
ul: true, // 无序列表
|
||||||
|
link: true, // 链接
|
||||||
|
imagelink: true, // 图片链接
|
||||||
|
code: true, // code
|
||||||
|
table: true, // 表格
|
||||||
|
fullscreen: true, // 全屏编辑
|
||||||
|
readmodel: true, // 沉浸式阅读
|
||||||
|
htmlcode: true, // 展示html源码
|
||||||
|
undo: true, // 上一步
|
||||||
|
redo: true, // 下一步
|
||||||
|
trash: true, // 清空
|
||||||
|
navigation: true, // 导航目录
|
||||||
|
subfield: true, // 单双栏模式
|
||||||
|
preview: true // 预览
|
||||||
|
}
|
||||||
|
|
||||||
|
export { toolbars }
|
|
@ -116,6 +116,11 @@
|
||||||
:src="postToStage.thumbnail || 'https://os.alipayobjects.com/rmsportal/mgesTPFxodmIwpi.png'"
|
:src="postToStage.thumbnail || 'https://os.alipayobjects.com/rmsportal/mgesTPFxodmIwpi.png'"
|
||||||
@click="showThumbDrawer"
|
@click="showThumbDrawer"
|
||||||
>
|
>
|
||||||
|
<a-button
|
||||||
|
class="post-thum-remove"
|
||||||
|
type="dashed"
|
||||||
|
@click="handlerRemoveThumb"
|
||||||
|
>移除</a-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -165,33 +170,11 @@ import AttachmentDrawer from '../attachment/components/AttachmentDrawer'
|
||||||
import AttachmentSelectDrawer from '../attachment/components/AttachmentSelectDrawer'
|
import AttachmentSelectDrawer from '../attachment/components/AttachmentSelectDrawer'
|
||||||
import FooterToolBar from '@/components/FooterToolbar'
|
import FooterToolBar from '@/components/FooterToolbar'
|
||||||
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
||||||
|
import { toolbars } from '@/core/const'
|
||||||
import 'mavon-editor/dist/css/index.css'
|
import 'mavon-editor/dist/css/index.css'
|
||||||
import tagApi from '@/api/tag'
|
import tagApi from '@/api/tag'
|
||||||
import categoryApi from '@/api/category'
|
import categoryApi from '@/api/category'
|
||||||
import postApi from '@/api/post'
|
import postApi from '@/api/post'
|
||||||
const toolbars = {
|
|
||||||
bold: true, // 粗体
|
|
||||||
italic: true, // 斜体
|
|
||||||
header: true, // 标题
|
|
||||||
underline: true, // 下划线
|
|
||||||
strikethrough: true, // 中划线
|
|
||||||
quote: true, // 引用
|
|
||||||
ol: true, // 有序列表
|
|
||||||
ul: true, // 无序列表
|
|
||||||
link: true, // 链接
|
|
||||||
imagelink: true, // 图片链接
|
|
||||||
code: true, // code
|
|
||||||
table: true, // 表格
|
|
||||||
fullscreen: true, // 全屏编辑
|
|
||||||
readmodel: true, // 沉浸式阅读
|
|
||||||
htmlcode: true, // 展示html源码
|
|
||||||
undo: true, // 上一步
|
|
||||||
redo: true, // 下一步
|
|
||||||
trash: true, // 清空
|
|
||||||
navigation: true, // 导航目录
|
|
||||||
subfield: true, // 单双栏模式
|
|
||||||
preview: true // 预览
|
|
||||||
}
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
TagSelect,
|
TagSelect,
|
||||||
|
@ -204,6 +187,7 @@ export default {
|
||||||
mixins: [mixin, mixinDevice],
|
mixins: [mixin, mixinDevice],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
toolbars,
|
||||||
wrapperCol: {
|
wrapperCol: {
|
||||||
xl: { span: 24 },
|
xl: { span: 24 },
|
||||||
sm: { span: 24 },
|
sm: { span: 24 },
|
||||||
|
@ -216,7 +200,6 @@ export default {
|
||||||
categories: [],
|
categories: [],
|
||||||
selectedCategoryIds: [],
|
selectedCategoryIds: [],
|
||||||
selectedTagIds: [],
|
selectedTagIds: [],
|
||||||
toolbars: toolbars,
|
|
||||||
postToStage: {}
|
postToStage: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -296,6 +279,9 @@ export default {
|
||||||
this.postToStage.status = 'DRAFT'
|
this.postToStage.status = 'DRAFT'
|
||||||
this.createOrUpdatePost()
|
this.createOrUpdatePost()
|
||||||
},
|
},
|
||||||
|
handlerRemoveThumb() {
|
||||||
|
this.postToStage.thumbnail = null
|
||||||
|
},
|
||||||
onClose() {
|
onClose() {
|
||||||
this.visible = false
|
this.visible = false
|
||||||
},
|
},
|
||||||
|
@ -307,14 +293,20 @@ export default {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="less" scoped>
|
||||||
.v-note-wrapper {
|
.v-note-wrapper {
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
min-height: 580px;
|
min-height: 580px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-thum .img {
|
.post-thum {
|
||||||
|
.img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.post-thum-remove {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -89,6 +89,11 @@
|
||||||
:src="sheetToStage.thumbnail || 'https://os.alipayobjects.com/rmsportal/mgesTPFxodmIwpi.png'"
|
:src="sheetToStage.thumbnail || 'https://os.alipayobjects.com/rmsportal/mgesTPFxodmIwpi.png'"
|
||||||
@click="showThumbDrawer"
|
@click="showThumbDrawer"
|
||||||
>
|
>
|
||||||
|
<a-button
|
||||||
|
class="sheet-thum-remove"
|
||||||
|
type="dashed"
|
||||||
|
@click="handlerRemoveThumb"
|
||||||
|
>移除</a-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -99,7 +104,7 @@
|
||||||
@listenToSelect="selectSheetThumb"
|
@listenToSelect="selectSheetThumb"
|
||||||
:drawerWidth="460"
|
:drawerWidth="460"
|
||||||
/>
|
/>
|
||||||
<div class="sheetControl">
|
<div class="bottom-control">
|
||||||
<a-button
|
<a-button
|
||||||
style="marginRight: 8px"
|
style="marginRight: 8px"
|
||||||
@click="handleDraftClick"
|
@click="handleDraftClick"
|
||||||
|
@ -133,32 +138,10 @@ import AttachmentDrawer from '../attachment/components/AttachmentDrawer'
|
||||||
import AttachmentSelectDrawer from '../attachment/components/AttachmentSelectDrawer'
|
import AttachmentSelectDrawer from '../attachment/components/AttachmentSelectDrawer'
|
||||||
import FooterToolBar from '@/components/FooterToolbar'
|
import FooterToolBar from '@/components/FooterToolbar'
|
||||||
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
import { mixin, mixinDevice } from '@/utils/mixin.js'
|
||||||
|
import { toolbars } from '@/core/const'
|
||||||
import 'mavon-editor/dist/css/index.css'
|
import 'mavon-editor/dist/css/index.css'
|
||||||
import sheetApi from '@/api/sheet'
|
import sheetApi from '@/api/sheet'
|
||||||
import themeApi from '@/api/theme'
|
import themeApi from '@/api/theme'
|
||||||
const toolbars = {
|
|
||||||
bold: true, // 粗体
|
|
||||||
italic: true, // 斜体
|
|
||||||
header: true, // 标题
|
|
||||||
underline: true, // 下划线
|
|
||||||
strikethrough: true, // 中划线
|
|
||||||
quote: true, // 引用
|
|
||||||
ol: true, // 有序列表
|
|
||||||
ul: true, // 无序列表
|
|
||||||
link: true, // 链接
|
|
||||||
imagelink: true, // 图片链接
|
|
||||||
code: true, // code
|
|
||||||
table: true, // 表格
|
|
||||||
fullscreen: true, // 全屏编辑
|
|
||||||
readmodel: true, // 沉浸式阅读
|
|
||||||
htmlcode: true, // 展示html源码
|
|
||||||
undo: true, // 上一步
|
|
||||||
redo: true, // 下一步
|
|
||||||
trash: true, // 清空
|
|
||||||
navigation: true, // 导航目录
|
|
||||||
subfield: true, // 单双栏模式
|
|
||||||
preview: true // 预览
|
|
||||||
}
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
mavonEditor,
|
mavonEditor,
|
||||||
|
@ -169,6 +152,7 @@ export default {
|
||||||
mixins: [mixin, mixinDevice],
|
mixins: [mixin, mixinDevice],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
toolbars,
|
||||||
wrapperCol: {
|
wrapperCol: {
|
||||||
xl: { span: 24 },
|
xl: { span: 24 },
|
||||||
sm: { span: 24 },
|
sm: { span: 24 },
|
||||||
|
@ -176,9 +160,7 @@ export default {
|
||||||
},
|
},
|
||||||
attachmentDrawerVisible: false,
|
attachmentDrawerVisible: false,
|
||||||
thumDrawerVisible: false,
|
thumDrawerVisible: false,
|
||||||
toolbars,
|
|
||||||
visible: false,
|
visible: false,
|
||||||
sheetUrl: 'hello-world',
|
|
||||||
customTpls: [],
|
customTpls: [],
|
||||||
sheetToStage: {}
|
sheetToStage: {}
|
||||||
}
|
}
|
||||||
|
@ -230,6 +212,9 @@ export default {
|
||||||
this.sheetToStage.status = 'DRAFT'
|
this.sheetToStage.status = 'DRAFT'
|
||||||
this.createOrUpdateSheet()
|
this.createOrUpdateSheet()
|
||||||
},
|
},
|
||||||
|
handlerRemoveThumb() {
|
||||||
|
this.sheetToStage.thumbnail = null
|
||||||
|
},
|
||||||
createOrUpdateSheet() {
|
createOrUpdateSheet() {
|
||||||
if (this.sheetToStage.id) {
|
if (this.sheetToStage.id) {
|
||||||
sheetApi.update(this.sheetToStage.id, this.sheetToStage).then(response => {
|
sheetApi.update(this.sheetToStage.id, this.sheetToStage).then(response => {
|
||||||
|
@ -254,25 +239,20 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style lang="less" scoped>
|
||||||
.v-note-wrapper {
|
.v-note-wrapper {
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
min-height: 580px;
|
min-height: 580px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sheetControl {
|
.sheet-thum {
|
||||||
position: absolute;
|
.img {
|
||||||
bottom: 0px;
|
|
||||||
width: 100%;
|
|
||||||
border-top: 1px solid rgb(232, 232, 232);
|
|
||||||
padding: 10px 16px;
|
|
||||||
text-align: right;
|
|
||||||
left: 0px;
|
|
||||||
background: rgb(255, 255, 255);
|
|
||||||
border-radius: 0px 0px 4px 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sheet-thum .img {
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.sheet-thum-remove {
|
||||||
|
margin-top: 16px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
:md="12"
|
:md="12"
|
||||||
:lg="8"
|
:lg="8"
|
||||||
>
|
>
|
||||||
<div class="case">
|
|
||||||
<a-card
|
<a-card
|
||||||
title="Markdown 导入"
|
title="Markdown 导入"
|
||||||
:bordered="false"
|
:bordered="false"
|
||||||
|
@ -20,14 +19,12 @@
|
||||||
>导入</a-button>
|
>导入</a-button>
|
||||||
<p>支持 Hexo/Jekyll 导入并解析元数据</p>
|
<p>支持 Hexo/Jekyll 导入并解析元数据</p>
|
||||||
</a-card>
|
</a-card>
|
||||||
</div>
|
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col
|
<a-col
|
||||||
:sm="24"
|
:sm="24"
|
||||||
:md="12"
|
:md="12"
|
||||||
:lg="8"
|
:lg="8"
|
||||||
>
|
>
|
||||||
<div class="case">
|
|
||||||
<a-card
|
<a-card
|
||||||
title="WordPress 导入"
|
title="WordPress 导入"
|
||||||
:bordered="false"
|
:bordered="false"
|
||||||
|
@ -40,7 +37,6 @@
|
||||||
>导入</a-button>
|
>导入</a-button>
|
||||||
<p>尽请期待</p>
|
<p>尽请期待</p>
|
||||||
</a-card>
|
</a-card>
|
||||||
</div>
|
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<a-modal
|
<a-modal
|
||||||
|
@ -97,10 +93,4 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.card-content {
|
|
||||||
padding: 11px;
|
|
||||||
}
|
|
||||||
.case {
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue