fixed
This commit is contained in:
@ -28,7 +28,8 @@ import {
|
||||
watch,
|
||||
} from "vue";
|
||||
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
|
||||
|
||||
import request from "@/utils/request";
|
||||
import { getToken } from "@/utils/auth";
|
||||
export default {
|
||||
components: { Editor, Toolbar },
|
||||
props: {
|
||||
@ -76,26 +77,45 @@ export default {
|
||||
);
|
||||
const { height } = toRefs(props);
|
||||
const toolbarConfig = {
|
||||
toolbarKeys: [
|
||||
"bold",
|
||||
"underline",
|
||||
"italic",
|
||||
"through",
|
||||
"color",
|
||||
"bgColor",
|
||||
"fontSize",
|
||||
"fontFamily",
|
||||
"lineHeight",
|
||||
// "emotion",
|
||||
// "redo",
|
||||
// "undo",
|
||||
],
|
||||
// toolbarKeys: [
|
||||
// "bold",
|
||||
// "underline",
|
||||
// "italic",
|
||||
// "through",
|
||||
// "color",
|
||||
// "bgColor",
|
||||
// "fontSize",
|
||||
// "fontFamily",
|
||||
// "lineHeight",
|
||||
// "uploadImage",
|
||||
// // "emotion",
|
||||
// // "redo",
|
||||
// // "undo",
|
||||
// ],
|
||||
};
|
||||
const editorConfig = {
|
||||
placeholder: "请输入内容...",
|
||||
autoFocus: props.focus,
|
||||
maxLength: 140,
|
||||
readOnly: props.readOnly,
|
||||
MENU_CONF: {
|
||||
uploadImage: {
|
||||
async customUpload(file, insertFn) {
|
||||
const fd = new FormData();
|
||||
fd.append("file", file);
|
||||
const resp = await request({
|
||||
url: "/common/upload",
|
||||
method: "post",
|
||||
data: fd,
|
||||
headers: {
|
||||
Authorization: "Bearer " + getToken(),
|
||||
},
|
||||
});
|
||||
|
||||
insertFn(resp.url, "", resp.url);
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
onMounted(() => {
|
||||
// console.log(editorRef.value.getConfig());
|
||||
@ -110,6 +130,7 @@ export default {
|
||||
|
||||
const handleCreated = (editor) => {
|
||||
editorRef.value = editor; // 记录 editor 实例,重要!
|
||||
console.log(editorRef.value.getAllMenuKeys());
|
||||
};
|
||||
|
||||
const handleChange = (editor) => {
|
||||
|
||||
Reference in New Issue
Block a user