| | |
| | | import tinymce from "tinymce/tinymce"; |
| | | import Editor from "@tinymce/tinymce-vue"; |
| | | import { upload } from "@/api/backManage/notice"; |
| | | import 'tinymce-paragraphspacing' |
| | | import "tinymce/themes/silver"; |
| | | import "tinymce/themes/silver/theme"; |
| | | import "tinymce/icons/default/icons"; |
| | |
| | | import "tinymce/plugins/wordcount"; |
| | | import "tinymce/plugins/fullscreen"; |
| | | import "../../../public/tinymce/plugins/upfile/index"; |
| | | import "../../../public/tinymce/plugins/formatpainter/plugin.min"; |
| | | import {getToken} from "@/utils/auth"; |
| | | // import "tinymce/plugins/upfile"; |
| | | // import "tinymce/plugins/attachment"; |
| | |
| | | }, |
| | | plugins: { |
| | | type: [String, Array], |
| | | default: "upfile lists image table wordcount fullscreen " |
| | | default: "formatpainter paragraphspacing upfile lists image table wordcount fullscreen " |
| | | }, |
| | | toolbar: { |
| | | type: [String, Array], |
| | | default: " styleselect fontsizeselect | undo redo | upfile image bold italic | fontselect |alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | lists insertfile table | removeformat fullscreen " |
| | | default: " styleselect fontsizeselect paragraphspacing formatpainter | upfile image bold italic | fontselect |alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | undo redo | lists insertfile table | removeformat fullscreen " |
| | | } |
| | | }, |
| | | data() { |
| | |
| | | content_css: '/tinymce/skins/content/default/content.css', |
| | | height: this.height? this.height : 500, // 编辑器高度 |
| | | branding: false, // 是否禁用“Powered by TinyMCE” |
| | | menubar: true, // 顶部菜单栏显示 |
| | | menubar: false, // 顶部菜单栏显示 |
| | | plugins: this.plugins, |
| | | toolbar: this.toolbar, |
| | | relative_urls: false, |
| | | remove_script_host: true, |
| | | statusbar: false, |
| | | images_upload_handler: async (blobInfo, success, failure) => { |
| | | font_formats: '默认字体=default;' + |
| | | 'Arial=arial,helvetica,sans-serif;' + |
| | | '楷体=KaiTi, "Kai", serif;' + |
| | | '圆体=Microsoft YaHei UI, sans-serif;' + |
| | | '思源宋体=Source Han Serif SC, serif;' + |
| | | '宋体=SimSun, NSimSun, "Songti SC", serif;' + // Windows宋体 |
| | | '新宋体=NSimSun, serif;' + |
| | | '黑体=SimHei, "Microsoft YaHei", "PingFang SC", sans-serif;' + // Windows黑体 |
| | | '微软雅黑=Microsoft YaHei, sans-serif;' + |
| | | '仿宋=FangSong, "Fang", serif;', |
| | | fontsize_formats: "8pt 10pt 12pt 13pt 14pt 18pt 24pt 36pt", |
| | | |
| | | // 字体样式应用到文本时使用 <span> 而非 <font> |
| | | inline_styles: true, |
| | | images_upload_handler: async (blobInfo, success, failure) => { |
| | | const formData = new FormData(); // 和后端协商后用formData格式进行传参 |
| | | formData.append("file", blobInfo.blob());// 传递的参数 |
| | | formData.append("Authorization", getToken());// token值 |