y595705120 3 rokov pred
rodič
commit
759c204b04

+ 2 - 1
src/components/Tinymce/components/EditorImage.vue

@@ -7,12 +7,13 @@
       <el-upload
         :multiple="true"
         :file-list="fileList"
-        action="/api/artical/uploadFile"
+        action="/api/artical/uploadImage"
         :headers="headers"
         :show-file-list="true"
         :on-remove="handleRemove"
         :on-success="handleSuccess"
         :before-upload="beforeUpload"
+        accept=".jpg,.jpeg,.png,.gif,.bmp,.JPG,.JPEG,.PBG,.GIF,.BMP"
         class="editor-slide-upload"
         list-type="picture-card"
       >

+ 11 - 6
src/components/Tinymce/index.vue

@@ -20,7 +20,7 @@ import axios from 'axios';
 // import tinymceCDN from '@/assets/tinymce.min.js'
 
 // why use this cdn, detail see https://github.com/PanJiaChen/tinymce-all-in-one
-const tinymceCDN = 'https://cdn.jsdelivr.net/npm/tinymce-all-in-one@4.9.5/tinymce.min.js'
+const tinymceCDN = 'https://cdn.jsdelivr.net/npm/tinymce-all-in-one@4.9.3/tinymce.min.js'
 
 export default {
   name: 'Tinymce',
@@ -135,15 +135,16 @@ export default {
         height: this.height,
         body_class: 'panel-body',
         object_resizing: true,
+        // extended_valid_elements: 'img[style|class|src|border|alt|title|hspace|vspace|width|height|align|name|loading]',
         toolbar: this.toolbar.length > 0 ? this.toolbar : toolbar,
         menubar: this.menubar,
         plugins: plugins,
-        content_css : "tinymce.css",
+        // content_css : "tinymce.css",
         entity_encoding : "raw",
         remove_linebreaks : false,
         forced_root_block: false,
         force_br_newlines: true,
-        invalid_elements : "p, div, span",
+        // invalid_elements : "p, div, span",
         imagetools_toolbar: 'editimage',
         end_container_on_empty_block: true,
         powerpaste_word_import: 'clean',
@@ -160,7 +161,11 @@ export default {
         //   cellspacing:"0",
         //   cellpadding:"0"
         // },
+        automatic_uploads: false,
+        remove_linebreaks: false,
         link_title: true,
+        relative_urls: false,
+        paste_data_images: false,
         nonbreaking_force_tab: true, // inserting nonbreaking space &nbsp; need Nonbreaking Space Plugin
         init_instance_callback: editor => {
           if (_this.value) {
@@ -186,8 +191,8 @@ export default {
         // it will try to keep these URLs intact
         // https://www.tiny.cloud/docs-3x/reference/configuration/Configuration3x@convert_urls/
         // https://stackoverflow.com/questions/5196205/disable-tinymce-absolute-to-relative-url-conversions
-        convert_urls: true,
-        automatic_uploads: true
+        // convert_urls: true,
+        // automatic_uploads: true
         // 整合七牛上传
         // images_upload_handler(blobInfo, success, failure, progress) {
         //   console.log("images_upload_handler" )
@@ -227,7 +232,7 @@ export default {
       // 上传图片
       axios.post(this.uploadUrl, formData, { headers: this.headers }).then(res => {
       if (res.data.code === 200) {
-        window.tinymce.get(this.tinymceId).insertContent(`<img style="width:100%" src="http://smoa.ndjsxh.cn:8888/api/preview/${res.data.data.filename}" >`)
+        window.tinymce.get(this.tinymceId).insertContent(`<img style="width:100%" src="http://smoa.ndjsxh.cn:8888/preview/${res.data.data.filename}" >`)
       } else {
         this.$message.error('图片上传失败,联系开发人员')
         }

+ 1 - 1
src/components/Tinymce/plugins.js

@@ -2,7 +2,7 @@
 // Detail plugins list see https://www.tinymce.com/docs/plugins/
 // Custom builds see https://www.tinymce.com/download/custom-builds/
 // bbcode table
-const plugins = ['bbcode table advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount']
+const plugins = ['table advlist anchor autolink autosave code codesample colorpicker colorpicker contextmenu directionality emoticons fullscreen hr image imagetools insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus table template textcolor textpattern visualblocks visualchars wordcount']
 
 export default plugins
 // powerpaste image table imagetools