diff --git a/src/components/CodemirrorEditor/header.vue b/src/components/CodemirrorEditor/header.vue index 45392d7..a649be5 100644 --- a/src/components/CodemirrorEditor/header.vue +++ b/src/components/CodemirrorEditor/header.vue @@ -36,204 +36,259 @@
- - - - - - - - - - - - - - - - - - - - - - - {{ font.label }} - Abc - - - - - {{ size.label }} - {{ size.desc }} - - - - - {{ color.label }} - {{ color.desc }} - - - - - {{ code.label }} - {{ code.desc }} - - - - - - - - - + + + 文件 + + + + + 导入 .md + + + + + 导出 .md + + + + 导出 .html + + + + 暗黑模式 + + + + + + + 格式 + + + + 加粗 + Ctrl + B + + + 斜体 + Ctrl + I + + + 删除线 + Alt + Shift + U + + + 超链接 + Alt + Shift + K + + + 格式化 + Ctrl + Alt + L + + + + 微信外链转底部引用 + + + + + + + 编辑 + + + + + 上传图片 + + + + 插入表格 + + + + + + + 样式 + + + + + + + + + {{ font.label }} + Abc + + + + + + + + + + + {{ size.label }} + {{ size.desc }} + + + + + + + + + + + {{ color.label }} + {{ color.desc }} + + + + + + + + + + + {{ code.label }} + {{ code.desc }} + + + + + + 自定义颜色 + + + + 自定义 CSS + + + 重置 + + + + + + + 帮助 + + + + 关于 + + +
+
- - - 复制 + >复制 + 发布 - 关于 - -
-
-
+ >发布 +
{ + const file = fileInput.files[0] + if (file == null) { + return + } + const read = new FileReader() + read.readAsText(file) + read.onload = () => { + this.$emit(`import-md`, read.result) + } + } }, } @@ -457,15 +537,11 @@ export default { .editor__header { width: 100%; } -.header__item { - margin: 0 3px; -} -.header__item_last { - margin-right: 8px; -} + .header__switch { margin-left: 8px; } + .mode__switch { margin-left: 24px; margin-right: 24px; @@ -475,10 +551,12 @@ export default { background-size: cover; transition: all 0.3s; } + .mode__switch_black { background: url('../../assets/images/light.png') no-repeat; background-size: cover; } + .top { height: 60px; padding: 10px 20px; @@ -486,14 +564,17 @@ export default { align-items: center; margin-right: 0; } + .el-select { margin-right: 12px; } + .left-side { display: flex; align-items: center; flex: 1; } + .right-side { display: flex; align-items: center; @@ -513,4 +594,53 @@ export default { color: #8492a6; font-size: 13px; } + +.el-dropdown { + margin: 0 10px; +} + +.el-dropdown-link { + cursor: pointer; +} + +.style-option-menu { + margin: 0; + width: 150px; + + .el-dropdown-link { + display: flex; + align-items: center; + justify-content: space-between; + } +} + +.padding-left-3 { + padding-left: 3em; +} + +// 添加边距影响了 divided 行的移入效果,此处做一个兼容处理 +.el-dropdown-menu__item--divided.padding-left-3 { + position: relative; + + &::after { + content: ''; + position: absolute; + left: 0; + top: 0; + width: 3em; + height: 6px; + background: white; + } +} + +.format-item { + .padding-left-3; + width: 180px; + + kbd { + font-size: 0.75em; + float: right; + color: #666; + } +} diff --git a/src/views/CodemirrorEditor.vue b/src/views/CodemirrorEditor.vue index 290eade..88e3bb8 100644 --- a/src/views/CodemirrorEditor.vue +++ b/src/views/CodemirrorEditor.vue @@ -1,11 +1,20 @@