Files
2026-03-22 03:21:45 +02:00

1 line
1.4 KiB
JavaScript

"use strict";var e=function(e){return e&&e.__esModule?e["default"]:e},t=e(require("react")),n=e(require("../../toolbar/run-configuration")),o=atom.grammars.getGrammars(),a=void 0;o.forEach(function(e){"XML"===e.name&&(a=e)});var s=t.createClass({displayName:"SSMLView",onMouseDown:function(){var e=t.findDOMNode(this.refs.editor),o=e.getModel(),a=new XMLHttpRequest,s={prompt:o.getText(),locale:"en-us",voice:"bw",duration_stretch:1,pitch:120,pitchBandwidth:35,mode:"ssml",outputMode:"stream",timeout:null};s=JSON.stringify(s);var i=n.host+"/tts_speak";i=i.replace("8181/registry","8089"),a.open("POST",i,!0),a.onreadystatechange=function(){4==a.readyState&&204==a.status||4==a.readyState&&0==a.status&&console.log("TTS Service is unavailable")},a.send(s)},render:function(){return t.createElement("div",null,t.createElement("atom-text-editor",{ref:"editor",style:{height:200,width:"100%"}},this.props.content),t.createElement("div",{className:"block"},t.createElement("button",{onMouseDown:this.onMouseDown,className:"btn inline-block-tight"},t.createElement("i",{"class":"fa fa-volume-up"}),"Test Speech")))},componentDidMount:function(){var e=this,n=t.findDOMNode(this.refs.editor),o=n.getModel();o.setGrammar(a),this.disposable=o.onDidChange(function(){e.props.onChange(o.getText())})},componentWillUnmount:function(){this.disposable&&this.disposable.dispose()}});module.exports=function(e,n,o){return t.createElement(s,{key:n,content:e,onChange:o})};