hookehuyr

fix 表格控件-禁止图片复制

1 <!-- 1 <!--
2 * @Date: 2024-07-12 13:28:27 2 * @Date: 2024-07-12 13:28:27
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-08-01 17:07:24 4 + * @LastEditTime: 2024-08-01 17:38:43
5 * @FilePath: /data-table/src/components/TEditor/index.vue 5 * @FilePath: /data-table/src/components/TEditor/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -236,7 +236,22 @@ const tinymceOptions = { ...@@ -236,7 +236,22 @@ const tinymceOptions = {
236 // document.getElementById(editor.id).click(); 236 // document.getElementById(editor.id).click();
237 // }); 237 // });
238 // 初始化实例 238 // 初始化实例
239 - handleSetContent(props.table_html) 239 + handleSetContent(props.table_html);
240 + // 禁止图片复制
241 + editor.on('paste', function (e) {
242 + // 获取粘贴的数据
243 + const clipboardData = e.clipboardData || window.clipboardData;
244 + const items = clipboardData.items;
245 +
246 + // 检查剪贴板是否包含图片
247 + for (let i = 0; i < items.length; i++) {
248 + if (items[i].type.indexOf('image') !== -1) {
249 + e.preventDefault(); // 阻止图片粘贴
250 + alert('禁止粘贴图片到编辑器中。');
251 + break;
252 + }
253 + }
254 + });
240 }, 255 },
241 } 256 }
242 257
......