Time:11-04
CodePudding user response:
custom upload audio button, use the iframe or audio is inserted into the content of
import Audio from '../.. Quill/audio 'Quill. Register (Audio, true)
https://blog.csdn.net/qq_43526066/article/details/92829794
Let quill=this. $refs. MyQuillEditor. Quill.//get The let length=quill. Selection. SavedRange. Index;//get focus subscript Quill. PasteHTML (length, ` & lt; Iframe SRC="https://bbs.csdn.net/topics/static/videos/audio.mp4" & gt; </iframe> `)
The import Vue from 'Vue' Import VueQuillEditor from 'vue - quill - editor' The import 'quill/dist/quill. Core. CSS' The import 'quill/dist/quill. Snow. CSS' The import 'quill/dist/quill. Mercifully. CSS' Vue. Use (VueQuillEditor) //HTML Const BlockEmbed=Quill. Import (' blots/block/embed ') Const Link=Quill. Import (' formats/Link ') Export the default class Audio extends BlockEmbed {The static create (value) {Let the node=super. The create (value) Node. The setAttribute (' controls', 'controls') Node. The setAttribute (' SRC ', enclosing sanitize (value)) Return the node } The static sanitize (url) {The return Link. Sanitize (url) } The static value (domNode) {Return domNode. GetAttribute (' SRC ') } } //HTML. Vue The import PDF from 'PDFJS - dist' The import Audio from '../../js/audio. Js' Audio. BlotName='Audio' Audio. TagName='Audio' Quill. Register (Audio) </script> <script> Let quill=this. $refs. MyQuillEditor. Quill.//get The let length=quill. Selection. SavedRange. Index;//get focus subscript Quill. PasteHTML (length, ` & lt; Audio SRC="https://bbs.csdn.net/topics/static/videos/notify.mp3" & gt; `) </script>
Page link:https//www.codepudding.com/frontend/77043.html