@dao42/d42paas-front 0.6.21 → 0.6.23

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.
@@ -189430,6 +189430,34 @@ function lineAndColumnToIndex(lines, lineNumber, column2) {
189430
189430
  index2 += column2 - 1;
189431
189431
  return index2;
189432
189432
  }
189433
+ function operationFromMonacoChanges(changeEvent, liveOperationCode) {
189434
+ let operation;
189435
+ let composedCode = liveOperationCode;
189436
+ for (const change of [...changeEvent.changes]) {
189437
+ const newOt = new TextOperation();
189438
+ const cursorStartOffset = lineAndColumnToIndex(composedCode.split(/\n/), change.range.startLineNumber, change.range.startColumn);
189439
+ const retain = cursorStartOffset - newOt.targetLength;
189440
+ if (retain !== 0) {
189441
+ newOt.retain(retain);
189442
+ }
189443
+ if (change.rangeLength > 0) {
189444
+ newOt.delete(change.rangeLength);
189445
+ }
189446
+ if (change.text) {
189447
+ newOt.insert(change.text);
189448
+ }
189449
+ const remaining = composedCode.length - newOt.baseLength;
189450
+ if (remaining > 0) {
189451
+ newOt.retain(remaining);
189452
+ }
189453
+ operation = operation ? operation.compose(newOt) : newOt;
189454
+ composedCode = operation.apply(liveOperationCode);
189455
+ }
189456
+ return {
189457
+ operation,
189458
+ liveOperationCode: composedCode
189459
+ };
189460
+ }
189433
189461
  new IoClient(0);
189434
189462
  class MonacoAdapter {
189435
189463
  constructor(monacoIns, serviceWorkerOrigin) {
@@ -189520,8 +189548,12 @@ class MonacoAdapter {
189520
189548
  } = evt;
189521
189549
  if (!isFlush) {
189522
189550
  try {
189523
- const pair = this.operationFromMonacoChanges(evt);
189524
- this.trigger("change", pair);
189551
+ const {
189552
+ operation,
189553
+ liveOperationCode
189554
+ } = operationFromMonacoChanges(evt, this.liveOperationCode);
189555
+ this.liveOperationCode = liveOperationCode;
189556
+ this.trigger("change", operation);
189525
189557
  } catch (err) {
189526
189558
  console.log(err);
189527
189559
  }
@@ -189588,34 +189620,6 @@ class MonacoAdapter {
189588
189620
  });
189589
189621
  }, "save");
189590
189622
  }
189591
- operationFromMonacoChanges(evt) {
189592
- let composedCode = this.liveOperationCode;
189593
- let operation;
189594
- for (let i2 = 0; i2 < evt.changes.length; i2++) {
189595
- const change = evt.changes[i2];
189596
- const cursorStartOffset = lineAndColumnToIndex(composedCode.split(/\n/), change.range.startLineNumber, change.range.startColumn);
189597
- const {
189598
- rangeLength,
189599
- text: text2
189600
- } = change;
189601
- const newOt = new TextOperation();
189602
- newOt.retain(cursorStartOffset);
189603
- if (rangeLength > 0) {
189604
- newOt.delete(rangeLength);
189605
- }
189606
- if (text2) {
189607
- newOt.insert(text2);
189608
- }
189609
- const remaining = composedCode.length - newOt.baseLength;
189610
- if (remaining > 0) {
189611
- newOt.retain(remaining);
189612
- }
189613
- operation = operation ? operation.compose(newOt) : newOt;
189614
- composedCode = operation.apply(this.liveOperationCode);
189615
- }
189616
- this.liveOperationCode = composedCode;
189617
- return operation;
189618
- }
189619
189623
  lspServerInject(_lan, useLsp = true) {
189620
189624
  languages.register({
189621
189625
  id: "ruby",
@@ -189646,7 +189650,7 @@ class MonacoAdapter {
189646
189650
  lspUrl,
189647
189651
  ticket
189648
189652
  } = oTStore.getState().dockerInfo;
189649
- if (!useLsp || !lspUrl || this.lspInited)
189653
+ if (!lspUrl || this.lspInited)
189650
189654
  return;
189651
189655
  this.lspInited = true;
189652
189656
  lib.MonacoServices.install(monaco);
@@ -189701,16 +189705,20 @@ class MonacoAdapter {
189701
189705
  globalAPI: true,
189702
189706
  getWorkerUrl(_moduleId, label) {
189703
189707
  if (label === "json") {
189704
- return "./json.worker.bundle.js";
189708
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189709
+ importScripts('${serviceWorkerOrigin}/assets/editor.worker.66c12891.js');`)}`;
189705
189710
  }
189706
189711
  if (label === "css" || label === "scss" || label === "less") {
189707
- return "./css.worker.bundle.js";
189712
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189713
+ importScripts('${serviceWorkerOrigin}/assets/editor.worker.5157db2f.js');`)}`;
189708
189714
  }
189709
189715
  if (label === "html" || label === "handlebars" || label === "razor") {
189710
- return "./html.worker.bundle.js";
189716
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189717
+ importScripts('${serviceWorkerOrigin}/assets/editor.worker.3f2697f1.js');`)}`;
189711
189718
  }
189712
189719
  if (label === "typescript" || label === "javascript") {
189713
- return "./ts.worker.bundle.js";
189720
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189721
+ importScripts('${serviceWorkerOrigin}/assets/editor.worker.d75e32f4.js');`)}`;
189714
189722
  }
189715
189723
  return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
189716
189724
  importScripts('${serviceWorkerOrigin}/assets/editor.worker.43309ac9.js');`)}`;
@@ -190269,10 +190277,10 @@ const Editor = ({
190269
190277
  }
190270
190278
  });
190271
190279
  return () => {
190272
- io.off("editFile");
190273
- io.off("serverAck");
190274
- io.off("selection");
190275
- io.off("cursor");
190280
+ io == null ? void 0 : io.off("editFile");
190281
+ io == null ? void 0 : io.off("serverAck");
190282
+ io == null ? void 0 : io.off("selection");
190283
+ io == null ? void 0 : io.off("cursor");
190276
190284
  };
190277
190285
  }, [clientEditor]);
190278
190286
  react.exports.useEffect(() => {