Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions speech-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@

// gather inputEl data
var nextNode = inputEl.nextSibling;
var isHTMLEditor = false;
if (inputEl.classList.contains("textarea_editor")) {
isHTMLEditor = true;
console.log("speech-input applied to textarea_editor");
}
var parent = inputEl.parentNode;
var inputRightBorder = parseInt(getComputedStyle(inputEl).borderRightWidth, 10);
var buttonSize = 0.8 * (inputEl.dataset.buttonsize || inputEl.offsetHeight);
Expand All @@ -36,6 +41,7 @@
if (!wrapper.classList.contains('si-wrapper')) {
wrapper = document.createElement('div');
wrapper.classList.add('si-wrapper');
wrapper.style.width = "100%"
wrapper.appendChild(parent.removeChild(inputEl));
newWrapper = true;
}
Expand Down Expand Up @@ -133,8 +139,12 @@
transcript = !prefix || isSentence ? capitalize(transcript) : transcript;

// append transcript to cached input value
inputEl.value = prefix + transcript;

if (isHTMLEditor) {
$('#' + inputEl.id).data("wysihtml5").editor.setValue(prefix + transcript);
}
else {
inputEl.value = prefix + transcript;
}
// set cursur and scroll to end
inputEl.focus();
if (inputEl.tagName === 'INPUT') {
Expand Down