@ones-editor/editor 2.1.1-beta.91 → 2.1.1-beta.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -41395,6 +41395,13 @@ ${codeText}
41395
41395
  this.menu.close();
41396
41396
  return true;
41397
41397
  }
41398
+ if (isEnterOnly(event)) {
41399
+ const item = this.menu.menu.getSelectedItem();
41400
+ if (!item) {
41401
+ this.menu.close();
41402
+ return true;
41403
+ }
41404
+ }
41398
41405
  return this.menu.handleKeydown(event);
41399
41406
  }
41400
41407
  popup(block, offset, leftText, trigger) {
@@ -44478,7 +44485,7 @@ ${codeText}
44478
44485
  };
44479
44486
  editor.updateBlockData(tableBlock, newBlockData);
44480
44487
  }
44481
- const DEFAULT_COLUMN_WIDTH = 200;
44488
+ const DEFAULT_COLUMN_WIDTH$1 = 200;
44482
44489
  const MIN_COLUMN_WIDTH = 40;
44483
44490
  const logger$2i = getLogger("table-insert-column");
44484
44491
  function insertColumn(editor, tableBlock, insertIndex) {
@@ -44512,7 +44519,7 @@ ${codeText}
44512
44519
  oldBlockData[key] = oldSpan + 1;
44513
44520
  });
44514
44521
  const colsWidth = ((_a = oldBlockData.colsWidth) == null ? void 0 : _a.concat()) || new Array(oldBlockData.cols).fill(0);
44515
- colsWidth.splice(insertIndex, 0, DEFAULT_COLUMN_WIDTH);
44522
+ colsWidth.splice(insertIndex, 0, DEFAULT_COLUMN_WIDTH$1);
44516
44523
  const newChildren = TableGrid.virtualCellContainersGridToChildren(cells);
44517
44524
  const newBlockData = {
44518
44525
  ...oldBlockData,
@@ -69466,7 +69473,7 @@ ${codeText}
69466
69473
  children.push(createEmptyContainer(editor.doc, i === 0 ? text2 : ""));
69467
69474
  });
69468
69475
  }
69469
- const colsWidth = Array(cols).fill(DEFAULT_COLUMN_WIDTH);
69476
+ const colsWidth = Array(cols).fill(DEFAULT_COLUMN_WIDTH$1);
69470
69477
  const focusContainerId = children[emptyBlock ? 0 : cols];
69471
69478
  const focusBlockId = editor.doc.getContainerBlocks(focusContainerId)[0].id;
69472
69479
  const blockData = {
@@ -69494,7 +69501,7 @@ ${codeText}
69494
69501
  children.push(createEmptyContainer(editor.doc));
69495
69502
  }
69496
69503
  }
69497
- const colsWidth = Array(cols).fill(DEFAULT_COLUMN_WIDTH);
69504
+ const colsWidth = Array(cols).fill(DEFAULT_COLUMN_WIDTH$1);
69498
69505
  const focusContainerId = children[0];
69499
69506
  const focusBlockId = editor.doc.getContainerBlocks(focusContainerId)[0].id;
69500
69507
  const blockData = {
@@ -86009,6 +86016,34 @@ ${data2.flowchartText}
86009
86016
  return ret;
86010
86017
  }
86011
86018
  const logger$4 = getLogger("to-docx");
