Git Product home page Git Product logo

vue-ueditor-wrap's Introduction

vue-ueditor-wrap

一个“包装”了 UEditor 的 Vue 组件,支持通过 v-model 来绑定富文本编辑器的内容,让 UEditor 的使用简单到像 Input 框一样。

Version Downloads jsdelivr size Issues License

🔥 文档网站(国内)   🌈 文档网站(GitHub)   🧭 Vue 2 项目请移步此处

Installation

# vue-ueditor-wrap v3 仅支持 Vue 3
npm i [email protected]
# 或者
yarn add [email protected]

安装太慢?试试 URM

Quick Start

  1. 下载 UEditor
编码方式\语言 PHP NET JSP ASP
utf8 下载 下载 下载 下载
gbk 下载 下载 下载 下载

UEditor 并不支持通过 npm 的方式来安装,vue-ueditor-wrap 也只是一个 Vue 组件,组件本身并不是 UEditor 的 Vue 版。了解 UEditor 基本使用,请参考 UEditor 官网

不同语言的 UEditor,前端部分,并无区别,只是包含了对应语言的服务端示例代码。UEditor 官方并没有提供 Node.js 版的示例代码,有需求的同学可以参考 此处

将解压的文件夹重命名为 UEditor 并移动到你项目的静态资源目录下,比如下面是一个由 Vue CLI(v3+)创建的项目,静态资源目录就是 public。

  1. 注册组件

    // main.js
    import { createApp } from 'vue';
    import VueUeditorWrap from 'vue-ueditor-wrap';
    import App from './App.vue';
    
    createApp(App).use(VueUeditorWrap).mount('#app');
  2. v-model绑定数据

    <vue-ueditor-wrap v-model="msg" :config="editorConfig" editor-id="editor-demo-01"></vue-ueditor-wrap>
    import { ref } from 'vue';
    
    export default {
      setup() {
        const msg = ref('<h2>Hello World!</h2>');
        return {
          msg,
        };
      },
      created() {
        // 更多 UEditor 配置,参考 http://fex.baidu.com/ueditor/#start-config
        this.editorConfig = {
          // 访问 UEditor 静态资源的根路径,可参考 https://hc199421.gitee.io/vue-ueditor-wrap/#/faq
          UEDITOR_HOME_URL: '/UEditor/',
          // 服务端接口(这个地址是我为了方便各位体验文件上传功能搭建的临时接口,请勿在生产环境使用!!!)
          serverUrl: '//ueditor.zhenghaochuan.com/cos',
        };
      },
    };

至此你已经可以在页面中看到一个初始化之后的 UEditor 了,并且它已经成功和数据绑定了!👏👏👏

Props

参数 说明 类型 默认值
v-model 当前富文本编辑器内容 string
config UEditor 配置 object
editor-id 富文本编辑器 ID string editor_ + 随机八位小写字母
name 类似 input 框的 name 属性,常用于表单中 string
mode 监听内容变化的方式,可选值为 observer, listener string observer
observer-options MutationObserver 的参数 object 见下方说明
observer-debounce-time MutationObserver 的回调函数防抖间隔 number 50
forceInit 跳过环境检测,直接初始化 boolean false
editor-dependencies 指定使用 UEditor 所需要加载的 JS 和 CSS string[]
editor-dependencies-checker 检测依赖的静态资源是否加载完成的方法 ()=>boolean

mode 属性说明

