# UNDF: UNDF-2026-000001131 --- a/word/Editor/Table.js +++ b/word/Editor/Table.js @@ -12305,12 +12305,13 @@ CTable.prototype.SelectCells = function(X1, Y1, X2, Y2, CurPageStart, drawMode) // Индексы строк, попавших под режущую линию Rows = this.GetAffectedRows(X1, Y1, X2, Y2, CurPageStart, 2); + var RowsSet = new Set(Rows); // Далее мы определяем, какие ячейки в строках(попавших под выделение) попадают под выделение // и заполняем this.Selection.Data for (var curRow = 0; curRow < this.Get_RowsCount(); curRow++) { // Проверка строки на наличие в массиве Rows - if (Rows.indexOf(curRow) != -1) + if (RowsSet.has(curRow)) { @@ -12767,10 +12768,11 @@ CTable.prototype.VertSplitCells = function(X, RowsIndices) //Добавляем новые ячейки в горизонтальном разбиении for (var curRow = 0; curRow < this.Get_RowsCount(); curRow++) { + var RowsIndicesSet = new Set(RowsIndices); for (var curCell = 0; curCell < this.GetRow(curRow).Get_CellsCount(); curCell++) { if ((X - this.GetRow(curRow).CellsInfo[curCell].X_cell_start > 1.5) && (this.GetRow(curRow).CellsInfo[curCell].X_cell_end - X > 1.5)) { //проверка текущей строки на наличие в массиве Rows - if (RowsIndices.indexOf(curRow) != -1) + if (RowsIndicesSet.has(curRow)) { @@ -12947,10 +12949,11 @@ CTable.prototype.CalculateNewRowsInfo = function(X, RowsIndices) var rowsInfo = []; // заполняем массив rowsInfo строк с ширинами ячеек for (var curRow = 0; curRow < this.Get_RowsCount(); curRow++) { + var RowsIndicesSet = new Set(RowsIndices); var cellsInfo = []; for (var curCell = 0; curCell < this.GetRow(curRow).Get_CellsCount(); curCell++) { if ((X - this.GetRow(curRow).CellsInfo[curCell].X_cell_start > 1.5) && (this.GetRow(curRow).CellsInfo[curCell].X_cell_end - X > 1.5)) { - if (RowsIndices.indexOf(curRow) != -1) //проверка на наличие строки curRow в массиве строк которые мы выделили + if (RowsIndicesSet.has(curRow)) //проверка на наличие строки curRow в массиве строк которые мы выделили { @@ -12978,10 +12981,11 @@ CTable.prototype.HorSplitCells = function(Y, RowIndex, CellsIndexes, CurPageSta // Если хотим разделить ячейку с VMerge > 1 и линия находится близка к линии строки (невидимой), то делим ячейку по этой линии for (var curCell = 0; curCell < this.GetRow(RowIndex).Get_CellsCount(); curCell++) { - if (CellsIndexes.indexOf(curCell) != -1) //проверка ячейки на наличие в массиве Cells + if (CellsIndexesSet.has(curCell)) //проверка ячейки на наличие в массиве Cells { @@ -13150,9 +13154,9 @@ CTable.prototype.HorSplitCells = function(Y, RowIndex, CellsIndexes, CurPageSta - if (CellsIndexes.indexOf(CurCell) != -1) + if (CellsIndexesSet.has(CurCell)) if (CurCell != CellsIndexes[0]) - if (-1 !== CellsIndexes.indexOf(CurCell)) + if (CellsIndexesSet.has(CurCell)) @@ -13820,10 +13824,11 @@ CTable.prototype.GetAffectedCells = function(X1, Y1, X2, Y2, CurPageStart) // Далее мы определяем, какие ячейки в строках(попавших под выделение) попадают под выделение // и заполняем SelectionData + var RowsSet = new Set(Rows); for (var curRow = 0; curRow < this.Get_RowsCount(); curRow++) { // Проверка строки на наличие в массиве Rows - if (Rows.indexOf(curRow) === -1) + if (!RowsSet.has(curRow)) continue; @@ -13888,9 +13893,10 @@ CTable.prototype.CalculateNewRowsInfoByRowsIndices = function(X, RowsIndices) for (var curRow = 0; curRow < this.Get_RowsCount(); curRow++) { + var RowsIndicesSet = new Set(RowsIndices); var cellsInfo = []; for (var curCell = 0; curCell < this.GetRow(curRow).Get_CellsCount(); curCell++) { if ((X - this.GetRow(curRow).CellsInfo[curCell].X_cell_start > 1.5) && (this.GetRow(curRow).CellsInfo[curCell].X_cell_end - X > 1.5)) { - if (RowsIndices.indexOf(curRow) != -1) //проверка на наличие строки curRow в массиве строк которые мы выделили + if (RowsIndicesSet.has(curRow)) //проверка на наличие строки curRow в массиве строк которые мы выделили {