mirror of
https://github.com/lxsang/antd-web-apps
synced 2025-07-23 17:19:47 +02:00
allow tab, math and highlight in comments
This commit is contained in:
@ -94,6 +94,20 @@ class QuickTalk {
|
||||
}
|
||||
});
|
||||
let ta = document.createElement("textarea");
|
||||
ta.onkeydown = (e) => {
|
||||
if (e.keyCode === 9) {
|
||||
// tab was pressed
|
||||
// get caret position/selection
|
||||
var val = ta.value, start = ta.selectionStart, end = ta.selectionEnd;
|
||||
// set textarea value to: text before caret + tab + text after caret
|
||||
ta.value =
|
||||
val.substring(0, start) + " " + val.substring(end);
|
||||
// put caret at right position again
|
||||
ta.selectionStart = ta.selectionEnd = start + 4;
|
||||
// prevent the focus lose
|
||||
return false;
|
||||
}
|
||||
};
|
||||
let footer = document.createElement("div");
|
||||
footer.setAttribute("class", "quick-talk-compose-footer");
|
||||
this.status_el = document.createElement("div");
|
||||
@ -190,6 +204,9 @@ class QuickTalk {
|
||||
ret.result.forEach((comment) => {
|
||||
this.show_comment(container, comment, true);
|
||||
});
|
||||
if (this.options.onload) {
|
||||
this.options.onload();
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.error(ret.error);
|
||||
|
Reference in New Issue
Block a user