wikiparser-node 1.0.3 → 1.1.0

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.
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ /* eslint operator-linebreak: [2, "before", {overrides: {"=": "after"}}] */
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.Layout = void 0;
4
5
  const assert = require("assert/strict");
@@ -96,14 +97,15 @@ class Layout extends Array {
96
97
  }
97
98
  }
98
99
  exports.Layout = Layout;
99
- Object.assign(table_1.TableToken.prototype, {
100
+ table_1.TableToken.prototype.getNthCell =
100
101
  /** @implements */
101
- getNthCell(coords) {
102
+ function (coords) {
102
103
  const rawCoords = coords.row === undefined ? this.toRawCoords(coords) : coords;
103
104
  return rawCoords && this.getNthRow(rawCoords.row, false, false)?.getNthCol(rawCoords.column);
104
- },
105
+ };
106
+ table_1.TableToken.prototype.getLayout =
105
107
  /** @implements */
106
- getLayout(stop) {
108
+ function (stop) {
107
109
  const rows = this.getAllRows(), { length } = rows, layout = new Layout(...new Array(length).fill(undefined).map(() => []));
108
110
  for (let i = 0; i < length; i++) {
109
111
  if (i > (stop?.row ?? stop?.y ?? NaN)) {
@@ -143,18 +145,21 @@ Object.assign(table_1.TableToken.prototype, {
143
145
  }
144
146
  }
145
147
  return layout;
146
- },
148
+ };
149
+ table_1.TableToken.prototype.printLayout =
147
150
  /** @implements */
148
- printLayout() {
151
+ function () {
149
152
  this.getLayout().print();
150
- },
153
+ };
154
+ table_1.TableToken.prototype.toRenderedCoords =
151
155
  /** @implements */
152
- toRenderedCoords({ row, column }) {
156
+ function ({ row, column }) {
153
157
  const rowLayout = this.getLayout({ row, column })[row], x = rowLayout?.findIndex(coords => cmpCoords(coords, { row, column }) === 0);
154
158
  return rowLayout && (x === -1 ? undefined : { y: row, x: x });
155
- },
159
+ };
160
+ table_1.TableToken.prototype.toRawCoords =
156
161
  /** @implements */
157
- toRawCoords({ x, y }) {
162
+ function ({ x, y }) {
158
163
  const rowLayout = this.getLayout({ x, y })[y], coords = rowLayout?.[x];
159
164
  if (coords) {
160
165
  return { ...coords, start: coords.row === y && rowLayout[x - 1] !== coords };
@@ -165,39 +170,46 @@ Object.assign(table_1.TableToken.prototype, {
165
170
  : undefined;
166
171
  }
167
172
  return { row: 0, column: 0, start: true };
168
- },
173
+ };
174
+ table_1.TableToken.prototype.getFullRow =
169
175
  /** @implements */
170
- getFullRow(y) {
176
+ function (y) {
171
177
  const rows = this.getAllRows();
172
178
  return new Map(this.getLayout({ y })[y]?.map(({ row, column }) => [rows[row].getNthCol(column), row === y]));
173
- },
179
+ };
180
+ table_1.TableToken.prototype.getFullCol =
174
181
  /** @implements */
175
- getFullCol(x) {
182
+ function (x) {
176
183
  const layout = this.getLayout(), colLayout = layout.map(row => row[x]).filter(Boolean), rows = this.getAllRows();
177
184
  return new Map(colLayout.map(coords => [rows[coords.row].getNthCol(coords.column), layout[coords.row][x - 1] !== coords]));
178
- },
185
+ };
186
+ table_1.TableToken.prototype.formatTableRow =
179
187
  /** @implements */
180
- formatTableRow(y, attr = {}, multiRow = false) {
188
+ function (y, attr = {}, multiRow = false) {
181
189
  format(this.getFullRow(y), attr, multiRow);
182
- },
190
+ };
191
+ table_1.TableToken.prototype.formatTableCol =
183
192
  /** @implements */
184
- formatTableCol(x, attr = {}, multiCol = false) {
193
+ function (x, attr = {}, multiCol = false) {
185
194
  format(this.getFullCol(x), attr, multiCol);
186
- },
195
+ };
196
+ table_1.TableToken.prototype.fillTableRow =
187
197
  /** @implements */
188
- fillTableRow(y, inner, subtype = 'td', attr = {}) {
198
+ function (y, inner, subtype = 'td', attr = {}) {
189
199
  const rowToken = this.getNthRow(y), layout = this.getLayout({ y }), maxCol = Math.max(...layout.map(({ length }) => length)), token = (0, td_1.createTd)(inner, subtype, attr, this.getAttribute('include'), this.getAttribute('config'));
190
200
  fill(y, rowToken, layout, maxCol, token);
191
- },
201
+ };
202
+ table_1.TableToken.prototype.fillTable =
192
203
  /** @implements */
193
- fillTable(inner, subtype = 'td', attr = {}) {
204
+ function (inner, subtype = 'td', attr = {}) {
194
205
  const rowTokens = this.getAllRows(), layout = this.getLayout(), maxCol = Math.max(...layout.map(({ length }) => length)), token = (0, td_1.createTd)(inner, subtype, attr, this.getAttribute('include'), this.getAttribute('config'));
195
206
  for (let y = 0; y < rowTokens.length; y++) {
196
207
  fill(y, rowTokens[y], layout, maxCol, token);
197
208
  }
198
- },
209
+ };
210
+ table_1.TableToken.prototype.insertTableCell =
199
211
  /** @implements */
200
- insertTableCell(inner, coords, subtype = 'td', attr = {}) {
212
+ function (inner, coords, subtype = 'td', attr = {}) {
201
213
  let rawCoords;
202
214
  if (coords.column === undefined) {
203
215
  const { x, y } = coords;
@@ -213,9 +225,10 @@ Object.assign(table_1.TableToken.prototype, {
213
225
  return rowToken === this
214
226
  ? trBase_1.TrBaseToken.prototype.insertTableCell.call(this, inner, rawCoords, subtype, attr)
215
227
  : rowToken.insertTableCell(inner, rawCoords, subtype, attr);
216
- },
228
+ };
229
+ table_1.TableToken.prototype.prependTableRow =
217
230
  /** @implements */
218
- prependTableRow() {
231
+ function () {
219
232
  const row = debug_1.Shadow.run(() => new tr_1.TrToken('\n|-', undefined, this.getAttribute('config'))), { childNodes } = this, [, , plain] = childNodes, start = plain?.constructor === src_1.Token ? 3 : 2, tdChildren = childNodes.slice(start), index = tdChildren.findIndex(({ type }) => type !== 'td');
220
233
  this.insertAt(row, index === -1 ? -1 : index + start);
221
234
  debug_1.Shadow.run(() => {
@@ -226,9 +239,10 @@ Object.assign(table_1.TableToken.prototype, {
226
239
  }
227
240
  });
228
241
  return row;
229
- },
242
+ };
243
+ table_1.TableToken.prototype.insertTableRow =
230
244
  /** @implements */
231
- insertTableRow(y, attr = {}, inner, subtype = 'td', innerAttr = {}) {
245
+ function (y, attr = {}, inner, subtype = 'td', innerAttr = {}) {
232
246
  let reference = this.getNthRow(y, false, true);
233
247
  const token = debug_1.Shadow.run(() => new tr_1.TrToken('\n|-', undefined, this.getAttribute('config')));
234
248
  for (const [k, v] of Object.entries(attr)) {
@@ -256,9 +270,10 @@ Object.assign(table_1.TableToken.prototype, {
256
270
  });
257
271
  }
258
272
  return token;
259
- },
273
+ };
274
+ table_1.TableToken.prototype.insertTableCol =
260
275
  /** @implements */
261
- insertTableCol(x, inner, subtype = 'td', attr = {}) {
276
+ function (x, inner, subtype = 'td', attr = {}) {
262
277
  const layout = this.getLayout(), rowLength = layout.map(({ length }) => length), minCol = Math.min(...rowLength);
263
278
  if (x > minCol) {
264
279
  throw new RangeError(`表格第 ${rowLength.indexOf(minCol)} 行仅有 ${minCol} 列!`);
@@ -277,9 +292,10 @@ Object.assign(table_1.TableToken.prototype, {
277
292
  this.getNthCell(coords).colspan++;
278
293
  }
279
294
  }
280
- },
295
+ };
296
+ table_1.TableToken.prototype.removeTableRow =
281
297
  /** @implements */
282
- removeTableRow(y) {
298
+ function (y) {
283
299
  const rows = this.getAllRows(), layout = this.getLayout(), rowLayout = layout[y], set = new WeakSet();
284
300
  for (let x = rowLayout.length - 1; x >= 0; x--) {
285
301
  const coords = rowLayout[x];
@@ -306,9 +322,10 @@ Object.assign(table_1.TableToken.prototype, {
306
322
  const rowToken = rows[y].type === 'table' ? this.prependTableRow() : rows[y];
307
323
  rowToken.remove();
308
324
  return rowToken;
309
- },
325
+ };
326
+ table_1.TableToken.prototype.removeTableCol =
310
327
  /** @implements */
311
- removeTableCol(x) {
328
+ function (x) {
312
329
  for (const [token, start] of this.getFullCol(x)) {
313
330
  const { colspan, lastChild } = token;
314
331
  if (colspan > 1) {
@@ -321,10 +338,11 @@ Object.assign(table_1.TableToken.prototype, {
321
338
  token.remove();
322
339
  }
323
340
  }
324
- },
341
+ };
342
+ table_1.TableToken.prototype.mergeCells =
325
343
  /** @implements */
326
- mergeCells(xlim, ylim) {
327
- const layout = this.getLayout(), maxCol = Math.max(...layout.map(({ length }) => length)), posXlim = xlim.map(x => x < 0 ? x + maxCol : x), posYlim = ylim.map(y => y < 0 ? y + layout.length : y), [xmin, xmax] = posXlim.sort(), [ymin, ymax] = posYlim.sort(), set = new Set(layout.slice(ymin, ymax).flatMap(rowLayout => rowLayout.slice(xmin, xmax)));
344
+ function (xlim, ylim) {
345
+ const layout = this.getLayout(), maxCol = Math.max(...layout.map(({ length }) => length)), [xmin, xmax] = xlim.map(x => x < 0 ? x + maxCol : x).sort(), [ymin, ymax] = ylim.map(y => y < 0 ? y + layout.length : y).sort(), set = new Set(layout.slice(ymin, ymax).flatMap(rowLayout => rowLayout.slice(xmin, xmax)));
328
346
  if ([...layout[ymin - 1] ?? [], ...layout[ymax] ?? []].some(coords => set.has(coords))
329
347
  || layout.some(rowLayout => set.has(rowLayout[xmin - 1]) || set.has(rowLayout[xmax]))) {
330
348
  throw new RangeError('待合并区域与外侧区域有重叠!');
@@ -337,9 +355,10 @@ Object.assign(table_1.TableToken.prototype, {
337
355
  token.remove();
338
356
  }
339
357
  return cornerCell;
340
- },
358
+ };
359
+ table_1.TableToken.prototype.split =
341
360
  /** @implements */
342
- split(coords, dirs) {
361
+ function (coords, dirs) {
343
362
  const cell = this.getNthCell(coords), attr = cell.getAttrs(), { subtype } = cell;
344
363
  attr.rowspan ||= 1;
345
364
  attr.colspan ||= 1;
@@ -377,21 +396,25 @@ Object.assign(table_1.TableToken.prototype, {
377
396
  }
378
397
  }
379
398
  }
380
- },
399
+ };
400
+ table_1.TableToken.prototype.splitIntoRows =
381
401
  /** @implements */
382
- splitIntoRows(coords) {
402
+ function (coords) {
383
403
  this.split(coords, new Set(['rowspan']));
384
- },
404
+ };
405
+ table_1.TableToken.prototype.splitIntoCols =
385
406
  /** @implements */
386
- splitIntoCols(coords) {
407
+ function (coords) {
387
408
  this.split(coords, new Set(['colspan']));
388
- },
409
+ };
410
+ table_1.TableToken.prototype.splitIntoCells =
389
411
  /** @implements */
390
- splitIntoCells(coords) {
412
+ function (coords) {
391
413
  this.split(coords, new Set(['rowspan', 'colspan']));
392
- },
414
+ };
415
+ table_1.TableToken.prototype.replicateTableRow =
393
416
  /** @implements */
394
- replicateTableRow(row) {
417
+ function (row) {
395
418
  let rowToken = this.getNthRow(row);
396
419
  if (rowToken.type === 'table') {
397
420
  rowToken = this.prependTableRow();
@@ -406,9 +429,10 @@ Object.assign(table_1.TableToken.prototype, {
406
429
  }
407
430
  }
408
431
  return replicated;
409
- },
432
+ };
433
+ table_1.TableToken.prototype.replicateTableCol =
410
434
  /** @implements */
411
- replicateTableCol(x) {
435
+ function (x) {
412
436
  const replicated = [];
413
437
  for (const [token, start] of this.getFullCol(x)) {
414
438
  if (start) {
@@ -422,9 +446,10 @@ Object.assign(table_1.TableToken.prototype, {
422
446
  }
423
447
  }
424
448
  return replicated;
425
- },
449
+ };
450
+ table_1.TableToken.prototype.moveTableRowBefore =
426
451
  /** @implements */
427
- moveTableRowBefore(y, before) {
452
+ function (y, before) {
428
453
  const layout = this.getLayout(),
429
454
  /** @ignore */
430
455
  occupied = (i) => layout[i].map(({ row }, j) => row === i ? j : undefined).filter(j => j !== undefined);
@@ -449,9 +474,10 @@ Object.assign(table_1.TableToken.prototype, {
449
474
  }
450
475
  this.insertBefore(rowToken, beforeToken);
451
476
  return rowToken;
452
- },
477
+ };
478
+ table_1.TableToken.prototype.moveTableRowAfter =
453
479
  /** @implements */
454
- moveTableRowAfter(y, after) {
480
+ function (y, after) {
455
481
  const layout = this.getLayout(), afterToken = this.getNthRow(after), cells = afterToken.childNodes.filter(child => child instanceof td_1.TdToken && child.subtype !== 'caption'),
456
482
  /** @ignore */
457
483
  occupied = (i, oneRow = false) => layout[i].map(({ row, column }, j) => row === i && (!oneRow || cells[column].rowspan === 1) ? j : undefined).filter(j => j !== undefined);
@@ -484,9 +510,10 @@ Object.assign(table_1.TableToken.prototype, {
484
510
  this.insertBefore(rowToken, afterToken);
485
511
  }
486
512
  return rowToken;
487
- },
513
+ };
514
+ table_1.TableToken.prototype.moveCol =
488
515
  /** @implements */
489
- moveCol(x, reference, after = false) {
516
+ function (x, reference, after = false) {
490
517
  const layout = this.getLayout();
491
518
  if (layout.some(rowLayout => isStartCol(rowLayout, x) !== isStartCol(rowLayout, reference, after))) {
492
519
  throw new RangeError(`第 ${x} 列与第 ${reference} 列的构造不同,无法移动!`);
@@ -518,14 +545,15 @@ Object.assign(table_1.TableToken.prototype, {
518
545
  }
519
546
  }
520
547
  }
521
- },
548
+ };
549
+ table_1.TableToken.prototype.moveTableColBefore =
522
550
  /** @implements */
523
- moveTableColBefore(x, before) {
551
+ function (x, before) {
524
552
  this.moveCol(x, before);
525
- },
553
+ };
554
+ table_1.TableToken.prototype.moveTableColAfter =
526
555
  /** @implements */
527
- moveTableColAfter(x, after) {
556
+ function (x, after) {
528
557
  this.moveCol(x, after, true);
529
- },
530
- });
558
+ };
531
559
  constants_1.classes['ExtendTableToken'] = __filename;
package/dist/index.d.ts CHANGED
@@ -53,7 +53,7 @@ declare interface Parser {
53
53
  * 是否是跨维基链接
54
54
  * @param title 链接标题
55
55
  */
56
- isInterwiki(title: string, config?: Config): [string, string] | null;
56
+ isInterwiki(title: string, config?: Config): RegExpExecArray | null;
57
57
  }
58
58
  declare const Parser: Parser;
59
59
  export = Parser;
package/dist/index.js CHANGED
@@ -11,6 +11,11 @@ const constants_1 = require("./util/constants");
11
11
  * @param dir 子路径
12
12
  */
13
13
  const rootRequire = (file, dir) => require(file.startsWith('/') ? file : `../${file.includes('/') ? '' : dir}${file}`);
14
+ /**
15
+ * 清理解析专用的不可见字符
16
+ * @param text 源文本
17
+ */
18
+ const tidy = (text) => text.replace(/[\0\x7F]/gu, '');
14
19
  // eslint-disable-next-line @typescript-eslint/no-redeclare
15
20
  const Parser = {
16
21
  config: 'default',
@@ -69,11 +74,10 @@ const Parser = {
69
74
  /** @implements */
70
75
  parse(wikitext, include, maxStage = constants_1.MAX_STAGE, config = Parser.getConfig()) {
71
76
  const { Token } = require('./src/index');
72
- let token;
73
- debug_1.Shadow.run(() => {
74
- token = new Token(wikitext.replace(/[\0\x7F]/gu, ''), config);
77
+ const root = debug_1.Shadow.run(() => {
78
+ const token = new Token(tidy(wikitext), config);
75
79
  try {
76
- token.parse(maxStage, include);
80
+ return token.parse(maxStage, include);
77
81
  }
78
82
  catch (e) {
79
83
  if (e instanceof Error) {
@@ -88,10 +92,10 @@ const Parser = {
88
92
  }
89
93
  });
90
94
  if (this.debugging) {
91
- let restored = String(token), process = '解析';
95
+ let restored = String(root), process = '解析';
92
96
  if (restored === wikitext) {
93
97
  const entities = { lt: '<', gt: '>', amp: '&' };
94
- restored = token.print().replace(/<[^<]+?>|&([lg]t|amp);/gu, (_, s) => s ? entities[s] : '');
98
+ restored = root.print().replace(/<[^<]+?>|&([lg]t|amp);/gu, (_, s) => s ? entities[s] : '');
95
99
  process = '渲染HTML';
96
100
  }
97
101
  if (restored !== wikitext) {
@@ -104,7 +108,7 @@ const Parser = {
104
108
  })());
105
109
  }
106
110
  }
107
- return token;
111
+ return root;
108
112
  },
109
113
  /* NOT FOR BROWSER */
110
114
  /** @implements */
@@ -139,6 +143,7 @@ const Parser = {
139
143
  ...Object.entries(constants_1.classes),
140
144
  ...Object.entries(constants_1.mixins),
141
145
  ...Object.entries(constants_1.parsers),
146
+ ...Object.entries(constants_1.utils),
142
147
  ];
143
148
  for (const [, filePath] of entries) {
144
149
  try {
@@ -158,7 +163,7 @@ const Parser = {
158
163
  },
159
164
  /** @implements */
160
165
  isInterwiki(title, { interwiki } = Parser.getConfig()) {
161
- return new RegExp(`^(${interwiki.join('|')})\\s*:`, 'iu')
166
+ return new RegExp(`^(${interwiki.join('|')})\\s*:`, 'diu')
162
167
  .exec(title.replaceAll('_', ' ').replace(/^\s*:?\s*/u, ''));
163
168
  },
164
169
  /** @implements */
@@ -172,7 +177,7 @@ const Parser = {
172
177
  const { stage, include, config } = require(`${file}.json`), { Token } = require('./src');
173
178
  this.config = config;
174
179
  return debug_1.Shadow.run(() => {
175
- const halfParsed = stage < constants_1.MAX_STAGE, token = new Token(halfParsed ? wikitext : wikitext.replace(/[\0\x7F]/gu, ''), this.getConfig());
180
+ const halfParsed = stage < constants_1.MAX_STAGE, token = new Token(halfParsed ? wikitext : tidy(wikitext), this.getConfig());
176
181
  if (halfParsed) {
177
182
  token.setAttribute('stage', stage);
178
183
  token.parseOnce(stage, include);
package/dist/lib/node.js CHANGED
@@ -38,12 +38,12 @@ class AstNode {
38
38
  }
39
39
  /** 后一个兄弟节点 */
40
40
  get nextSibling() {
41
- const childNodes = this.#parentNode?.childNodes;
41
+ const childNodes = this.parentNode?.childNodes;
42
42
  return childNodes && childNodes[childNodes.indexOf(this) + 1];
43
43
  }
44
44
  /** 前一个兄弟节点 */
45
45
  get previousSibling() {
46
- const childNodes = this.#parentNode?.childNodes;
46
+ const childNodes = this.parentNode?.childNodes;
47
47
  return childNodes && childNodes[childNodes.indexOf(this) - 1];
48
48
  }
49
49
  /** 行数 */
@@ -57,12 +57,12 @@ class AstNode {
57
57
  /* NOT FOR BROWSER */
58
58
  /** 后一个非文本兄弟节点 */
59
59
  get nextElementSibling() {
60
- const childNodes = this.#parentNode?.childNodes, i = childNodes?.indexOf(this);
60
+ const childNodes = this.parentNode?.childNodes, i = childNodes?.indexOf(this);
61
61
  return childNodes?.slice(i + 1).find(({ type }) => type !== 'text');
62
62
  }
63
63
  /** 前一个非文本兄弟节点 */
64
64
  get previousElementSibling() {
65
- const childNodes = this.#parentNode?.childNodes, i = childNodes?.indexOf(this);
65
+ const childNodes = this.parentNode?.childNodes, i = childNodes?.indexOf(this);
66
66
  return childNodes?.slice(0, i).findLast(({ type }) => type !== 'text');
67
67
  }
68
68
  /** 是否具有根节点 */
@@ -71,14 +71,15 @@ class AstNode {
71
71
  }
72
72
  /** 后方是否还有其他节点(不含后代) */
73
73
  get eof() {
74
- if (!this.#parentNode) {
74
+ const { parentNode } = this;
75
+ if (!parentNode) {
75
76
  return true;
76
77
  }
77
78
  let { nextSibling } = this;
78
79
  while (nextSibling?.type === 'text' && nextSibling.data.trim() === '') {
79
80
  ({ nextSibling } = nextSibling);
80
81
  }
81
- return nextSibling === undefined && this.#parentNode.eof;
82
+ return nextSibling === undefined && parentNode.eof;
82
83
  }
83
84
  /** 相对于父容器的行号 */
84
85
  get offsetTop() {
@@ -360,8 +361,8 @@ class AstNode {
360
361
  currentTarget: { value: this, enumerable: true, configurable: true },
361
362
  });
362
363
  this.#events.emit(e.type, e, data);
363
- if (e.bubbles && this.#parentNode) {
364
- this.#parentNode.dispatchEvent(e, data);
364
+ if (e.bubbles && this.parentNode) {
365
+ this.parentNode.dispatchEvent(e, data);
365
366
  }
366
367
  }
367
368
  /** 获取所有祖先节点 */
@@ -408,7 +409,7 @@ class AstNode {
408
409
  }
409
410
  /** 获取当前节点的相对位置 */
410
411
  #getPosition() {
411
- return this.#parentNode?.posFromIndex(this.getRelativeIndex()) ?? { top: 0, left: 0 };
412
+ return this.parentNode?.posFromIndex(this.getRelativeIndex()) ?? { top: 0, left: 0 };
412
413
  }
413
414
  /** 获取当前节点的行列位置和大小 */
414
415
  getBoundingClientRect() {
@@ -27,7 +27,6 @@ export declare class AstRange {
27
27
  * 设置起点
28
28
  * @param startNode 起点容器
29
29
  * @param startOffset 起点位置
30
- * @throws `RangeError` 不在同一个文档
31
30
  * @throws `RangeError` offset取值超出范围
32
31
  */
33
32
  setStart(startNode: AstNodes, startOffset: number): void;
@@ -35,7 +34,6 @@ export declare class AstRange {
35
34
  * 设置终点
36
35
  * @param endNode 终点容器
37
36
  * @param endOffset 终点位置
38
- * @throws `RangeError` 不在同一个文档
39
37
  * @throws `RangeError` offset取值超出范围
40
38
  */
41
39
  setEnd(endNode: AstNodes, endOffset: number): void;
@@ -67,6 +65,7 @@ export declare class AstRange {
67
65
  /**
68
66
  * 设置Range包含整个节点
69
67
  * @param referenceNode 节点
68
+ * @throws `RangeError` 参考节点没有父节点
70
69
  */
71
70
  selectNode(referenceNode: AstNodes): void;
72
71
  /**
@@ -85,15 +84,8 @@ export declare class AstRange {
85
84
  * 端点是否在Range中
86
85
  * @param referenceNode 端点容器
87
86
  * @param offset 端点位置
88
- * @throws `RangeError` 不在同一个文档
89
87
  */
90
88
  isPointInRange(referenceNode: AstNodes, offset: number): boolean;
91
- /**
92
- * 是否与节点相交
93
- * @param referenceNode 节点
94
- * @throws `RangeError` 不在同一个文档
95
- */
96
- intersectsNode(referenceNode: AstNodes): boolean;
97
89
  /** 复制AstRange对象 */
98
90
  cloneRange(): AstRange;
99
91
  /** 删除Range中的内容 */
@@ -105,10 +97,7 @@ export declare class AstRange {
105
97
  * @param newNode 插入的节点
106
98
  */
107
99
  insertNode(newNode: AstNodes | string): void;
108
- /**
109
- * 在满足条件时获取范围内的全部节点
110
- * @throws `Error` 不是某个节点的连续子节点
111
- */
100
+ /** 获取范围内的全部节点 */
112
101
  extractContents(): AstNodes[];
113
102
  /** 在满足条件时拷贝范围内的全部节点 */
114
103
  cloneContents(): AstNodes[];