zoukankan      html  css  js  c++  java
  • Quill自定义插入视频video实例

    import Quill from 'quill'
    
    const BlockEmbed = Quill.import('blots/block/embed')
    class VideoBlot extends BlockEmbed {
      static create(value) {
        let node = super.create()
        node.setAttribute('src', value.url)
        node.setAttribute('controls', value.controls)
        node.setAttribute('width', value.width)
        node.setAttribute('height', value.height)
        node.setAttribute('webkit-playsinline', true)
        node.setAttribute('playsinline', true)
        node.setAttribute('x5-playsinline', true)
        return node;
      }
    
      static value(node) {
        return {
          url: node.getAttribute('src'),
          controls: node.getAttribute('controls'),
           node.getAttribute('width'),
          height: node.getAttribute('height')
        };
      }
    }
    
    VideoBlot.blotName = 'simple_video'
    VideoBlot.tagName = 'video'
    Quill.register(VideoBlot)
    
    // 使用
    this.quill.insertEmbed(range.index, 'simple_video', {
      url,
      controls: 'controls',
       '100%',
      height: '100%'
    })
    
  • 相关阅读:
    0827IO作业
    0927集合作业
    初学集合,以及泛型
    异常课——抛出
    Python环境变量配置
    安装Python
    MySQL多表操作
    MySQL增删改查
    Group by分组详解
    MySQL常用函数
  • 原文地址:https://www.cnblogs.com/ZweiZhao/p/13390927.html
Copyright © 2011-2022 走看看