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

Commit

Permalink
feat: add underline button
Browse files Browse the repository at this point in the history
  • Loading branch information
PIMBA authored and 王雍昊 committed Oct 27, 2020
1 parent f7c609e commit df56ba6
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/controllers/constant.js

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

4 changes: 4 additions & 0 deletions src/controllers/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,10 @@ export function keyboardInitial(){
//Alt + Shift + 5(删除线)
$("#luckysheet-icon-strikethrough").click();
}
// else if (altKey && (kcode == 54 || kcode == 102)) {
// //Alt + Shift + 6(删除线)
// $("#luckysheet-icon-underline").click();
// }

event.preventDefault();
}
Expand Down
32 changes: 30 additions & 2 deletions src/controllers/menuButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,27 @@ const menuButton = {
_this.menuButtonFocus(d, row_index, col_index);
});

//下划线
$("#luckysheet-icon-underline").mousedown(function(e){
hideMenuByCancel(e);
e.stopPropagation();
}).click(function(){
let d = editor.deepCopyFlowData(Store.flowdata);
let row_index = Store.luckysheet_select_save[0]["row_focus"],
col_index = Store.luckysheet_select_save[0]["column_focus"];
let foucsStatus = _this.checkstatus(d, row_index, col_index, "un");

if(foucsStatus == 1){
foucsStatus = 0;
}
else{
foucsStatus = 1;
}

_this.updateFormat(d, "un", foucsStatus);
_this.menuButtonFocus(d, row_index, col_index);
});

//条件格式
$("#luckysheet-icon-conditionformat").click(function(){
let menuButtonId = $(this).attr("id") + "-menuButton";
Expand Down Expand Up @@ -3372,7 +3393,6 @@ const menuButton = {
if(_locale==null){
_locale = locale();
}

const locale_fontarray = _locale.fontarray;
const locale_fontjson = _locale.fontjson;

Expand Down Expand Up @@ -3400,6 +3420,14 @@ const menuButton = {
$("#luckysheet-icon-strikethrough").removeClass("luckysheet-toolbar-button-hover");
}
}
else if(attr == "un"){
if(foucsStatus != "0"){
$("#luckysheet-icon-underline").addClass("luckysheet-toolbar-button-hover");
}
else{
$("#luckysheet-icon-underline").removeClass("luckysheet-toolbar-button-hover");
}
}
else if(attr == "ff"){
let menuButtonId = "luckysheet-icon-font-family-menuButton";
let $menuButton = $("#" + menuButtonId);
Expand Down Expand Up @@ -3560,7 +3588,7 @@ const menuButton = {
},
menuButtonFocus: function(d, r, c){
let _this = this;
let foucsList = ["bl", "it", "cl", "ff", "ht", "vt", "fs", "tb", "tr", "ct"];
let foucsList = ["bl", "it", "cl", "ff", "ht", "vt", "fs", "tb", "tr", "ct", "un"];
const _locale = locale();
for(let i = 0; i < foucsList.length; i++){
let attr = foucsList[i];
Expand Down
2 changes: 2 additions & 0 deletions src/controllers/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ export function menuToolBarWidth() {
$('#luckysheet-icon-bold').offset().left,
$('#luckysheet-icon-italic').offset().left,
$('#luckysheet-icon-strikethrough').offset().left,
$('#luckysheet-icon-underline').offset().left,
$('#luckysheet-icon-text-color').offset().left,
$('#luckysheet-icon-cell-color').offset().left,
$('#luckysheet-icon-border-all').offset().left,
Expand Down Expand Up @@ -347,6 +348,7 @@ export function menuToolBarWidth() {
'#luckysheet-icon-bold',
'#luckysheet-icon-italic',
'#luckysheet-icon-strikethrough',
'#luckysheet-icon-underline',
['#luckysheet-icon-text-color','#luckysheet-icon-text-color-menu','#toolbar-separator-text-color'],
['#luckysheet-icon-cell-color','#luckysheet-icon-cell-color-menu'],
['#luckysheet-icon-border-all','#luckysheet-icon-border-menu'],
Expand Down
1 change: 1 addition & 0 deletions src/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -8826,6 +8826,7 @@ export default {
bold: 'Bold (Ctrl+B)',
italic : 'Italic (Ctrl+I)',
strikethrough: 'Strikethrough (Alt+Shift+5)',
underline: 'Underline',
textColor: 'Text color',
chooseColor: 'choose color',
resetColor: 'Reset',
Expand Down
1 change: 1 addition & 0 deletions src/locale/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -8826,6 +8826,7 @@ export default {
bold: 'Negrita (Ctrl+B)',
italic : 'Itálica (Ctrl+I)',
strikethrough: 'Tachar (Alt+Shift+5)',
underline: 'Guion bajo',
textColor: 'Color texto',
chooseColor: 'elegir color',
resetColor: 'Reinicializar',
Expand Down
1 change: 1 addition & 0 deletions src/locale/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -9052,6 +9052,7 @@ export default {
bold: '粗体 (Ctrl+B)',
italic: '斜体 (Ctrl+I)',
strikethrough: '删除线 (Alt+Shift+5)',
underline: '下划线',
textColor: '文本颜色',
chooseColor: '颜色选择',
resetColor: '重置颜色',
Expand Down

0 comments on commit df56ba6

Please sign in to comment.