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

Commit

Permalink
fix(more formats toolbar): fix more formats toolbar can't sync with c…
Browse files Browse the repository at this point in the history
…ell, fix mac delete button can't delete cell, fix can't delete cell with inline-style
  • Loading branch information
javahuang committed Sep 29, 2020
1 parent f24eb7f commit 23fcb13
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/controllers/constant.js

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

2 changes: 1 addition & 1 deletion src/controllers/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ export function keyboardInitial(){

selectHightlightShow();
}
else if (kcode == keycode.DELETE) {
else if (kcode == keycode.DELETE || kcode == keycode.BACKSPACE) {
$("#luckysheet-delete-text").click();

event.preventDefault();
Expand Down
29 changes: 26 additions & 3 deletions src/controllers/menuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,13 @@ const menuButton = {
//luckysheet-icon-fmt-other-menuButton_sub
$("body").append(menu+submenu);
$menuButton = $("#" + menuButtonId).width(250);
_this.focus($menuButton);

$menuButton.find(".luckysheet-cols-menuitem").click(function(){
$menuButton.hide();
luckysheetContainerFocus();

let $t = $(this), itemvalue = $t.attr("itemvalue");
let $t = $(this), itemvalue = $t.attr("itemvalue"),itemname = $t.attr("itemname");;
$("#luckysheet-icon-fmt-other").find(".luckysheet-toolbar-menu-button-caption").html(" "+ itemname +" ");

if(itemvalue == "fmtOtherSelf"){
return;
Expand All @@ -448,6 +448,12 @@ const menuButton = {
luckysheetMoreFormat.createDialog(itemvalue);
luckysheetMoreFormat.init();
})
} else {
const text =$(this).find(".luckysheet-toolbar-menu-button-caption").text().trim();
const format = locale_defaultFmt.find(f => f.text === text);
if(format) {
_this.focus($menuButton, format.value);
}
}

let userlen = $(this).outerWidth();
Expand Down Expand Up @@ -3416,6 +3422,23 @@ const menuButton = {
$icon.removeAttr("class").addClass("luckysheet-icon-img-container luckysheet-icon-img luckysheet-icon-rotation-" + itemvalue + iconfontObject[itemvalue]);
$menuButton.hide();
}
else if(attr == "ct") {
let $menuButton = $("#luckysheet-icon-fmt-other");
const _locale = locale();
const locale_defaultFmt = _locale.defaultFmt;
if(!foucsStatus) {
$menuButton.find(".luckysheet-toolbar-menu-button-caption").html(" "+ locale_defaultFmt[0].text +" ");
return;
}
const {fa} = foucsStatus;
const format = locale_defaultFmt.find(f => f.value === fa);
if(format) {
$menuButton.find(".luckysheet-toolbar-menu-button-caption").html(" "+ format.text +" ");
} else {
const otherFormat = locale_defaultFmt.find(f => f.value === "fmtOtherSelf");
$menuButton.find(".luckysheet-toolbar-menu-button-caption").html(" "+ otherFormat.text +" ");
}
}
},
inputMenuButtonFocus:function(focusTarget){
var w = window.getSelection();
Expand All @@ -3433,7 +3456,7 @@ const menuButton = {
},
menuButtonFocus: function(d, r, c){
let _this = this;
let foucsList = ["bl", "it", "cl", "ff", "ht", "vt", "fs", "tb", "tr"];
let foucsList = ["bl", "it", "cl", "ff", "ht", "vt", "fs", "tb", "tr", "ct"];
const _locale = locale();
for(let i = 0; i < foucsList.length; i++){
let attr = foucsList[i];
Expand Down
3 changes: 3 additions & 0 deletions src/controllers/rowColumnOperation.js
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,9 @@ export function rowColumnOperationInitial(){
if(getObjType(d[r][c]) == "object"){
delete d[r][c]["m"];
delete d[r][c]["v"];
if(d[r][c]["ct"] != null) {
delete d[r][c]["ct"]["s"]
}

if(d[r][c]["f"] != null){
delete d[r][c]["f"];
Expand Down
2 changes: 1 addition & 1 deletion src/css/iconCustom.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#luckysheet-icon-morebtn{
position: absolute;
right: 30px;
right: 15px;
}


Expand Down
9 changes: 9 additions & 0 deletions src/css/luckysheet-core.css
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,15 @@
top: -1660px;
} */

#luckysheet-icon-fmt-other .luckysheet-toolbar-menu-button-caption {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 55px;
margin-left: 1px;
text-align: center;
}

#luckysheet-icon-font-family .luckysheet-toolbar-menu-button-caption {
overflow: hidden;
text-overflow: ellipsis;
Expand Down

0 comments on commit 23fcb13

Please sign in to comment.