86019
+ function initEmptyLayoutMatrix(cols) {
86020
+ return Array.from({ length: cols }, () => ({
86021
+ cellId: void 0,
86022
+ originalWidth: 0,
86023
+ width: 0
86024
+ }));
86025
+ }
86026
+ function buildLayoutMatrix(block, maxWidth) {
86027
+ assert(logger$4, block.children, "no layout children");
86028
+ const cols = block.children.length;
86029
+ const colsWidth = block.colsWidth;
86030
+ if (colsWidth) {
86031
+ for (let i = 0; i < colsWidth.length; i++) {
86032
+ if (colsWidth[i] === 0) {
86033
+ colsWidth[i] = 1 / colsWidth.length;
86034
+ }
86035
+ }
86036
+ }
86037
+ const matrix = initEmptyLayoutMatrix(cols);
86038
+ for (let i = 0; i < cols; ++i) {
86039
+ matrix[i].cellId = block.children[i];
86040
+ matrix[i].originalWidth = colsWidth[i] * maxWidth;
86041
+ matrix[i].width = colsWidth[i] * maxWidth;
86042
+ }
86043
+ return matrix;
86044
+ }
86045
+ const logger$3 = getLogger("to-docx");
86046
+ const DEFAULT_COLUMN_WIDTH = 200;
86012
86047
  function initEmptyTableMatrix(rows, cols) {
86013
86048
  return Array(rows).fill(0).map(() => Array(cols).fill(0).map(() => ({
86014
86049
  cellId: void 0,
@@ -86035,14 +86070,14 @@ ${data2.flowchartText}
86035
86070
  }
86036
86071
  }
86037
86072
  function buildTableMatrix(block) {
86038
- assert(logger$4, block.children, "no table children");
86073
+ assert(logger$3, block.children, "no table children");
86039
86074
  const rows = block.rows;
86040
86075
  const cols = block.cols;
86041
- const colsWidth = block.colsWidth;
86076
+ const colsWidth = new Array(block.cols).fill(DEFAULT_COLUMN_WIDTH).map((_2, i) => block.colsWidth[i] || _2);
86042
86077
  if (colsWidth) {
86043
86078
  for (let i = 0; i < colsWidth.length; i++) {
86044
86079
  if (colsWidth[i] === 0) {
86045
- colsWidth[i] = 100;
86080
+ colsWidth[i] = DEFAULT_COLUMN_WIDTH;
86046
86081
  }
86047
86082
  }
86048
86083
  }
@@ -86084,33 +86119,6 @@ ${data2.flowchartText}
86084
86119
  updateMatrixByStripe(block, rows, cols, matrix);
86085
86120
  return matrix;
86086
86121
  }
86087
- const logger$3 = getLogger("to-docx");
86088
- function initEmptyLayoutMatrix(cols) {
86089
- return Array.from({ length: cols }, () => ({
86090
- cellId: void 0,
86091
- originalWidth: 0,
86092
- width: 0
86093
- }));
86094
- }
86095
- function buildLayoutMatrix(block, maxWidth) {
86096
- assert(logger$3, block.children, "no layout children");
86097
- const cols = block.children.length;
86098
- const colsWidth = block.colsWidth;
86099
- if (colsWidth) {
86100
- for (let i = 0; i < colsWidth.length; i++) {
86101
- if (colsWidth[i] === 0) {
86102
- colsWidth[i] = 1 / colsWidth.length;
86103
- }
86104
- }
86105
- }
86106
- const matrix = initEmptyLayoutMatrix(cols);
86107
- for (let i = 0; i < cols; ++i) {
86108
- matrix[i].cellId = block.children[i];
86109
- matrix[i].originalWidth = colsWidth[i] * maxWidth;
86110
- matrix[i].width = colsWidth[i] * maxWidth;
86111
- }
86112
- return matrix;
86113
- }
86114
86122
  async function convertBlocksOfDoc(parent, blocks, data2, dbg, appId, docId, md5HexFunc, getDocByBlock2, getTextsByBox, maxWidth) {
86115
86123
  async function convertBlock(block) {
86116
86124
  if (getDocByBlock2 && block.type !== "_exportVirtualBlock") {
@@ -86161,11 +86169,11 @@ ${data2.flowchartText}
86161
86169
  const cols = block.cols;
86162
86170
  colsWidth = new Array(cols);
86163
86171
  for (let i = 0; i < colsWidth.length; i++) {
86164
- colsWidth[i] = 100;
86172
+ colsWidth[i] = DEFAULT_COLUMN_WIDTH;
86165
86173
  }
86166
86174
  block.colsWidth = colsWidth;
86167
86175
  } else {
86168
- colsWidth = block.colsWidth;
86176
+ colsWidth = new Array(block.cols).fill(DEFAULT_COLUMN_WIDTH).map((_2, i) => block.colsWidth[i] || _2);
86169
86177
  }
86170
86178
  const matrix = buildTableMatrix(block);
86171
86179
  await dbg.addTableMatrix(colsWidth, matrix, data2);
@@ -86848,7 +86856,7 @@ ${data2.flowchartText}
86848
86856
  }
86849
86857
  }
86850
86858
  });
86851
- editor.version = "2.1.1-beta.91";
86859
+ editor.version = "2.1.1-beta.92";
86852
86860
  if (Logger$2.level === LogLevel.DEBUG) {
86853
86861
  window.setReauthFail = (fail) => {
86854
86862
  window.isReauthError = fail;
@@ -86949,7 +86957,7 @@ ${data2.flowchartText}
86949
86957
  });
86950
86958
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
86951
86959
  OnesEditorToolbar.register(editor);
86952
- editor.version = "2.1.1-beta.91";
86960
+ editor.version = "2.1.1-beta.92";
86953
86961
  return editor;
86954
86962
  }
86955
86963
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.1.1-beta.91",
3
+ "version": "2.1.1-beta.92",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",