v-model 的实现依赖对编辑器内容变化的监听,组件提供了两种可选的监听方式,但是不建议修改,除非你知道自己在干什么。

  1. listener 模式借助 UEditor 的 contentChange 事件,优点在于依赖官方提供的事件 API,无需额外的性能消耗,浏览器兼容性更好。但缺点在于监听不准确,存在如“特殊字符(? ! $ #)输入时不触发”的 BUG。
  2. observer 模式借助 MutationObserver API。它能提供更准确的监听,但编辑器内容变化时,observer 回调可能会连续触发多次,从而导致频繁的 emit('update:modelValue', editor.getContent());。你可以通过 observer-debounce-time 属性控制 emit 的最小时间间隔,还可以通过 observer-options 属性有选择的设置 MutationObserver 的监听行为。兼容性参考此处vue-ueditor-wrap 会在不支持的浏览器中自动启用 listener 模式。observer-options 的默认值为
{
  attributes: true, // 是否监听 DOM 元素的属性变化
  attributeFilter: ['src', 'style', 'type', 'name'], // 只有在该数组中的属性值的变化才会监听
  characterData: true, // 是否监听文本节点
  childList: true, // 是否监听子节点
  subtree: true, // 是否监听后代元素
};

forceInit 属性说明

在 SSR 项目中,服务端实例化组件时组件内部不会对 UEditor 进行初始化,仅在客户端初始化 UEditor,这个参数设置为 true 可以跳过环境检测,直接初始化 UEditor,但你大概率不需要手动设置这个值。

editor-dependencies 属性说明

使用 UEditor 时,我们通常都是在 index.html 中提前加载好 UEditor 的脚本,如下所示。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <!-- 加载配置文件 -->
    <script type="text/javascript" src="ueditor.config.js"></script>
    <!-- 加载编辑器源码文件 -->
    <script type="text/javascript" src="ueditor.all.js"></script>
  </head>
  <body>
    <div id="container"></div>

    <!-- 实例化编辑器 -->
    <script type="text/javascript">
      var ue = UE.getEditor('container');
    </script>
  </body>
</html>

但是富文本编辑器通常并不是在首页使用的,例如有一个“商品编辑页”通过 UEditor 来编辑商品介绍,如果用户不需要编辑商品,根本就用不到 UEditor,对这个用户来说完全可以不加载 UEditor 相关的资源。所以最好是能做到“按需加载”。


为此 vue-ueditor-wrap 内部会在组件实例化时通过动态创建 script 的方式来加载 UEditor 脚本,等脚本加载完成后,再实例化 UEditor。默认加载的脚本是 ueditor.config.jsueditor.all.min.js,如果你希望自定义要加载的 JS,比如集成第三方的插件,那你就可以利用 editor-dependencies 属性直接指定依赖的资源,支持填写 js 和 css 文件的链接。具体用法可参考集成秀米的示例


但这又带来一个问题,如果已经通过其他方式加载了 UEditor 脚本,vue-ueditor-wrap 还是会创建 script 来再加载一遍 UEditor 脚本。所以组件也提供了 editor-dependencies-checker 属性,这个属性接受一个函数作为参数,函数在组件创建 script 之前执行,如果返回 ture,则认为 UEditor 资源已存在,不会再创建 script。通常你不需要手动指定,组件内部已经实现了判断 ueditor.config.jsueditor.all.min.js 是否加载过的默认检测函数。也就是说,如果你在网站的其他位置加载过 UEditor 的脚本,vue-ueditor-wrap 是不会重复加载的。


除此之外,还需要解决的一个问题是,如果一个页面,存在多个 vue-ueditor-wrap 组件,那么每个组件实例化的时候,脚本都还没有加载下来,默认的检测函数也都认为不存在 UEditor 资源,就会多次创建同一个文件的 script 脚本。组件内部利用了 Promise事件机制 解决了这个问题,感兴趣的可以去看一下组件的实现。它保证了针对同一个资源,不会创建两次 script 标签。

Events

事件名 说明 回调参数
before-init 在 UEditor 的 scripts 加载完毕之后、编辑器初始化之前触发 editorId: string
ready UEditor ready 时触发 editor: UEditor 实例

before-init 事件说明

before-init 在 UEditor 相关的资源已经加载完毕之后、编辑器初始化之前触发。你可以在此时机,通过操作 window.UE 对象,来进行诸如添加自定义按钮、弹窗等的二次开发。before-init 的触发函数以 编辑器 id 作为入参。具体使用方式可参考自定义按钮自定义弹窗 的示例。

ready 事件说明

UEditor ready 时触发此事件,触发函数以 UEditor 实例作为入参,通过 UEditor 实例你可以调用各种 UEditor 的 API,具体参考UEditor API 文档

<vue-ueditor-wrap @ready="ready"></vue-ueditor-wrap>
methods: {
  ready (editorInstance) {
    console.log(`编辑器实例${editorInstance.key}: `, editorInstance);
  }
}

常见问题 & 代码示例

参考 https://hc199421.gitee.io/vue-ueditor-wrap/#/faq

问题反馈

方式一、去 GitHub 提 ISSUE

方式二、添加我的微信,备注 "ueditor"。

如果你感兴趣的话,可以阅读一下本组件的源码,并不复杂,欢迎 PR。

推广链接

License

MIT

vue-ueditor-wrap's People

Contributors

beeplin avatar colincll avatar dependabot[bot] avatar dreamago avatar haochuan9421 avatar lqycappuccino avatar zhangzhengyi12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vue-ueditor-wrap's Issues

自定义按钮进行上传视频到腾讯云服务器

自定义一个上传视频的按钮,把原来上传视频的按钮隐藏掉。使用腾讯云点播提供的web sdk上传视频到腾讯云服务器,后端只提供一个签名,然后拿到这个签名来上传视频。想用腾讯云的sdk替换webuploader上传视频,可以上传成功,但是后功后需要在编辑器中插入一个video或img标签来表示已经上传成功,怎么实现?需要改ueditor的源码?

webpack打包之后静态资源引用路径不对

webpack的配置文件
build: {
index: path.resolve(__dirname, '../ROOT/index.html'),
assetsRoot: path.resolve(__dirname, '../ROOT'),
// index: path.resolve(__dirname, '../plat/index.html'),
// assetsRoot: path.resolve(__dirname, '../plat'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
productionSourceMap: false,
devtool: '#source-map',
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
bundleAnalyzerReport: process.env.npm_config_report
}
这里我希望引用的静态资源带有打包文件的路径,但是没有出现
浏览器查找的路径
E:/static/UEditor/ueditor.config.js
真实的路径
E:\workspace\open-system\open-system\static

遇到一个问题,请教下你

背景:我的1个组件中存在多个ueditor,我再mounted里面执行ajax请求加载数据并返回成功
问题:只显示第1个ueditor里面的内容;这个时候其它ueditor还没有加载完全;等加载完全后仅仅第一个ueditor里面显示内容
我的尝试:update中进行ajax请求,这个时候所有的ueditor会显示内容;但是没有办法正常的修改保存
需要:初始化一次性所有的ueditor显示对应的内容

插件非常好用!

封装的很好。
之前自己封装一个,乱挤八糟的还经常出BUG。你这个完美了。找不到留言的地方,只能来这里了。

上传图片到七牛怎么配置,有遇见吗

ueditor.all.min.js:9 GET http://upload.qiniu.com/?action=config&callback=bd__editor__qgui58 net::ERR_ABORTED 405 (Method Not Allowed)
d @ ueditor.all.min.js:9
c @ ueditor.all.min.js:9
request @ ueditor.all.min.js:9
(anonymous) @ ueditor.all.min.js:9
setTimeout (async)
UE.Editor.loadServerConfig @ ueditor.all.min.js:9
UE.Editor @ ueditor.all.min.js:8
UE.ui.Editor @ ueditor.all.min.js:18
UE.getEditor @ ueditor.all.min.js:18
_initEditor @ vue-ueditor-wrap.min.js?6625:1
(anonymous) @ vue-ueditor-wrap.min.js?6625:1
Promise.then (async)
handler @ vue-ueditor-wrap.min.js?6625:1
Vue.$watch @ vue.runtime.esm.js?2b0e:3609
createWatcher @ vue.runtime.esm.js?2b0e:3567
initWatch @ vue.runtime.esm.js?2b0e:3549
initState @ vue.runtime.esm.js?2b0e:3313
Vue._init @ vue.runtime.esm.js?2b0e:4624
VueComponent @ vue.runtime.esm.js?2b0e:4794
createComponentInstanceForVnode @ vue.runtime.esm.js?2b0e:4306
init @ vue.runtime.esm.js?2b0e:4127
createComponent @ vue.runtime.esm.js?2b0e:5604
createElm @ vue.runtime.esm.js?2b0e:5551
createChildren @ vue.runtime.esm.js?2b0e:5678
createElm @ vue.runtime.esm.js?2b0e:5580
createChildren @ vue.runtime.esm.js?2b0e:5678
createElm @ vue.runtime.esm.js?2b0e:5580
patch @ vue.runtime.esm.js?2b0e:6087
Vue._update @ vue.runtime.esm.js?2b0e:2656
updateComponent @ vue.runtime.esm.js?2b0e:2784
get @ vue.runtime.esm.js?2b0e:3138
Watcher @ vue.runtime.esm.js?2b0e:3127
mountComponent @ vue.runtime.esm.js?2b0e:2791
Vue.$mount @ vue.runtime.esm.js?2b0e:7995
init @ vue.runtime.esm.js?2b0e:4133
createComponent @ vue.runtime.esm.js?2b0e:5604
createElm @ vue.runtime.esm.js?2b0e:5551
createChildren @ vue.runtime.esm.js?2b0e:5678
createElm @ vue.runtime.esm.js?2b0e:5580
patch @ vue.runtime.esm.js?2b0e:6087
Vue._update @ vue.runtime.esm.js?2b0e:2656
updateComponent @ vue.runtime.esm.js?2b0e:2784
get @ vue.runtime.esm.js?2b0e:3138
Watcher @ vue.runtime.esm.js?2b0e:3127
mountComponent @ vue.runtime.esm.js?2b0e:2791
Vue.$mount @ vue.runtime.esm.js?2b0e:7995
init @ vue.runtime.esm.js?2b0e:4133
createComponent @ vue.runtime.esm.js?2b0e:5604
createElm @ vue.runtime.esm.js?2b0e:5551
createChildren @ vue.runtime.esm.js?2b0e:5678
createElm @ vue.runtime.esm.js?2b0e:5580
updateChildren @ vue.runtime.esm.js?2b0e:5841
patchVnode @ vue.runtime.esm.js?2b0e:5932
updateChildren @ vue.runtime.esm.js?2b0e:5818
patchVnode @ vue.runtime.esm.js?2b0e:5932
patch @ vue.runtime.esm.js?2b0e:6092
Vue._update @ vue.runtime.esm.js?2b0e:2666
updateComponent @ vue.runtime.esm.js?2b0e:2784
get @ vue.runtime.esm.js?2b0e:3138
run @ vue.runtime.esm.js?2b0e:3215
flushSchedulerQueue @ vue.runtime.esm.js?2b0e:2977
(anonymous) @ vue.runtime.esm.js?2b0e:1833
flushCallbacks @ vue.runtime.esm.js?2b0e:1754
ueditor.all.min.js:9 请求后台配置项http错误,上传功能将不能正常使用!
showErrorMsg @ ueditor.all.min.js:9
onerror @ ueditor.all.min.js:9
(anonymous) @ ueditor.all.min.js:9
error (async)
c @ ueditor.all.min.js:9
request @ ueditor.all.min.js:9
(anonymous) @ ueditor.all.min.js:9
setTimeout (async)
UE.Editor.loadServerConfig @ ueditor.all.min.js:9
UE.Editor @ ueditor.all.min.js:8
UE.ui.Editor @ ueditor.all.min.js:18
UE.getEditor @ ueditor.all.min.js:18
_initEditor @ vue-ueditor-wrap.min.js?6625:1
(anonymous) @ vue-ueditor-wrap.min.js?6625:1
Promise.then (async)
handler @ vue-ueditor-wrap.min.js?6625:1
Vue.$watch @ vue.runtime.esm.js?2b0e:3609
createWatcher @ vue.runtime.esm.js?2b0e:3567
initWatch @ vue.runtime.esm.js?2b0e:3549
initState @ vue.runtime.esm.js?2b0e:3313
Vue._init @ vue.runtime.esm.js?2b0e:4624
VueComponent @ vue.runtime.esm.js?2b0e:4794
createComponentInstanceForVnode @ vue.runtime.esm.js?2b0e:4306
init @ vue.runtime.esm.js?2b0e:4127
createComponent @ vue.runtime.esm.js?2b0e:5604
createElm @ vue.runtime.esm.js?2b0e:5551
createChildren @ vue.runtime.esm.js?2b0e:5678
createElm @ vue.runtime.esm.js?2b0e:5580
createChildren @ vue.runtime.esm.js?2b0e:5678
createElm @ vue.runtime.esm.js?2b0e:5580
patch @ vue.runtime.esm.js?2b0e:6087
Vue._update @ vue.runtime.esm.js?2b0e:2656
updateComponent @ vue.runtime.esm.js?2b0e:2784
get @ vue.runtime.esm.js?2b0e:3138
Watcher @ vue.runtime.esm.js?2b0e:3127
mountComponent @ vue.runtime.esm.js?2b0e:2791
Vue.$mount @ vue.runtime.esm.js?2b0e:7995
init @ vue.runtime.esm.js?2b0e:4133
createComponent @ vue.runtime.esm.js?2b0e:5604
createElm @ vue.runtime.esm.js?2b0e:5551
createChildren @ vue.runtime.esm.js?2b0e:5678
createElm @ vue.runtime.esm.js?2b0e:5580
patch @ vue.runtime.esm.js?2b0e:6087
Vue._update @ vue.runtime.esm.js?2b0e:2656
updateComponent @ vue.runtime.esm.js?2b0e:2784
get @ vue.runtime.esm.js?2b0e:3138
Watcher @ vue.runtime.esm.js?2b0e:3127
mountComponent @ vue.runtime.esm.js?2b0e:2791
Vue.$mount @ vue.runtime.esm.js?2b0e:7995
init @ vue.runtime.esm.js?2b0e:4133
createComponent @ vue.runtime.esm.js?2b0e:5604
createElm @ vue.runtime.esm.js?2b0e:5551
createChildren @ vue.runtime.esm.js?2b0e:5678
createElm @ vue.runtime.esm.js?2b0e:5580
updateChildren @ vue.runtime.esm.js?2b0e:5841
patchVnode @ vue.runtime.esm.js?2b0e:5932
updateChildren @ vue.runtime.esm.js?2b0e:5818
patchVnode @ vue.runtime.esm.js?2b0e:5932
patch @ vue.runtime.esm.js?2b0e:6092
Vue._update @ vue.runtime.esm.js?2b0e:2666
updateComponent @ vue.runtime.esm.js?2b0e:2784
get @ vue.runtime.esm.js?2b0e:3138
run @ vue.runtime.esm.js?2b0e:3215
flushSchedulerQueue @ vue.runtime.esm.js?2b0e:2977
(anonymous) @ vue.runtime.esm.js?2b0e:1833
flushCallbacks @ vue.runtime.esm.js?2b0e:1754
4ueditor.all.min.js:8 The given range isn't in document.

当使用Shift+某个按键 组合输入时 无法触发数据同步

环境

macos 10.14.1 外接键盘

复现

在编辑器中使用Shift+某个按键进行输入,如输入一大串的大写英文字母,这时候和会发现没有触发$emit("input")事件,所以无法同步到数据上。如果使用大写锁定输入大写英文是可以的

对Ueditor的特性不是很了解,不知道是那里除了问题。我在自己的项目中或者是你的DEMO中测试结果相同

keep-alive 出现 `Cannot read property 'style' of null`

你遇到了什么 BUG
组件使用了keep-alive, 跳出路由时候会提示 Cannot read property 'style' of null, 然后再次进入,文本编辑区域就是空白的

如何复现
keepAlive:true
0. 路由

const routes = [
  { path: '/publish', component: Publish ,
    children:[
      // {path:'article', name:'article', components:{publish:Article},alias:'/article',meta:{keepAlive:true}},
      {path:'article', name:'article', components:{publish:Article},alias:'/article',meta:{keepAlive:false}},
      {path:'article/:contentId', props:true,components:{publish:Article},alias:'/article/:contentId'},
    ],
]
  1. 从列表页进入详情页 /article/122, 正常
  2. 在publish几个嵌套路由切换publish:aticle,publish:picture,正常
  3. 从publish:aricle 直接跳到列表页,就会报Cannot read property 'style' of null;以后从列表页进入详情页article/123 都会出现空白,文本编辑器没有出现
    如果从列表页直接进编辑页面publish:aticle是正常的;然后再从列表页详情页article/123就正常了

是 UEditor 的 BUG 还是组件的 BUG
可能keep-alive使用问题,导致 UEditor 的报错。
从详情页(没有keep-alive)进列表页 ,可能触发了destory;但是再次进入article是好的,因为 keep-alive 还是因为重新初始化了??

你是否查阅了 README 中的常见问题和其他 ISSUE
已查阅,没有发现我遇到的问题

开发环境

  • 操作系统:Win7
  • 浏览器: 谷歌 71.0
  • 组件版本: 2.4.1
  • 是否使用了本仓库下载的 UEditor 资源文件: 都使用过
  • 是否使用了我提供的 serverUrl: 否

额外说明
没用本仓库之前也会有上述错误,使用了keep-alive 尝试过多种销毁和重建的触发时机,扔未搞清楚。什么时候销毁和重建。
希望大佬指点一下,非常感谢

简直是帮了我大忙了~

刚开始按照网上的方法来集成,各种报错,什么caller,callee啦,关键是build的时候直接内存溢出。。幸好看到了你写的这个,稍微折腾了一下,完美~~~~你要是在边上简直想要亲你一脸的口水~~。总之谢谢~

谢谢兄弟,加油

兄弟 你太棒了 减少一上午的工作量 vue-cli 3.x 放到public中 UEDITOR_HOME_URL: './UEditor/'

有时候会遇见并不能显示返回数据的问题

因为数据是请求回来的,但是整个组件应该已经注册了,所以没有获取对应的数据会有这样的报错:

commons.971f9ffd311d2cc2ebb6.js:45 [Vue warn]: Error in callback for watcher "value": "TypeError: Cannot read property 'innerHTML' of undefined"

found in

---> <VueUeditorWrap> at node_modules/vue-ueditor-wrap/lib/index.vue
       <FormItem> at node_modules/iview/src/components/form/form-item.vue
         <IForm> at node_modules/iview/src/components/form/form.vue
           <Content> at node_modules/iview/src/components/layout/content.vue
             <Layout> at node_modules/iview/src/components/layout/layout.vue
               <Container> at src/components/container/container.vue
                 <InsuranceEdit> at src/pages/insurance-pages/edit/edit.vue
                   <Content> at node_modules/iview/src/components/layout/content.vue
                     <Layout> at node_modules/iview/src/components/layout/layout.vue... (1 recursive calls)
                       <LeftRight>
                         <Layout>
                           <Home> at src/components/layout/index.vue
                             <Root>
commons.971f9ffd311d2cc2ebb6.js:45 TypeError: Cannot read property 'innerHTML' of undefined
    at UE.Editor.getContent (ueditor.all.min.js:8)
    at a._setContent (commons.971f9ffd311d2cc2ebb6.js:33)
    at a.handler (commons.971f9ffd311d2cc2ebb6.js:33)
    at nn.run (commons.971f9ffd311d2cc2ebb6.js:45)
    at tn (commons.971f9ffd311d2cc2ebb6.js:45)
    at Array.<anonymous> (commons.971f9ffd311d2cc2ebb6.js:45)
    at ae (commons.971f9ffd311d2cc2ebb6.js:45)

然后我发现初始化对象的时候没有对应的数据,添加了对应的字段初始化的值:
然后出现以下的报错:

ueditor.all.min.js:9 Uncaught TypeError: Cannot read property 'replace' of null
    at Object.UE.htmlparser (ueditor.all.min.js:9)
    at UE.Editor.setContent (ueditor.all.min.js:8)
    at a.<anonymous> (commons.971f9ffd311d2cc2ebb6.js:33)
    at UE.Editor.fireEvent (ueditor.all.min.js:7)
    at UE.Editor._setup (ueditor.all.min.js:8)
    at about:blank:1

ueditor上传800M的大视频文件提示:上传失败,请重试

你遇到了什么 BUG
简单描述你遇到的 BUG。

如何复现
复现 BUG 的步骤:

  1. 进入编辑器 页面。
  2. 点击 上传视频。
  3. 选择大小为800M视频,点击开始上传。
  4. 上传视频处提示:上传失败,请重试。

是 UEditor 的 BUG 还是组件的 BUG
初步判断一下是因为 UEditor 导致的报错,还是由于本仓库的 vue-ueditor-wrap 组件导致的报错。

你是否查阅了 README 中的常见问题和其他 ISSUE
已查阅,没有发现我遇到的问题

截图
如果可能,提供截图
image

image

开发环境

  • 操作系统: [e.g. mac]
  • 浏览器: [e.g. 谷歌 71.0.3578.98 版本]
  • 是否使用了本仓库下载的 UEditor 资源文件: [e.g. 否]

额外说明
如果可能请提供一个复现问题的 GitHub 仓库地址

TypeError: Cannot read property 'nodeType' of undefined

Ueditor.vue


<template>
    <div>
        <vue-ueditor-wrap v-model="content"
                          :editor_content="editor_content"
                          :config="ueditorConfig"
                          @ready="ready">

        </vue-ueditor-wrap>
    </div>

</template>
<script>
import VueUeditorWrap from 'vue-ueditor-wrap' //调用编辑器

export default {
        components: {
            VueUeditorWrap
        },
        data () {
            return {
                content:' ',
                ueditorConfig:{
                    // 你的UEditor资源存放的路径,相对于打包后的index.html
                    UEDITOR_HOME_URL: '/ueditor/',
                    // 编辑器不自动被内容撑高
                    autoHeightEnabled: false,
                    // 初始容器宽度
                    initialFrameWidth: '100%'
                },
            }
        },
        props: [
            'editor_content'
        ],
        mounted() {

        },
        watch: {
            content(val){
              this.$emit('input',val);
            },
            editor_content(newVal) {
                this.content = newVal
            }
        },
        methods: {
            ready(ue){
                ue.execCommand('serverparam', function(editor) {
                    return {
                        'X-Requested-With':'XMLHttpRequest',
                        'sellerToken':window.sellerToken
                    };
                });
            },
        }
    }
</script>

MySetting.vue
<ueditor v-model="storeForm.content" :editor_content="storeForm.content"></ueditor>

我在我的项目里进行了一下封装,上面定义好组件,本地有时会出现一个这个问题

TypeError: Cannot read property 'nodeType' of undefined
    at Object.isEmptyBlock (ueditor.all.min.js:5)
    at UE.Editor.hasContents (ueditor.all.min.js:6)
    at UE.Editor.d.hasContents (ueditor.all.min.js:8)
    at UE.Editor.getContent (ueditor.all.min.js:6)
    at a._setContent (2.405bd65ff421689a6a1a.js:1)
    at a.handler (2.405bd65ff421689a6a1a.js:1)
    at It.I3G/.It.run (seller.js?id=cd8d74d5bfa8846d2f01:1)
    at Tt (seller.js?id=cd8d74d5bfa8846d2f01:1)
    at Array.<anonymous> (seller.js?id=cd8d74d5bfa8846d2f01:1)
    at Xe (seller.js?id=cd8d74d5bfa8846d2f01:1)

线上直接就出现这个问题

innerHtml报错

我的vue页面每次首次加载ueditor显示正常,刷新页面后直接报错:

单图片上传BUG

大大的demo
image
搭建的环境
image

相同的域名不是跨域的问题

单图上传有问题,多图上传并没有问题

自定义上传

 this.$emit("beforeInit", this.id, this.mixedConfig);
/* 自定义上传接口
            // 先保留,后覆盖 
            window.UE.Editor.prototype._bkGetActionUrl = window.UE.Editor.prototype.getActionUrl;
            UE.Editor.prototype.getActionUrl = function(action) {
                if (!action) {
                    console.error('[Ueditor] 无法连接到资源服务器');
                    return;
                }
                return this.options[action.toUpperCase()] || this._bkGetActionUrl.call(this, action);
            };
*/
this.editor = window.UE.getEditor(this.id, this.mixedConfig);

添加大图,点击大图出现蓝色线会偏移,在点击同级文字会点击不了

你遇到了什么 BUG
简单描述你遇到的 BUG。

如何复现
复现 BUG 的步骤:

  1. 进入 xxx 页面。
  2. 点击 xxx。
  3. 输入 xxx。
  4. 出现报错 xxx。

是 UEditor 的 BUG 还是组件的 BUG
初步判断一下是因为 UEditor 导致的报错,还是由于本仓库的 vue-ueditor-wrap 组件导致的报错。

你是否查阅了 README 中的常见问题和其他 ISSUE
已查阅,没有发现我遇到的问题

截图
如果可能,提供截图

开发环境

  • 操作系统: [e.g. Win10]
  • 浏览器: [e.g. 谷歌 71.0.3578.98 版本]
  • 组件版本: [e.g. v2.3.0]
  • 是否使用了本仓库下载的 UEditor 资源文件: [e.g. 否]
  • 是否使用了我提供的 serverUrl: [e.g. http://35.201.165.105:8000/controller.php]

额外说明
如果可能请提供一个复现问题的 GitHub 仓库地址

封装以后如何调用原生的detroy方法?

封装以后的实例上找不到原生的方法
在以下场景会报错
绑定的value,在跳转新页面前有时候会做清空操作,这时候value的值发生变化,但是Ueditor的绑定是一个异步过程,此时页面已销毁,找不到UE实例,DOM渲染会出错

Uncaught TypeError: Cannot set property 'innerHTML' of null
at baidu.editor.ui.Message.setContent (ueditor.all.min.js:17)
at baidu.editor.ui.Message.reset (ueditor.all.min.js:17)
at UE.Editor. (ueditor.all.min.js:18)
at UE.Editor.fireEvent (ueditor.all.min.js:7)
at UE.Editor.trigger (ueditor.all.min.js:7)
at ueditor.all.min.js:18

如果没有文字,直接上传视频,v-model的值是空的,输入一个字符,就都有了

你遇到了什么 BUG
简单描述你遇到的 BUG。

如何复现
复现 BUG 的步骤:

  1. 进入 xxx 页面。
  2. 点击 xxx。
  3. 输入 xxx。
  4. 出现报错 xxx。

是 UEditor 的 BUG 还是组件的 BUG
初步判断一下是因为 UEditor 导致的报错,还是由于本仓库的 vue-ueditor-wrap 组件导致的报错。

你是否查阅了 README 中的常见问题和其他 ISSUE
已查阅,没有发现我遇到的问题

截图
如果可能,提供截图

开发环境

  • 操作系统: [e.g. Win10]
  • 浏览器: [e.g. 谷歌 71.0.3578.98 版本]
  • 组件版本: [e.g. v2.3.0]
  • 是否使用了本仓库下载的 UEditor 资源文件: [e.g. 否]
  • 是否使用了我提供的 serverUrl: [e.g. http://35.201.165.105:8000/controller.php]

额外说明
如果可能请提供一个复现问题的 GitHub 仓库地址

频繁切换页面时报错

报错信息:
image
此报错会阻塞路由的跳转。
另外频繁切换时还会有其他报错:
image
请问如何解决?

想请教下有关修改ueditor源码的问题

想请教,我看了下你的工具中是引入的ueditor.all.min.js
如果我想修改ueditor中的源码里的内容是不是只能通过改ueditor.all.js?
这样的话是不是不能生效?

上传视频和音频遇到的bug

我在用你的组件的时候,上传视频和音频的时候需要把这个地方改成embed,不知道你是实现的的呢?请大佬告知一下。小白感激不尽。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.