Browse Source

研报模块富文本粘贴内容限制

cxmo 1 năm trước cách đây
mục cha
commit
100652b9bc

+ 7 - 0
src/views/report_manage/mixins/reportMixin.js

@@ -165,6 +165,13 @@ export default {
           "image.error": function (error, response) {
             that.autoSaveFlag = true;
           },
+          "paste.before":function(e,editor){
+            let content = e.clipboardData.getData('text/html');
+            if(content.includes('<iframe')){
+                that.$message.warning("粘贴内容含有外链,请核对内容或粘贴纯文本")
+                return false
+            }
+          },
         },
         charCounterCount: false,
         reportloadding: false,

+ 11 - 1
src/views/report_manage/reportEn/reportEditor.vue

@@ -391,6 +391,7 @@ import importSemantics from '../components/importSemantics.vue';
 export default {
 	mixins:[mixinMsg,reportMixin,reportApproveConfig],
 	data() {
+        let that = this;
 		return {
 			//批量导入图表
 			importChartNum:0,//批量导入图表的数量 如果大于0则说明在加载
@@ -497,7 +498,16 @@ export default {
         placeholderText:localStorage.getItem('i18n') == 'en' ? 'Please Overview' : '请输入overview',
         language: localStorage.getItem('i18n') == 'en' ? 'en' : "zh_cn",
         //允许粘贴的样式
-        pasteAllowedStyleProps: ['font-family', 'font-size', 'color']
+        pasteAllowedStyleProps: ['font-family', 'font-size', 'color'],
+        events:{
+            "paste.before":function(e,editor){
+            let content = e.clipboardData.getData('text/html');
+            if(content.includes('<iframe')){
+                that.$message.warning("粘贴内容含有外链,请核对内容或粘贴纯文本")
+                return false
+            }
+          }
+        }
       },
 
 			showDSFB:false,//显示定时发布弹窗

+ 7 - 0
src/views/smartReport/components/TextEdit.vue

@@ -106,6 +106,13 @@ export default {
                         // that.$emit('textChange', that.html)
                         that.sendHtml()
                     },
+                    "paste.before":function(e,editor){
+                        let content = e.clipboardData.getData('text/html');
+                        if(content.includes('<iframe')){
+                            that.$message.warning("粘贴内容含有外链,请核对内容或粘贴纯文本")
+                            return false
+                        }
+                    }
                 },
             }
         }