我是Monaco-editor的新手。我在使用Windows 10机器的Chrome浏览器中使用0.15.6版的Monaco-editor。到目前为止,我正在尝试整合Microsoft的认知语音服务,但无法做到。我正在从识别服务获得响应,但是无法在摩纳哥编辑器中附加响应文本。我使用了摩纳哥编辑的ID,但是没有用。这是我到目前为止所做的
<div id="phraseDiv" style="height: 300px;">
<script>
require(['vs/editor/editor.main'], function() {
var editor = monaco.editor.create(document.getElementById('phraseDiv'), {
value: [ 'function x() {', '\tconsole.log("Hello world!");', '}' ].join('\n'), language: 'javascript' }); });
在演讲中,我正在使用以下代码
document.addEventListener("DOMContentLoaded", function () {
startRecognizeOnceAsyncButton =
document.getElementById("startRecognizeOnceAsyncButton");
subscriptionKey = document.getElementById("subscriptionKey");
serviceRegion = document.getElementById("serviceRegion");
phraseDiv = document.getElementById("phraseDiv");
startRecognizeOnceAsyncButton.addEventListener("click", function () {
speechConfig.speechRecognitionLanguage = "en-US";
var audioConfig = SpeechSDK.AudioConfig.fromDefaultMicrophoneInput();
recognizer = new SpeechSDK.SpeechRecognizer(speechConfig, audioConfig);
recognizer.recognizeOnceAsync(
function (result) {
startRecognizeOnceAsyncButton.disabled = false;
phraseDiv.innerText += result.text;
我需要为语音指定元素ID /类,而编辑器的ID不起作用。编辑器的正确类/标识是什么? 谢谢