Skip to content

Commit

Permalink
fix: inflection input selector (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwyywm authored Oct 5, 2023
1 parent 54ede6d commit 895bce9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/providers/inflection.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class InflectionPi extends Provider {

static handleInput(input) {
this.getWebview().executeJavaScript(`{
var inputElement = document.querySelector('.text-muted textarea');
var inputElement = document.querySelector('textarea[placeholder="Talk with Pi"]');
if (inputElement) {
var nativeTextAreaValueSetter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, "value").set;
nativeTextAreaValueSetter.call(inputElement, \`${input}\`);
Expand All @@ -21,9 +21,8 @@ class InflectionPi extends Provider {
}

static handleSubmit() {
// this does not work yet.. how to fix?
this.getWebview().executeJavaScript(`{
var inputElement = document.querySelector('.text-muted textarea');
var inputElement = document.querySelector('textarea[placeholder="Talk with Pi"]');
if (inputElement) {
const event = new KeyboardEvent('keydown', {
key: 'Enter',
Expand Down

0 comments on commit 895bce9

Please sign in to comment.