Browse Source

Merge pull request #125 from PIMBA/add-button

feat: add underline button
master
mengshukeji 5 years ago
committed by GitHub
parent
commit
0afe5c99d7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      src/controllers/constant.js
  2. 4
      src/controllers/keyboard.js
  3. 32
      src/controllers/menuButton.js
  4. 58
      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

@ -1015,6 +1015,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";
@ -3373,7 +3394,6 @@ const menuButton = {
if(_locale==null){
_locale = locale();
}
const locale_fontarray = _locale.fontarray;
const locale_fontjson = _locale.fontjson;
@ -3401,6 +3421,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);
@ -3561,7 +3589,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];

58
src/controllers/resize.js

@ -352,97 +352,102 @@ export function menuToolBarWidth() {
ele:'#luckysheet-icon-strikethrough',
index:12,
}, //'Strikethrough (Alt+Shift+5)'
underline: {
ele:'#luckysheet-icon-underline',
index:13,
}, //'Strikethrough (Alt+Shift+6)'
textColor: {
ele:['#luckysheet-icon-text-color','#luckysheet-icon-text-color-menu','#toolbar-separator-text-color'],
index:13,
index:14,
}, //'Text color'
fillColor: {
ele:['#luckysheet-icon-cell-color','#luckysheet-icon-cell-color-menu'],
index:14,
index:15,
}, //'Cell color'
border: {
ele:['#luckysheet-icon-border-all','#luckysheet-icon-border-menu'],
index:15,
index:16,
}, //'border'
mergeCell: {
ele:['#luckysheet-icon-merge-button','#luckysheet-icon-merge-menu','#toolbar-separator-merge-cell'],
index:16,
index:17,
}, //'Merge cells'
horizontalAlignMode: {
ele:['#luckysheet-icon-align','#luckysheet-icon-align-menu'],
index:17,
index:18,
}, //'Horizontal alignment'
verticalAlignMode: {
ele:['#luckysheet-icon-valign','#luckysheet-icon-valign-menu'],
index:18,
index:19,
}, //'Vertical alignment'
textWrapMode: {
ele:['#luckysheet-icon-textwrap','#luckysheet-icon-textwrap-menu'],
index:19,
index:20,
}, //'Wrap mode'
textRotateMode: {
ele:['#luckysheet-icon-rotation','#luckysheet-icon-rotation-menu','#toolbar-separator-text-rotate'],
index:20,
index:21,
}, //'Text Rotation Mode'
image:{
image:{
ele:'#luckysheet-insertImg-btn-title',
index:21,
index:22,
}, //'Insert link'
link:{
link:{
ele:'#luckysheet-insertLink-btn-title',
index:22,
index:23,
}, //'Insert picture'
chart: {
ele:'#luckysheet-chart-btn-title',
index:23,
index:24,
}, //'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click)
postil: {
ele:'#luckysheet-icon-postil',
index:24,
index:25,
}, //'comment'
pivotTable: {
ele:['#luckysheet-pivot-btn-title','#toolbar-separator-pivot-table'],
index:25,
index:26,
}, //'PivotTable'
function: {
ele:['#luckysheet-icon-function','#luckysheet-icon-function-menu'],
index:26,
index:27,
}, //'formula'
frozenMode: {
ele:['#luckysheet-freezen-btn-horizontal','#luckysheet-icon-freezen-menu'],
index:27,
index:28,
}, //'freeze mode'
sortAndFilter: {
ele:'#luckysheet-icon-autofilter',
index:28,
index:29,
}, //'sort and filter'
conditionalFormat: {
ele:'#luckysheet-icon-conditionformat',
index:29,
index:30,
}, //'Conditional Format'
dataVerification: {
ele:'#luckysheet-dataVerification-btn-title',
index:30,
index:31,
}, // 'Data Verification'
splitColumn: {
ele:'#luckysheet-splitColumn-btn-title',
index:31,
index:32,
}, //'Split column'
screenshot: {
ele:'#luckysheet-chart-btn-screenshot',
index:32,
index:33,
}, //'screenshot'
findAndReplace: {
ele:'#luckysheet-icon-seachmore',
index:33,
index:34,
}, //'Find and Replace'
protection:{
ele:'#luckysheet-icon-protection',
index:34,
index:35,
}, // 'Worksheet protection'
print:{
print:{
ele:'#luckysheet-icon-print',
index:35,
index:36,
}, // 'print'
};
@ -688,5 +693,4 @@ function customStatisticBarConfig() {
$("#" + Store.container).find(".luckysheet-stat-area").show();
Store.statisticBarHeight = 23;
}
}

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