@dao42/d42paas-front 0.5.50 → 0.5.52

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.
@@ -14942,14 +14942,15 @@ const oTStore = create$3((set2) => ({
14942
14942
  },
14943
14943
  messageId: "",
14944
14944
  playgroundId: "",
14945
- result: ""
14945
+ result: "",
14946
+ dockerInfos: new Map([])
14946
14947
  },
14947
14948
  playgroundStatus: "EMPTY",
14948
14949
  dockerStatus: "STOP",
14949
14950
  queryObject: {},
14950
14951
  globalData: {
14951
14952
  isRecording: false,
14952
- syncCursor: true,
14953
+ syncCursor: false,
14953
14954
  useLsp: true
14954
14955
  },
14955
14956
  fileSaved: true,
@@ -28413,6 +28414,9 @@ const PlaygroundInit = (arg) => {
28413
28414
  avatar: avatarGenerator(lodash$2.exports.random(0, 6), userData.uuid)
28414
28415
  }), "coUsers");
28415
28416
  setUserInfo(originUser);
28417
+ if (oTStore.getState().playgroundStatus === "INACTIVE") {
28418
+ io == null ? void 0 : io.emit("active");
28419
+ }
28416
28420
  }
28417
28421
  const userInfoList = [originUser, ...userData.coUsers.filter((f2) => f2.uuid !== originUser.uuid).map((user) => {
28418
28422
  return __spreadProps(__spreadValues({}, user), {
@@ -28423,12 +28427,17 @@ const PlaygroundInit = (arg) => {
28423
28427
  setUserList(userInfoList);
28424
28428
  });
28425
28429
  io.on("playgroundInfo", (data) => {
28430
+ var _a2;
28426
28431
  const {
28427
28432
  playgroundInfo,
28428
28433
  crdt,
28429
28434
  dockerInfo: dockerInfo2
28430
28435
  } = JSON.parse(data);
28431
- setPlaygroundInfo(playgroundInfo);
28436
+ const otPlaygroundInfo = oTStore.getState().playgroundInfo;
28437
+ setPlaygroundInfo(__spreadProps(__spreadValues(__spreadValues({}, playgroundInfo), otPlaygroundInfo), {
28438
+ activeDocker: dockerInfo2.dockerId
28439
+ }));
28440
+ (_a2 = otPlaygroundInfo == null ? void 0 : otPlaygroundInfo.dockerInfos) == null ? void 0 : _a2.set(dockerInfo2.dockerId, dockerInfo2);
28432
28441
  setDockerInfo(__spreadValues(__spreadValues({}, oTStore.getState().dockerInfo), dockerInfo2));
28433
28442
  dockerInfo2.fileTree && switchFileTree({
28434
28443
  data: dockerInfo2.fileTree
@@ -42240,7 +42249,7 @@ const GuiComponent = () => {
42240
42249
  };
42241
42250
  useControls({
42242
42251
  lsp: {
42243
- value: true,
42252
+ value: oTStore.getState().globalData.useLsp,
42244
42253
  onChange: (v2) => {
42245
42254
  oTStore.getState().setGlobalData({
42246
42255
  useLsp: v2
@@ -42253,7 +42262,7 @@ const GuiComponent = () => {
42253
42262
  },
42254
42263
  syncCursor: {
42255
42264
  label: "\u5149\u6807\u540C\u6B65",
42256
- value: true,
42265
+ value: oTStore.getState().globalData.syncCursor,
42257
42266
  onChange: (v2) => {
42258
42267
  oTStore.getState().setGlobalData({
42259
42268
  syncCursor: v2
@@ -187728,23 +187737,6 @@ const Editor = ({
187728
187737
  const throttled = lodash$2.exports.throttle((callback) => {
187729
187738
  callback();
187730
187739
  }, 300);
187731
- const cursorTool = (evt) => {
187732
- var _a2, _b2, _c2, _d2;
187733
- const {
187734
- userInfo
187735
- } = userStore.getState();
187736
- const selection2 = [[evt.selection.startLineNumber, evt.selection.startColumn, evt.selection.endLineNumber, evt.selection.endColumn, evt.selection.selectionStartLineNumber, evt.selection.selectionStartColumn, evt.selection.positionColumn, evt.selection.positionLineNumber], ...evt.secondarySelections.map((s2) => [s2.startLineNumber, s2.startColumn, s2.endLineNumber, s2.endColumn, s2.selectionStartLineNumber, s2.selectionStartColumn, s2.positionColumn, s2.positionLineNumber])];
187737
- const crdt = {
187738
- timestamp: Date.now().toString(),
187739
- selection: selection2,
187740
- file: {
187741
- action: "Update",
187742
- path: (_b2 = (_a2 = oTStore.getState()) == null ? void 0 : _a2.doc) == null ? void 0 : _b2.path
187743
- },
187744
- userInfo: lodash$2.exports.pick(userInfo, "uuid", "role")
187745
- };
187746
- (_d2 = (_c2 = useOT.getState()) == null ? void 0 : _c2.socket) == null ? void 0 : _d2.emit("selection", JSON.stringify(crdt));
187747
- };
187748
187740
  const receiveOperation = (revision, operation, _path) => {
187749
187741
  client2.receiveOperation = operation;
187750
187742
  return {
@@ -187759,18 +187751,8 @@ const Editor = ({
187759
187751
  }
187760
187752
  });
187761
187753
  editor.onDidChangeCursorSelection((evt) => {
187762
- if (oTStore.getState().appStatus === "replay")
187763
- return;
187764
- if (evt.source === "api") {
187765
- throttled(() => {
187766
- cursorTool(evt);
187767
- });
187768
- }
187769
- if (evt.reason === 0 || evt.source === "model")
187770
- return;
187771
- throttled(() => {
187772
- cursorTool(evt);
187773
- });
187754
+ oTStore.getState();
187755
+ return;
187774
187756
  });
187775
187757
  editor.onDidChangeModelContent((evt) => {
187776
187758
  const {
@@ -188158,6 +188140,12 @@ const Editor = ({
188158
188140
  if (!editor)
188159
188141
  return;
188160
188142
  }, [OTSTATE.fileSaved]);
188143
+ react.exports.useEffect(() => {
188144
+ if (!editor)
188145
+ return;
188146
+ editor$1.getModels().forEach((model) => model.dispose());
188147
+ setFileTreeStack([]);
188148
+ }, [OTSTATE.dockerInfo]);
188161
188149
  react.exports.useEffect(() => {
188162
188150
  if (!editor || !file)
188163
188151
  return;
@@ -196323,6 +196311,11 @@ const MultiPlayerCursor = () => {
196323
196311
  userInfo
196324
196312
  } = userStore.getState();
196325
196313
  window.addEventListener("mousemove", (evt) => {
196314
+ const {
196315
+ globalData
196316
+ } = oTStore.getState();
196317
+ if (!globalData.syncCursor)
196318
+ return;
196326
196319
  const crdt = {
196327
196320
  timestamp: Date.now().toString(),
196328
196321
  userInfo: lodash$2.exports.pick(userInfo, "uuid", "role"),