如何解决百度富文本在线视屏不能预览

ueditor版本1.4.3.3 网上参考案例 www.cnblogs.com/koreyoshi/a...

1.找到dialogs/video/video.js文件,搜索function createPreviewVideo(url) 找到conUrl = utils.unhtmlForUrl(conUrl)下方代码片段

ini 复制代码
$G("preview").innerHTML = '<div class="previewMsg"><span>'+lang.urlError+'</span></div>'+
        '<embed class="previewVideo" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"' +
            ' src="' + conUrl + '"' +
            ' width="' + 420  + '"' +
            ' height="' + 280  + '"' +
            ' wmode="transparent" play="true" loop="false" menu="false" allowscriptaccess="never" allowfullscreen="true" >' +
        '</embed>';

替换成

ini 复制代码
$G("preview").innerHTML = '<video class="previewVideo" controls="controls" src="' + conUrl + '" ></video>';

2.ueditor.all.js文件搜索me.commands["insertvideo"] 如果for循环下面是

less 复制代码
html.push(creatInsertStr( vi.url, vi.width || 420,  vi.height || 280, id + i, null, cl, 'image'));

替换成

less 复制代码
html.push(creatInsertStr(vi.url, vi.width || 420, vi.height || 280, id + i, null, cl, 'embed'));

3.ueditor.config.js白名单配置,搜索whitList,替换img配置

css 复制代码
 img: ['src', 'alt', 'title', 'width', 'height', 'id', '_src', '_url', 'loadingclass', 'class', 'data-latex', 'style', 'word_img', 'name', 'anchorname'],

再另外加三个

bash 复制代码
source: ['src', 'type'],
embed: ['type', 'class', 'pluginspage', 'src', 'width', 'height', 'align', 'style', 'wmode', 'play', 'autoplay', 'loop', 'menu', 'allowscriptaccess', 'allowfullscreen', 'controls', 'preload'],
 iframe: ['src', 'class', 'height', 'width', 'max-width', 'max-height', 'align', 'frameborder', 'allowfullscreen']

完整的白名单

less 复制代码
whitList: {
            iframe: ['frameborder', 'border', 'marginwidth', 'marginheight', 'width', 'height', 'src', 'id'], 
            a: ['target', 'href', 'title', 'class', 'style'],
            abbr: ['title', 'class', 'style'],
            address: ['class', 'style'],
            area: ['shape', 'coords', 'href', 'alt', 'style'],
            article: ['class', 'style'],
            aside: ['class', 'style'],
            audio: ['autoplay', 'controls', 'loop', 'preload', 'src', 'class', 'style'],
            b: ['class', 'style'],
            bdi: ['dir', 'style'],
            bdo: ['dir', 'style'],
            big: ['class', 'style'],
            blockquote: ['cite', 'class', 'style'],
            br: ['class', 'style'],
            caption: ['class', 'style'],
            center: ['class', 'style'],
            cite: ['class', 'style'],
            code: ['class', 'style'],
            col: ['align', 'valign', 'span', 'width', 'class', 'style'],
            colgroup: ['align', 'valign', 'span', 'width', 'class', 'style'],
            dd: ['class', 'style'],
            del: ['datetime', 'style'],
            details: ['open', 'style'],
            div: ['class', 'style'],
            dl: ['class', 'style'],
            dt: ['class', 'style'],
            em: ['class', 'style'],
            font: ['color', 'size', 'face'],
            footer: ['class', 'style'],
            h1: ['class', 'style'],
            h2: ['class', 'style'],
            h3: ['class', 'style'],
            h4: ['class', 'style'],
            h5: ['class', 'style'],
            h6: ['class', 'style'],
            header: ['class', 'style'],
            hr: ['class', 'style'],
            i: ['class', 'style'],
            img: ['src', 'alt', 'title', 'width', 'height', 'id', '_src', '_url', 'loadingclass', 'class', 'data-latex', 'style', 'word_img', 'name', 'anchorname'],
            ins: ['datetime', 'style'],
            li: ['class', 'style'],
            mark: ['class', 'style'],
            nav: ['class', 'style'],
            ol: ['class', 'style'],
            p: ['class', 'style'],
            pre: ['class', 'style'],
            s: ['class', 'style'],
            section: ['class', 'style'],
            small: ['class', 'style'],
            span: ['class', 'style'],
            sub: ['class', 'style'],
            sup: ['class', 'style'],
            strong: ['class', 'style'],
            table: ['width', 'border', 'align', 'valign', 'class', 'style'],
            tbody: ['align', 'valign', 'class', 'style'],
            td: ['width', 'rowspan', 'colspan', 'align', 'valign', 'class', 'style'],
            tfoot: ['align', 'valign', 'class', 'style'],
            th: ['width', 'rowspan', 'colspan', 'align', 'valign', 'class', 'style'],
            thead: ['align', 'valign', 'class', 'style'],
            tr: ['rowspan', 'align', 'valign', 'class', 'style'],
            tt: ['class', 'style'],
            u: ['class', 'style'],
            ul: ['class', 'style'],
            video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width', 'class', 'style'],
            source: ['src', 'type'],
            embed: ['type', 'class', 'pluginspage', 'src', 'width', 'height', 'align', 'style', 'wmode', 'play', 'autoplay', 'loop', 'menu', 'allowscriptaccess', 'allowfullscreen', 'controls', 'preload'],
            iframe: ['src', 'class', 'height', 'width', 'max-width', 'max-height', 'align', 'frameborder', 'allowfullscreen']
        }
    };
相关推荐
GISer_Jing3 分钟前
Vue3状态管理——Pinia
前端·javascript·vue.js
好开心3318 分钟前
axios的使用
开发语言·前端·javascript·前端框架·html
Domain-zhuo27 分钟前
Git常用命令
前端·git·gitee·github·gitea·gitcode
菜根Sec1 小时前
XSS跨站脚本攻击漏洞练习
前端·xss
m0_748257181 小时前
Spring Boot FileUpLoad and Interceptor(文件上传和拦截器,Web入门知识)
前端·spring boot·后端
桃园码工1 小时前
15_HTML5 表单属性 --[HTML5 API 学习之旅]
前端·html5·表单属性
百万蹄蹄向前冲2 小时前
2024不一样的VUE3期末考查
前端·javascript·程序员
Anlici2 小时前
three.js建立3D模型展示地球+高亮
前端·数据可视化·canvas
轻口味2 小时前
【每日学点鸿蒙知识】AVCodec、SmartPerf工具、web组件加载、监听键盘的显示隐藏、Asset Store Kit
前端·华为·harmonyos
alikami2 小时前
【若依】用 post 请求传 json 格式的数据下载文件
前端·javascript·json