@edifice.io/tiptap-extensions
Version:
Edifice Rich Text Editor Extensions
3 lines (2 loc) • 788 B
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const core=require("@tiptap/core");class SS_Node extends core.Node{static create(config){return core.Node.create(config)}}const SpeechSynthesis=SS_Node.create({name:"speechSynthesis",addOptions(){return{lang:"fr-FR",pitch:1}},addCommands(){return{startSpeechSynthesis:()=>({commands})=>(this.speechSynthesis=new SpeechSynthesisUtterance,this.speechSynthesis.lang=this.options.lang,this.speechSynthesis.pitch=this.options.pitch,this.speechSynthesis.text=this.editor.getText(),window.speechSynthesis.speak(this.speechSynthesis),commands),stopSpeechSynthesis:()=>({commands})=>(window.speechSynthesis.cancel(),commands)}}});exports.SpeechSynthesis=SpeechSynthesis;
//# sourceMappingURL=speech-synthesis.cjs.map