提交 8c56ab19 编写于 作者: 璃白.'s avatar 璃白. 🌻

fix:修复打包报错问题

上级 2c7b2f8c
......@@ -324,6 +324,8 @@ export default {
}
if (this.callUserList.length) {
emitContent.callUserList = this.callUserList;
} else {
emitContent.callUserList = [];
}
emitContent.filteredTags = this.filteredTags;
......
......@@ -76,7 +76,8 @@ export function initStyle({
contentBgColor,
codeBgColor,
codeTheme,
helpdocColor
helpdocColor,
itemActiveBgColor
}) {
// 夜晚模式
if (dark) {
......@@ -89,6 +90,7 @@ export function initStyle({
codeBgColor = "#777888";
contentBgColor = "#222226";
helpdocColor = "#CCCCD8";
itemActiveBgColor = "#777888";
}
if (frameBgColor) {
document.documentElement.style.setProperty(
......@@ -96,6 +98,12 @@ export function initStyle({
frameBgColor
);
}
if (itemActiveBgColor) {
document.documentElement.style.setProperty(
"--md-editor-item-active-bg-color",
itemActiveBgColor
);
}
if (contentBgColor) {
document.documentElement.style.setProperty(
"--md-editor-content-bg-color",
......@@ -143,19 +151,19 @@ export function initStyle({
if (codeTheme) {
switch (codeTheme) {
case "dark":
import("@/assets/style/code/dark.css");
import("@/assets/style/code/dark.less");
break;
case "light":
import("@/assets/style/code/lightfair.css");
import("@/assets/style/code/lightfair.less");
break;
case "atom-one-dark":
import("@/assets/style/code/atom-one-dark.css");
import("@/assets/style/code/atom-one-dark.less");
break;
default:
break;
}
} else {
import("@/assets/style/code/lightfair.css");
import("@/assets/style/code/lightfair.less");
}
}
......@@ -183,6 +191,13 @@ export function checkBoswer() {
);
return agent !== null;
}
export function isAndroid() {
const agent = navigator.userAgent.match(
/(Android)/i
);
return agent !== null;
}
// 去除头部空格行
export function removeBlankLine(val) {
if (!val) return "";
......
......@@ -7,6 +7,7 @@
--md-editor-content-bg-color: #fff;
--md-editor-frame-bg-color-disabled: #f5f7fa;
--md-editor-content-bg-color-disabled: #f5f7fa;
--md-editor-item-active-bg-color: #f5f7fa;
--md-editor-helpdoc-color: #666666;
--md-editor-code-bg-color: #f3f4f5;
--md-editor-fullScrren-zIndex: 2000;
......
......@@ -25,6 +25,7 @@
</div>
</template>
<script>
import { throttle as throttleFn } from "@/assets/js/utils";
export default {
props: {
position: {
......@@ -48,6 +49,8 @@ export default {
computed: {
list() {
const list = this.userList;
console.log("list", list);
if (!list.length) return [];
return list.map((item, index) => {
if (index === 0) {
......@@ -57,6 +60,9 @@ export default {
}
return item;
});
},
throttle() {
return throttleFn();
}
},
watch: {
......@@ -76,7 +82,12 @@ export default {
},
methods: {
selectUser(user) {
this.$emit("selectUser", user);
console.log(this.throttle);
this.throttle(() => {
console.log(111);
this.$emit("selectUser", user);
}, 1000);
},
isActive(index) {
return index === this.activeUserIndex;
......@@ -90,7 +101,7 @@ export default {
<style lang="less" scoped>
.md_select_container {
position: absolute;
background: #fff;
background: var(--md-editor-content-bg-color);
box-shadow: 0 1px 6px rgb(0 0 0 / 10%);
border: 1px solid var(--md-editor-border-color);
border-radius: 4px;
......@@ -139,11 +150,11 @@ export default {
cursor: pointer;
@media (any-hover: hover) {
&:hover {
background: #f5f7fa;
background: var(--md-editor-item-active-bg-color);
}
}
&.active {
background: #f5f7fa;
background: var(--md-editor-item-active-bg-color);
}
// & + li {
// margin-top: 10px;
......
......@@ -5,6 +5,8 @@
:id="id"
@change="$emit('update:text', textContent)"
@input="input"
@keydown.stop.50="handleCallUser"
@keydown.stop.229="handleCallUser"
@focus="setFocus(true)"
@blur="setFocus(false)"
@paste="pasteFile"
......@@ -53,7 +55,7 @@
import {
getSelectionInfo,
getPosition,
preventDefault,
isAndroid,
throttle as throttleFn
} from "@/assets/js/utils";
import selectUser from "./components/user-select";
......@@ -288,8 +290,8 @@ export default {
};
},
input(e) {
if (e.data === "@") {
this.createSelectUserDialog();
if (isAndroid() && e.data === "@") {
this.createSelectUserDialog("android");
}
if (this.showSelectUser) this.handleQueryUser(e);
this.$emit("update:textLength", this.textContent.length);
......
......@@ -5,6 +5,21 @@ export default {
allUserList: []
};
},
mounted() {
setTimeout(() => {
const text = this.text;
if (/(\@\S+\s{0,1})/g.test(text)) {
this.$emit("queryUserList", "");
this.$nextTick(() => {
const userList = this.userList;
this.allUserList = userList;
this.$nextTick(() => {
this.transferMarkdown(text);
});
});
}
}, 0);
},
methods: {
handleSelectUser(user) {
const originalText = this.textContent;
......@@ -42,16 +57,12 @@ export default {
this.queryInfo.keyWord = keyWord;
this.$emit("queryUserList", keyWord);
},
// handleCallUser(e) {
// // console.log('aaa');
// // console.log(e);
// // alert(e.key)
// if (e.key === "@" || (e.key === "Process" && e.code === "Digit2")) {
// this.createSelectUserDialog();
// }
// },
createSelectUserDialog() {
handleCallUser(e) {
if (e.key === "@" || (e.key === "Process" && e.code === "Digit2")) {
this.createSelectUserDialog();
}
},
createSelectUserDialog(type) {
const textEl = document.getElementById(this.id);
if (!textEl) return;
const height = getComputedStyle(textEl).getPropertyValue("height");
......@@ -95,6 +106,10 @@ export default {
textEl.parentNode.removeChild(hideEl);
this.queryInfo.startPosition = getPosition(this.id) + 1;
this.queryInfo.endPosition = getPosition(this.id) + 1;
if (type === "android") {
this.queryInfo.startPosition--;
this.queryInfo.endPosition--;
}
this.$emit("queryUserList", this.queryInfo.keyWord);
this.$nextTick(() => {
const userList = this.userList;
......@@ -116,7 +131,7 @@ export default {
getUserByName(name) {
const userList = this.allUserList;
if (!userList.length) return "";
return userList.find((item) => item.nickname === name);
return userList.find(item => item.nickname === name);
}
}
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册