@dao42/d42paas-front 0.7.31 → 0.7.34
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/DaoPaaS.es.js +779 -677
- package/dist/DaoPaaS.umd.js +512 -509
- package/dist/README.md +47 -0
- package/dist/editor.d.ts +305 -305
- package/dist/style.css +1 -1
- package/package.json +204 -205
package/dist/DaoPaaS.es.js
CHANGED
|
@@ -15083,16 +15083,14 @@ create$5((set2) => ({
|
|
|
15083
15083
|
}));
|
|
15084
15084
|
const shadowUserStore = create$5(persist((set2) => ({
|
|
15085
15085
|
shadowUser: {},
|
|
15086
|
-
switchShadowUser: (
|
|
15087
|
-
|
|
15088
|
-
|
|
15086
|
+
switchShadowUser: (id2) => set2(() => {
|
|
15087
|
+
let user;
|
|
15088
|
+
if (id2 !== void 0) {
|
|
15089
|
+
user = userListStore.getState().userList.find((user2) => user2.userId === id2);
|
|
15090
|
+
console.log(`\u5DF2\u5207\u6362\u81F3\u3010${user.username}\u3011\u89C6\u89D2`);
|
|
15089
15091
|
} else {
|
|
15090
15092
|
console.log(`\u5DF2\u9000\u51FA\u8DDF\u968F\u89C6\u89D2`);
|
|
15091
15093
|
}
|
|
15092
|
-
const user = userListStore.getState().userList.find((x2) => {
|
|
15093
|
-
var _a2;
|
|
15094
|
-
return x2.userId === ((_a2 = arg.userId) == null ? void 0 : _a2.toString());
|
|
15095
|
-
});
|
|
15096
15094
|
return {
|
|
15097
15095
|
shadowUser: user ? user : {}
|
|
15098
15096
|
};
|
|
@@ -28509,6 +28507,16 @@ class Toast {
|
|
|
28509
28507
|
});
|
|
28510
28508
|
}
|
|
28511
28509
|
}
|
|
28510
|
+
const clearUserList = () => {
|
|
28511
|
+
userListStore.getState().setUserList([]);
|
|
28512
|
+
};
|
|
28513
|
+
const setAppStatusTo = (status2 = "code") => {
|
|
28514
|
+
oTStore.getState().setAppStatus(status2);
|
|
28515
|
+
};
|
|
28516
|
+
const ResetPlayground = () => {
|
|
28517
|
+
setAppStatusTo("code");
|
|
28518
|
+
clearUserList();
|
|
28519
|
+
};
|
|
28512
28520
|
const heartbeatTime = 1e3 * 60 * 10;
|
|
28513
28521
|
const PlaygroundInit = (arg) => {
|
|
28514
28522
|
const {
|
|
@@ -28540,13 +28548,7 @@ const PlaygroundInit = (arg) => {
|
|
|
28540
28548
|
setGlobalData
|
|
28541
28549
|
} = oTStore.getState();
|
|
28542
28550
|
shadowUserStore.getState();
|
|
28543
|
-
|
|
28544
|
-
allFiles.length > 0 && allFiles.forEach((f2) => {
|
|
28545
|
-
setLocalReplayFile(f2 == null ? void 0 : f2.path, __spreadProps(__spreadValues({}, f2), {
|
|
28546
|
-
revision: 0
|
|
28547
|
-
}));
|
|
28548
|
-
});
|
|
28549
|
-
});
|
|
28551
|
+
ResetPlayground();
|
|
28550
28552
|
window.clearCache = () => {
|
|
28551
28553
|
localStorage.clear();
|
|
28552
28554
|
indexedDB.deleteDatabase("daopaas").onsuccess = () => {
|
|
@@ -28616,6 +28618,21 @@ const PlaygroundInit = (arg) => {
|
|
|
28616
28618
|
callback && callback();
|
|
28617
28619
|
}
|
|
28618
28620
|
});
|
|
28621
|
+
io.on("dockerInfo", (data) => {
|
|
28622
|
+
var _a2;
|
|
28623
|
+
const {
|
|
28624
|
+
dockerInfo: dockerInfo2
|
|
28625
|
+
} = JSON.parse(data);
|
|
28626
|
+
const otPlaygroundInfo = oTStore.getState().playgroundInfo;
|
|
28627
|
+
if (dockerInfo2) {
|
|
28628
|
+
(_a2 = otPlaygroundInfo == null ? void 0 : otPlaygroundInfo.dockerInfos) == null ? void 0 : _a2.set(dockerInfo2.dockerId, dockerInfo2);
|
|
28629
|
+
setDockerInfo(__spreadValues(__spreadValues({}, oTStore.getState().dockerInfo), dockerInfo2));
|
|
28630
|
+
dockerState.getState().setDockerStatus(dockerInfo2.status);
|
|
28631
|
+
dockerInfo2.fileTree && switchFileTree({
|
|
28632
|
+
data: dockerInfo2.fileTree
|
|
28633
|
+
});
|
|
28634
|
+
}
|
|
28635
|
+
});
|
|
28619
28636
|
io.on("playgroundStatus", (data) => {
|
|
28620
28637
|
setPlaygroundStatus(data);
|
|
28621
28638
|
});
|
|
@@ -32927,7 +32944,10 @@ const {
|
|
|
32927
32944
|
} = oTStore.getState();
|
|
32928
32945
|
const replay = async (passInData) => {
|
|
32929
32946
|
var _a2, _b2, _c2;
|
|
32930
|
-
|
|
32947
|
+
if (oTStore.getState().appStatus !== "replay") {
|
|
32948
|
+
clearReplayList();
|
|
32949
|
+
setAppStatus("replay");
|
|
32950
|
+
}
|
|
32931
32951
|
let operation;
|
|
32932
32952
|
const replayList = await getLocalCRDTs();
|
|
32933
32953
|
const filterReplayList = passInData.userId === void 0 ? replayList : replayList.filter((replayItem) => replayItem.userInfo.uuid === passInData.userId);
|
|
@@ -32974,7 +32994,6 @@ const replay = async (passInData) => {
|
|
|
32974
32994
|
path: filterReplaySource.file.path
|
|
32975
32995
|
});
|
|
32976
32996
|
}
|
|
32977
|
-
console.log(oTStore.getState().appStatus);
|
|
32978
32997
|
setLocalReplayFile((_a2 = filterReplaySource == null ? void 0 : filterReplaySource.file) == null ? void 0 : _a2.path, __spreadProps(__spreadValues({}, replayFile), {
|
|
32979
32998
|
revision: (_b2 = filterReplaySource == null ? void 0 : filterReplaySource.editor) == null ? void 0 : _b2.revision,
|
|
32980
32999
|
path: (_c2 = filterReplaySource == null ? void 0 : filterReplaySource.file) == null ? void 0 : _c2.path
|
|
@@ -32983,6 +33002,15 @@ const replay = async (passInData) => {
|
|
|
32983
33002
|
setCRDTInfo(__spreadValues({}, filterReplaySource));
|
|
32984
33003
|
}, 0);
|
|
32985
33004
|
};
|
|
33005
|
+
const clearReplayList = () => {
|
|
33006
|
+
return getAllLocalReplayFile().then((allFiles) => {
|
|
33007
|
+
allFiles.length > 0 && allFiles.forEach((f2) => {
|
|
33008
|
+
setLocalReplayFile(f2 == null ? void 0 : f2.path, __spreadProps(__spreadValues({}, f2), {
|
|
33009
|
+
revision: 0
|
|
33010
|
+
}));
|
|
33011
|
+
});
|
|
33012
|
+
});
|
|
33013
|
+
};
|
|
32986
33014
|
var index$7 = "";
|
|
32987
33015
|
const ignoreReplayerStore = create$5((set2) => ({
|
|
32988
33016
|
ignoreReplayers: [],
|
|
@@ -41875,11 +41903,6 @@ register$2(LevaInputs.BOOLEAN, boolean$6);
|
|
|
41875
41903
|
register$2(LevaInputs.INTERVAL, interval);
|
|
41876
41904
|
register$2(LevaInputs.VECTOR3D, vector3d);
|
|
41877
41905
|
register$2(LevaInputs.VECTOR2D, vector2d);
|
|
41878
|
-
const ReplayTimeline = () => {
|
|
41879
|
-
return /* @__PURE__ */ jsx("div", {
|
|
41880
|
-
id: "timeline-embed"
|
|
41881
|
-
});
|
|
41882
|
-
};
|
|
41883
41906
|
/**
|
|
41884
41907
|
* @license
|
|
41885
41908
|
* Copyright 2019 Google LLC
|
|
@@ -44507,7 +44530,7 @@ const GuiComponent = () => {
|
|
|
44507
44530
|
return /* @__PURE__ */ jsxs(Fragment, {
|
|
44508
44531
|
children: [/* @__PURE__ */ jsx(Leva, {
|
|
44509
44532
|
hidden: !showGUI
|
|
44510
|
-
}), /* @__PURE__ */ jsx(
|
|
44533
|
+
}), /* @__PURE__ */ jsx(CmdKey, {})]
|
|
44511
44534
|
});
|
|
44512
44535
|
};
|
|
44513
44536
|
const CURRENT_BRANCH = "staging";
|
|
@@ -44701,18 +44724,18 @@ class DaoPaaS {
|
|
|
44701
44724
|
callback && callback();
|
|
44702
44725
|
};
|
|
44703
44726
|
}
|
|
44704
|
-
followUser(
|
|
44727
|
+
followUser(userId, callback) {
|
|
44705
44728
|
const {
|
|
44706
44729
|
switchShadowUser
|
|
44707
44730
|
} = shadowUserStore.getState();
|
|
44708
|
-
switchShadowUser(
|
|
44709
|
-
callback && callback();
|
|
44731
|
+
switchShadowUser(userId);
|
|
44732
|
+
callback && callback(this.userList.find((u2) => u2.userId === userId));
|
|
44710
44733
|
}
|
|
44711
44734
|
unFollowUser(userInfo, callback) {
|
|
44712
44735
|
const {
|
|
44713
44736
|
switchShadowUser
|
|
44714
44737
|
} = shadowUserStore.getState();
|
|
44715
|
-
switchShadowUser(
|
|
44738
|
+
switchShadowUser();
|
|
44716
44739
|
callback && callback();
|
|
44717
44740
|
}
|
|
44718
44741
|
replay(arg) {
|
|
@@ -46101,7 +46124,7 @@ var TreeItemRenamingInput = function(props2) {
|
|
|
46101
46124
|
environment.setActiveTree(treeId);
|
|
46102
46125
|
});
|
|
46103
46126
|
};
|
|
46104
|
-
var
|
|
46127
|
+
var confirm2 = function() {
|
|
46105
46128
|
var _a3;
|
|
46106
46129
|
(_a3 = environment.onRenameItem) === null || _a3 === void 0 ? void 0 : _a3.call(environment, item, title, treeInformation.treeId);
|
|
46107
46130
|
setRenamingItem(null);
|
|
@@ -46136,13 +46159,13 @@ var TreeItemRenamingInput = function(props2) {
|
|
|
46136
46159
|
var submitButtonProps = {
|
|
46137
46160
|
onClick: function(e2) {
|
|
46138
46161
|
e2.stopPropagation();
|
|
46139
|
-
|
|
46162
|
+
confirm2();
|
|
46140
46163
|
}
|
|
46141
46164
|
};
|
|
46142
46165
|
var formProps = {
|
|
46143
46166
|
onSubmit: function(e2) {
|
|
46144
46167
|
e2.preventDefault();
|
|
46145
|
-
|
|
46168
|
+
confirm2();
|
|
46146
46169
|
}
|
|
46147
46170
|
};
|
|
46148
46171
|
return renderers.renderRenameInput({
|
|
@@ -48261,6 +48284,9 @@ Transition.Child = function Child(props2) {
|
|
|
48261
48284
|
return !hasTransitionContext && hasOpenClosedContext ? /* @__PURE__ */ jsx(Transition, __spreadValues({}, Object.assign({}, props2))) : /* @__PURE__ */ jsx(TransitionChild, __spreadValues({}, Object.assign({}, props2)));
|
|
48262
48285
|
};
|
|
48263
48286
|
Transition.Root = Transition;
|
|
48287
|
+
const checkIfTheFileHasDeleted = (fileTree, value) => {
|
|
48288
|
+
return !JSON.stringify(fileTree).includes(value);
|
|
48289
|
+
};
|
|
48264
48290
|
const IoClient = function(revision) {
|
|
48265
48291
|
this.revision = revision;
|
|
48266
48292
|
this.state = synchronized_;
|
|
@@ -48394,25 +48420,25 @@ const FollowLayout = ({
|
|
|
48394
48420
|
if (!(shadowUser == null ? void 0 : shadowUser.uuid))
|
|
48395
48421
|
return;
|
|
48396
48422
|
setAsyncType(void 0);
|
|
48397
|
-
switchShadowUser(
|
|
48423
|
+
switchShadowUser(void 0);
|
|
48398
48424
|
},
|
|
48399
48425
|
onKeyDown: () => {
|
|
48400
48426
|
if (!(shadowUser == null ? void 0 : shadowUser.uuid))
|
|
48401
48427
|
return;
|
|
48402
48428
|
setAsyncType(void 0);
|
|
48403
|
-
switchShadowUser(
|
|
48429
|
+
switchShadowUser(void 0);
|
|
48404
48430
|
},
|
|
48405
48431
|
onScroll: () => {
|
|
48406
48432
|
if (!(shadowUser == null ? void 0 : shadowUser.uuid))
|
|
48407
48433
|
return;
|
|
48408
48434
|
setAsyncType(void 0);
|
|
48409
|
-
switchShadowUser(
|
|
48435
|
+
switchShadowUser(void 0);
|
|
48410
48436
|
},
|
|
48411
48437
|
onWheel: () => {
|
|
48412
48438
|
if (!(shadowUser == null ? void 0 : shadowUser.uuid))
|
|
48413
48439
|
return;
|
|
48414
48440
|
setAsyncType(void 0);
|
|
48415
|
-
switchShadowUser(
|
|
48441
|
+
switchShadowUser(void 0);
|
|
48416
48442
|
},
|
|
48417
48443
|
children: [oTStore.getState().appStatus === "replay" && FROZEN_CONTROL_COMPONENTS.some((d2) => d2 === name) ? /* @__PURE__ */ jsx(Freezer, {}) : null, children]
|
|
48418
48444
|
});
|
|
@@ -48434,583 +48460,6 @@ const Freezer = ({
|
|
|
48434
48460
|
}) => /* @__PURE__ */ jsx(FreezerLayout, {
|
|
48435
48461
|
children
|
|
48436
48462
|
});
|
|
48437
|
-
function addChildrenArray(children, parent2) {
|
|
48438
|
-
var _a2, _b2;
|
|
48439
|
-
for (let i = 0; i < children.length; i++) {
|
|
48440
|
-
if (children[i].type === "DIRECTORY") {
|
|
48441
|
-
(_a2 = parent2 == null ? void 0 : parent2.children) == null ? void 0 : _a2.push(`${parent2.index}${children[i].name}/`);
|
|
48442
|
-
} else {
|
|
48443
|
-
(_b2 = parent2 == null ? void 0 : parent2.children) == null ? void 0 : _b2.push(`${parent2.index}${children[i].name}`);
|
|
48444
|
-
}
|
|
48445
|
-
}
|
|
48446
|
-
}
|
|
48447
|
-
function formatFileToTree(data) {
|
|
48448
|
-
if (!data)
|
|
48449
|
-
return;
|
|
48450
|
-
const formatData = {};
|
|
48451
|
-
const root2 = data.name;
|
|
48452
|
-
formatData[root2] = {
|
|
48453
|
-
index: root2,
|
|
48454
|
-
children: [],
|
|
48455
|
-
hasChildren: true,
|
|
48456
|
-
data: root2
|
|
48457
|
-
};
|
|
48458
|
-
addChildrenArray(data.children, formatData[root2]);
|
|
48459
|
-
let nodeChildren = [...data.children];
|
|
48460
|
-
let pathChildren = [...formatData[root2].children];
|
|
48461
|
-
while (nodeChildren.length) {
|
|
48462
|
-
const size2 = nodeChildren.length;
|
|
48463
|
-
for (let i = 0; i < size2; i++) {
|
|
48464
|
-
const child = nodeChildren.shift();
|
|
48465
|
-
const path2 = pathChildren.shift();
|
|
48466
|
-
nodeChildren = nodeChildren.concat(child.children);
|
|
48467
|
-
switch (child.type) {
|
|
48468
|
-
case "DIRECTORY":
|
|
48469
|
-
const dirPath = path2;
|
|
48470
|
-
formatData[dirPath] = {
|
|
48471
|
-
index: dirPath,
|
|
48472
|
-
hasChildren: true,
|
|
48473
|
-
children: [],
|
|
48474
|
-
data: child.name
|
|
48475
|
-
};
|
|
48476
|
-
addChildrenArray(child.children, formatData[dirPath]);
|
|
48477
|
-
pathChildren = pathChildren.concat(formatData[dirPath].children);
|
|
48478
|
-
break;
|
|
48479
|
-
case "FILE":
|
|
48480
|
-
const filePath = path2;
|
|
48481
|
-
formatData[filePath] = {
|
|
48482
|
-
index: filePath,
|
|
48483
|
-
hasChildren: false,
|
|
48484
|
-
data: child.name
|
|
48485
|
-
};
|
|
48486
|
-
break;
|
|
48487
|
-
}
|
|
48488
|
-
}
|
|
48489
|
-
}
|
|
48490
|
-
return formatData;
|
|
48491
|
-
}
|
|
48492
|
-
const getStringFromFile = async (file) => {
|
|
48493
|
-
const base64String = await new Promise((resolve2) => {
|
|
48494
|
-
const reader2 = new FileReader();
|
|
48495
|
-
reader2.readAsDataURL(file);
|
|
48496
|
-
reader2.onload = (e2) => {
|
|
48497
|
-
resolve2(e2.target.result);
|
|
48498
|
-
};
|
|
48499
|
-
});
|
|
48500
|
-
return base64String;
|
|
48501
|
-
};
|
|
48502
|
-
const FileTree = ({
|
|
48503
|
-
onCustomSelect
|
|
48504
|
-
}) => {
|
|
48505
|
-
const addedFolder = {
|
|
48506
|
-
target: "",
|
|
48507
|
-
files: []
|
|
48508
|
-
};
|
|
48509
|
-
const io = useOT.getState().socket;
|
|
48510
|
-
const [focusedItem, setFocusedItem] = react.exports.useState();
|
|
48511
|
-
const [expandedItems, setExpandedItems] = react.exports.useState([]);
|
|
48512
|
-
const [selectedItems, setSelectedItems] = react.exports.useState([]);
|
|
48513
|
-
const [remoteUserList, setRemoteUserList] = react.exports.useState({});
|
|
48514
|
-
const [renameItem, setRenameItem] = react.exports.useState("");
|
|
48515
|
-
const [renameValue, setRenameValue] = react.exports.useState("");
|
|
48516
|
-
const treeRef = react.exports.useRef(null);
|
|
48517
|
-
const {
|
|
48518
|
-
CRDTInfo: CRDTInfo2,
|
|
48519
|
-
dockerInfo: dockerInfo2
|
|
48520
|
-
} = oTStore((state2) => state2);
|
|
48521
|
-
const {
|
|
48522
|
-
fileTree
|
|
48523
|
-
} = fileTreeStore((state2) => state2);
|
|
48524
|
-
const [treeData, setTreeData] = react.exports.useState({});
|
|
48525
|
-
react.exports.useEffect(() => {
|
|
48526
|
-
if (oTStore.getState().appStatus === "replay") {
|
|
48527
|
-
setSelectedItems([]);
|
|
48528
|
-
setExpandedItems([]);
|
|
48529
|
-
}
|
|
48530
|
-
if (!fileTree.data)
|
|
48531
|
-
return;
|
|
48532
|
-
const newData = formatFileToTree(fileTree == null ? void 0 : fileTree.data);
|
|
48533
|
-
setSelectedItems(selectedItems.filter((item) => newData[item]));
|
|
48534
|
-
setExpandedItems(expandedItems.filter((item) => newData[item]));
|
|
48535
|
-
setTreeData(newData);
|
|
48536
|
-
}, [fileTree]);
|
|
48537
|
-
react.exports.useEffect(() => {
|
|
48538
|
-
setSelectedItems([]);
|
|
48539
|
-
setExpandedItems([]);
|
|
48540
|
-
}, [dockerInfo2]);
|
|
48541
|
-
const onSelect = (items) => {
|
|
48542
|
-
if (items.length === 1) {
|
|
48543
|
-
setSelectedItems(items);
|
|
48544
|
-
if (oTStore.getState().appStatus === "code") {
|
|
48545
|
-
const crdt = {
|
|
48546
|
-
timestamp: Date.now(),
|
|
48547
|
-
userInfo: userStore.getState().userInfo,
|
|
48548
|
-
editor: {
|
|
48549
|
-
extraInfo: {
|
|
48550
|
-
messageId: "1",
|
|
48551
|
-
playgroundId: oTStore.getState().playgroundInfo.playgroundId
|
|
48552
|
-
},
|
|
48553
|
-
evtType: "File"
|
|
48554
|
-
},
|
|
48555
|
-
file: {
|
|
48556
|
-
action: "Get",
|
|
48557
|
-
path: items[0]
|
|
48558
|
-
}
|
|
48559
|
-
};
|
|
48560
|
-
io == null ? void 0 : io.emit("fileContent", JSON.stringify(crdt));
|
|
48561
|
-
}
|
|
48562
|
-
}
|
|
48563
|
-
};
|
|
48564
|
-
const onExpand = (item) => {
|
|
48565
|
-
setExpandedItems([...expandedItems, item]);
|
|
48566
|
-
};
|
|
48567
|
-
const onCollapse = (item) => {
|
|
48568
|
-
setExpandedItems(expandedItems.filter((expandedItemIndex) => expandedItemIndex !== item));
|
|
48569
|
-
};
|
|
48570
|
-
const onUploadFile = (payload) => {
|
|
48571
|
-
io == null ? void 0 : io.emit("upload", payload);
|
|
48572
|
-
addedFolder.target = "";
|
|
48573
|
-
addedFolder.files = [];
|
|
48574
|
-
};
|
|
48575
|
-
const formatUploadFileTarget = (path2) => {
|
|
48576
|
-
if (path2[path2.length - 1] !== "/") {
|
|
48577
|
-
addedFolder.target = `${path2.split("/").slice(0, -1).join("/")}/`;
|
|
48578
|
-
} else {
|
|
48579
|
-
addedFolder.target = path2;
|
|
48580
|
-
}
|
|
48581
|
-
};
|
|
48582
|
-
const traverseFileTree = async (item, path2 = "/") => {
|
|
48583
|
-
const data = await new Promise((resolve2) => {
|
|
48584
|
-
if (item.isFile) {
|
|
48585
|
-
item.file(async (file) => {
|
|
48586
|
-
resolve2([{
|
|
48587
|
-
path: `${path2}${file.name}`,
|
|
48588
|
-
content: await getStringFromFile(file)
|
|
48589
|
-
}]);
|
|
48590
|
-
});
|
|
48591
|
-
} else if (item.isDirectory) {
|
|
48592
|
-
let result = [{
|
|
48593
|
-
path: `${path2}${item.name}/`,
|
|
48594
|
-
content: ""
|
|
48595
|
-
}];
|
|
48596
|
-
const dirReader = item.createReader();
|
|
48597
|
-
dirReader.readEntries(async (entries) => {
|
|
48598
|
-
for (let i = 0; i < entries.length; i++) {
|
|
48599
|
-
result = result.concat(await traverseFileTree(entries[i], `${path2}${item.name}/`));
|
|
48600
|
-
}
|
|
48601
|
-
resolve2(result);
|
|
48602
|
-
});
|
|
48603
|
-
}
|
|
48604
|
-
});
|
|
48605
|
-
return data;
|
|
48606
|
-
};
|
|
48607
|
-
const onOriginDrop = async (event) => {
|
|
48608
|
-
var _a2;
|
|
48609
|
-
event.preventDefault();
|
|
48610
|
-
let buttonElement = event.target;
|
|
48611
|
-
while (buttonElement && ((_a2 = buttonElement.tagName) == null ? void 0 : _a2.toLowerCase()) !== "button") {
|
|
48612
|
-
buttonElement = buttonElement.lastChild;
|
|
48613
|
-
}
|
|
48614
|
-
const node2 = buttonElement ? buttonElement.dataset["rctItemId"] : "/";
|
|
48615
|
-
formatUploadFileTarget(node2);
|
|
48616
|
-
const items = event.dataTransfer.items;
|
|
48617
|
-
if (items.length === 0)
|
|
48618
|
-
return;
|
|
48619
|
-
const itemsIterate = [];
|
|
48620
|
-
for (const i of items) {
|
|
48621
|
-
itemsIterate.push(i.webkitGetAsEntry());
|
|
48622
|
-
}
|
|
48623
|
-
for (const item of itemsIterate) {
|
|
48624
|
-
if (item) {
|
|
48625
|
-
addedFolder.files = addedFolder.files.concat(await traverseFileTree(item));
|
|
48626
|
-
}
|
|
48627
|
-
}
|
|
48628
|
-
buttonElement == null ? void 0 : buttonElement.parentNode.classList.remove("rct-tree-item-title-container-selected");
|
|
48629
|
-
buttonElement == null ? void 0 : buttonElement.parentNode.parentNode.classList.remove("rct-tree-item-li-selected");
|
|
48630
|
-
onUploadFile(JSON.stringify(addedFolder));
|
|
48631
|
-
};
|
|
48632
|
-
react.exports.useEffect(() => {
|
|
48633
|
-
if (treeRef.current) {
|
|
48634
|
-
treeRef.current.removeEventListener("drop", onOriginDrop);
|
|
48635
|
-
treeRef.current.addEventListener("drop", onOriginDrop, false);
|
|
48636
|
-
treeRef.current.addEventListener("dragover", (e2) => {
|
|
48637
|
-
if (e2.dataTransfer.items.length === 0)
|
|
48638
|
-
return;
|
|
48639
|
-
e2.preventDefault();
|
|
48640
|
-
e2.stopPropagation();
|
|
48641
|
-
}, false);
|
|
48642
|
-
treeRef.current.addEventListener("dragenter", (e2) => {
|
|
48643
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
48644
|
-
if (((_a2 = e2 == null ? void 0 : e2.dataTransfer) == null ? void 0 : _a2.items.length) === 0)
|
|
48645
|
-
return;
|
|
48646
|
-
e2.preventDefault();
|
|
48647
|
-
e2.stopPropagation();
|
|
48648
|
-
if (((_c2 = (_b2 = e2 == null ? void 0 : e2.target) == null ? void 0 : _b2.tagName) == null ? void 0 : _c2.toLowerCase()) === "button") {
|
|
48649
|
-
(_e2 = (_d2 = e2.target) == null ? void 0 : _d2.parentNode) == null ? void 0 : _e2.classList.add("rct-tree-item-title-container-selected");
|
|
48650
|
-
(_g2 = (_f2 = e2.target) == null ? void 0 : _f2.parentNode) == null ? void 0 : _g2.parentNode.classList.add("rct-tree-item-li-selected");
|
|
48651
|
-
}
|
|
48652
|
-
}, false);
|
|
48653
|
-
treeRef.current.addEventListener("dragleave", (e2) => {
|
|
48654
|
-
if (e2.dataTransfer.items.length === 0)
|
|
48655
|
-
return;
|
|
48656
|
-
e2.preventDefault();
|
|
48657
|
-
e2.stopPropagation();
|
|
48658
|
-
if (e2.target.tagName.toLowerCase() === "button") {
|
|
48659
|
-
e2.target.parentNode.classList.remove("rct-tree-item-title-container-selected");
|
|
48660
|
-
e2.target.parentNode.parentNode.classList.remove("rct-tree-item-li-selected");
|
|
48661
|
-
}
|
|
48662
|
-
}, false);
|
|
48663
|
-
}
|
|
48664
|
-
}, [treeRef]);
|
|
48665
|
-
react.exports.useEffect(() => {
|
|
48666
|
-
var _a2, _b2;
|
|
48667
|
-
const user = userListStore.getState().userList.find((item) => item.uuid === CRDTInfo2.userInfo.uuid);
|
|
48668
|
-
if (((_a2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.editor) == null ? void 0 : _a2.evtType) === "File" && user) {
|
|
48669
|
-
const path2 = (_b2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.file) == null ? void 0 : _b2.path;
|
|
48670
|
-
if (!IsMe(CRDTInfo2.userInfo)) {
|
|
48671
|
-
setRemoteUserList((oldUserListItem) => {
|
|
48672
|
-
const userListItem = __spreadValues({}, oldUserListItem);
|
|
48673
|
-
const remoteUserListObj = Object.entries(userListItem);
|
|
48674
|
-
for (const iteratorItem of remoteUserListObj) {
|
|
48675
|
-
const [key, value] = iteratorItem;
|
|
48676
|
-
const index2 = value.findIndex((item) => item.uuid === user.uuid);
|
|
48677
|
-
if (index2 > -1) {
|
|
48678
|
-
userListItem[key].splice(index2, 1);
|
|
48679
|
-
if (userListItem[key].length === 0) {
|
|
48680
|
-
delete userListItem[key];
|
|
48681
|
-
}
|
|
48682
|
-
break;
|
|
48683
|
-
}
|
|
48684
|
-
}
|
|
48685
|
-
if (userListItem[path2]) {
|
|
48686
|
-
userListItem[path2].push({
|
|
48687
|
-
uuid: user.uuid,
|
|
48688
|
-
color: user.color,
|
|
48689
|
-
avatar: user.avatar
|
|
48690
|
-
});
|
|
48691
|
-
} else {
|
|
48692
|
-
userListItem[path2] = [{
|
|
48693
|
-
uuid: user.uuid,
|
|
48694
|
-
color: user.color,
|
|
48695
|
-
avatar: user.avatar
|
|
48696
|
-
}];
|
|
48697
|
-
}
|
|
48698
|
-
return userListItem;
|
|
48699
|
-
});
|
|
48700
|
-
if (path2[path2.length - 1] === "/") {
|
|
48701
|
-
const index2 = expandedItems.indexOf(path2);
|
|
48702
|
-
if (index2 === -1) {
|
|
48703
|
-
onExpand(path2);
|
|
48704
|
-
} else {
|
|
48705
|
-
onCollapse(path2);
|
|
48706
|
-
}
|
|
48707
|
-
}
|
|
48708
|
-
} else if (oTStore.getState().appStatus === "replay" && !ignoreReplayerStore.getState().ignoreReplayers.some((d2) => d2 === "file")) {
|
|
48709
|
-
onSelect([path2]);
|
|
48710
|
-
if (path2[path2.length - 1] === "/") {
|
|
48711
|
-
const index2 = expandedItems.indexOf(path2);
|
|
48712
|
-
if (index2 === -1) {
|
|
48713
|
-
onExpand(path2);
|
|
48714
|
-
} else {
|
|
48715
|
-
onCollapse(path2);
|
|
48716
|
-
}
|
|
48717
|
-
}
|
|
48718
|
-
}
|
|
48719
|
-
}
|
|
48720
|
-
}, [CRDTInfo2]);
|
|
48721
|
-
const handleAddFile = (path2) => {
|
|
48722
|
-
onExpand(path2);
|
|
48723
|
-
if (path2[path2.length - 1] !== "/") {
|
|
48724
|
-
path2 = `${path2.split("/").slice(0, -1).join("/")}/`;
|
|
48725
|
-
}
|
|
48726
|
-
setTreeData((treeData2) => {
|
|
48727
|
-
var _a2;
|
|
48728
|
-
const newFilePath = `${path2}${v4$1().substring(0, 6)}`;
|
|
48729
|
-
(_a2 = treeData2[path2].children) == null ? void 0 : _a2.push(newFilePath);
|
|
48730
|
-
treeData2[newFilePath] = {
|
|
48731
|
-
index: newFilePath,
|
|
48732
|
-
hasChildren: false,
|
|
48733
|
-
data: "Untitled"
|
|
48734
|
-
};
|
|
48735
|
-
setRenameItem(newFilePath);
|
|
48736
|
-
setRenameValue("");
|
|
48737
|
-
return treeData2;
|
|
48738
|
-
});
|
|
48739
|
-
};
|
|
48740
|
-
const handleAddFolder = (path2) => {
|
|
48741
|
-
onExpand(path2);
|
|
48742
|
-
if (path2[path2.length - 1] !== "/") {
|
|
48743
|
-
path2 = `${path2.split("/").slice(0, -1).join("/")}/`;
|
|
48744
|
-
}
|
|
48745
|
-
setTreeData((treeData2) => {
|
|
48746
|
-
var _a2;
|
|
48747
|
-
const newFolderPath = `${path2}${v4$1().substring(0, 6)}/`;
|
|
48748
|
-
(_a2 = treeData2[path2].children) == null ? void 0 : _a2.push(newFolderPath);
|
|
48749
|
-
treeData2[newFolderPath] = {
|
|
48750
|
-
index: newFolderPath,
|
|
48751
|
-
hasChildren: true,
|
|
48752
|
-
children: [],
|
|
48753
|
-
data: "Untitled"
|
|
48754
|
-
};
|
|
48755
|
-
setRenameItem(newFolderPath);
|
|
48756
|
-
setRenameValue("");
|
|
48757
|
-
return treeData2;
|
|
48758
|
-
});
|
|
48759
|
-
};
|
|
48760
|
-
const handleStopRenaming = (path2) => {
|
|
48761
|
-
if (renameValue === "") {
|
|
48762
|
-
setTreeData((treeData2) => {
|
|
48763
|
-
delete treeData2[path2];
|
|
48764
|
-
return treeData2;
|
|
48765
|
-
});
|
|
48766
|
-
}
|
|
48767
|
-
setRenameItem("");
|
|
48768
|
-
};
|
|
48769
|
-
const handleSave = (treeNode, name = "") => {
|
|
48770
|
-
const payload = {
|
|
48771
|
-
action: "",
|
|
48772
|
-
path: "",
|
|
48773
|
-
newPath: ""
|
|
48774
|
-
};
|
|
48775
|
-
const newPath = treeNode.index.split("/");
|
|
48776
|
-
if (treeNode.hasChildren) {
|
|
48777
|
-
newPath.splice(-2, 1, name);
|
|
48778
|
-
} else {
|
|
48779
|
-
newPath.splice(-1, 1, name);
|
|
48780
|
-
}
|
|
48781
|
-
if (treeNode.data === "Untitled") {
|
|
48782
|
-
payload.action = "CREATE";
|
|
48783
|
-
payload.path = newPath.join("/");
|
|
48784
|
-
} else {
|
|
48785
|
-
payload.action = "RENAME";
|
|
48786
|
-
payload.path = treeNode.index;
|
|
48787
|
-
payload.newPath = newPath.join("/");
|
|
48788
|
-
}
|
|
48789
|
-
io == null ? void 0 : io.emit("fileTreeOp", JSON.stringify(payload));
|
|
48790
|
-
};
|
|
48791
|
-
const handleUpload = (path2, uploadType) => {
|
|
48792
|
-
formatUploadFileTarget(path2);
|
|
48793
|
-
document.getElementById(`manual-upload-${uploadType}`).click();
|
|
48794
|
-
};
|
|
48795
|
-
const handleManualUploadFile = async (files) => {
|
|
48796
|
-
for (const item of files) {
|
|
48797
|
-
addedFolder.files = addedFolder.files.concat([{
|
|
48798
|
-
path: `/${item.name}`,
|
|
48799
|
-
content: await getStringFromFile(item)
|
|
48800
|
-
}]);
|
|
48801
|
-
}
|
|
48802
|
-
onUploadFile(JSON.stringify(addedFolder));
|
|
48803
|
-
};
|
|
48804
|
-
const handleManualUploadFolder = async (files) => {
|
|
48805
|
-
for (const item of files) {
|
|
48806
|
-
addedFolder.files = addedFolder.files.concat([{
|
|
48807
|
-
path: `/${item.webkitRelativePath}`,
|
|
48808
|
-
content: await getStringFromFile(item)
|
|
48809
|
-
}]);
|
|
48810
|
-
}
|
|
48811
|
-
onUploadFile(JSON.stringify(addedFolder));
|
|
48812
|
-
};
|
|
48813
|
-
const handleDeleteFileFolder = (path2) => {
|
|
48814
|
-
io == null ? void 0 : io.emit("fileTreeOp", JSON.stringify({
|
|
48815
|
-
action: "DELETE",
|
|
48816
|
-
path: path2
|
|
48817
|
-
}));
|
|
48818
|
-
};
|
|
48819
|
-
return /* @__PURE__ */ jsx(FollowLayout, {
|
|
48820
|
-
name: "file",
|
|
48821
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
48822
|
-
ref: treeRef,
|
|
48823
|
-
style: {
|
|
48824
|
-
height: "100%",
|
|
48825
|
-
overflow: "auto"
|
|
48826
|
-
},
|
|
48827
|
-
children: [/* @__PURE__ */ jsx("input", {
|
|
48828
|
-
id: "manual-upload-file",
|
|
48829
|
-
type: "file",
|
|
48830
|
-
multiple: true,
|
|
48831
|
-
hidden: true,
|
|
48832
|
-
onChange: (event) => {
|
|
48833
|
-
handleManualUploadFile(event.target.files);
|
|
48834
|
-
}
|
|
48835
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
48836
|
-
id: "manual-upload-folder",
|
|
48837
|
-
type: "file",
|
|
48838
|
-
multiple: true,
|
|
48839
|
-
hidden: true,
|
|
48840
|
-
webkitdirectory: "",
|
|
48841
|
-
mozdirectory: "",
|
|
48842
|
-
directory: "",
|
|
48843
|
-
onChange: (event) => {
|
|
48844
|
-
handleManualUploadFolder(event.target.files);
|
|
48845
|
-
}
|
|
48846
|
-
}), /* @__PURE__ */ jsx(ControlledTreeEnvironment, {
|
|
48847
|
-
canDragAndDrop: true,
|
|
48848
|
-
canSearch: false,
|
|
48849
|
-
items: treeData,
|
|
48850
|
-
onFocusItem: (item) => setFocusedItem(item.index),
|
|
48851
|
-
onExpandItem: (item) => {
|
|
48852
|
-
onExpand(item.index);
|
|
48853
|
-
},
|
|
48854
|
-
onCollapseItem: (item) => {
|
|
48855
|
-
onCollapse(item.index);
|
|
48856
|
-
},
|
|
48857
|
-
getItemTitle: (item) => item.data,
|
|
48858
|
-
viewState: {
|
|
48859
|
-
["tree-1"]: {
|
|
48860
|
-
focusedItem,
|
|
48861
|
-
expandedItems,
|
|
48862
|
-
selectedItems
|
|
48863
|
-
}
|
|
48864
|
-
},
|
|
48865
|
-
onSelectItems: (items) => {
|
|
48866
|
-
onSelect(items);
|
|
48867
|
-
onCustomSelect == null ? void 0 : onCustomSelect(items);
|
|
48868
|
-
},
|
|
48869
|
-
renderItem: ({
|
|
48870
|
-
title,
|
|
48871
|
-
arrow,
|
|
48872
|
-
depth,
|
|
48873
|
-
context,
|
|
48874
|
-
children
|
|
48875
|
-
}) => {
|
|
48876
|
-
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, context.itemContainerWithChildrenProps), {
|
|
48877
|
-
className: ["rct-tree-item-li", context.isSelected ? "rct-tree-item-li-selected" : "", context.isExpanded ? "rct-tree-item-li-expanded" : "", context.isFocused ? "rct-tree-item-li-focused" : "", children ? "rct-tree-item-li-hasChildren" : ""].join(" "),
|
|
48878
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
48879
|
-
className: ["rct-tree-item-title-container", context.isSelected ? "rct-tree-item-title-container-selected" : "", context.isExpanded ? "rct-tree-item-title-container-expanded" : "", context.isFocused ? "rct-tree-item-title-container-focused" : "", children ? "rct-tree-item-title-container-hasChildren" : ""].join(" "),
|
|
48880
|
-
style: {
|
|
48881
|
-
paddingLeft: `${depth}0px`
|
|
48882
|
-
},
|
|
48883
|
-
children: [remoteUserList[context.interactiveElementProps["data-rct-item-id"]] && remoteUserList[context.interactiveElementProps["data-rct-item-id"]].map((remoteUser) => /* @__PURE__ */ jsx("div", {
|
|
48884
|
-
className: "rct-tree-item-avatar rounded-full absolute border",
|
|
48885
|
-
style: {
|
|
48886
|
-
borderColor: remoteUser.color,
|
|
48887
|
-
backgroundImage: `url(${remoteUser.avatar})`
|
|
48888
|
-
}
|
|
48889
|
-
}, remoteUser.uuid)), /* @__PURE__ */ jsxs("div", {
|
|
48890
|
-
className: "rct-tree-item-toolbar absolute right-0",
|
|
48891
|
-
children: [/* @__PURE__ */ jsx("button", {
|
|
48892
|
-
onClick: () => {
|
|
48893
|
-
handleAddFile(context.interactiveElementProps["data-rct-item-id"]);
|
|
48894
|
-
},
|
|
48895
|
-
children: /* @__PURE__ */ jsx("i", {
|
|
48896
|
-
className: "d42 add-file"
|
|
48897
|
-
})
|
|
48898
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
48899
|
-
onClick: () => {
|
|
48900
|
-
handleAddFolder(context.interactiveElementProps["data-rct-item-id"]);
|
|
48901
|
-
},
|
|
48902
|
-
children: /* @__PURE__ */ jsx("i", {
|
|
48903
|
-
className: "d42 add-folder"
|
|
48904
|
-
})
|
|
48905
|
-
}), /* @__PURE__ */ jsx(Menu$2, {
|
|
48906
|
-
as: "div",
|
|
48907
|
-
className: "relative",
|
|
48908
|
-
children: ({
|
|
48909
|
-
open: open2
|
|
48910
|
-
}) => /* @__PURE__ */ jsxs(Fragment, {
|
|
48911
|
-
children: [/* @__PURE__ */ jsx(Menu$2.Button, {
|
|
48912
|
-
children: /* @__PURE__ */ jsx("i", {
|
|
48913
|
-
className: "d42 more"
|
|
48914
|
-
})
|
|
48915
|
-
}), /* @__PURE__ */ jsx(Transition, {
|
|
48916
|
-
show: open2,
|
|
48917
|
-
as: react.exports.Fragment,
|
|
48918
|
-
enter: "transition ease-out duration-100",
|
|
48919
|
-
enterFrom: "transform opacity-0 scale-95",
|
|
48920
|
-
enterTo: "transform opacity-100 scale-100",
|
|
48921
|
-
leave: "transition ease-in duration-75",
|
|
48922
|
-
leaveFrom: "transform opacity-100 scale-100",
|
|
48923
|
-
leaveTo: "transform opacity-0 scale-95",
|
|
48924
|
-
children: /* @__PURE__ */ jsxs(Menu$2.Items, {
|
|
48925
|
-
static: true,
|
|
48926
|
-
className: "absolute z-1 w-20 right-0 top-full",
|
|
48927
|
-
children: [/* @__PURE__ */ jsx(Menu$2.Item, {
|
|
48928
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
48929
|
-
className: "code-dropdown-btn-item",
|
|
48930
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
48931
|
-
className: "w-full justify-center my-2",
|
|
48932
|
-
onClick: () => {
|
|
48933
|
-
handleUpload(context.interactiveElementProps["data-rct-item-id"], "file");
|
|
48934
|
-
},
|
|
48935
|
-
children: "\u4E0A\u4F20\u6587\u4EF6"
|
|
48936
|
-
})
|
|
48937
|
-
})
|
|
48938
|
-
}), /* @__PURE__ */ jsx(Menu$2.Item, {
|
|
48939
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
48940
|
-
className: "code-dropdown-btn-item",
|
|
48941
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
48942
|
-
className: "w-full justify-center my-2",
|
|
48943
|
-
onClick: () => {
|
|
48944
|
-
handleUpload(context.interactiveElementProps["data-rct-item-id"], "folder");
|
|
48945
|
-
},
|
|
48946
|
-
children: "\u4E0A\u4F20\u6587\u4EF6\u5939"
|
|
48947
|
-
})
|
|
48948
|
-
})
|
|
48949
|
-
}), /* @__PURE__ */ jsx(Menu$2.Item, {
|
|
48950
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
48951
|
-
className: "code-dropdown-btn-item",
|
|
48952
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
48953
|
-
className: "w-full justify-center my-2",
|
|
48954
|
-
onClick: () => {
|
|
48955
|
-
setRenameValue(title.props.children);
|
|
48956
|
-
setRenameItem(context.interactiveElementProps["data-rct-item-id"]);
|
|
48957
|
-
},
|
|
48958
|
-
children: "\u91CD\u547D\u540D"
|
|
48959
|
-
})
|
|
48960
|
-
})
|
|
48961
|
-
}), /* @__PURE__ */ jsx(Menu$2.Item, {
|
|
48962
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
48963
|
-
className: "code-dropdown-btn-item",
|
|
48964
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
48965
|
-
className: "w-full justify-center text-red-800 my-2",
|
|
48966
|
-
onClick: () => handleDeleteFileFolder(context.interactiveElementProps["data-rct-item-id"]),
|
|
48967
|
-
children: "\u5220\u9664"
|
|
48968
|
-
})
|
|
48969
|
-
})
|
|
48970
|
-
})]
|
|
48971
|
-
})
|
|
48972
|
-
})]
|
|
48973
|
-
})
|
|
48974
|
-
})]
|
|
48975
|
-
}), arrow, renameItem === context.interactiveElementProps["data-rct-item-id"] ? /* @__PURE__ */ jsx("input", {
|
|
48976
|
-
className: "text-black focus:outline-none active:outline-none",
|
|
48977
|
-
type: "text",
|
|
48978
|
-
autoFocus: true,
|
|
48979
|
-
value: renameValue,
|
|
48980
|
-
onInput: (event) => setRenameValue(event.target.value),
|
|
48981
|
-
onKeyDown: (event) => {
|
|
48982
|
-
switch (event.key) {
|
|
48983
|
-
case "Enter":
|
|
48984
|
-
handleStopRenaming(renameItem);
|
|
48985
|
-
handleSave(treeData[renameItem], renameValue);
|
|
48986
|
-
break;
|
|
48987
|
-
case "Escape":
|
|
48988
|
-
handleStopRenaming(renameItem);
|
|
48989
|
-
break;
|
|
48990
|
-
}
|
|
48991
|
-
}
|
|
48992
|
-
}) : /* @__PURE__ */ jsx("button", __spreadProps(__spreadValues(__spreadValues({}, context.itemContainerWithoutChildrenProps), context.interactiveElementProps), {
|
|
48993
|
-
className: ["rct-tree-item-button", context.isSelected ? "rct-tree-item-button-selected" : "", context.isExpanded ? "rct-tree-item-button-expanded" : "", context.isFocused ? "rct-tree-item-button-focused" : "", children ? "rct-tree-item-button-hasChildren" : ""].join(" "),
|
|
48994
|
-
children: title
|
|
48995
|
-
}))]
|
|
48996
|
-
}), children]
|
|
48997
|
-
}));
|
|
48998
|
-
},
|
|
48999
|
-
children: /* @__PURE__ */ jsx(Tree, {
|
|
49000
|
-
treeId: "tree-1",
|
|
49001
|
-
rootItem: "/",
|
|
49002
|
-
treeLabel: "File Tree"
|
|
49003
|
-
})
|
|
49004
|
-
})]
|
|
49005
|
-
})
|
|
49006
|
-
});
|
|
49007
|
-
};
|
|
49008
|
-
var index$6 = /* @__PURE__ */ Object.freeze({
|
|
49009
|
-
__proto__: null,
|
|
49010
|
-
[Symbol.toStringTag]: "Module",
|
|
49011
|
-
getStringFromFile,
|
|
49012
|
-
FileTree
|
|
49013
|
-
});
|
|
49014
48463
|
function _format$1(message, args) {
|
|
49015
48464
|
let result;
|
|
49016
48465
|
if (args.length === 0) {
|
|
@@ -174451,6 +173900,649 @@ var monaco = /* @__PURE__ */ Object.freeze({
|
|
|
174451
173900
|
editor: editor$1,
|
|
174452
173901
|
languages
|
|
174453
173902
|
});
|
|
173903
|
+
create$5((set2) => ({
|
|
173904
|
+
cursor: {},
|
|
173905
|
+
setCursor: (arg) => set2((state2) => ({ cursor: arg }))
|
|
173906
|
+
}));
|
|
173907
|
+
const editorStore = create$5((set2) => ({
|
|
173908
|
+
fileTreeStack: [],
|
|
173909
|
+
setFileTreeStack: (arg) => set2(() => ({ fileTreeStack: arg }))
|
|
173910
|
+
}));
|
|
173911
|
+
class EditorData {
|
|
173912
|
+
localSetFileTreeStack(arg) {
|
|
173913
|
+
editorStore.getState().setFileTreeStack(arg);
|
|
173914
|
+
}
|
|
173915
|
+
static get fileTreeStack() {
|
|
173916
|
+
const fileTreeStack = editorStore.getState().fileTreeStack;
|
|
173917
|
+
return fileTreeStack;
|
|
173918
|
+
}
|
|
173919
|
+
static setFileTreeStack(arg) {
|
|
173920
|
+
return editorStore.getState().setFileTreeStack(arg);
|
|
173921
|
+
}
|
|
173922
|
+
static updateModel({
|
|
173923
|
+
value,
|
|
173924
|
+
path: path2,
|
|
173925
|
+
language: language2,
|
|
173926
|
+
APP_DIR: APP_DIR2
|
|
173927
|
+
}, callback, cover = false) {
|
|
173928
|
+
let gotModel = editor$1.getModels().find((x2) => x2.uri.path.includes(path2));
|
|
173929
|
+
if (!gotModel && !!cover) {
|
|
173930
|
+
gotModel = editor$1.createModel(value, language2, Uri.parse(`file://${APP_DIR2}${path2}`));
|
|
173931
|
+
}
|
|
173932
|
+
const _fileTreeStack = [
|
|
173933
|
+
...this.fileTreeStack,
|
|
173934
|
+
{
|
|
173935
|
+
label: path2,
|
|
173936
|
+
path: path2,
|
|
173937
|
+
model: gotModel
|
|
173938
|
+
}
|
|
173939
|
+
];
|
|
173940
|
+
this.setFileTreeStack(lodash$2.exports.uniqBy(_fileTreeStack, "path"));
|
|
173941
|
+
if (cover) {
|
|
173942
|
+
gotModel == null ? void 0 : gotModel.setValue(value);
|
|
173943
|
+
}
|
|
173944
|
+
callback && callback(gotModel);
|
|
173945
|
+
}
|
|
173946
|
+
}
|
|
173947
|
+
__publicField(EditorData, "EditorData");
|
|
173948
|
+
const TreeRootLayout = newStyled.div`
|
|
173949
|
+
height: 100%;
|
|
173950
|
+
overflow: auto;
|
|
173951
|
+
`;
|
|
173952
|
+
function addChildrenArray(children, parent2) {
|
|
173953
|
+
var _a2, _b2;
|
|
173954
|
+
for (let i = 0; i < children.length; i++) {
|
|
173955
|
+
if (children[i].type === "DIRECTORY") {
|
|
173956
|
+
(_a2 = parent2 == null ? void 0 : parent2.children) == null ? void 0 : _a2.push(`${parent2.index}${children[i].name}/`);
|
|
173957
|
+
} else {
|
|
173958
|
+
(_b2 = parent2 == null ? void 0 : parent2.children) == null ? void 0 : _b2.push(`${parent2.index}${children[i].name}`);
|
|
173959
|
+
}
|
|
173960
|
+
}
|
|
173961
|
+
}
|
|
173962
|
+
function formatFileToTree(data) {
|
|
173963
|
+
if (!data)
|
|
173964
|
+
return;
|
|
173965
|
+
const formatData = {};
|
|
173966
|
+
const root2 = data.name;
|
|
173967
|
+
formatData[root2] = {
|
|
173968
|
+
index: root2,
|
|
173969
|
+
children: [],
|
|
173970
|
+
hasChildren: true,
|
|
173971
|
+
data: root2
|
|
173972
|
+
};
|
|
173973
|
+
addChildrenArray(data.children, formatData[root2]);
|
|
173974
|
+
let nodeChildren = [...data.children];
|
|
173975
|
+
let pathChildren = [...formatData[root2].children];
|
|
173976
|
+
while (nodeChildren.length) {
|
|
173977
|
+
const size2 = nodeChildren.length;
|
|
173978
|
+
for (let i = 0; i < size2; i++) {
|
|
173979
|
+
const child = nodeChildren.shift();
|
|
173980
|
+
const path2 = pathChildren.shift();
|
|
173981
|
+
nodeChildren = nodeChildren.concat(child.children);
|
|
173982
|
+
switch (child.type) {
|
|
173983
|
+
case "DIRECTORY":
|
|
173984
|
+
const dirPath = path2;
|
|
173985
|
+
formatData[dirPath] = {
|
|
173986
|
+
index: dirPath,
|
|
173987
|
+
hasChildren: true,
|
|
173988
|
+
children: [],
|
|
173989
|
+
data: child.name
|
|
173990
|
+
};
|
|
173991
|
+
addChildrenArray(child.children, formatData[dirPath]);
|
|
173992
|
+
pathChildren = pathChildren.concat(formatData[dirPath].children);
|
|
173993
|
+
break;
|
|
173994
|
+
case "FILE":
|
|
173995
|
+
const filePath = path2;
|
|
173996
|
+
formatData[filePath] = {
|
|
173997
|
+
index: filePath,
|
|
173998
|
+
hasChildren: false,
|
|
173999
|
+
data: child.name
|
|
174000
|
+
};
|
|
174001
|
+
break;
|
|
174002
|
+
}
|
|
174003
|
+
}
|
|
174004
|
+
}
|
|
174005
|
+
return formatData;
|
|
174006
|
+
}
|
|
174007
|
+
const getStringFromFile = async (file) => {
|
|
174008
|
+
const base64String = await new Promise((resolve2) => {
|
|
174009
|
+
const reader2 = new FileReader();
|
|
174010
|
+
reader2.readAsDataURL(file);
|
|
174011
|
+
reader2.onload = (e2) => {
|
|
174012
|
+
resolve2(e2.target.result);
|
|
174013
|
+
};
|
|
174014
|
+
});
|
|
174015
|
+
return base64String;
|
|
174016
|
+
};
|
|
174017
|
+
const FileTree = ({
|
|
174018
|
+
onCustomSelect,
|
|
174019
|
+
className
|
|
174020
|
+
}) => {
|
|
174021
|
+
const addedFolder = {
|
|
174022
|
+
target: "",
|
|
174023
|
+
files: []
|
|
174024
|
+
};
|
|
174025
|
+
useOT.getState().socket;
|
|
174026
|
+
const [focusedItem, setFocusedItem] = react.exports.useState();
|
|
174027
|
+
const [expandedItems, setExpandedItems] = react.exports.useState([]);
|
|
174028
|
+
const [selectedItems, setSelectedItems] = react.exports.useState([]);
|
|
174029
|
+
const [remoteUserList, setRemoteUserList] = react.exports.useState({});
|
|
174030
|
+
const [renameItem, setRenameItem] = react.exports.useState("");
|
|
174031
|
+
const [renameValue, setRenameValue] = react.exports.useState("");
|
|
174032
|
+
const treeRef = react.exports.useRef(null);
|
|
174033
|
+
const {
|
|
174034
|
+
CRDTInfo: CRDTInfo2,
|
|
174035
|
+
dockerInfo: dockerInfo2
|
|
174036
|
+
} = oTStore((state2) => state2);
|
|
174037
|
+
const {
|
|
174038
|
+
fileTree
|
|
174039
|
+
} = fileTreeStore((state2) => state2);
|
|
174040
|
+
const [treeData, setTreeData] = react.exports.useState({});
|
|
174041
|
+
react.exports.useEffect(() => {
|
|
174042
|
+
if (oTStore.getState().appStatus === "replay") {
|
|
174043
|
+
setSelectedItems([]);
|
|
174044
|
+
setExpandedItems([]);
|
|
174045
|
+
}
|
|
174046
|
+
if (!fileTree.data)
|
|
174047
|
+
return;
|
|
174048
|
+
const newData = formatFileToTree(fileTree == null ? void 0 : fileTree.data);
|
|
174049
|
+
setSelectedItems(selectedItems.filter((item) => newData[item]));
|
|
174050
|
+
setExpandedItems(expandedItems.filter((item) => newData[item]));
|
|
174051
|
+
setTreeData(newData);
|
|
174052
|
+
}, [fileTree]);
|
|
174053
|
+
react.exports.useEffect(() => {
|
|
174054
|
+
setSelectedItems([]);
|
|
174055
|
+
setExpandedItems([]);
|
|
174056
|
+
}, [dockerInfo2]);
|
|
174057
|
+
const onSelect = (items) => {
|
|
174058
|
+
var _a2;
|
|
174059
|
+
if (items.length === 1) {
|
|
174060
|
+
setSelectedItems(items);
|
|
174061
|
+
if (oTStore.getState().appStatus === "code") {
|
|
174062
|
+
const crdt = {
|
|
174063
|
+
timestamp: Date.now(),
|
|
174064
|
+
userInfo: userStore.getState().userInfo,
|
|
174065
|
+
editor: {
|
|
174066
|
+
extraInfo: {
|
|
174067
|
+
messageId: "1",
|
|
174068
|
+
playgroundId: oTStore.getState().playgroundInfo.playgroundId
|
|
174069
|
+
},
|
|
174070
|
+
evtType: "File"
|
|
174071
|
+
},
|
|
174072
|
+
file: {
|
|
174073
|
+
action: "Get",
|
|
174074
|
+
path: items[0]
|
|
174075
|
+
}
|
|
174076
|
+
};
|
|
174077
|
+
(_a2 = useOT.getState().socket) == null ? void 0 : _a2.emit("fileContent", JSON.stringify(crdt));
|
|
174078
|
+
}
|
|
174079
|
+
}
|
|
174080
|
+
};
|
|
174081
|
+
const onExpand = (item) => {
|
|
174082
|
+
setExpandedItems([...expandedItems, item]);
|
|
174083
|
+
};
|
|
174084
|
+
const onCollapse = (item) => {
|
|
174085
|
+
setExpandedItems(expandedItems.filter((expandedItemIndex) => expandedItemIndex !== item));
|
|
174086
|
+
};
|
|
174087
|
+
const onUploadFile = (payload) => {
|
|
174088
|
+
var _a2;
|
|
174089
|
+
console.log(payload, 213);
|
|
174090
|
+
(_a2 = useOT.getState().socket) == null ? void 0 : _a2.emit("upload", payload);
|
|
174091
|
+
addedFolder.target = "";
|
|
174092
|
+
addedFolder.files = [];
|
|
174093
|
+
console.log(addedFolder, 217);
|
|
174094
|
+
};
|
|
174095
|
+
const formatUploadFileTarget = (path2) => {
|
|
174096
|
+
if (path2[path2.length - 1] !== "/") {
|
|
174097
|
+
addedFolder.target = `${path2.split("/").slice(0, -1).join("/")}/`;
|
|
174098
|
+
} else {
|
|
174099
|
+
addedFolder.target = path2;
|
|
174100
|
+
}
|
|
174101
|
+
};
|
|
174102
|
+
const traverseFileTree = async (item, path2 = "/") => {
|
|
174103
|
+
const data = await new Promise((resolve2) => {
|
|
174104
|
+
if (item.isFile) {
|
|
174105
|
+
item.file(async (file) => {
|
|
174106
|
+
resolve2([{
|
|
174107
|
+
path: `${path2}${file.name}`,
|
|
174108
|
+
content: await getStringFromFile(file)
|
|
174109
|
+
}]);
|
|
174110
|
+
});
|
|
174111
|
+
} else if (item.isDirectory) {
|
|
174112
|
+
let result = [{
|
|
174113
|
+
path: `${path2}${item.name}/`,
|
|
174114
|
+
content: ""
|
|
174115
|
+
}];
|
|
174116
|
+
const dirReader = item.createReader();
|
|
174117
|
+
dirReader.readEntries(async (entries) => {
|
|
174118
|
+
for (let i = 0; i < entries.length; i++) {
|
|
174119
|
+
result = result.concat(await traverseFileTree(entries[i], `${path2}${item.name}/`));
|
|
174120
|
+
}
|
|
174121
|
+
resolve2(result);
|
|
174122
|
+
});
|
|
174123
|
+
}
|
|
174124
|
+
});
|
|
174125
|
+
return data;
|
|
174126
|
+
};
|
|
174127
|
+
const onOriginDrop = async (event) => {
|
|
174128
|
+
var _a2;
|
|
174129
|
+
event.preventDefault();
|
|
174130
|
+
event.currentTarget.lastElementChild.classList.remove("root-drag-over");
|
|
174131
|
+
let buttonElement = event.target;
|
|
174132
|
+
while (buttonElement && ((_a2 = buttonElement.tagName) == null ? void 0 : _a2.toLowerCase()) !== "button") {
|
|
174133
|
+
buttonElement = buttonElement.lastChild;
|
|
174134
|
+
}
|
|
174135
|
+
const node2 = buttonElement ? buttonElement.dataset["rctItemId"] : "/";
|
|
174136
|
+
formatUploadFileTarget(node2);
|
|
174137
|
+
const items = event.dataTransfer.items;
|
|
174138
|
+
if (items.length === 0)
|
|
174139
|
+
return;
|
|
174140
|
+
const itemsIterate = [];
|
|
174141
|
+
for (const i of items) {
|
|
174142
|
+
itemsIterate.push(i.webkitGetAsEntry());
|
|
174143
|
+
}
|
|
174144
|
+
console.log("drop5", 295);
|
|
174145
|
+
for (const item of itemsIterate) {
|
|
174146
|
+
if (item) {
|
|
174147
|
+
addedFolder.files = addedFolder.files.concat(await traverseFileTree(item));
|
|
174148
|
+
}
|
|
174149
|
+
}
|
|
174150
|
+
buttonElement == null ? void 0 : buttonElement.parentNode.classList.remove("rct-tree-item-title-container-selected");
|
|
174151
|
+
buttonElement == null ? void 0 : buttonElement.parentNode.parentNode.classList.remove("rct-tree-item-li-selected");
|
|
174152
|
+
console.log("drop5", 310);
|
|
174153
|
+
onUploadFile(JSON.stringify(addedFolder));
|
|
174154
|
+
};
|
|
174155
|
+
react.exports.useEffect(() => {
|
|
174156
|
+
if (treeRef.current) {
|
|
174157
|
+
treeRef.current.removeEventListener("drop", onOriginDrop);
|
|
174158
|
+
treeRef.current.addEventListener("drop", onOriginDrop, false);
|
|
174159
|
+
treeRef.current.addEventListener("dragover", (e2) => {
|
|
174160
|
+
if (e2.dataTransfer.items.length === 0)
|
|
174161
|
+
return;
|
|
174162
|
+
e2.preventDefault();
|
|
174163
|
+
e2.stopPropagation();
|
|
174164
|
+
}, false);
|
|
174165
|
+
treeRef.current.addEventListener("dragenter", (e2) => {
|
|
174166
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
174167
|
+
if (((_a2 = e2 == null ? void 0 : e2.dataTransfer) == null ? void 0 : _a2.items.length) === 0)
|
|
174168
|
+
return;
|
|
174169
|
+
e2.preventDefault();
|
|
174170
|
+
e2.stopPropagation();
|
|
174171
|
+
console.log(e2.currentTarget.lastElementChild);
|
|
174172
|
+
e2.currentTarget.lastElementChild.classList.remove("root-drag-over");
|
|
174173
|
+
if (e2.target.classList.contains("rct-tree-root")) {
|
|
174174
|
+
console.log(e2.target);
|
|
174175
|
+
e2.target.classList.add("root-drag-over");
|
|
174176
|
+
}
|
|
174177
|
+
if (((_c2 = (_b2 = e2 == null ? void 0 : e2.target) == null ? void 0 : _b2.tagName) == null ? void 0 : _c2.toLowerCase()) === "button") {
|
|
174178
|
+
(_e2 = (_d2 = e2.target) == null ? void 0 : _d2.parentNode) == null ? void 0 : _e2.classList.add("rct-tree-item-title-container-selected");
|
|
174179
|
+
(_g2 = (_f2 = e2.target) == null ? void 0 : _f2.parentNode) == null ? void 0 : _g2.parentNode.classList.add("rct-tree-item-li-selected");
|
|
174180
|
+
}
|
|
174181
|
+
}, false);
|
|
174182
|
+
treeRef.current.addEventListener("dragleave", (e2) => {
|
|
174183
|
+
if (e2.dataTransfer.items.length === 0)
|
|
174184
|
+
return;
|
|
174185
|
+
e2.preventDefault();
|
|
174186
|
+
e2.stopPropagation();
|
|
174187
|
+
if (e2.target.tagName.toLowerCase() === "button") {
|
|
174188
|
+
e2.target.parentNode.classList.remove("rct-tree-item-title-container-selected");
|
|
174189
|
+
e2.target.parentNode.parentNode.classList.remove("rct-tree-item-li-selected");
|
|
174190
|
+
}
|
|
174191
|
+
}, false);
|
|
174192
|
+
}
|
|
174193
|
+
}, [treeRef]);
|
|
174194
|
+
react.exports.useEffect(() => {
|
|
174195
|
+
var _a2;
|
|
174196
|
+
const user = userListStore.getState().userList.find((item) => item.uuid === CRDTInfo2.userInfo.uuid);
|
|
174197
|
+
if (((_a2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.editor) == null ? void 0 : _a2.evtType) === "File" && user) {
|
|
174198
|
+
const path2 = CRDTInfo2.file.path;
|
|
174199
|
+
if (!IsMe(CRDTInfo2.userInfo)) {
|
|
174200
|
+
setRemoteUserList((oldUserListItem) => {
|
|
174201
|
+
const userListItem = __spreadValues({}, oldUserListItem);
|
|
174202
|
+
const remoteUserListObj = Object.entries(userListItem);
|
|
174203
|
+
for (const iteratorItem of remoteUserListObj) {
|
|
174204
|
+
const [key, value] = iteratorItem;
|
|
174205
|
+
const index2 = value.findIndex((item) => item.uuid === user.uuid);
|
|
174206
|
+
if (index2 > -1) {
|
|
174207
|
+
userListItem[key].splice(index2, 1);
|
|
174208
|
+
if (userListItem[key].length === 0) {
|
|
174209
|
+
delete userListItem[key];
|
|
174210
|
+
}
|
|
174211
|
+
break;
|
|
174212
|
+
}
|
|
174213
|
+
}
|
|
174214
|
+
if (userListItem[path2]) {
|
|
174215
|
+
userListItem[path2].push({
|
|
174216
|
+
uuid: user.uuid,
|
|
174217
|
+
color: user.color,
|
|
174218
|
+
avatar: user.avatar
|
|
174219
|
+
});
|
|
174220
|
+
} else {
|
|
174221
|
+
userListItem[path2] = [{
|
|
174222
|
+
uuid: user.uuid,
|
|
174223
|
+
color: user.color,
|
|
174224
|
+
avatar: user.avatar
|
|
174225
|
+
}];
|
|
174226
|
+
}
|
|
174227
|
+
return userListItem;
|
|
174228
|
+
});
|
|
174229
|
+
if (path2[path2.length - 1] === "/") {
|
|
174230
|
+
const index2 = expandedItems.indexOf(path2);
|
|
174231
|
+
if (index2 === -1) {
|
|
174232
|
+
onExpand(path2);
|
|
174233
|
+
} else {
|
|
174234
|
+
onCollapse(path2);
|
|
174235
|
+
}
|
|
174236
|
+
}
|
|
174237
|
+
} else if (oTStore.getState().appStatus === "replay" && !ignoreReplayerStore.getState().ignoreReplayers.some((d2) => d2 === "file")) {
|
|
174238
|
+
onSelect([path2]);
|
|
174239
|
+
if (path2[path2.length - 1] === "/") {
|
|
174240
|
+
const index2 = expandedItems.indexOf(path2);
|
|
174241
|
+
if (index2 === -1) {
|
|
174242
|
+
onExpand(path2);
|
|
174243
|
+
} else {
|
|
174244
|
+
onCollapse(path2);
|
|
174245
|
+
}
|
|
174246
|
+
}
|
|
174247
|
+
}
|
|
174248
|
+
}
|
|
174249
|
+
}, [CRDTInfo2]);
|
|
174250
|
+
const handleAddFile = (path2) => {
|
|
174251
|
+
onExpand(path2);
|
|
174252
|
+
if (path2[path2.length - 1] !== "/") {
|
|
174253
|
+
path2 = `${path2.split("/").slice(0, -1).join("/")}/`;
|
|
174254
|
+
}
|
|
174255
|
+
setTreeData((treeData2) => {
|
|
174256
|
+
var _a2;
|
|
174257
|
+
const newFilePath = `${path2}${v4$1().substring(0, 6)}`;
|
|
174258
|
+
(_a2 = treeData2[path2].children) == null ? void 0 : _a2.push(newFilePath);
|
|
174259
|
+
treeData2[newFilePath] = {
|
|
174260
|
+
index: newFilePath,
|
|
174261
|
+
hasChildren: false,
|
|
174262
|
+
data: "Untitled"
|
|
174263
|
+
};
|
|
174264
|
+
setRenameItem(newFilePath);
|
|
174265
|
+
setRenameValue("");
|
|
174266
|
+
return treeData2;
|
|
174267
|
+
});
|
|
174268
|
+
};
|
|
174269
|
+
const handleAddFolder = (path2) => {
|
|
174270
|
+
onExpand(path2);
|
|
174271
|
+
if (path2[path2.length - 1] !== "/") {
|
|
174272
|
+
path2 = `${path2.split("/").slice(0, -1).join("/")}/`;
|
|
174273
|
+
}
|
|
174274
|
+
setTreeData((treeData2) => {
|
|
174275
|
+
var _a2;
|
|
174276
|
+
const newFolderPath = `${path2}${v4$1().substring(0, 6)}/`;
|
|
174277
|
+
(_a2 = treeData2[path2].children) == null ? void 0 : _a2.push(newFolderPath);
|
|
174278
|
+
treeData2[newFolderPath] = {
|
|
174279
|
+
index: newFolderPath,
|
|
174280
|
+
hasChildren: true,
|
|
174281
|
+
children: [],
|
|
174282
|
+
data: "Untitled"
|
|
174283
|
+
};
|
|
174284
|
+
setRenameItem(newFolderPath);
|
|
174285
|
+
setRenameValue("");
|
|
174286
|
+
return treeData2;
|
|
174287
|
+
});
|
|
174288
|
+
};
|
|
174289
|
+
const handleStopRenaming = (path2) => {
|
|
174290
|
+
if (renameValue === "") {
|
|
174291
|
+
setTreeData((treeData2) => {
|
|
174292
|
+
delete treeData2[path2];
|
|
174293
|
+
return treeData2;
|
|
174294
|
+
});
|
|
174295
|
+
}
|
|
174296
|
+
setRenameItem("");
|
|
174297
|
+
};
|
|
174298
|
+
const handleSave = (treeNode, name = "") => {
|
|
174299
|
+
var _a2;
|
|
174300
|
+
const payload = {
|
|
174301
|
+
action: "",
|
|
174302
|
+
path: "",
|
|
174303
|
+
newPath: "",
|
|
174304
|
+
userInfo: userStore.getState().userInfo
|
|
174305
|
+
};
|
|
174306
|
+
const newPath = treeNode.index.split("/");
|
|
174307
|
+
if (treeNode.hasChildren) {
|
|
174308
|
+
newPath.splice(-2, 1, name);
|
|
174309
|
+
} else {
|
|
174310
|
+
newPath.splice(-1, 1, name);
|
|
174311
|
+
}
|
|
174312
|
+
if (treeNode.data === "Untitled") {
|
|
174313
|
+
payload.action = "CREATE";
|
|
174314
|
+
payload.path = newPath.join("/");
|
|
174315
|
+
} else {
|
|
174316
|
+
payload.action = "RENAME";
|
|
174317
|
+
payload.path = treeNode.index;
|
|
174318
|
+
payload.newPath = newPath.join("/");
|
|
174319
|
+
}
|
|
174320
|
+
(_a2 = useOT.getState().socket) == null ? void 0 : _a2.emit("fileTreeOp", JSON.stringify(payload));
|
|
174321
|
+
};
|
|
174322
|
+
const handleUpload = (path2, uploadType) => {
|
|
174323
|
+
formatUploadFileTarget(path2);
|
|
174324
|
+
document.getElementById(`manual-upload-${uploadType}`).click();
|
|
174325
|
+
};
|
|
174326
|
+
const handleManualUploadFile = async (files) => {
|
|
174327
|
+
for (const item of files) {
|
|
174328
|
+
addedFolder.files = addedFolder.files.concat([{
|
|
174329
|
+
path: `/${item.name}`,
|
|
174330
|
+
content: await getStringFromFile(item)
|
|
174331
|
+
}]);
|
|
174332
|
+
}
|
|
174333
|
+
onUploadFile(JSON.stringify(addedFolder));
|
|
174334
|
+
};
|
|
174335
|
+
const handleManualUploadFolder = async (files) => {
|
|
174336
|
+
for (const item of files) {
|
|
174337
|
+
addedFolder.files = addedFolder.files.concat([{
|
|
174338
|
+
path: `/${item.webkitRelativePath}`,
|
|
174339
|
+
content: await getStringFromFile(item)
|
|
174340
|
+
}]);
|
|
174341
|
+
}
|
|
174342
|
+
onUploadFile(JSON.stringify(addedFolder));
|
|
174343
|
+
};
|
|
174344
|
+
const handleDeleteFileFolder = (path2) => {
|
|
174345
|
+
var _a2;
|
|
174346
|
+
EditorData.setFileTreeStack(EditorData.fileTreeStack.filter((file) => file.path !== path2));
|
|
174347
|
+
(_a2 = useOT.getState().socket) == null ? void 0 : _a2.emit("fileTreeOp", JSON.stringify({
|
|
174348
|
+
action: "DELETE",
|
|
174349
|
+
path: path2
|
|
174350
|
+
}));
|
|
174351
|
+
oTStore.getState().switchDoc({
|
|
174352
|
+
value: "",
|
|
174353
|
+
path: "/"
|
|
174354
|
+
});
|
|
174355
|
+
};
|
|
174356
|
+
return /* @__PURE__ */ jsx(FollowLayout, {
|
|
174357
|
+
name: "file",
|
|
174358
|
+
children: /* @__PURE__ */ jsxs(TreeRootLayout, {
|
|
174359
|
+
className: `tree-root-layout ${className ? className : ""}`,
|
|
174360
|
+
ref: treeRef,
|
|
174361
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
174362
|
+
id: "manual-upload-file",
|
|
174363
|
+
type: "file",
|
|
174364
|
+
multiple: true,
|
|
174365
|
+
hidden: true,
|
|
174366
|
+
onChange: (event) => {
|
|
174367
|
+
handleManualUploadFile(event.target.files);
|
|
174368
|
+
}
|
|
174369
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
174370
|
+
id: "manual-upload-folder",
|
|
174371
|
+
type: "file",
|
|
174372
|
+
multiple: true,
|
|
174373
|
+
hidden: true,
|
|
174374
|
+
onChange: (event) => {
|
|
174375
|
+
handleManualUploadFolder(event.target.files);
|
|
174376
|
+
}
|
|
174377
|
+
}), /* @__PURE__ */ jsx(ControlledTreeEnvironment, {
|
|
174378
|
+
canDragAndDrop: true,
|
|
174379
|
+
canSearch: false,
|
|
174380
|
+
items: treeData,
|
|
174381
|
+
onFocusItem: (item) => setFocusedItem(item.index),
|
|
174382
|
+
onExpandItem: (item) => {
|
|
174383
|
+
onExpand(item.index);
|
|
174384
|
+
},
|
|
174385
|
+
onCollapseItem: (item) => {
|
|
174386
|
+
onCollapse(item.index);
|
|
174387
|
+
},
|
|
174388
|
+
getItemTitle: (item) => item.data,
|
|
174389
|
+
viewState: {
|
|
174390
|
+
["tree-1"]: {
|
|
174391
|
+
focusedItem,
|
|
174392
|
+
expandedItems,
|
|
174393
|
+
selectedItems
|
|
174394
|
+
}
|
|
174395
|
+
},
|
|
174396
|
+
onSelectItems: (items) => {
|
|
174397
|
+
onSelect(items);
|
|
174398
|
+
onCustomSelect == null ? void 0 : onCustomSelect(items);
|
|
174399
|
+
},
|
|
174400
|
+
renderItem: ({
|
|
174401
|
+
title,
|
|
174402
|
+
arrow,
|
|
174403
|
+
depth,
|
|
174404
|
+
context,
|
|
174405
|
+
children
|
|
174406
|
+
}) => {
|
|
174407
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, context.itemContainerWithChildrenProps), {
|
|
174408
|
+
className: ["rct-tree-item-li", context.isSelected ? "rct-tree-item-li-selected" : "", context.isExpanded ? "rct-tree-item-li-expanded" : "", context.isFocused ? "rct-tree-item-li-focused" : "", children ? "rct-tree-item-li-hasChildren" : ""].join(" "),
|
|
174409
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
174410
|
+
className: ["rct-tree-item-title-container", context.isSelected ? "rct-tree-item-title-container-selected" : "", context.isExpanded ? "rct-tree-item-title-container-expanded" : "", context.isFocused ? "rct-tree-item-title-container-focused" : "", children ? "rct-tree-item-title-container-hasChildren" : ""].join(" "),
|
|
174411
|
+
style: {
|
|
174412
|
+
paddingLeft: `${depth}0px`
|
|
174413
|
+
},
|
|
174414
|
+
children: [remoteUserList[context.interactiveElementProps["data-rct-item-id"]] && remoteUserList[context.interactiveElementProps["data-rct-item-id"]].map((remoteUser) => /* @__PURE__ */ jsx("div", {
|
|
174415
|
+
className: "rct-tree-item-avatar rounded-full absolute border",
|
|
174416
|
+
style: {
|
|
174417
|
+
borderColor: remoteUser.color,
|
|
174418
|
+
backgroundImage: `url(${remoteUser.avatar})`
|
|
174419
|
+
}
|
|
174420
|
+
}, remoteUser.uuid)), /* @__PURE__ */ jsxs("div", {
|
|
174421
|
+
className: "rct-tree-item-toolbar absolute right-0",
|
|
174422
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
174423
|
+
onClick: () => {
|
|
174424
|
+
handleAddFile(context.interactiveElementProps["data-rct-item-id"]);
|
|
174425
|
+
},
|
|
174426
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
174427
|
+
className: "d42 add-file"
|
|
174428
|
+
})
|
|
174429
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
174430
|
+
onClick: () => {
|
|
174431
|
+
handleAddFolder(context.interactiveElementProps["data-rct-item-id"]);
|
|
174432
|
+
},
|
|
174433
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
174434
|
+
className: "d42 add-folder"
|
|
174435
|
+
})
|
|
174436
|
+
}), /* @__PURE__ */ jsx(Menu$2, {
|
|
174437
|
+
as: "div",
|
|
174438
|
+
className: "relative",
|
|
174439
|
+
children: ({
|
|
174440
|
+
open: open2
|
|
174441
|
+
}) => /* @__PURE__ */ jsxs(Fragment, {
|
|
174442
|
+
children: [/* @__PURE__ */ jsx(Menu$2.Button, {
|
|
174443
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
174444
|
+
className: "d42 more"
|
|
174445
|
+
})
|
|
174446
|
+
}), /* @__PURE__ */ jsx(Transition, {
|
|
174447
|
+
show: open2,
|
|
174448
|
+
as: react.exports.Fragment,
|
|
174449
|
+
enter: "transition ease-out duration-100",
|
|
174450
|
+
enterFrom: "transform opacity-0 scale-95",
|
|
174451
|
+
enterTo: "transform opacity-100 scale-100",
|
|
174452
|
+
leave: "transition ease-in duration-75",
|
|
174453
|
+
leaveFrom: "transform opacity-100 scale-100",
|
|
174454
|
+
leaveTo: "transform opacity-0 scale-95",
|
|
174455
|
+
children: /* @__PURE__ */ jsxs(Menu$2.Items, {
|
|
174456
|
+
static: true,
|
|
174457
|
+
className: "absolute z-1 w-20 right-0 top-full",
|
|
174458
|
+
children: [/* @__PURE__ */ jsx(Menu$2.Item, {
|
|
174459
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
174460
|
+
className: "code-dropdown-btn-item",
|
|
174461
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
174462
|
+
className: "w-full justify-center my-2",
|
|
174463
|
+
onClick: () => {
|
|
174464
|
+
handleUpload(context.interactiveElementProps["data-rct-item-id"], "file");
|
|
174465
|
+
},
|
|
174466
|
+
children: "\u4E0A\u4F20\u6587\u4EF6"
|
|
174467
|
+
})
|
|
174468
|
+
})
|
|
174469
|
+
}), /* @__PURE__ */ jsx(Menu$2.Item, {
|
|
174470
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
174471
|
+
className: "code-dropdown-btn-item",
|
|
174472
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
174473
|
+
className: "w-full justify-center my-2",
|
|
174474
|
+
onClick: () => {
|
|
174475
|
+
handleUpload(context.interactiveElementProps["data-rct-item-id"], "folder");
|
|
174476
|
+
},
|
|
174477
|
+
children: "\u4E0A\u4F20\u6587\u4EF6\u5939"
|
|
174478
|
+
})
|
|
174479
|
+
})
|
|
174480
|
+
}), /* @__PURE__ */ jsx(Menu$2.Item, {
|
|
174481
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
174482
|
+
className: "code-dropdown-btn-item",
|
|
174483
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
174484
|
+
className: "w-full justify-center my-2",
|
|
174485
|
+
onClick: () => {
|
|
174486
|
+
var _a2;
|
|
174487
|
+
setRenameValue((_a2 = title == null ? void 0 : title.props) == null ? void 0 : _a2.children);
|
|
174488
|
+
setRenameItem(context.interactiveElementProps["data-rct-item-id"]);
|
|
174489
|
+
},
|
|
174490
|
+
children: "\u91CD\u547D\u540D"
|
|
174491
|
+
})
|
|
174492
|
+
})
|
|
174493
|
+
}), /* @__PURE__ */ jsx(Menu$2.Item, {
|
|
174494
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
174495
|
+
className: "code-dropdown-btn-item",
|
|
174496
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
174497
|
+
className: "w-full justify-center text-red-800 my-2",
|
|
174498
|
+
onClick: () => handleDeleteFileFolder(context.interactiveElementProps["data-rct-item-id"]),
|
|
174499
|
+
children: "\u5220\u9664"
|
|
174500
|
+
})
|
|
174501
|
+
})
|
|
174502
|
+
})]
|
|
174503
|
+
})
|
|
174504
|
+
})]
|
|
174505
|
+
})
|
|
174506
|
+
})]
|
|
174507
|
+
}), arrow, renameItem === context.interactiveElementProps["data-rct-item-id"] ? /* @__PURE__ */ jsx("input", {
|
|
174508
|
+
className: "text-black focus:outline-none active:outline-none",
|
|
174509
|
+
type: "text",
|
|
174510
|
+
autoFocus: true,
|
|
174511
|
+
value: renameValue,
|
|
174512
|
+
onInput: (event) => setRenameValue(event.target.value),
|
|
174513
|
+
onKeyDown: (event) => {
|
|
174514
|
+
switch (event.key) {
|
|
174515
|
+
case "Enter":
|
|
174516
|
+
handleStopRenaming(renameItem);
|
|
174517
|
+
handleSave(treeData[renameItem], renameValue);
|
|
174518
|
+
break;
|
|
174519
|
+
case "Escape":
|
|
174520
|
+
handleStopRenaming(renameItem);
|
|
174521
|
+
break;
|
|
174522
|
+
}
|
|
174523
|
+
}
|
|
174524
|
+
}) : /* @__PURE__ */ jsx("button", __spreadProps(__spreadValues(__spreadValues({}, context.itemContainerWithoutChildrenProps), context.interactiveElementProps), {
|
|
174525
|
+
className: ["rct-tree-item-button", context.isSelected ? "rct-tree-item-button-selected" : "", context.isExpanded ? "rct-tree-item-button-expanded" : "", context.isFocused ? "rct-tree-item-button-focused" : "", children ? "rct-tree-item-button-hasChildren" : ""].join(" "),
|
|
174526
|
+
children: title
|
|
174527
|
+
}))]
|
|
174528
|
+
}), children]
|
|
174529
|
+
}));
|
|
174530
|
+
},
|
|
174531
|
+
children: /* @__PURE__ */ jsx(Tree, {
|
|
174532
|
+
treeId: "tree-1",
|
|
174533
|
+
rootItem: "/",
|
|
174534
|
+
treeLabel: "File Tree"
|
|
174535
|
+
})
|
|
174536
|
+
})]
|
|
174537
|
+
})
|
|
174538
|
+
});
|
|
174539
|
+
};
|
|
174540
|
+
var index$6 = /* @__PURE__ */ Object.freeze({
|
|
174541
|
+
__proto__: null,
|
|
174542
|
+
[Symbol.toStringTag]: "Module",
|
|
174543
|
+
getStringFromFile,
|
|
174544
|
+
FileTree
|
|
174545
|
+
});
|
|
174454
174546
|
var FExtension;
|
|
174455
174547
|
(function(FExtension2) {
|
|
174456
174548
|
FExtension2["erb"] = "erb";
|
|
@@ -190142,51 +190234,6 @@ class MonacoAdapter {
|
|
|
190142
190234
|
return new Cursor(start, end);
|
|
190143
190235
|
}
|
|
190144
190236
|
}
|
|
190145
|
-
create$5((set2) => ({
|
|
190146
|
-
cursor: {},
|
|
190147
|
-
setCursor: (arg) => set2((state2) => ({ cursor: arg }))
|
|
190148
|
-
}));
|
|
190149
|
-
const editorStore = create$5((set2) => ({
|
|
190150
|
-
fileTreeStack: [],
|
|
190151
|
-
setFileTreeStack: (arg) => set2(() => ({ fileTreeStack: arg }))
|
|
190152
|
-
}));
|
|
190153
|
-
class EditorData {
|
|
190154
|
-
localSetFileTreeStack(arg) {
|
|
190155
|
-
editorStore.getState().setFileTreeStack(arg);
|
|
190156
|
-
}
|
|
190157
|
-
static get fileTreeStack() {
|
|
190158
|
-
const fileTreeStack = editorStore.getState().fileTreeStack;
|
|
190159
|
-
return fileTreeStack;
|
|
190160
|
-
}
|
|
190161
|
-
static setFileTreeStack(arg) {
|
|
190162
|
-
return editorStore.getState().setFileTreeStack(arg);
|
|
190163
|
-
}
|
|
190164
|
-
static updateModel({
|
|
190165
|
-
value,
|
|
190166
|
-
path: path2,
|
|
190167
|
-
language: language2,
|
|
190168
|
-
APP_DIR: APP_DIR2
|
|
190169
|
-
}, callback, cover = false) {
|
|
190170
|
-
let gotModel = editor$1.getModels().find((x2) => x2.uri.path.includes(path2));
|
|
190171
|
-
if (!gotModel && !!cover) {
|
|
190172
|
-
gotModel = editor$1.createModel(value, language2, Uri.parse(`file://${APP_DIR2}${path2}`));
|
|
190173
|
-
}
|
|
190174
|
-
const _fileTreeStack = [
|
|
190175
|
-
...this.fileTreeStack,
|
|
190176
|
-
{
|
|
190177
|
-
label: path2,
|
|
190178
|
-
path: path2,
|
|
190179
|
-
model: gotModel
|
|
190180
|
-
}
|
|
190181
|
-
];
|
|
190182
|
-
this.setFileTreeStack(lodash$2.exports.uniqBy(_fileTreeStack, "path"));
|
|
190183
|
-
if (cover) {
|
|
190184
|
-
gotModel == null ? void 0 : gotModel.setValue(value);
|
|
190185
|
-
}
|
|
190186
|
-
callback && callback(gotModel);
|
|
190187
|
-
}
|
|
190188
|
-
}
|
|
190189
|
-
__publicField(EditorData, "EditorData");
|
|
190190
190237
|
class ClientMeta {
|
|
190191
190238
|
constructor(editor2, clientList) {
|
|
190192
190239
|
__publicField(this, "clientList");
|
|
@@ -220152,7 +220199,8 @@ const Editor = ({
|
|
|
220152
220199
|
menuStyle,
|
|
220153
220200
|
editorStyle,
|
|
220154
220201
|
serviceWorkerOrigin,
|
|
220155
|
-
useLsp
|
|
220202
|
+
useLsp,
|
|
220203
|
+
className
|
|
220156
220204
|
}) => {
|
|
220157
220205
|
const divEl = react.exports.useRef(null);
|
|
220158
220206
|
const [clientEditor, setClientEditor] = react.exports.useState(null);
|
|
@@ -220166,9 +220214,11 @@ const Editor = ({
|
|
|
220166
220214
|
} = oTStore.getState();
|
|
220167
220215
|
const CRDTInfo2 = oTStore((state2) => state2.CRDTInfo);
|
|
220168
220216
|
const dockerInfo2 = oTStore((state2) => state2.dockerInfo);
|
|
220217
|
+
const fileTree = fileTreeStore((state2) => state2.fileTree);
|
|
220169
220218
|
oTStore((state2) => state2.CRDTInfo.file);
|
|
220170
220219
|
const docFile = oTStore((state2) => state2.doc);
|
|
220171
220220
|
const globalData = oTStore((state2) => state2.globalData);
|
|
220221
|
+
const [keepVal, setKeepVal] = react.exports.useState("");
|
|
220172
220222
|
const userList = userListStore((state2) => state2.userList);
|
|
220173
220223
|
const userInfo = userStore((state2) => state2.userInfo);
|
|
220174
220224
|
const io = useOT((state2) => state2.socket);
|
|
@@ -220232,6 +220282,7 @@ const Editor = ({
|
|
|
220232
220282
|
const onChange = (operation) => {
|
|
220233
220283
|
var _a2;
|
|
220234
220284
|
const applyDoc = oTStore.getState().doc;
|
|
220285
|
+
console.log(clientEditor.liveOperationCode);
|
|
220235
220286
|
setTimeout(() => {
|
|
220236
220287
|
client.applyClient(operation);
|
|
220237
220288
|
setLocalFile((applyDoc == null ? void 0 : applyDoc.path) ? applyDoc == null ? void 0 : applyDoc.path : "singleFile", {
|
|
@@ -220242,6 +220293,7 @@ const Editor = ({
|
|
|
220242
220293
|
if ((_a2 = applyDoc == null ? void 0 : applyDoc.path) == null ? void 0 : _a2.includes("md")) {
|
|
220243
220294
|
setMarkdownVal(editor.getValue());
|
|
220244
220295
|
}
|
|
220296
|
+
setKeepVal(editor.getValue());
|
|
220245
220297
|
};
|
|
220246
220298
|
const onDidScroll = (evt) => {
|
|
220247
220299
|
var _a2;
|
|
@@ -220397,6 +220449,28 @@ const Editor = ({
|
|
|
220397
220449
|
enabled: true
|
|
220398
220450
|
}
|
|
220399
220451
|
});
|
|
220452
|
+
editor.onDidAttemptReadOnlyEdit(() => {
|
|
220453
|
+
var _a2, _b2;
|
|
220454
|
+
const text2 = "\u8BE5\u6587\u4EF6\u5DF2\u88AB\u5220\u9664\uFF0C\u7EE7\u7EED\u7F16\u8F91\u9700\u8981\u91CD\u65B0\u521B\u5EFA\u6B64\u6587\u4EF6\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u91CD\u65B0\u521B\u5EFA\uFF1F";
|
|
220455
|
+
if (confirm(text2)) {
|
|
220456
|
+
editor.updateOptions({
|
|
220457
|
+
readOnly: false
|
|
220458
|
+
});
|
|
220459
|
+
const _fileTreeStack = EditorData.fileTreeStack.map((value) => {
|
|
220460
|
+
return __spreadProps(__spreadValues({}, value), {
|
|
220461
|
+
deleted: false,
|
|
220462
|
+
label: value.label.replace(" has deleted", "")
|
|
220463
|
+
});
|
|
220464
|
+
});
|
|
220465
|
+
EditorData.setFileTreeStack(_fileTreeStack);
|
|
220466
|
+
const payload = {
|
|
220467
|
+
action: "RECORVERY",
|
|
220468
|
+
path: (_b2 = (_a2 = oTStore.getState()) == null ? void 0 : _a2.doc) == null ? void 0 : _b2.path,
|
|
220469
|
+
newPath: ""
|
|
220470
|
+
};
|
|
220471
|
+
io == null ? void 0 : io.emit("fileTreeOp", JSON.stringify(payload));
|
|
220472
|
+
}
|
|
220473
|
+
});
|
|
220400
220474
|
editor$1.defineTheme("myCoolTheme", {
|
|
220401
220475
|
base: "vs-dark",
|
|
220402
220476
|
inherit: false,
|
|
@@ -220527,6 +220601,9 @@ const Editor = ({
|
|
|
220527
220601
|
} = oTStore.getState();
|
|
220528
220602
|
if (appStatus === "replay")
|
|
220529
220603
|
return;
|
|
220604
|
+
if (docFile.path === "/") {
|
|
220605
|
+
editor.setValue("");
|
|
220606
|
+
}
|
|
220530
220607
|
if (/\/$/.test(docFile.path))
|
|
220531
220608
|
return;
|
|
220532
220609
|
updateModel(docFile);
|
|
@@ -220551,6 +220628,23 @@ const Editor = ({
|
|
|
220551
220628
|
readOnly: globalData.disableEditor
|
|
220552
220629
|
});
|
|
220553
220630
|
}, [globalData]);
|
|
220631
|
+
react.exports.useEffect(() => {
|
|
220632
|
+
const _fileTreeStack = EditorData.fileTreeStack.map((value) => {
|
|
220633
|
+
if (checkIfTheFileHasDeleted(fileTree, value.path)) {
|
|
220634
|
+
return __spreadProps(__spreadValues({}, value), {
|
|
220635
|
+
deleted: true,
|
|
220636
|
+
label: `${value.label} has deleted`
|
|
220637
|
+
});
|
|
220638
|
+
}
|
|
220639
|
+
return value;
|
|
220640
|
+
});
|
|
220641
|
+
EditorData.setFileTreeStack(_fileTreeStack);
|
|
220642
|
+
if ((docFile == null ? void 0 : docFile.path) && checkIfTheFileHasDeleted(fileTree, docFile.path)) {
|
|
220643
|
+
editor.updateOptions({
|
|
220644
|
+
readOnly: true
|
|
220645
|
+
});
|
|
220646
|
+
}
|
|
220647
|
+
}, [fileTree]);
|
|
220554
220648
|
return /* @__PURE__ */ jsxs(FollowLayout, {
|
|
220555
220649
|
name: "editor",
|
|
220556
220650
|
children: [/* @__PURE__ */ jsx(Markdown, {
|
|
@@ -220561,7 +220655,7 @@ const Editor = ({
|
|
|
220561
220655
|
}
|
|
220562
220656
|
}), /* @__PURE__ */ jsxs(EditorLayout, {
|
|
220563
220657
|
style: containerStyle,
|
|
220564
|
-
className:
|
|
220658
|
+
className: `editor-layout ${className ? className : ""} flex flex-col`,
|
|
220565
220659
|
children: [/* @__PURE__ */ jsx(FileTreeStack, {
|
|
220566
220660
|
editor,
|
|
220567
220661
|
menuStyle,
|
|
@@ -220583,6 +220677,7 @@ const FileTreeStack = ({
|
|
|
220583
220677
|
clearPlayground
|
|
220584
220678
|
}) => {
|
|
220585
220679
|
const switchDoc2 = oTStore((state2) => state2.switchDoc);
|
|
220680
|
+
oTStore((state2) => state2.dockerInfo);
|
|
220586
220681
|
const docFile = oTStore((state2) => state2.doc);
|
|
220587
220682
|
const fileTreeStack = editorStore((state2) => state2.fileTreeStack);
|
|
220588
220683
|
const setFileTreeStack = editorStore((state2) => state2.setFileTreeStack);
|
|
@@ -220607,7 +220702,7 @@ const FileTreeStack = ({
|
|
|
220607
220702
|
style: menuStyle,
|
|
220608
220703
|
id: "menu-list",
|
|
220609
220704
|
ref,
|
|
220610
|
-
className: " flex flex-row stack-list items-center flex-shrink-0 scroll-smooth no-scrollbar overflow-x-scroll bg-codezone-black overflow-auto touch-pan-x",
|
|
220705
|
+
className: "\r flex\r flex-row\r stack-list\r items-center\r flex-shrink-0\r scroll-smooth\r no-scrollbar\r overflow-x-scroll\r bg-codezone-black\r overflow-auto touch-pan-x",
|
|
220611
220706
|
children: fileTreeStack == null ? void 0 : fileTreeStack.map((f2, index2) => /* @__PURE__ */ jsxs("li", {
|
|
220612
220707
|
className: `
|
|
220613
220708
|
flex
|
|
@@ -227875,6 +227970,7 @@ const Console = (_e2) => {
|
|
|
227875
227970
|
}, [dockerStatus]);
|
|
227876
227971
|
return /* @__PURE__ */ jsx(FollowLayout, {
|
|
227877
227972
|
children: /* @__PURE__ */ jsx("div", {
|
|
227973
|
+
className: props2.className ? props2.className : "",
|
|
227878
227974
|
style: {
|
|
227879
227975
|
height: "100%",
|
|
227880
227976
|
width: "100%"
|
|
@@ -227941,7 +228037,11 @@ const StopMask = newStyled.div`
|
|
|
227941
228037
|
opacity: 0.6;
|
|
227942
228038
|
`;
|
|
227943
228039
|
const OutputBrowser = (_g2) => {
|
|
227944
|
-
var
|
|
228040
|
+
var _h2 = _g2, {
|
|
228041
|
+
showURL = false
|
|
228042
|
+
} = _h2, props2 = __objRest(_h2, [
|
|
228043
|
+
"showURL"
|
|
228044
|
+
]);
|
|
227945
228045
|
var _a2;
|
|
227946
228046
|
const pStatus = oTStore((state2) => state2.playgroundStatus);
|
|
227947
228047
|
const dStatus = oTStore((state2) => state2.dockerStatus);
|
|
@@ -227996,7 +228096,7 @@ const OutputBrowser = (_g2) => {
|
|
|
227996
228096
|
}, [playgroundStatus, dockerStatus]);
|
|
227997
228097
|
return /* @__PURE__ */ jsxs(FollowLayout, {
|
|
227998
228098
|
name: "browser",
|
|
227999
|
-
children: [/* @__PURE__ */ jsxs(NavBar, {
|
|
228099
|
+
children: [showURL ? /* @__PURE__ */ jsxs(NavBar, {
|
|
228000
228100
|
children: [/* @__PURE__ */ jsx("i", {
|
|
228001
228101
|
className: "d42 text-xl reload cursor-pointer",
|
|
228002
228102
|
onClick: onRefresh
|
|
@@ -228009,7 +228109,7 @@ const OutputBrowser = (_g2) => {
|
|
|
228009
228109
|
className: "d42 text-xl file-copy cursor-pointer",
|
|
228010
228110
|
onClick: onOpenInNewTab
|
|
228011
228111
|
})]
|
|
228012
|
-
}), dockerStatus === "STOP" && /* @__PURE__ */ jsx(StopMask, {
|
|
228112
|
+
}) : null, dockerStatus === "STOP" && /* @__PURE__ */ jsx(StopMask, {
|
|
228013
228113
|
children: /* @__PURE__ */ jsx("span", {
|
|
228014
228114
|
children: "\u70B9\u51FB\u201C\u8FD0\u884C\u201D\uFF0C\u542F\u52A8\u5E94\u7528"
|
|
228015
228115
|
})
|
|
@@ -228028,10 +228128,10 @@ var index$2 = /* @__PURE__ */ Object.freeze({
|
|
|
228028
228128
|
[Symbol.toStringTag]: "Module",
|
|
228029
228129
|
"default": OutputBrowser
|
|
228030
228130
|
});
|
|
228031
|
-
const TerminalComponent = (
|
|
228032
|
-
var
|
|
228131
|
+
const TerminalComponent = (_i) => {
|
|
228132
|
+
var _j = _i, {
|
|
228033
228133
|
options
|
|
228034
|
-
} =
|
|
228134
|
+
} = _j, props2 = __objRest(_j, [
|
|
228035
228135
|
"options"
|
|
228036
228136
|
]);
|
|
228037
228137
|
const defaultOptions2 = __spreadValues({}, options);
|
|
@@ -228151,6 +228251,7 @@ const TerminalComponent = (_h2) => {
|
|
|
228151
228251
|
return /* @__PURE__ */ jsx(FollowLayout, {
|
|
228152
228252
|
name: "terminal",
|
|
228153
228253
|
children: /* @__PURE__ */ jsx("div", {
|
|
228254
|
+
className: props2.className ? props2.className : "",
|
|
228154
228255
|
id: "terminal",
|
|
228155
228256
|
style: {
|
|
228156
228257
|
height: "100%",
|
|
@@ -228168,12 +228269,12 @@ var index$1 = /* @__PURE__ */ Object.freeze({
|
|
|
228168
228269
|
[Symbol.toStringTag]: "Module",
|
|
228169
228270
|
"default": TerminalComponent
|
|
228170
228271
|
});
|
|
228171
|
-
const Tabs = (
|
|
228172
|
-
var
|
|
228272
|
+
const Tabs = (_k) => {
|
|
228273
|
+
var _l = _k, {
|
|
228173
228274
|
activeKey,
|
|
228174
228275
|
onSelect,
|
|
228175
228276
|
tabItems
|
|
228176
|
-
} =
|
|
228277
|
+
} = _l, props2 = __objRest(_l, [
|
|
228177
228278
|
"activeKey",
|
|
228178
228279
|
"onSelect",
|
|
228179
228280
|
"tabItems"
|
|
@@ -228491,10 +228592,10 @@ const AvatarLayout = newStyled.div`
|
|
|
228491
228592
|
border-color: ${(props2) => props2.user.color};
|
|
228492
228593
|
background-image: ${(props2) => 'url("' + props2.user.avatar + '")'};
|
|
228493
228594
|
`;
|
|
228494
|
-
const Avatar = (
|
|
228495
|
-
var
|
|
228595
|
+
const Avatar = (_m) => {
|
|
228596
|
+
var _n = _m, {
|
|
228496
228597
|
user
|
|
228497
|
-
} =
|
|
228598
|
+
} = _n, props2 = __objRest(_n, [
|
|
228498
228599
|
"user"
|
|
228499
228600
|
]);
|
|
228500
228601
|
return /* @__PURE__ */ jsx(AvatarLayout, __spreadValues({
|
|
@@ -228503,8 +228604,8 @@ const Avatar = (_l) => {
|
|
|
228503
228604
|
}, props2));
|
|
228504
228605
|
};
|
|
228505
228606
|
const SkeletonThemeContext = React.createContext({});
|
|
228506
|
-
function SkeletonTheme(
|
|
228507
|
-
var
|
|
228607
|
+
function SkeletonTheme(_o) {
|
|
228608
|
+
var _p = _o, { children } = _p, styleOptions = __objRest(_p, ["children"]);
|
|
228508
228609
|
return React.createElement(SkeletonThemeContext.Provider, { value: styleOptions }, children);
|
|
228509
228610
|
}
|
|
228510
228611
|
const defaultEnableAnimation = true;
|
|
@@ -228530,8 +228631,8 @@ function styleOptionsToCssProperties({ baseColor, highlightColor, width, height,
|
|
|
228530
228631
|
style2["--highlight-color"] = highlightColor;
|
|
228531
228632
|
return style2;
|
|
228532
228633
|
}
|
|
228533
|
-
function Skeleton$1(
|
|
228534
|
-
var
|
|
228634
|
+
function Skeleton$1(_q) {
|
|
228635
|
+
var _r = _q, { count = 1, wrapper: Wrapper, className: customClassName, containerClassName, containerTestId, circle = false, style: styleProp } = _r, propsStyleOptions = __objRest(_r, ["count", "wrapper", "className", "containerClassName", "containerTestId", "circle", "style"]);
|
|
228535
228636
|
var _a2, _b2;
|
|
228536
228637
|
const contextStyleOptions = React.useContext(SkeletonThemeContext);
|
|
228537
228638
|
const styleOptions = __spreadProps(__spreadValues(__spreadValues({}, contextStyleOptions), propsStyleOptions), {
|
|
@@ -228654,8 +228755,8 @@ const ButtonContent = ({
|
|
|
228654
228755
|
})()
|
|
228655
228756
|
});
|
|
228656
228757
|
};
|
|
228657
|
-
const ToolBar = (
|
|
228658
|
-
var props2 = __objRest(
|
|
228758
|
+
const ToolBar = (_s) => {
|
|
228759
|
+
var props2 = __objRest(_s, []);
|
|
228659
228760
|
const io = useOT.getState().socket;
|
|
228660
228761
|
const pStatus = oTStore((state2) => state2.playgroundStatus);
|
|
228661
228762
|
const dStatus = oTStore((state2) => state2.dockerStatus);
|
|
@@ -228773,7 +228874,7 @@ const MainLayout = newStyled.div`
|
|
|
228773
228874
|
const PreviewWrapper = newStyled.div`
|
|
228774
228875
|
height: 40vh;
|
|
228775
228876
|
color: #333333;
|
|
228776
|
-
background-color: #eaeaea;
|
|
228877
|
+
/* background-color: #eaeaea; */
|
|
228777
228878
|
`;
|
|
228778
228879
|
const TermWrapper = newStyled.div`
|
|
228779
228880
|
height: calc(100% - 40vh - 51px);
|
|
@@ -228859,6 +228960,7 @@ const Index = (props2) => {
|
|
|
228859
228960
|
count: 10
|
|
228860
228961
|
}),
|
|
228861
228962
|
children: /* @__PURE__ */ jsx(LazyEditorComponent, {
|
|
228963
|
+
className: "editor-custom-style",
|
|
228862
228964
|
serviceWorkerOrigin: props2.serviceWorkerOrigin,
|
|
228863
228965
|
useLsp: true
|
|
228864
228966
|
})
|