Browse Source

feat: add underline button

master
PIMBA 5 years ago
committed by 王雍昊
parent
commit
df56ba6f35
  1. 14
      src/controllers/constant.js
  2. 4
      src/controllers/keyboard.js
  3. 32
      src/controllers/menuButton.js
  4. 2
      src/controllers/resize.js
  5. 1
      src/locale/en.js
  6. 1
      src/locale/es.js
  7. 1
      src/locale/zh.js

14
src/controllers/constant.js

@ -943,6 +943,20 @@ function menuToolBar (){
</div>
</div>
</div>
<div class="luckysheet-toolbar-button luckysheet-inline-block" data-tips="${toolbar.underline}"
id="luckysheet-icon-underline" role="button" style="user-select: none;">
<div class="luckysheet-toolbar-button-outer-box luckysheet-inline-block"
style="user-select: none;">
<div class="luckysheet-toolbar-button-inner-box luckysheet-inline-block"
style="user-select: none;">
<div class="luckysheet-icon luckysheet-inline-block " style="user-select: none;">
<div aria-hidden="true" class="luckysheet-icon-img-container luckysheet-icon-img luckysheet-icon-underline iconfont icon-wenbenxiahuaxian"
style="user-select: none;">
</div>
</div>
</div>
</div>
</div>
<div class="luckysheet-toolbar-button-split-left luckysheet-toolbar-button luckysheet-inline-block luckysheet-icon-text-color"
data-tips="${toolbar.textColor}" id="luckysheet-icon-text-color" role="button" style="user-select: none;">
<div class="luckysheet-toolbar-button-outer-box luckysheet-inline-block"

4
src/controllers/keyboard.js

@ -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();
}

32
src/controllers/menuButton.js

@ -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";
@ -3372,7 +3393,6 @@ const menuButton = {
if(_locale==null){
_locale = locale();
}
const locale_fontarray = _locale.fontarray;
const locale_fontjson = _locale.fontjson;
@ -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);
@ -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];

2
src/controllers/resize.js

@ -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,
@ -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'],

1
src/locale/en.js

@ -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',

1
src/locale/es.js

@ -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',

1
src/locale/zh.js

@ -9052,6 +9052,7 @@ export default {
bold: '粗体 (Ctrl+B)',
italic: '斜体 (Ctrl+I)',
strikethrough: '删除线 (Alt+Shift+5)',
underline: '下划线',
textColor: '文本颜色',
chooseColor: '颜色选择',
resetColor: '重置颜色',

Loading…
Cancel
Save