美文网首页
ckEditor5踩坑(1)

ckEditor5踩坑(1)

作者: 沫tiny | 来源:发表于2019-12-26 11:23 被阅读0次

1.插入媒体

const config = {
 mediaEmbed: {
    previewsInData: true,
    providers: [
      {
        // A URL regexp or an array of URL regexps:
        // url: /^example\.com\/media\/(\w+)/,
        name: 'allow-all',
        url: /^.+/,    //适配所有url
        html: match => {
          // Array.prototype.slice.call(match)
          // console.log(match)
          // console.log(match['input'])
          const id = match['input']
          // match.map(item => {
          //   console.log(item)
          // })
          // console.log(id)
          return (
            '<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 30%;">' +
              `<iframe src="${id}" ` +
                'style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" ' +
                'frameborder="0" allowtransparency="true" allow="encrypted-media"' + 'allow="autoplay; encrypted-media">' +
              '</iframe>' +
            '</div>'
          )
        }
      }
    ]
  },
}

2.插入超链接

const config = {
  link: {
    addTargetToExternalLinks: true
  }
}

相关文章

  • ckEditor5踩坑(1)

    1.插入媒体 2.插入超链接

  • ckEditor5踩坑(2)

    1.上传图片(使用自定义上传适配器的js文件) 2.使用适配器

  • CKEditor5--食用方式

    我想我当初一定是脑子抽了才会选择CKEditor5的 , 再简洁好看的UI , 也不值得我踩的这些坑. 前方高能预...

  • Android 日常踩坑

    1、Android NDK开发踩坑 踩坑环境 Android Studio 3.4.1,JDK 1.8 1、为什么...

  • 应届生和职场新人一定要知道的5个观点

    刚接触社会的应届生和职场新人总会踩很多坑,我把自己踩坑的感悟分享出来,避免大家踩坑。 文末有福利 1.以目标为导向...

  • JavaScrip-StepPitGuide《JavaScrip

    《JavaScript踩坑指南》JavaScrip-StepPitGuide? 《JavaScript踩坑指南》 ...

  • 算法踩坑6-二叉搜索树排序

    背景 接上面五篇文章算法踩坑-快速排序 算法踩坑2-插入排序 算法踩坑3-堆排序 算法踩坑4-冒泡排序 ...

  • Cordova踩坑日记

    Cordova踩坑日记 1.配置环境 ​ 配置SDK踩了很多坑,其实只需要下载一个 android studi...

  • 算法踩坑5-归并排序

    背景 接上面四篇文章算法踩坑-快速排序 算法踩坑2-插入排序 算法踩坑3-堆排序 算法踩坑4-冒泡排序 来...

  • D1094:踩坑的价值最大化

    是人就会踩坑,不踩坑理论上就不属于人类,踩坑是人之常情,能回头站在坑边反思,才是对踩过的的坑价值最大化的体现,要不...

网友评论

      本文标题:ckEditor5踩坑(1)

      本文链接:https://www.haomeiwen.com/subject/inykoctx.html