bunnyquery 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bunnyquery.js +22 -5
- package/package.json +1 -1
package/bunnyquery.js
CHANGED
|
@@ -1035,6 +1035,7 @@
|
|
|
1035
1035
|
this._loadingOlder = false;
|
|
1036
1036
|
this._loadingFirstHistory = false;
|
|
1037
1037
|
this._initialHistoryLoaded = false;
|
|
1038
|
+
this._isPromptComposing = false;
|
|
1038
1039
|
|
|
1039
1040
|
this.refs = {};
|
|
1040
1041
|
|
|
@@ -1456,12 +1457,11 @@
|
|
|
1456
1457
|
rows: '1',
|
|
1457
1458
|
placeholder: `Ask anything about ${this.projectName || 'the project'}...`,
|
|
1458
1459
|
oninput: (e) => this._autoGrow(e.target),
|
|
1459
|
-
onkeydown: (e) =>
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
this._sendMessage();
|
|
1463
|
-
}
|
|
1460
|
+
onkeydown: (e) => this._handlePromptEnter(e),
|
|
1461
|
+
oncompositionstart: () => {
|
|
1462
|
+
this._isPromptComposing = true;
|
|
1464
1463
|
},
|
|
1464
|
+
oncompositionend: () => this._handlePromptCompositionEnd(),
|
|
1465
1465
|
});
|
|
1466
1466
|
const sendBtn = $('button', { type: 'submit', class: 'btn' }, 'Send');
|
|
1467
1467
|
|
|
@@ -1609,6 +1609,23 @@
|
|
|
1609
1609
|
el.style.height = Math.min(el.scrollHeight, 200) + 'px';
|
|
1610
1610
|
}
|
|
1611
1611
|
|
|
1612
|
+
_handlePromptCompositionEnd() {
|
|
1613
|
+
this._isPromptComposing = false;
|
|
1614
|
+
if (this.refs.textarea) {
|
|
1615
|
+
this._autoGrow(this.refs.textarea);
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
_handlePromptEnter(e) {
|
|
1620
|
+
if (e.key !== 'Enter' || e.shiftKey) return;
|
|
1621
|
+
if (e.isComposing || this._isPromptComposing || e.keyCode === 229 || e.which === 229) {
|
|
1622
|
+
return;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
e.preventDefault();
|
|
1626
|
+
Promise.resolve().then(() => this._sendMessage());
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1612
1629
|
_anyPending() {
|
|
1613
1630
|
return this.messages.some((m) => m.isPending);
|
|
1614
1631
|
}
|