x-star-editor 0.3.8 → 0.3.9

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.
@@ -190,10 +190,10 @@ export var editorRender = function editorRender(sourceCode) {
190
190
  _step;
191
191
  try {
192
192
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
193
- var _node$position, _node$position2;
193
+ var _node$position, _node$position$start, _node$position2, _node$position2$end;
194
194
  var node = _step.value;
195
- var startOffset = (_node$position = node.position) === null || _node$position === void 0 ? void 0 : _node$position.start.offset;
196
- var endOffset = (_node$position2 = node.position) === null || _node$position2 === void 0 ? void 0 : _node$position2.end.offset;
195
+ var startOffset = (_node$position = node.position) === null || _node$position === void 0 ? void 0 : (_node$position$start = _node$position.start) === null || _node$position$start === void 0 ? void 0 : _node$position$start.offset;
196
+ var endOffset = (_node$position2 = node.position) === null || _node$position2 === void 0 ? void 0 : (_node$position2$end = _node$position2.end) === null || _node$position2$end === void 0 ? void 0 : _node$position2$end.offset;
197
197
  if (startOffset === undefined || endOffset === undefined) {
198
198
  continue;
199
199
  }
@@ -223,12 +223,12 @@ export var editorRender = function editorRender(sourceCode) {
223
223
  if (stack.length > 1) {
224
224
  pushElement(stack.length - 1);
225
225
  } else {
226
- var _node$position3;
226
+ var _node$position3, _node$position3$start;
227
227
  // 如果栈大小为 1,说明为块级元素终点
228
228
  stack[0].element.append("\u200B");
229
229
  pushElement(0);
230
230
  // 记录行号,用于同步滚动
231
- block.dataset.line = "".concat((_node$position3 = node.position) === null || _node$position3 === void 0 ? void 0 : _node$position3.start.line);
231
+ block.dataset.line = "".concat((_node$position3 = node.position) === null || _node$position3 === void 0 ? void 0 : (_node$position3$start = _node$position3.start) === null || _node$position3$start === void 0 ? void 0 : _node$position3$start.line);
232
232
  pushBlock();
233
233
  scanOffset++;
234
234
  }
@@ -6,10 +6,10 @@ import { SKIP, visit } from 'unist-util-visit';
6
6
  var rehypeLine = function rehypeLine() {
7
7
  return function (root) {
8
8
  return visit(root, 'element', function (node) {
9
- var _node$properties, _node$position;
9
+ var _node$properties, _node$position, _node$position$start;
10
10
  (_node$properties = node.properties) !== null && _node$properties !== void 0 ? _node$properties : node.properties = {};
11
11
  // 记录行号,用于同步滚动
12
- node.properties['data-line'] = (_node$position = node.position) === null || _node$position === void 0 ? void 0 : _node$position.start.line;
12
+ node.properties['data-line'] = (_node$position = node.position) === null || _node$position === void 0 ? void 0 : (_node$position$start = _node$position.start) === null || _node$position$start === void 0 ? void 0 : _node$position$start.line;
13
13
  return SKIP;
14
14
  });
15
15
  };
@@ -156,8 +156,8 @@ var rehypeMath = function rehypeMath() {
156
156
  return SKIP;
157
157
  }
158
158
  if (node.type === 'text' && index !== null && parent) {
159
- var _node$position;
160
- var startOffset = (_node$position = node.position) === null || _node$position === void 0 ? void 0 : _node$position.start.offset;
159
+ var _node$position, _node$position$start;
160
+ var startOffset = (_node$position = node.position) === null || _node$position === void 0 ? void 0 : (_node$position$start = _node$position.start) === null || _node$position$start === void 0 ? void 0 : _node$position$start.offset;
161
161
  if (startOffset === undefined) {
162
162
  return;
163
163
  }
@@ -7,9 +7,9 @@ var rehypeRawPositions = function rehypeRawPositions() {
7
7
  return function (root) {
8
8
  var rawPositions = [];
9
9
  visit(root, 'raw', function (node) {
10
- var _node$position, _node$position2;
11
- var startOffset = (_node$position = node.position) === null || _node$position === void 0 ? void 0 : _node$position.start.offset;
12
- var endOffset = (_node$position2 = node.position) === null || _node$position2 === void 0 ? void 0 : _node$position2.end.offset;
10
+ var _node$position, _node$position$start, _node$position2, _node$position2$end;
11
+ var startOffset = (_node$position = node.position) === null || _node$position === void 0 ? void 0 : (_node$position$start = _node$position.start) === null || _node$position$start === void 0 ? void 0 : _node$position$start.offset;
12
+ var endOffset = (_node$position2 = node.position) === null || _node$position2 === void 0 ? void 0 : (_node$position2$end = _node$position2.end) === null || _node$position2$end === void 0 ? void 0 : _node$position2$end.offset;
13
13
  if (startOffset === undefined || endOffset === undefined) {
14
14
  return;
15
15
  }