import Oss from '@/components/upload/upload.js' import { Loading } from 'element-ui' export default { //skin:'oxide-dark', language:'zh_CN', language_url: './styles/tinymce/langs/zh_CN.js', plugins: 'print preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern help emoticons autosave autoresize', toolbar: 'code undo redo restoredraft | cut copy pastetext | forecolor backcolor headings fontsize lineHeight bold italic underline strikethrough link anchor | alignleft aligncenter alignright alignjustify | \ styleselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | \ table image media charmap emoticons hr pagebreak insertdatetime print preview | fullscreen | indent2em', style_formats: [ //新增 首行缩进与行高 配置 { title: '首行缩进', block: 'p', styles: { 'text-indent': '2em' } }, { title: '行高', items: [{ title: '1', styles: { 'line-height': '1' }, inline: 'span' }, { title: '1.5', styles: { 'line-height': '1.5' }, inline: 'span' }, { title: '2', styles: { 'line-height': '2' }, inline: 'span' }, { title: '2.5', styles: { 'line-height': '2.5' }, inline: 'span' }, { title: '3', styles: { 'line-height': '3' }, inline: 'span' } ] }, //默认的配置 { title: 'headings', items: [ { title: 'Heading 1', format: 'h1' }, { title: 'Heading 2', format: 'h2' }, { title: 'Heading 3', format: 'h3' }, { title: 'Heading 4', format: 'h4' }, { title: 'Heading 5', format: 'h5' }, { title: 'Heading 6', format: 'h6' } ] }, { title: 'Inline', items: [ { title: 'Bold', icon: 'bold', format: 'bold' }, { title: 'Italic', icon: 'italic', format: 'italic' }, { title: 'Underline', icon: 'underline', format: 'underline' }, { title: 'Strikethrough', icon: 'strikethrough', format: 'strikethrough' }, { title: 'Superscript', icon: 'superscript', format: 'superscript' }, { title: 'Subscript', icon: 'subscript', format: 'subscript' }, { title: 'Code', icon: 'code', format: 'code' } ] }, { title: 'Blocks', items: [ { title: 'Paragraph', format: 'p' }, { title: 'Blockquote', format: 'blockquote' }, { title: 'Div', format: 'div' }, { title: 'Pre', format: 'pre' } ] }, { title: 'Alignment', items: [ { title: 'Left', icon: 'alignleft', format: 'alignleft' }, { title: 'Center', icon: 'aligncenter', format: 'aligncenter' }, { title: 'Right', icon: 'alignright', format: 'alignright' }, { title: 'Justify', icon: 'alignjustify', format: 'alignjustify' } ] } ], promotion: false, branding: false, width: '100%', height: 400, //编辑器高度 min_height: 400, max_height: 600, content_css: [ //可设置编辑区内容展示的css,谨慎使用 './styles/css/editor.css', ], // content_style: Style, fontsize_formats: '12px 14px 16px 19px 24px 36px 48px 56px 72px', font_formats: '苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats;知乎配置=BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;小米配置=Helvetica Neue,Helvetica,Arial,Microsoft Yahei,Hiragino Sans GB,Heiti SC,WenQuanYi Micro Hei,sans-serif', link_list: [ { title: '预置链接1', value: 'http://www.tinymce.com' }, { title: '预置链接2', value: 'http://tinymce.ax-z.cn' } ], image_list: [ { title: '预置图片1', value: 'https://www.tiny.cloud/images/glyph-tinymce@2x.png' }, { title: '预置图片2', value: 'https://www.baidu.com/img/bd_logo1.png' } ], image_class_list: [ { title: 'None', value: '' }, { title: 'Some class', value: 'class-name' } ], //importcss_append: true, //自定义文件选择器的回调内容 file_picker_callback: function (callback, value, meta) { if (meta.filetype === 'file') { callback('https://www.baidu.com/img/bd_logo1.png', { text: 'My text' }); } if (meta.filetype === 'image') { callback('https://www.baidu.com/img/bd_logo1.png', { alt: 'My alt text' }); } if (meta.filetype === 'media') { callback('movie.mp4', { source2: 'alt.ogg', poster: 'https://www.baidu.com/img/bd_logo1.png' }); } }, //为内容模板插件提供预置模板 templates: [ { title: '个股分析报告', description: '', content: `

个股分析报告

1.引言
2.公司概况
3.财务分析
4.行业比较和竞争分析
5.市场前景和趋势
6.投资评估和风险分析
7.结论和建议
8.参考文献
` }, { title: '行业数据分析报告', description: '', content: `

行业数据分析报告

1.引言
2.行业概述
3.行业规模和增长趋势
4.主要参与者和竞争格局
5.消费者行为和市场需求
6.技术创新和趋势
7.政策和法规环境
8.风险与挑战
9.结论和展望
10.参考文献
` }, { title: '宏观数据分析报告', description: '', content: `

宏观数据分析报告

1.引言
2.数据来源和方法
3.宏观经济指标分析
4.产业和部门分析
5.外部环境分析
6.风险与挑战
7.结论和展望
8.参考文献
` }, { title: '可视化报告', description: '', content: `

可视化报告

1.封面
2.目录
3.引言
4.数据总览
5.主要发现
6.数据分析
7.行业比较和竞争分析
8.市场前景和趋势
9.投资评估和风险分析
10.结论和建议
11.附录
` }, { title: '数据分析报告', description: '', content: `

数据分析报告

1.引言
2.数据来源和方法
3.数据概览
4.数据清洗和预处理
5.数据分析结果
6.数据解读和发现
7.分析方法和模型
8.结果验证和可靠性
9.结论和建议
10.限制和局限性
11.参考文献
12.附录
` }, ], // content_security_policy: "https://cdn.tiny.cloud/1/rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda/tinymce/6/tinymce.min.js", // extended_valid_elements:'script[src]', // // template_cdate_format: '[CDATE: %m/%d/%Y : %H:%M:%S]', // template_mdate_format: '[MDATE: %m/%d/%Y : %H:%M:%S]', // autosave_ask_before_unload: false, toolbar_mode : 'wrap', // automatic_uploads: true, // images_upload_base_path: '/demo', // images_upload_url: 'http://10.10.11.7:10000/iasf/sysFiles/upload', paste_data_images: true, powerpaste_allow_local_images: true, powerpaste_word_import: 'clean', powerpaste_html_import: 'clean', // 自定义上传 images_upload_handler: function (blobInfo, succFun, failFun) { const blob = blobInfo.blob() // blob转换为file const file = new File([blob], blobInfo.filename(), { type: 'application/json', lastModified: Date.now() }); Oss.upload(file).then(res => { succFun(res.url) }) }, //自定义文件选择器的回调内容 此方法只有在点击上方图片按钮才会触发 file_picker_callback: function (callback, value, meta) { if (meta.filetype === 'file') { callback('https://www.baidu.com/img/bd_logo1.png', { text: 'My text' }); } if (meta.filetype === 'image') { callback('https://www.baidu.com/img/bd_logo1.png', { alt: 'My alt text' }); } // 主要判断 media if (meta.filetype === 'media') { // 动态创建上传input,并进行模拟点击上传操作,达到本地上传视频效果。 let input = document.createElement('input');//创建一个隐藏的input input.setAttribute('type', 'file'); input.setAttribute("accept", ".mp4"); input.onchange = function(){ let file = this.files[0]; const load = Loading.service() Oss.upload(file).then(res => { load.close() callback(res.url) }).catch(e => { load.close() }) } //触发点击 input.click(); } }, // 初始化事件 setup: function(editor) { editor.on('init', function(ed) { // 设置默认字体 ed.target.editorCommands.execCommand("fontName", false, "Microsoft Yahei") ed.target.editorCommands.execCommand("fontSize", false, "19px") ed.target.editorCommands.execCommand("lineHeight", false, "1.5") }) }, }