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>
</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" <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;"> 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" <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(删除线) //Alt + Shift + 5(删除线)
$("#luckysheet-icon-strikethrough").click(); $("#luckysheet-icon-strikethrough").click();
} }
// else if (altKey && (kcode == 54 || kcode == 102)) {
// //Alt + Shift + 6(删除线)
// $("#luckysheet-icon-underline").click();
// }
event.preventDefault(); event.preventDefault();
} }

32
src/controllers/menuButton.js

@ -2225,6 +2225,27 @@ const menuButton = {
_this.menuButtonFocus(d, row_index, col_index); _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(){ $("#luckysheet-icon-conditionformat").click(function(){
let menuButtonId = $(this).attr("id") + "-menuButton"; let menuButtonId = $(this).attr("id") + "-menuButton";
@ -3373,7 +3394,6 @@ const menuButton = {
if(_locale==null){ if(_locale==null){
_locale = locale(); _locale = locale();
} }
const locale_fontarray = _locale.fontarray; const locale_fontarray = _locale.fontarray;
const locale_fontjson = _locale.fontjson; const locale_fontjson = _locale.fontjson;
@ -3401,6 +3421,14 @@ const menuButton = {
$("#luckysheet-icon-strikethrough").removeClass("luckysheet-toolbar-button-hover"); $("#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"){ else if(attr == "ff"){
let menuButtonId = "luckysheet-icon-font-family-menuButton"; let menuButtonId = "luckysheet-icon-font-family-menuButton";
let $menuButton = $("#" + menuButtonId); let $menuButton = $("#" + menuButtonId);
@ -3561,7 +3589,7 @@ const menuButton = {
}, },
menuButtonFocus: function(d, r, c){ menuButtonFocus: function(d, r, c){
let _this = this; 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(); const _locale = locale();
for(let i = 0; i < foucsList.length; i++){ for(let i = 0; i < foucsList.length; i++){
let attr = foucsList[i]; let attr = foucsList[i];

58
src/controllers/resize.js

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

1
src/locale/en.js

@ -8826,6 +8826,7 @@ export default {
bold: 'Bold (Ctrl+B)', bold: 'Bold (Ctrl+B)',
italic : 'Italic (Ctrl+I)', italic : 'Italic (Ctrl+I)',
strikethrough: 'Strikethrough (Alt+Shift+5)', strikethrough: 'Strikethrough (Alt+Shift+5)',
underline: 'Underline',
textColor: 'Text color', textColor: 'Text color',
chooseColor: 'choose color', chooseColor: 'choose color',
resetColor: 'Reset', resetColor: 'Reset',

1
src/locale/es.js

@ -8826,6 +8826,7 @@ export default {
bold: 'Negrita (Ctrl+B)', bold: 'Negrita (Ctrl+B)',
italic : 'Itálica (Ctrl+I)', italic : 'Itálica (Ctrl+I)',
strikethrough: 'Tachar (Alt+Shift+5)', strikethrough: 'Tachar (Alt+Shift+5)',
underline: 'Guion bajo',
textColor: 'Color texto', textColor: 'Color texto',
chooseColor: 'elegir color', chooseColor: 'elegir color',
resetColor: 'Reinicializar', resetColor: 'Reinicializar',

1
src/locale/zh.js

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

Loading…
Cancel
Save