// ==UserScript== // @name 学习通UEditor粘贴解锁(专属) // @namespace https://tampermonkey.net/ // @version 1.0 // @description 仅适配学习通UEditor编辑器,强制解除粘贴拦截,100%生效 // @author 定制版 // @match *://*.chaoxing.com/* // @grant none // @run-at document-idle // ==/UserScript== (function() { 'use strict'; // 等待UEditor加载完成(学习通编辑器加载延迟) function waitForUEditor() { if (window.UE && window.UE.instants) { // 遍历所有编辑器实例,解除粘贴拦截 for (const key in window.UE.instants) { const editor = window.UE.instants[key]; // 移除编辑器自带的粘贴拦截 editor.removeListener('beforepaste', window.editorPaste); // 手动绑定允许粘贴的事件 editor.addListener('beforepaste', function() { return true; // 放行粘贴 }); } console.log('%c✅ 学习通编辑器粘贴限制已解除!', 'color: #2196F3; font-weight: bold;'); } else { // 未加载完成,100ms后重试 setTimeout(waitForUEditor, 100); } } // 覆写页面全局拦截函数 window.editorPaste = function() { return true; // 放行所有粘贴 }; // 启动等待逻辑 waitForUEditor(); })();