Vanessa219 / vditor

♏ 一款浏览器端的 Markdown 编辑器,支持所见即所得(富文本)、即时渲染(类似 Typora)和分屏预览模式。An In-browser Markdown editor, support WYSIWYG (Rich Text), Instant Rendering (Typora-like) and Split View modes.
https://b3log.org/vditor
MIT License
8.28k stars 855 forks source link

录音保存到OSS失败 #760

Closed eeezae closed 3 years ago

eeezae commented 4 years ago

请先看《提问的智慧》,并尝试到链滴搜寻资料解决问题。


编辑模式

请选择你遇到问题时使用的编辑模式(把正常情况模式删掉):

描述问题

在VUE中使用vditor,通过配置options.uploadhandler上传文件到OSS(没有经过后台),上传文件和返回上传结果都成功(音频或图片),但是只有图片正常插入编辑器,音频插入失败(使用图片/文件上传功能成功插入音频文件,使用录音功能上传的音频文件插入编辑器失败),且录音->取消录音后编辑器处于disabled锁住状态无法编辑输入。

    const _that = this
    this.editor = new Vditor('editor', {
      height: 800,
      upload: {
        handler(files) {
          let aliOss = new AliOss()

          aliOss.putAll(files).then(res => {
            for (const r of res) {
              switch (r.type) {
                case 'video/webm':
                case 'audio/wav':
                  _that.editor.insertValue('<audio controls="controls" src="' + r.url + '"></audio>')
                  break
                case 'image/png':
                case 'image/jpg':
                case 'image/jpeg':
                case 'image/gif':
                  _that.editor.insertValue('![](' + r.url + ')')
                  break
                default:
                  return 'upload Error'
              }
            }
          })

        }
      },
      toolbarConfig: {
        pin: true
      },
      cache: {
        enable: false
      },
      after: () => {
        _that.editor.setValue('hello, Vditor + Vue!')
      }
    })

期待的结果

请尽量清晰精准地描述你所期待的结果。

截屏或录像

image

Vanessa219 commented 4 years ago

你看一下有没有什么报错信息,上传都是走的一个方法

eeezae commented 4 years ago

点录音完成后Console里没有出现报错,上传成功了,返回结果也能拿的到文件地址,但是编辑器没有插入,然后编辑器锁住卡死状态。

eeezae commented 4 years ago

网站标签栏还是有录音按钮的录音中状态,录音事件似乎没有被正常结束。

Vanessa219 commented 4 years ago

你在这个地方打个断点看看,我不太好分析问题

 aliOss.putAll(files).then(res => {
            for (const r of res) {
Vanessa219 commented 3 years ago

没问题的话我就先关闭了

jxzhn commented 2 years ago

我也遇到了这个问题,只要是用handler自己处理上传(哪怕handler是个空函数),录音结束后编辑器仍然被遮罩覆盖无法输入(但工具栏可以正常点击),浏览器显示仍在录音。