Remove extra space in CJK post

With CJK language and IME turned on, typing text in the post field and
pressing enter caused an extra space to be inserted. So I deleted the
code.
This commit is contained in:
SENOO, Ken 2022-11-18 16:35:53 +09:00
parent a4005b8fa5
commit 45371fb4d5

View File

@ -3385,13 +3385,7 @@ $('body').on('keyup', 'div.queet-box-syntax', function(e) {
var cursorPosArray = getSelectionInElement(queetBox[0]); var cursorPosArray = getSelectionInElement(queetBox[0]);
var cursorPos = cursorPosArray[0]; var cursorPos = cursorPosArray[0];
// add space before linebreaks (to separate mentions in beginning of new lines when .text():ing later) if(e.keyCode != '40' && e.keyCode != '38' && e.keyCode != '13' && e.keyCode != '9') {
if(e.keyCode == '13') {
e.preventDefault();
var range = createRangeFromCharacterIndices(queetBox[0], cursorPos, cursorPos);
range.insertNode(document.createTextNode(" \n"));
}
else if(e.keyCode != '40' && e.keyCode != '38' && e.keyCode != '13' && e.keyCode != '9') {
var contents = queetBox.text().substring(0,cursorPos); var contents = queetBox.text().substring(0,cursorPos);
var mentionPos = contents.lastIndexOf('@'); var mentionPos = contents.lastIndexOf('@');
var check_contents = contents.substring(mentionPos - 1, cursorPos); var check_contents = contents.substring(mentionPos - 1, cursorPos);
@ -3459,13 +3453,7 @@ $('body').on('keyup', 'div.queet-box-syntax', function(e) {
var cursorPosArray = getSelectionInElement(queetBox[0]); var cursorPosArray = getSelectionInElement(queetBox[0]);
var cursorPos = cursorPosArray[0]; var cursorPos = cursorPosArray[0];
// add space before linebreaks (to separate mentions in beginning of new lines when .text():ing later) if(e.keyCode != '40' && e.keyCode != '38' && e.keyCode != '13' && e.keyCode != '9') {
if(e.keyCode == '13') {
e.preventDefault();
var range = createRangeFromCharacterIndices(queetBox[0], cursorPos, cursorPos);
range.insertNode(document.createTextNode(" \n"));
}
else if(e.keyCode != '40' && e.keyCode != '38' && e.keyCode != '13' && e.keyCode != '9') {
var contents = queetBox.text().substring(0,cursorPos); var contents = queetBox.text().substring(0,cursorPos);
var mentionPos = contents.lastIndexOf('!'); var mentionPos = contents.lastIndexOf('!');
var check_contents = contents.substring(mentionPos - 1, cursorPos); var check_contents = contents.substring(mentionPos - 1, cursorPos);