Skip to content
This repository has been archived by the owner on Mar 28, 2024. It is now read-only.

Commit

Permalink
fix(input range bug): fix it
Browse files Browse the repository at this point in the history
  • Loading branch information
DR-Univer committed Sep 27, 2020
1 parent 2d6e73e commit 5412721
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/controllers/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,11 @@ export function keyboardInitial(){
formulaMoveEvent("right", ctrlKey, shiftKey,event);
}
else if (!((kcode >= 112 && kcode <= 123) || kcode <= 46 || kcode == 144 || kcode == 108 || event.ctrlKey || event.altKey || (event.shiftKey && (kcode == 37 || kcode == 38 || kcode == 39 || kcode == 40 || kcode == keycode.WIN || kcode == keycode.WIN_R || kcode == keycode.MENU))) || kcode == 8 || kcode == 32 || kcode == 46 || (event.ctrlKey && kcode == 86)) {
formula.functionInputHanddler($("#luckysheet-functionbox-cell"), $("#luckysheet-rich-text-editor"), kcode);
setCenterInputPosition(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1], Store.flowdata);
if(event.target.id!="luckysheet-input-box" && event.target.id!="luckysheet-rich-text-editor"){
formula.functionInputHanddler($("#luckysheet-functionbox-cell"), $("#luckysheet-rich-text-editor"), kcode);
setCenterInputPosition(Store.luckysheetCellUpdate[0], Store.luckysheetCellUpdate[1], Store.flowdata);
}

}
}).keyup(function (e) {
let kcode = e.keyCode;
Expand Down
27 changes: 24 additions & 3 deletions src/global/formula.js
Original file line number Diff line number Diff line change
Expand Up @@ -3238,7 +3238,7 @@ const luckysheetformula = {
let value = $editer.text(),
valuetxt = value;

if (value.length > 0 && !(value1txt.substr(0, 1) != "=" && value1.indexOf("span")>-1) && (kcode != 229 || value.length == 1)) {
if (value.length > 0 && value1txt.substr(0, 1) == "=" && (kcode != 229 || value.length == 1)) {
value = _this.functionHTMLGenerate(value);
value1 = _this.functionHTMLGenerate(value1txt);

Expand Down Expand Up @@ -3266,10 +3266,31 @@ const luckysheetformula = {
}

$functionbox.html(value);


}
else if(value1txt.substr(0, 1) != "=" && value1.indexOf("span")>-1){
else if(value1txt.substr(0, 1) != "=" && (kcode != 229 || value.length == 1)){
//&& value1.indexOf("span")>-1
// $editer.html(value1);
$functionbox.html(value);
let w = window.getSelection();
if(w!=null && w.type!="None"){
let range = w.getRangeAt(0);
let c = range.startContainer;

if(c.id=="luckysheet-rich-text-editor" || $(c).closest("#luckysheet-rich-text-editor")){
$functionbox.html(value);
}
else if(c.id=="luckysheet-functionbox-cell" || $(c).closest("#luckysheet-functionbox-cell")){
if(value1.indexOf("span")>-1){

}
else{
$editer.html(value);
}
}

}

}

_this.rangestart = false;
Expand Down

0 comments on commit 5412721

Please sign in to comment.