+
+
添加附件
@@ -23,9 +57,12 @@ export default {
cursor: pointer;
display: inline-block;
vertical-align: bottom;
- &:hover {
- color: var(--md-editor-text-color-active);
- }
+ }
+ &:hover {
+ color: var(--md-editor-text-color-active);
+ }
+ .md_upload {
+ display: none;
}
}
diff --git a/src/components/header/md-header.vue b/src/components/header/md-header.vue
index cc5b61d..a7e6071 100644
--- a/src/components/header/md-header.vue
+++ b/src/components/header/md-header.vue
@@ -43,9 +43,9 @@ export default {
align-items: center;
height: 32px;
transition: border-bottom 0.3s;
- border-bottom: 1px solid var(--md-editor-theme-color);
+ border-bottom: 1px solid var(--md-editor-border-color);
&.active {
- border-bottom: 1px solid var(--md-editor-theme-color-active);
+ border-bottom: 1px solid var(--md-editor-border-color-active);
}
.header_tabs {
display: flex;
@@ -76,7 +76,7 @@ export default {
color: var(--md-editor-text-color-active);
&::after {
width: 100%;
- background: var(--md-editor-theme-color);
+ background: var(--md-editor-border-color);
}
}
&.active {
@@ -84,7 +84,7 @@ export default {
font-weight: 700;
&::after {
width: 100%;
- background: var(--md-editor-theme-color-active);
+ background: var(--md-editor-border-color-active);
}
}
& + .tab_item {
diff --git a/src/main.js b/src/main.js
index 3f56a6c..028e166 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,19 +1,15 @@
import Vue from "vue";
import App from "./App";
import store from "./store";
+import { initStyle, isNotEmpty } from "@/assets/js/utils";
import "@/assets/style/global.less";
-function initStyle(val) {
- document.documentElement.style.setProperty(
- "--md-editor-theme-color-active",
- val
- );
-}
-
-function MdEditor(obj) {
- const { el, onChange, themeActive } = obj;
+function initMdEditor(obj) {
+ const { el, onChange, canAttachFile, themeOptions } = obj;
if (!el || !document.querySelector(el)) throw new Error("请指定容器");
- initStyle(themeActive);
+ if (isNotEmpty(themeOptions)) initStyle(themeOptions);
+ if (isNotEmpty(canAttachFile))
+ store.commit("setCanAttachFile", canAttachFile);
new Vue({
store,
@@ -28,4 +24,4 @@ function MdEditor(obj) {
}).$mount(el);
}
-window.MdEditor = MdEditor;
+window.MdEditor = initMdEditor;
diff --git a/src/store/index.js b/src/store/index.js
index 7ed726a..60b39a5 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -52,9 +52,10 @@ export default new Vuex.Store({
}
],
ulNum: 1,
- text: "4564564564657567\n3456456456456",
+ text: "# 456456456\n## 4657567\n3456456456456",
selectionInfo: "",
- html: ""
+ html: "",
+ canAttachFile: true
},
mutations: {
setFullScreen(state, val) {
@@ -68,6 +69,7 @@ export default new Vuex.Store({
},
setText(state, val) {
state.text = val;
+ state.selectionInfo = "";
},
setSelectionInfo(state, val) {
state.selectionInfo = val;
@@ -77,6 +79,9 @@ export default new Vuex.Store({
},
setUlNum(state, val) {
state.ulNum = val;
+ },
+ setCanAttachFile(state, val) {
+ state.canAttachFile = val;
}
}
});
--
GitLab