diff --git a/src/controllers/handler.js b/src/controllers/handler.js index ffe6e84..65347b2 100644 --- a/src/controllers/handler.js +++ b/src/controllers/handler.js @@ -28,6 +28,7 @@ import { ArrayUnique, showrightclickmenu, luckysheetactiveCell, + luckysheetContainerFocus, } from '../utils/util'; import { getSheetIndex, getRangetxt } from '../methods/get'; import { @@ -867,7 +868,7 @@ export default function luckysheetHandler() { //数据透视表 pivotTable.pivotclick(row_index, col_index, Store.currentSheetIndex); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); //$("#luckysheet-cols-h-c .luckysheet-cols-h-cells-c .luckysheet-cols-h-cells-clip .luckysheet-cols-h-cell-sel").removeClass("luckysheet-cols-h-cell-sel").addClass("luckysheet-cols-h-cell-nosel"); @@ -3074,7 +3075,7 @@ export default function luckysheetHandler() { //底部添加行按钮 $("#luckysheet-bottom-add-row").on("click", function (e) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), value = $("#luckysheet-bottom-add-row-input").val(); @@ -3549,7 +3550,7 @@ export default function luckysheetHandler() { luckysheetMoveHighlightCell("down", 0, "rangeOfSelect"); } - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); }); diff --git a/src/controllers/matrixOperation.js b/src/controllers/matrixOperation.js index 382e907..95692ce 100644 --- a/src/controllers/matrixOperation.js +++ b/src/controllers/matrixOperation.js @@ -1,6 +1,6 @@ import selection from './selection'; import { - numFormat, + numFormat,luckysheetContainerFocus, } from '../utils/util'; import { hasPartMC, isEditMode } from '../global/validate'; import { getdatabyselection, getcellvalue } from '../global/getdata'; @@ -13,7 +13,7 @@ export function initialMatrixOperation(){ //复制为json格式字符串,首行为标题 $("#luckysheet-copy-json-head").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -86,7 +86,7 @@ export function initialMatrixOperation(){ //复制为json格式字符串,无标题,采用ABCD作为标题 $("#luckysheet-copy-json-nohead").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ @@ -147,7 +147,7 @@ export function initialMatrixOperation(){ //复制为一维数组 $("#luckysheet-copy-array1").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -204,7 +204,7 @@ export function initialMatrixOperation(){ //复制为二维数组 $("#luckysheet-copy-array2").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ @@ -383,7 +383,7 @@ export function initialMatrixOperation(){ //复制为对角线 $("#luckysheet-copy-diagonal").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -443,7 +443,7 @@ export function initialMatrixOperation(){ //复制为反对角线 $("#luckysheet-copy-antidiagonal").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ @@ -504,7 +504,7 @@ export function initialMatrixOperation(){ //复制为对角偏移n列 $("#luckysheet-copy-diagonaloffset").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -590,7 +590,7 @@ export function initialMatrixOperation(){ //复制为布尔值 $("#luckysheet-copy-boolvalue").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ @@ -671,7 +671,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 翻转 上下 $("#luckysheet-matrix-turn-up").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -707,7 +707,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 翻转 左右 $("#luckysheet-matrix-turn-left").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -743,7 +743,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 翻转 顺时针 $("#luckysheet-matrix-turn-cw").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -779,7 +779,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 翻转 逆时针 $("#luckysheet-matrix-turn-anticw").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -815,7 +815,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 转置 $("#luckysheet-matrix-turn-trans").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -864,7 +864,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 矩阵计算 $("#luckysheet-matrix-cal-confirm").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -957,7 +957,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 删除两端0值 按行 $("#luckysheet-matrix-delezero-row").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1025,7 +1025,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 删除两端0值 按列 $("#luckysheet-matrix-delezero-column").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1106,7 +1106,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 删除重复值 按行 $("#luckysheet-matrix-delerpt-row").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1167,7 +1167,7 @@ export function initialMatrixOperation(){ //矩阵操作选区 删除重复值 按列 $("#luckysheet-matrix-delerpt-column").click(function (event) { $("body .luckysheet-cols-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ diff --git a/src/controllers/menuButton.js b/src/controllers/menuButton.js index 8651b8a..84d37ec 100644 --- a/src/controllers/menuButton.js +++ b/src/controllers/menuButton.js @@ -29,7 +29,7 @@ import { setcellvalue } from '../global/setdata'; import { countfunc } from '../global/count'; import { getSheetIndex, getRangetxt, getluckysheetfile } from '../methods/get'; import { setluckysheetfile } from '../methods/set'; -import { replaceHtml, getObjType, rgbTohex, mouseclickposition, luckysheetfontformat } from '../utils/util'; +import { replaceHtml, getObjType, rgbTohex, mouseclickposition, luckysheetfontformat,luckysheetContainerFocus } from '../utils/util'; import Store from '../store'; import locale from '../locale/locale'; import { connect } from 'tls'; @@ -418,7 +418,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -436,7 +436,7 @@ const menuButton = { $("#luckysheet-icon-fmtOtherSelf-menuButton").find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); $("#luckysheet-icon-fmtOtherSelf-menuButton").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let itemvalue = $(this).attr("itemvalue"); @@ -482,7 +482,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"), itemname = $t.attr("itemname"); _this.focus($menuButton, itemvalue); @@ -581,13 +581,13 @@ const menuButton = { _this.updateFormat(d, "fc", color); $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); }, }); $menuButton.find(".luckysheet-color-reset").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $input = $("#"+ menuButtonId).find(".luckysheet-color-selected"); $input.val("#000000"); @@ -602,7 +602,7 @@ const menuButton = { //交替颜色 $menuButton.find(".luckysheet-icon-alternateformat").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -719,13 +719,13 @@ const menuButton = { _this.updateFormat(d, "bg", color); $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); } }); $menuButton.find(".luckysheet-color-reset").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $input = $("#" + menuButtonId).find(".luckysheet-color-selected"); $input.val("#ffffff"); @@ -740,7 +740,7 @@ const menuButton = { //交替颜色 $menuButton.find(".luckysheet-icon-alternateformat").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -819,7 +819,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"), $input = $("#luckysheet-icon-font-size input"); $("#luckysheet-icon-font-size").attr("itemvalue", itemvalue); @@ -1020,7 +1020,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); if(itemvalue == "borderColor" || itemvalue == "borderSize"){ @@ -1220,7 +1220,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(selectIsOverlap()){ if(isEditMode()){ @@ -1311,7 +1311,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); _this.focus($menuButton, itemvalue); @@ -1367,7 +1367,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); _this.focus($menuButton, itemvalue); @@ -1414,7 +1414,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); _this.focus($menuButton, itemvalue); @@ -1464,7 +1464,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); _this.focus($menuButton, itemvalue); @@ -1516,7 +1516,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); _this.focus($menuButton, itemvalue); @@ -1780,7 +1780,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -1849,7 +1849,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -1977,7 +1977,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2264,7 +2264,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2343,7 +2343,7 @@ const menuButton = { $(document).off("click.CFhighlightCellRule").on("click.CFhighlightCellRule", "#luckysheet-icon-highlightCellRule-menuButton .luckysheet-cols-menuitem", function(){ $menuButton.hide(); $("#luckysheet-icon-highlightCellRule-menuButton").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2461,7 +2461,7 @@ const menuButton = { $(document).off("click.CFprojectSelectRule").on("click.CFprojectSelectRule", "#luckysheet-icon-projectSelectRule-menuButton .luckysheet-cols-menuitem", function(){ $menuButton.hide(); $("#luckysheet-icon-projectSelectRule-menuButton").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2565,7 +2565,7 @@ const menuButton = { $(document).off("click.CFdataBar").on("click.CFdataBar", "#luckysheet-icon-dataBar-menuButton .luckysheet-cols-menuitem", function(){ $menuButton.hide(); $("#luckysheet-icon-dataBar-menuButton").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2581,7 +2581,7 @@ const menuButton = { $(document).off("click.CFcolorGradation").on("click.CFcolorGradation", "#luckysheet-icon-colorGradation-menuButton .luckysheet-cols-menuitem", function(){ $menuButton.hide(); $("#luckysheet-icon-colorGradation-menuButton").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2597,7 +2597,7 @@ const menuButton = { $(document).off("click.CFdeleteRule").on("click.CFdeleteRule", "#luckysheet-icon-deleteRule-menuButton .luckysheet-cols-menuitem", function(){ $menuButton.hide(); $("#luckysheet-icon-deleteRule-menuButton").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); @@ -2667,7 +2667,7 @@ const menuButton = { $menuButton.find(".luckysheet-cols-menuitem").click(function(){ $menuButton.hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let $t = $(this), itemvalue = $t.attr("itemvalue"); diff --git a/src/controllers/rowColumnOperation.js b/src/controllers/rowColumnOperation.js index 888ae4d..10756f4 100644 --- a/src/controllers/rowColumnOperation.js +++ b/src/controllers/rowColumnOperation.js @@ -6,7 +6,8 @@ import server from './server'; import { selectHightlightShow, luckysheet_count_show,selectHelpboxFill } from './select'; import { getObjType, - showrightclickmenu, + showrightclickmenu, + luckysheetContainerFocus, } from '../utils/util'; import { getSheetIndex, getRangetxt } from '../methods/get'; import { @@ -909,7 +910,7 @@ export function rowColumnOperationInitial(){ //向左增加列,向上增加行 $("#luckysheet-add-lefttop, #luckysheet-add-lefttop_t").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -951,7 +952,7 @@ export function rowColumnOperationInitial(){ }); $("#luckysheet-addTopRows").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -993,7 +994,7 @@ export function rowColumnOperationInitial(){ }) $("#luckysheet-addLeftCols").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1037,7 +1038,7 @@ export function rowColumnOperationInitial(){ //向右增加列,向下增加行 $("#luckysheet-add-rightbottom, #luckysheet-add-rightbottom_t").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1080,7 +1081,7 @@ export function rowColumnOperationInitial(){ }); $("#luckysheet-addBottomRows").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1123,7 +1124,7 @@ export function rowColumnOperationInitial(){ }); $("#luckysheet-addRightCols").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(isEditMode()){ @@ -1168,7 +1169,7 @@ export function rowColumnOperationInitial(){ //删除选中行列 $("#luckysheet-del-selected, #luckysheet-del-selected_t").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheetRightHeadClickIs == "row"){ @@ -1196,7 +1197,7 @@ export function rowColumnOperationInitial(){ }); $("#luckysheet-delRows").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheetRightHeadClickIs == "row"){ @@ -1224,7 +1225,7 @@ export function rowColumnOperationInitial(){ }) $("#luckysheet-delCols").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 1){ if(Store.luckysheetRightHeadClickIs == "row"){ @@ -1254,7 +1255,7 @@ export function rowColumnOperationInitial(){ //隐藏、显示行 $("#luckysheet-hidRows").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let cfg = $.extend(true, {}, Store.config); if(cfg["rowhidden"] == null){ @@ -1295,7 +1296,7 @@ export function rowColumnOperationInitial(){ }) $("#luckysheet-showHidRows").click(function (event) { $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let cfg = $.extend(true, {}, Store.config); if(cfg["rowhidden"] == null){ @@ -1338,7 +1339,7 @@ export function rowColumnOperationInitial(){ //清除单元格内容 $("#luckysheet-delete-text").click(function(){ $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); if(Store.luckysheet_select_save.length > 0){ let d = editor.deepCopyFlowData(Store.flowdata); @@ -1405,7 +1406,7 @@ export function rowColumnOperationInitial(){ //行高列宽设置 $("#luckysheet-rows-cols-changesize").click(function(){ $("#luckysheet-rightclick-menu").hide(); - $("#" + Store.container).attr("tabindex", 0).focus(); + luckysheetContainerFocus(); let size = parseInt($(this).siblings("input[type='number']").val().trim()); diff --git a/src/utils/util.js b/src/utils/util.js index 17eedc9..f09207c 100644 --- a/src/utils/util.js +++ b/src/utils/util.js @@ -383,6 +383,13 @@ function luckysheetactiveCell() { } } +//单元格编辑聚焦 +function luckysheetContainerFocus() { + $("#" + Store.container).attr("tabindex", 0).focus({ + preventScroll: true + }); +} + //数字格式 function numFormat(num, type) { if (num == null || isNaN(parseFloat(num)) || hasChinaword(num) || num == -Infinity || num == Infinity) { @@ -638,5 +645,6 @@ export { $$, seriesLoadScripts, parallelLoadScripts, - loadLinks + loadLinks, + luckysheetContainerFocus } \ No newline at end of file