@dao42/d42paas-front 0.7.33 → 0.7.36
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 +1250 -743
- package/dist/DaoPaaS.umd.js +668 -557
- package/dist/editor.d.ts +60 -20
- package/dist/style.css +2 -2
- package/package.json +1 -1
package/dist/DaoPaaS.es.js
CHANGED
|
@@ -14944,6 +14944,12 @@ const dockerState = create$5(subscribeWithSelector$1((set2) => ({
|
|
|
14944
14944
|
dockerStatus: arg
|
|
14945
14945
|
})
|
|
14946
14946
|
})));
|
|
14947
|
+
const ErrorMsgState = create$5(subscribeWithSelector$1((set2) => ({
|
|
14948
|
+
message: {},
|
|
14949
|
+
setMessage: (arg) => set2({
|
|
14950
|
+
message: arg
|
|
14951
|
+
})
|
|
14952
|
+
})));
|
|
14947
14953
|
const oTStore = create$5(subscribeWithSelector$1((set2) => ({
|
|
14948
14954
|
asyncType: void 0,
|
|
14949
14955
|
appStatus: "code",
|
|
@@ -15083,16 +15089,14 @@ create$5((set2) => ({
|
|
|
15083
15089
|
}));
|
|
15084
15090
|
const shadowUserStore = create$5(persist((set2) => ({
|
|
15085
15091
|
shadowUser: {},
|
|
15086
|
-
switchShadowUser: (
|
|
15087
|
-
|
|
15088
|
-
|
|
15092
|
+
switchShadowUser: (id2) => set2(() => {
|
|
15093
|
+
let user;
|
|
15094
|
+
if (id2 !== void 0) {
|
|
15095
|
+
user = userListStore.getState().userList.find((user2) => user2.userId === id2);
|
|
15096
|
+
console.log(`\u5DF2\u5207\u6362\u81F3\u3010${user.username}\u3011\u89C6\u89D2`);
|
|
15089
15097
|
} else {
|
|
15090
15098
|
console.log(`\u5DF2\u9000\u51FA\u8DDF\u968F\u89C6\u89D2`);
|
|
15091
15099
|
}
|
|
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
15100
|
return {
|
|
15097
15101
|
shadowUser: user ? user : {}
|
|
15098
15102
|
};
|
|
@@ -28620,12 +28624,46 @@ const PlaygroundInit = (arg) => {
|
|
|
28620
28624
|
callback && callback();
|
|
28621
28625
|
}
|
|
28622
28626
|
});
|
|
28627
|
+
io.on("dockerInfo", (data) => {
|
|
28628
|
+
var _a2;
|
|
28629
|
+
const {
|
|
28630
|
+
dockerInfo: dockerInfo2
|
|
28631
|
+
} = JSON.parse(data);
|
|
28632
|
+
const otPlaygroundInfo = oTStore.getState().playgroundInfo;
|
|
28633
|
+
if (dockerInfo2) {
|
|
28634
|
+
(_a2 = otPlaygroundInfo == null ? void 0 : otPlaygroundInfo.dockerInfos) == null ? void 0 : _a2.set(dockerInfo2.dockerId, dockerInfo2);
|
|
28635
|
+
setDockerInfo(__spreadValues(__spreadValues({}, oTStore.getState().dockerInfo), dockerInfo2));
|
|
28636
|
+
dockerState.getState().setDockerStatus(dockerInfo2.status);
|
|
28637
|
+
dockerInfo2.fileTree && switchFileTree({
|
|
28638
|
+
data: dockerInfo2.fileTree
|
|
28639
|
+
});
|
|
28640
|
+
}
|
|
28641
|
+
});
|
|
28623
28642
|
io.on("playgroundStatus", (data) => {
|
|
28624
28643
|
setPlaygroundStatus(data);
|
|
28625
28644
|
});
|
|
28626
28645
|
io.on("dockerStatus", (data) => {
|
|
28627
28646
|
setDockerStatus(data || "STOP");
|
|
28628
28647
|
});
|
|
28648
|
+
io.on("folderEvent", async (d2) => {
|
|
28649
|
+
var _a2, _b2;
|
|
28650
|
+
const _d2 = JSON.parse(d2);
|
|
28651
|
+
setCRDTInfo2(_d2);
|
|
28652
|
+
setAsyncType("file");
|
|
28653
|
+
setReplaySource(__spreadProps(__spreadValues({}, _d2), {
|
|
28654
|
+
event: "file"
|
|
28655
|
+
}));
|
|
28656
|
+
const localReplayFile = await (await daopaasDB()).get("replayFiles", _d2.file.path);
|
|
28657
|
+
if (!localReplayFile) {
|
|
28658
|
+
setLocalReplayFile((_a2 = _d2 == null ? void 0 : _d2.file) == null ? void 0 : _a2.path, {
|
|
28659
|
+
value: _d2.file.value,
|
|
28660
|
+
revision: 0,
|
|
28661
|
+
path: _d2.file.path
|
|
28662
|
+
});
|
|
28663
|
+
}
|
|
28664
|
+
if (((_b2 = shadowUserStore.getState().shadowUser) == null ? void 0 : _b2.uuid) || IsMe(_d2 == null ? void 0 : _d2.userInfo) && _d2.file)
|
|
28665
|
+
;
|
|
28666
|
+
});
|
|
28629
28667
|
io.on("fileContent", async (d2) => {
|
|
28630
28668
|
var _a2, _b2;
|
|
28631
28669
|
const _d2 = JSON.parse(d2);
|
|
@@ -28691,6 +28729,9 @@ const PlaygroundInit = (arg) => {
|
|
|
28691
28729
|
event: "media"
|
|
28692
28730
|
}));
|
|
28693
28731
|
});
|
|
28732
|
+
io.on("errorHandler", (d2) => {
|
|
28733
|
+
ErrorMsgState.getState().setMessage(d2);
|
|
28734
|
+
});
|
|
28694
28735
|
io.on("disconnect", (reason) => {
|
|
28695
28736
|
if (reason === "io server disconnect") {
|
|
28696
28737
|
return;
|
|
@@ -44589,6 +44630,7 @@ class DaoPaaS {
|
|
|
44589
44630
|
__publicField(this, "playgroundId");
|
|
44590
44631
|
__publicField(this, "serviceWorkerOrigin");
|
|
44591
44632
|
__publicField(this, "onMessage");
|
|
44633
|
+
__publicField(this, "onError");
|
|
44592
44634
|
this.mode = mode;
|
|
44593
44635
|
this.ticket = ticket;
|
|
44594
44636
|
this.playgroundId = playgroundId;
|
|
@@ -44599,6 +44641,7 @@ class DaoPaaS {
|
|
|
44599
44641
|
this.paasDomain = paasDomain;
|
|
44600
44642
|
this.components = components;
|
|
44601
44643
|
this.onMessage = onMessage;
|
|
44644
|
+
this.onError = onError;
|
|
44602
44645
|
this.serviceWorkerOrigin = serviceWorkerOrigin;
|
|
44603
44646
|
sessionStorage.setItem("playgroundId", playgroundId);
|
|
44604
44647
|
this.init();
|
|
@@ -44699,11 +44742,21 @@ class DaoPaaS {
|
|
|
44699
44742
|
dockerState.subscribe((state2) => state2, (pre, next2) => {
|
|
44700
44743
|
this.trigger(lodash$2.exports.pick(pre, ["dockerStatus"]), lodash$2.exports.pick(next2, ["dockerStatus"]));
|
|
44701
44744
|
});
|
|
44745
|
+
oTStore.subscribe((state2) => state2, (pre, next2) => {
|
|
44746
|
+
this.trigger(lodash$2.exports.pick(pre, ["playgroundStatus"]), lodash$2.exports.pick(next2, ["playgroundStatus"]));
|
|
44747
|
+
});
|
|
44748
|
+
ErrorMsgState.subscribe((state2) => state2, (next2, pre) => {
|
|
44749
|
+
this.trigger("error", lodash$2.exports.pick(next2, "message"));
|
|
44750
|
+
});
|
|
44702
44751
|
userListStore.subscribe((next2, pre) => {
|
|
44703
44752
|
this.trigger(lodash$2.exports.pick(pre, ["userList"]), lodash$2.exports.pick(next2, ["userList"]));
|
|
44704
44753
|
});
|
|
44705
44754
|
}
|
|
44706
44755
|
trigger(_d2, data) {
|
|
44756
|
+
if (_d2 === "error") {
|
|
44757
|
+
this.on(data, _d2);
|
|
44758
|
+
return;
|
|
44759
|
+
}
|
|
44707
44760
|
this.on(data);
|
|
44708
44761
|
}
|
|
44709
44762
|
clearIDB(callback) {
|
|
@@ -44711,18 +44764,18 @@ class DaoPaaS {
|
|
|
44711
44764
|
callback && callback();
|
|
44712
44765
|
};
|
|
44713
44766
|
}
|
|
44714
|
-
followUser(
|
|
44767
|
+
followUser(userId, callback) {
|
|
44715
44768
|
const {
|
|
44716
44769
|
switchShadowUser
|
|
44717
44770
|
} = shadowUserStore.getState();
|
|
44718
|
-
switchShadowUser(
|
|
44719
|
-
callback && callback();
|
|
44771
|
+
switchShadowUser(userId);
|
|
44772
|
+
callback && callback(this.userList.find((u2) => u2.userId === userId));
|
|
44720
44773
|
}
|
|
44721
44774
|
unFollowUser(userInfo, callback) {
|
|
44722
44775
|
const {
|
|
44723
44776
|
switchShadowUser
|
|
44724
44777
|
} = shadowUserStore.getState();
|
|
44725
|
-
switchShadowUser(
|
|
44778
|
+
switchShadowUser();
|
|
44726
44779
|
callback && callback();
|
|
44727
44780
|
}
|
|
44728
44781
|
replay(arg) {
|
|
@@ -44772,8 +44825,12 @@ class DaoPaaS {
|
|
|
44772
44825
|
isRecording: !!setBoolean
|
|
44773
44826
|
});
|
|
44774
44827
|
}
|
|
44775
|
-
on(data) {
|
|
44776
|
-
|
|
44828
|
+
on(data, type) {
|
|
44829
|
+
if (type === "error") {
|
|
44830
|
+
this.onError && this.onError(data);
|
|
44831
|
+
} else {
|
|
44832
|
+
this.onMessage && this.onMessage(data);
|
|
44833
|
+
}
|
|
44777
44834
|
}
|
|
44778
44835
|
mapRender(components) {
|
|
44779
44836
|
components == null ? void 0 : components.forEach(({
|
|
@@ -44841,6 +44898,7 @@ class DaoPaaS {
|
|
|
44841
44898
|
props: props2
|
|
44842
44899
|
}) {
|
|
44843
44900
|
this.editorDOM = container ? isHTMLElement$1(container) : this.editorDOM;
|
|
44901
|
+
console.log(props2, 374);
|
|
44844
44902
|
reactDom.exports.render(/* @__PURE__ */ jsx(react.exports.Suspense, {
|
|
44845
44903
|
fallback: /* @__PURE__ */ jsx(Loading, {}),
|
|
44846
44904
|
children: /* @__PURE__ */ jsx(LazyEditorComponent$1, __spreadProps(__spreadValues({}, props2), {
|
|
@@ -46111,7 +46169,7 @@ var TreeItemRenamingInput = function(props2) {
|
|
|
46111
46169
|
environment.setActiveTree(treeId);
|
|
46112
46170
|
});
|
|
46113
46171
|
};
|
|
46114
|
-
var
|
|
46172
|
+
var confirm2 = function() {
|
|
46115
46173
|
var _a3;
|
|
46116
46174
|
(_a3 = environment.onRenameItem) === null || _a3 === void 0 ? void 0 : _a3.call(environment, item, title, treeInformation.treeId);
|
|
46117
46175
|
setRenamingItem(null);
|
|
@@ -46146,13 +46204,13 @@ var TreeItemRenamingInput = function(props2) {
|
|
|
46146
46204
|
var submitButtonProps = {
|
|
46147
46205
|
onClick: function(e2) {
|
|
46148
46206
|
e2.stopPropagation();
|
|
46149
|
-
|
|
46207
|
+
confirm2();
|
|
46150
46208
|
}
|
|
46151
46209
|
};
|
|
46152
46210
|
var formProps = {
|
|
46153
46211
|
onSubmit: function(e2) {
|
|
46154
46212
|
e2.preventDefault();
|
|
46155
|
-
|
|
46213
|
+
confirm2();
|
|
46156
46214
|
}
|
|
46157
46215
|
};
|
|
46158
46216
|
return renderers.renderRenameInput({
|
|
@@ -48271,6 +48329,9 @@ Transition.Child = function Child(props2) {
|
|
|
48271
48329
|
return !hasTransitionContext && hasOpenClosedContext ? /* @__PURE__ */ jsx(Transition, __spreadValues({}, Object.assign({}, props2))) : /* @__PURE__ */ jsx(TransitionChild, __spreadValues({}, Object.assign({}, props2)));
|
|
48272
48330
|
};
|
|
48273
48331
|
Transition.Root = Transition;
|
|
48332
|
+
const checkIfTheFileHasDeleted = (fileTree, value) => {
|
|
48333
|
+
return !JSON.stringify(fileTree).includes(value);
|
|
48334
|
+
};
|
|
48274
48335
|
const IoClient = function(revision) {
|
|
48275
48336
|
this.revision = revision;
|
|
48276
48337
|
this.state = synchronized_;
|
|
@@ -48404,25 +48465,25 @@ const FollowLayout = ({
|
|
|
48404
48465
|
if (!(shadowUser == null ? void 0 : shadowUser.uuid))
|
|
48405
48466
|
return;
|
|
48406
48467
|
setAsyncType(void 0);
|
|
48407
|
-
switchShadowUser(
|
|
48468
|
+
switchShadowUser(void 0);
|
|
48408
48469
|
},
|
|
48409
48470
|
onKeyDown: () => {
|
|
48410
48471
|
if (!(shadowUser == null ? void 0 : shadowUser.uuid))
|
|
48411
48472
|
return;
|
|
48412
48473
|
setAsyncType(void 0);
|
|
48413
|
-
switchShadowUser(
|
|
48474
|
+
switchShadowUser(void 0);
|
|
48414
48475
|
},
|
|
48415
48476
|
onScroll: () => {
|
|
48416
48477
|
if (!(shadowUser == null ? void 0 : shadowUser.uuid))
|
|
48417
48478
|
return;
|
|
48418
48479
|
setAsyncType(void 0);
|
|
48419
|
-
switchShadowUser(
|
|
48480
|
+
switchShadowUser(void 0);
|
|
48420
48481
|
},
|
|
48421
48482
|
onWheel: () => {
|
|
48422
48483
|
if (!(shadowUser == null ? void 0 : shadowUser.uuid))
|
|
48423
48484
|
return;
|
|
48424
48485
|
setAsyncType(void 0);
|
|
48425
|
-
switchShadowUser(
|
|
48486
|
+
switchShadowUser(void 0);
|
|
48426
48487
|
},
|
|
48427
48488
|
children: [oTStore.getState().appStatus === "replay" && FROZEN_CONTROL_COMPONENTS.some((d2) => d2 === name) ? /* @__PURE__ */ jsx(Freezer, {}) : null, children]
|
|
48428
48489
|
});
|
|
@@ -48444,583 +48505,6 @@ const Freezer = ({
|
|
|
48444
48505
|
}) => /* @__PURE__ */ jsx(FreezerLayout, {
|
|
48445
48506
|
children
|
|
48446
48507
|
});
|
|
48447
|
-
function addChildrenArray(children, parent2) {
|
|
48448
|
-
var _a2, _b2;
|
|
48449
|
-
for (let i = 0; i < children.length; i++) {
|
|
48450
|
-
if (children[i].type === "DIRECTORY") {
|
|
48451
|
-
(_a2 = parent2 == null ? void 0 : parent2.children) == null ? void 0 : _a2.push(`${parent2.index}${children[i].name}/`);
|
|
48452
|
-
} else {
|
|
48453
|
-
(_b2 = parent2 == null ? void 0 : parent2.children) == null ? void 0 : _b2.push(`${parent2.index}${children[i].name}`);
|
|
48454
|
-
}
|
|
48455
|
-
}
|
|
48456
|
-
}
|
|
48457
|
-
function formatFileToTree(data) {
|
|
48458
|
-
if (!data)
|
|
48459
|
-
return;
|
|
48460
|
-
const formatData = {};
|
|
48461
|
-
const root2 = data.name;
|
|
48462
|
-
formatData[root2] = {
|
|
48463
|
-
index: root2,
|
|
48464
|
-
children: [],
|
|
48465
|
-
hasChildren: true,
|
|
48466
|
-
data: root2
|
|
48467
|
-
};
|
|
48468
|
-
addChildrenArray(data.children, formatData[root2]);
|
|
48469
|
-
let nodeChildren = [...data.children];
|
|
48470
|
-
let pathChildren = [...formatData[root2].children];
|
|
48471
|
-
while (nodeChildren.length) {
|
|
48472
|
-
const size2 = nodeChildren.length;
|
|
48473
|
-
for (let i = 0; i < size2; i++) {
|
|
48474
|
-
const child = nodeChildren.shift();
|
|
48475
|
-
const path2 = pathChildren.shift();
|
|
48476
|
-
nodeChildren = nodeChildren.concat(child.children);
|
|
48477
|
-
switch (child.type) {
|
|
48478
|
-
case "DIRECTORY":
|
|
48479
|
-
const dirPath = path2;
|
|
48480
|
-
formatData[dirPath] = {
|
|
48481
|
-
index: dirPath,
|
|
48482
|
-
hasChildren: true,
|
|
48483
|
-
children: [],
|
|
48484
|
-
data: child.name
|
|
48485
|
-
};
|
|
48486
|
-
addChildrenArray(child.children, formatData[dirPath]);
|
|
48487
|
-
pathChildren = pathChildren.concat(formatData[dirPath].children);
|
|
48488
|
-
break;
|
|
48489
|
-
case "FILE":
|
|
48490
|
-
const filePath = path2;
|
|
48491
|
-
formatData[filePath] = {
|
|
48492
|
-
index: filePath,
|
|
48493
|
-
hasChildren: false,
|
|
48494
|
-
data: child.name
|
|
48495
|
-
};
|
|
48496
|
-
break;
|
|
48497
|
-
}
|
|
48498
|
-
}
|
|
48499
|
-
}
|
|
48500
|
-
return formatData;
|
|
48501
|
-
}
|
|
48502
|
-
const getStringFromFile = async (file) => {
|
|
48503
|
-
const base64String = await new Promise((resolve2) => {
|
|
48504
|
-
const reader2 = new FileReader();
|
|
48505
|
-
reader2.readAsDataURL(file);
|
|
48506
|
-
reader2.onload = (e2) => {
|
|
48507
|
-
resolve2(e2.target.result);
|
|
48508
|
-
};
|
|
48509
|
-
});
|
|
48510
|
-
return base64String;
|
|
48511
|
-
};
|
|
48512
|
-
const FileTree = ({
|
|
48513
|
-
onCustomSelect
|
|
48514
|
-
}) => {
|
|
48515
|
-
const addedFolder = {
|
|
48516
|
-
target: "",
|
|
48517
|
-
files: []
|
|
48518
|
-
};
|
|
48519
|
-
const io = useOT.getState().socket;
|
|
48520
|
-
const [focusedItem, setFocusedItem] = react.exports.useState();
|
|
48521
|
-
const [expandedItems, setExpandedItems] = react.exports.useState([]);
|
|
48522
|
-
const [selectedItems, setSelectedItems] = react.exports.useState([]);
|
|
48523
|
-
const [remoteUserList, setRemoteUserList] = react.exports.useState({});
|
|
48524
|
-
const [renameItem, setRenameItem] = react.exports.useState("");
|
|
48525
|
-
const [renameValue, setRenameValue] = react.exports.useState("");
|
|
48526
|
-
const treeRef = react.exports.useRef(null);
|
|
48527
|
-
const {
|
|
48528
|
-
CRDTInfo: CRDTInfo2,
|
|
48529
|
-
dockerInfo: dockerInfo2
|
|
48530
|
-
} = oTStore((state2) => state2);
|
|
48531
|
-
const {
|
|
48532
|
-
fileTree
|
|
48533
|
-
} = fileTreeStore((state2) => state2);
|
|
48534
|
-
const [treeData, setTreeData] = react.exports.useState({});
|
|
48535
|
-
react.exports.useEffect(() => {
|
|
48536
|
-
if (oTStore.getState().appStatus === "replay") {
|
|
48537
|
-
setSelectedItems([]);
|
|
48538
|
-
setExpandedItems([]);
|
|
48539
|
-
}
|
|
48540
|
-
if (!fileTree.data)
|
|
48541
|
-
return;
|
|
48542
|
-
const newData = formatFileToTree(fileTree == null ? void 0 : fileTree.data);
|
|
48543
|
-
setSelectedItems(selectedItems.filter((item) => newData[item]));
|
|
48544
|
-
setExpandedItems(expandedItems.filter((item) => newData[item]));
|
|
48545
|
-
setTreeData(newData);
|
|
48546
|
-
}, [fileTree]);
|
|
48547
|
-
react.exports.useEffect(() => {
|
|
48548
|
-
setSelectedItems([]);
|
|
48549
|
-
setExpandedItems([]);
|
|
48550
|
-
}, [dockerInfo2]);
|
|
48551
|
-
const onSelect = (items) => {
|
|
48552
|
-
if (items.length === 1) {
|
|
48553
|
-
setSelectedItems(items);
|
|
48554
|
-
if (oTStore.getState().appStatus === "code") {
|
|
48555
|
-
const crdt = {
|
|
48556
|
-
timestamp: Date.now(),
|
|
48557
|
-
userInfo: userStore.getState().userInfo,
|
|
48558
|
-
editor: {
|
|
48559
|
-
extraInfo: {
|
|
48560
|
-
messageId: "1",
|
|
48561
|
-
playgroundId: oTStore.getState().playgroundInfo.playgroundId
|
|
48562
|
-
},
|
|
48563
|
-
evtType: "File"
|
|
48564
|
-
},
|
|
48565
|
-
file: {
|
|
48566
|
-
action: "Get",
|
|
48567
|
-
path: items[0]
|
|
48568
|
-
}
|
|
48569
|
-
};
|
|
48570
|
-
io == null ? void 0 : io.emit("fileContent", JSON.stringify(crdt));
|
|
48571
|
-
}
|
|
48572
|
-
}
|
|
48573
|
-
};
|
|
48574
|
-
const onExpand = (item) => {
|
|
48575
|
-
setExpandedItems([...expandedItems, item]);
|
|
48576
|
-
};
|
|
48577
|
-
const onCollapse = (item) => {
|
|
48578
|
-
setExpandedItems(expandedItems.filter((expandedItemIndex) => expandedItemIndex !== item));
|
|
48579
|
-
};
|
|
48580
|
-
const onUploadFile = (payload) => {
|
|
48581
|
-
io == null ? void 0 : io.emit("upload", payload);
|
|
48582
|
-
addedFolder.target = "";
|
|
48583
|
-
addedFolder.files = [];
|
|
48584
|
-
};
|
|
48585
|
-
const formatUploadFileTarget = (path2) => {
|
|
48586
|
-
if (path2[path2.length - 1] !== "/") {
|
|
48587
|
-
addedFolder.target = `${path2.split("/").slice(0, -1).join("/")}/`;
|
|
48588
|
-
} else {
|
|
48589
|
-
addedFolder.target = path2;
|
|
48590
|
-
}
|
|
48591
|
-
};
|
|
48592
|
-
const traverseFileTree = async (item, path2 = "/") => {
|
|
48593
|
-
const data = await new Promise((resolve2) => {
|
|
48594
|
-
if (item.isFile) {
|
|
48595
|
-
item.file(async (file) => {
|
|
48596
|
-
resolve2([{
|
|
48597
|
-
path: `${path2}${file.name}`,
|
|
48598
|
-
content: await getStringFromFile(file)
|
|
48599
|
-
}]);
|
|
48600
|
-
});
|
|
48601
|
-
} else if (item.isDirectory) {
|
|
48602
|
-
let result = [{
|
|
48603
|
-
path: `${path2}${item.name}/`,
|
|
48604
|
-
content: ""
|
|
48605
|
-
}];
|
|
48606
|
-
const dirReader = item.createReader();
|
|
48607
|
-
dirReader.readEntries(async (entries) => {
|
|
48608
|
-
for (let i = 0; i < entries.length; i++) {
|
|
48609
|
-
result = result.concat(await traverseFileTree(entries[i], `${path2}${item.name}/`));
|
|
48610
|
-
}
|
|
48611
|
-
resolve2(result);
|
|
48612
|
-
});
|
|
48613
|
-
}
|
|
48614
|
-
});
|
|
48615
|
-
return data;
|
|
48616
|
-
};
|
|
48617
|
-
const onOriginDrop = async (event) => {
|
|
48618
|
-
var _a2;
|
|
48619
|
-
event.preventDefault();
|
|
48620
|
-
let buttonElement = event.target;
|
|
48621
|
-
while (buttonElement && ((_a2 = buttonElement.tagName) == null ? void 0 : _a2.toLowerCase()) !== "button") {
|
|
48622
|
-
buttonElement = buttonElement.lastChild;
|
|
48623
|
-
}
|
|
48624
|
-
const node2 = buttonElement ? buttonElement.dataset["rctItemId"] : "/";
|
|
48625
|
-
formatUploadFileTarget(node2);
|
|
48626
|
-
const items = event.dataTransfer.items;
|
|
48627
|
-
if (items.length === 0)
|
|
48628
|
-
return;
|
|
48629
|
-
const itemsIterate = [];
|
|
48630
|
-
for (const i of items) {
|
|
48631
|
-
itemsIterate.push(i.webkitGetAsEntry());
|
|
48632
|
-
}
|
|
48633
|
-
for (const item of itemsIterate) {
|
|
48634
|
-
if (item) {
|
|
48635
|
-
addedFolder.files = addedFolder.files.concat(await traverseFileTree(item));
|
|
48636
|
-
}
|
|
48637
|
-
}
|
|
48638
|
-
buttonElement == null ? void 0 : buttonElement.parentNode.classList.remove("rct-tree-item-title-container-selected");
|
|
48639
|
-
buttonElement == null ? void 0 : buttonElement.parentNode.parentNode.classList.remove("rct-tree-item-li-selected");
|
|
48640
|
-
onUploadFile(JSON.stringify(addedFolder));
|
|
48641
|
-
};
|
|
48642
|
-
react.exports.useEffect(() => {
|
|
48643
|
-
if (treeRef.current) {
|
|
48644
|
-
treeRef.current.removeEventListener("drop", onOriginDrop);
|
|
48645
|
-
treeRef.current.addEventListener("drop", onOriginDrop, false);
|
|
48646
|
-
treeRef.current.addEventListener("dragover", (e2) => {
|
|
48647
|
-
if (e2.dataTransfer.items.length === 0)
|
|
48648
|
-
return;
|
|
48649
|
-
e2.preventDefault();
|
|
48650
|
-
e2.stopPropagation();
|
|
48651
|
-
}, false);
|
|
48652
|
-
treeRef.current.addEventListener("dragenter", (e2) => {
|
|
48653
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
48654
|
-
if (((_a2 = e2 == null ? void 0 : e2.dataTransfer) == null ? void 0 : _a2.items.length) === 0)
|
|
48655
|
-
return;
|
|
48656
|
-
e2.preventDefault();
|
|
48657
|
-
e2.stopPropagation();
|
|
48658
|
-
if (((_c2 = (_b2 = e2 == null ? void 0 : e2.target) == null ? void 0 : _b2.tagName) == null ? void 0 : _c2.toLowerCase()) === "button") {
|
|
48659
|
-
(_e2 = (_d2 = e2.target) == null ? void 0 : _d2.parentNode) == null ? void 0 : _e2.classList.add("rct-tree-item-title-container-selected");
|
|
48660
|
-
(_g2 = (_f2 = e2.target) == null ? void 0 : _f2.parentNode) == null ? void 0 : _g2.parentNode.classList.add("rct-tree-item-li-selected");
|
|
48661
|
-
}
|
|
48662
|
-
}, false);
|
|
48663
|
-
treeRef.current.addEventListener("dragleave", (e2) => {
|
|
48664
|
-
if (e2.dataTransfer.items.length === 0)
|
|
48665
|
-
return;
|
|
48666
|
-
e2.preventDefault();
|
|
48667
|
-
e2.stopPropagation();
|
|
48668
|
-
if (e2.target.tagName.toLowerCase() === "button") {
|
|
48669
|
-
e2.target.parentNode.classList.remove("rct-tree-item-title-container-selected");
|
|
48670
|
-
e2.target.parentNode.parentNode.classList.remove("rct-tree-item-li-selected");
|
|
48671
|
-
}
|
|
48672
|
-
}, false);
|
|
48673
|
-
}
|
|
48674
|
-
}, [treeRef]);
|
|
48675
|
-
react.exports.useEffect(() => {
|
|
48676
|
-
var _a2, _b2;
|
|
48677
|
-
const user = userListStore.getState().userList.find((item) => item.uuid === CRDTInfo2.userInfo.uuid);
|
|
48678
|
-
if (((_a2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.editor) == null ? void 0 : _a2.evtType) === "File" && user) {
|
|
48679
|
-
const path2 = (_b2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.file) == null ? void 0 : _b2.path;
|
|
48680
|
-
if (!IsMe(CRDTInfo2.userInfo)) {
|
|
48681
|
-
setRemoteUserList((oldUserListItem) => {
|
|
48682
|
-
const userListItem = __spreadValues({}, oldUserListItem);
|
|
48683
|
-
const remoteUserListObj = Object.entries(userListItem);
|
|
48684
|
-
for (const iteratorItem of remoteUserListObj) {
|
|
48685
|
-
const [key, value] = iteratorItem;
|
|
48686
|
-
const index2 = value.findIndex((item) => item.uuid === user.uuid);
|
|
48687
|
-
if (index2 > -1) {
|
|
48688
|
-
userListItem[key].splice(index2, 1);
|
|
48689
|
-
if (userListItem[key].length === 0) {
|
|
48690
|
-
delete userListItem[key];
|
|
48691
|
-
}
|
|
48692
|
-
break;
|
|
48693
|
-
}
|
|
48694
|
-
}
|
|
48695
|
-
if (userListItem[path2]) {
|
|
48696
|
-
userListItem[path2].push({
|
|
48697
|
-
uuid: user.uuid,
|
|
48698
|
-
color: user.color,
|
|
48699
|
-
avatar: user.avatar
|
|
48700
|
-
});
|
|
48701
|
-
} else {
|
|
48702
|
-
userListItem[path2] = [{
|
|
48703
|
-
uuid: user.uuid,
|
|
48704
|
-
color: user.color,
|
|
48705
|
-
avatar: user.avatar
|
|
48706
|
-
}];
|
|
48707
|
-
}
|
|
48708
|
-
return userListItem;
|
|
48709
|
-
});
|
|
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
|
-
} else if (oTStore.getState().appStatus === "replay" && !ignoreReplayerStore.getState().ignoreReplayers.some((d2) => d2 === "file")) {
|
|
48719
|
-
onSelect([path2]);
|
|
48720
|
-
if (path2[path2.length - 1] === "/") {
|
|
48721
|
-
const index2 = expandedItems.indexOf(path2);
|
|
48722
|
-
if (index2 === -1) {
|
|
48723
|
-
onExpand(path2);
|
|
48724
|
-
} else {
|
|
48725
|
-
onCollapse(path2);
|
|
48726
|
-
}
|
|
48727
|
-
}
|
|
48728
|
-
}
|
|
48729
|
-
}
|
|
48730
|
-
}, [CRDTInfo2]);
|
|
48731
|
-
const handleAddFile = (path2) => {
|
|
48732
|
-
onExpand(path2);
|
|
48733
|
-
if (path2[path2.length - 1] !== "/") {
|
|
48734
|
-
path2 = `${path2.split("/").slice(0, -1).join("/")}/`;
|
|
48735
|
-
}
|
|
48736
|
-
setTreeData((treeData2) => {
|
|
48737
|
-
var _a2;
|
|
48738
|
-
const newFilePath = `${path2}${v4$1().substring(0, 6)}`;
|
|
48739
|
-
(_a2 = treeData2[path2].children) == null ? void 0 : _a2.push(newFilePath);
|
|
48740
|
-
treeData2[newFilePath] = {
|
|
48741
|
-
index: newFilePath,
|
|
48742
|
-
hasChildren: false,
|
|
48743
|
-
data: "Untitled"
|
|
48744
|
-
};
|
|
48745
|
-
setRenameItem(newFilePath);
|
|
48746
|
-
setRenameValue("");
|
|
48747
|
-
return treeData2;
|
|
48748
|
-
});
|
|
48749
|
-
};
|
|
48750
|
-
const handleAddFolder = (path2) => {
|
|
48751
|
-
onExpand(path2);
|
|
48752
|
-
if (path2[path2.length - 1] !== "/") {
|
|
48753
|
-
path2 = `${path2.split("/").slice(0, -1).join("/")}/`;
|
|
48754
|
-
}
|
|
48755
|
-
setTreeData((treeData2) => {
|
|
48756
|
-
var _a2;
|
|
48757
|
-
const newFolderPath = `${path2}${v4$1().substring(0, 6)}/`;
|
|
48758
|
-
(_a2 = treeData2[path2].children) == null ? void 0 : _a2.push(newFolderPath);
|
|
48759
|
-
treeData2[newFolderPath] = {
|
|
48760
|
-
index: newFolderPath,
|
|
48761
|
-
hasChildren: true,
|
|
48762
|
-
children: [],
|
|
48763
|
-
data: "Untitled"
|
|
48764
|
-
};
|
|
48765
|
-
setRenameItem(newFolderPath);
|
|
48766
|
-
setRenameValue("");
|
|
48767
|
-
return treeData2;
|
|
48768
|
-
});
|
|
48769
|
-
};
|
|
48770
|
-
const handleStopRenaming = (path2) => {
|
|
48771
|
-
if (renameValue === "") {
|
|
48772
|
-
setTreeData((treeData2) => {
|
|
48773
|
-
delete treeData2[path2];
|
|
48774
|
-
return treeData2;
|
|
48775
|
-
});
|
|
48776
|
-
}
|
|
48777
|
-
setRenameItem("");
|
|
48778
|
-
};
|
|
48779
|
-
const handleSave = (treeNode, name = "") => {
|
|
48780
|
-
const payload = {
|
|
48781
|
-
action: "",
|
|
48782
|
-
path: "",
|
|
48783
|
-
newPath: ""
|
|
48784
|
-
};
|
|
48785
|
-
const newPath = treeNode.index.split("/");
|
|
48786
|
-
if (treeNode.hasChildren) {
|
|
48787
|
-
newPath.splice(-2, 1, name);
|
|
48788
|
-
} else {
|
|
48789
|
-
newPath.splice(-1, 1, name);
|
|
48790
|
-
}
|
|
48791
|
-
if (treeNode.data === "Untitled") {
|
|
48792
|
-
payload.action = "CREATE";
|
|
48793
|
-
payload.path = newPath.join("/");
|
|
48794
|
-
} else {
|
|
48795
|
-
payload.action = "RENAME";
|
|
48796
|
-
payload.path = treeNode.index;
|
|
48797
|
-
payload.newPath = newPath.join("/");
|
|
48798
|
-
}
|
|
48799
|
-
io == null ? void 0 : io.emit("fileTreeOp", JSON.stringify(payload));
|
|
48800
|
-
};
|
|
48801
|
-
const handleUpload = (path2, uploadType) => {
|
|
48802
|
-
formatUploadFileTarget(path2);
|
|
48803
|
-
document.getElementById(`manual-upload-${uploadType}`).click();
|
|
48804
|
-
};
|
|
48805
|
-
const handleManualUploadFile = async (files) => {
|
|
48806
|
-
for (const item of files) {
|
|
48807
|
-
addedFolder.files = addedFolder.files.concat([{
|
|
48808
|
-
path: `/${item.name}`,
|
|
48809
|
-
content: await getStringFromFile(item)
|
|
48810
|
-
}]);
|
|
48811
|
-
}
|
|
48812
|
-
onUploadFile(JSON.stringify(addedFolder));
|
|
48813
|
-
};
|
|
48814
|
-
const handleManualUploadFolder = async (files) => {
|
|
48815
|
-
for (const item of files) {
|
|
48816
|
-
addedFolder.files = addedFolder.files.concat([{
|
|
48817
|
-
path: `/${item.webkitRelativePath}`,
|
|
48818
|
-
content: await getStringFromFile(item)
|
|
48819
|
-
}]);
|
|
48820
|
-
}
|
|
48821
|
-
onUploadFile(JSON.stringify(addedFolder));
|
|
48822
|
-
};
|
|
48823
|
-
const handleDeleteFileFolder = (path2) => {
|
|
48824
|
-
io == null ? void 0 : io.emit("fileTreeOp", JSON.stringify({
|
|
48825
|
-
action: "DELETE",
|
|
48826
|
-
path: path2
|
|
48827
|
-
}));
|
|
48828
|
-
};
|
|
48829
|
-
return /* @__PURE__ */ jsx(FollowLayout, {
|
|
48830
|
-
name: "file",
|
|
48831
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
48832
|
-
ref: treeRef,
|
|
48833
|
-
style: {
|
|
48834
|
-
height: "100%",
|
|
48835
|
-
overflow: "auto"
|
|
48836
|
-
},
|
|
48837
|
-
children: [/* @__PURE__ */ jsx("input", {
|
|
48838
|
-
id: "manual-upload-file",
|
|
48839
|
-
type: "file",
|
|
48840
|
-
multiple: true,
|
|
48841
|
-
hidden: true,
|
|
48842
|
-
onChange: (event) => {
|
|
48843
|
-
handleManualUploadFile(event.target.files);
|
|
48844
|
-
}
|
|
48845
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
48846
|
-
id: "manual-upload-folder",
|
|
48847
|
-
type: "file",
|
|
48848
|
-
multiple: true,
|
|
48849
|
-
hidden: true,
|
|
48850
|
-
webkitdirectory: "",
|
|
48851
|
-
mozdirectory: "",
|
|
48852
|
-
directory: "",
|
|
48853
|
-
onChange: (event) => {
|
|
48854
|
-
handleManualUploadFolder(event.target.files);
|
|
48855
|
-
}
|
|
48856
|
-
}), /* @__PURE__ */ jsx(ControlledTreeEnvironment, {
|
|
48857
|
-
canDragAndDrop: true,
|
|
48858
|
-
canSearch: false,
|
|
48859
|
-
items: treeData,
|
|
48860
|
-
onFocusItem: (item) => setFocusedItem(item.index),
|
|
48861
|
-
onExpandItem: (item) => {
|
|
48862
|
-
onExpand(item.index);
|
|
48863
|
-
},
|
|
48864
|
-
onCollapseItem: (item) => {
|
|
48865
|
-
onCollapse(item.index);
|
|
48866
|
-
},
|
|
48867
|
-
getItemTitle: (item) => item.data,
|
|
48868
|
-
viewState: {
|
|
48869
|
-
["tree-1"]: {
|
|
48870
|
-
focusedItem,
|
|
48871
|
-
expandedItems,
|
|
48872
|
-
selectedItems
|
|
48873
|
-
}
|
|
48874
|
-
},
|
|
48875
|
-
onSelectItems: (items) => {
|
|
48876
|
-
onSelect(items);
|
|
48877
|
-
onCustomSelect == null ? void 0 : onCustomSelect(items);
|
|
48878
|
-
},
|
|
48879
|
-
renderItem: ({
|
|
48880
|
-
title,
|
|
48881
|
-
arrow,
|
|
48882
|
-
depth,
|
|
48883
|
-
context,
|
|
48884
|
-
children
|
|
48885
|
-
}) => {
|
|
48886
|
-
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, context.itemContainerWithChildrenProps), {
|
|
48887
|
-
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(" "),
|
|
48888
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
48889
|
-
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(" "),
|
|
48890
|
-
style: {
|
|
48891
|
-
paddingLeft: `${depth}0px`
|
|
48892
|
-
},
|
|
48893
|
-
children: [remoteUserList[context.interactiveElementProps["data-rct-item-id"]] && remoteUserList[context.interactiveElementProps["data-rct-item-id"]].map((remoteUser) => /* @__PURE__ */ jsx("div", {
|
|
48894
|
-
className: "rct-tree-item-avatar rounded-full absolute border",
|
|
48895
|
-
style: {
|
|
48896
|
-
borderColor: remoteUser.color,
|
|
48897
|
-
backgroundImage: `url(${remoteUser.avatar})`
|
|
48898
|
-
}
|
|
48899
|
-
}, remoteUser.uuid)), /* @__PURE__ */ jsxs("div", {
|
|
48900
|
-
className: "rct-tree-item-toolbar absolute right-0",
|
|
48901
|
-
children: [/* @__PURE__ */ jsx("button", {
|
|
48902
|
-
onClick: () => {
|
|
48903
|
-
handleAddFile(context.interactiveElementProps["data-rct-item-id"]);
|
|
48904
|
-
},
|
|
48905
|
-
children: /* @__PURE__ */ jsx("i", {
|
|
48906
|
-
className: "d42 add-file"
|
|
48907
|
-
})
|
|
48908
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
48909
|
-
onClick: () => {
|
|
48910
|
-
handleAddFolder(context.interactiveElementProps["data-rct-item-id"]);
|
|
48911
|
-
},
|
|
48912
|
-
children: /* @__PURE__ */ jsx("i", {
|
|
48913
|
-
className: "d42 add-folder"
|
|
48914
|
-
})
|
|
48915
|
-
}), /* @__PURE__ */ jsx(Menu$2, {
|
|
48916
|
-
as: "div",
|
|
48917
|
-
className: "relative",
|
|
48918
|
-
children: ({
|
|
48919
|
-
open: open2
|
|
48920
|
-
}) => /* @__PURE__ */ jsxs(Fragment, {
|
|
48921
|
-
children: [/* @__PURE__ */ jsx(Menu$2.Button, {
|
|
48922
|
-
children: /* @__PURE__ */ jsx("i", {
|
|
48923
|
-
className: "d42 more"
|
|
48924
|
-
})
|
|
48925
|
-
}), /* @__PURE__ */ jsx(Transition, {
|
|
48926
|
-
show: open2,
|
|
48927
|
-
as: react.exports.Fragment,
|
|
48928
|
-
enter: "transition ease-out duration-100",
|
|
48929
|
-
enterFrom: "transform opacity-0 scale-95",
|
|
48930
|
-
enterTo: "transform opacity-100 scale-100",
|
|
48931
|
-
leave: "transition ease-in duration-75",
|
|
48932
|
-
leaveFrom: "transform opacity-100 scale-100",
|
|
48933
|
-
leaveTo: "transform opacity-0 scale-95",
|
|
48934
|
-
children: /* @__PURE__ */ jsxs(Menu$2.Items, {
|
|
48935
|
-
static: true,
|
|
48936
|
-
className: "absolute z-1 w-20 right-0 top-full",
|
|
48937
|
-
children: [/* @__PURE__ */ jsx(Menu$2.Item, {
|
|
48938
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
48939
|
-
className: "code-dropdown-btn-item",
|
|
48940
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
48941
|
-
className: "w-full justify-center my-2",
|
|
48942
|
-
onClick: () => {
|
|
48943
|
-
handleUpload(context.interactiveElementProps["data-rct-item-id"], "file");
|
|
48944
|
-
},
|
|
48945
|
-
children: "\u4E0A\u4F20\u6587\u4EF6"
|
|
48946
|
-
})
|
|
48947
|
-
})
|
|
48948
|
-
}), /* @__PURE__ */ jsx(Menu$2.Item, {
|
|
48949
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
48950
|
-
className: "code-dropdown-btn-item",
|
|
48951
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
48952
|
-
className: "w-full justify-center my-2",
|
|
48953
|
-
onClick: () => {
|
|
48954
|
-
handleUpload(context.interactiveElementProps["data-rct-item-id"], "folder");
|
|
48955
|
-
},
|
|
48956
|
-
children: "\u4E0A\u4F20\u6587\u4EF6\u5939"
|
|
48957
|
-
})
|
|
48958
|
-
})
|
|
48959
|
-
}), /* @__PURE__ */ jsx(Menu$2.Item, {
|
|
48960
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
48961
|
-
className: "code-dropdown-btn-item",
|
|
48962
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
48963
|
-
className: "w-full justify-center my-2",
|
|
48964
|
-
onClick: () => {
|
|
48965
|
-
setRenameValue(title.props.children);
|
|
48966
|
-
setRenameItem(context.interactiveElementProps["data-rct-item-id"]);
|
|
48967
|
-
},
|
|
48968
|
-
children: "\u91CD\u547D\u540D"
|
|
48969
|
-
})
|
|
48970
|
-
})
|
|
48971
|
-
}), /* @__PURE__ */ jsx(Menu$2.Item, {
|
|
48972
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
48973
|
-
className: "code-dropdown-btn-item",
|
|
48974
|
-
children: /* @__PURE__ */ jsx("button", {
|
|
48975
|
-
className: "w-full justify-center text-red-800 my-2",
|
|
48976
|
-
onClick: () => handleDeleteFileFolder(context.interactiveElementProps["data-rct-item-id"]),
|
|
48977
|
-
children: "\u5220\u9664"
|
|
48978
|
-
})
|
|
48979
|
-
})
|
|
48980
|
-
})]
|
|
48981
|
-
})
|
|
48982
|
-
})]
|
|
48983
|
-
})
|
|
48984
|
-
})]
|
|
48985
|
-
}), arrow, renameItem === context.interactiveElementProps["data-rct-item-id"] ? /* @__PURE__ */ jsx("input", {
|
|
48986
|
-
className: "text-black focus:outline-none active:outline-none",
|
|
48987
|
-
type: "text",
|
|
48988
|
-
autoFocus: true,
|
|
48989
|
-
value: renameValue,
|
|
48990
|
-
onInput: (event) => setRenameValue(event.target.value),
|
|
48991
|
-
onKeyDown: (event) => {
|
|
48992
|
-
switch (event.key) {
|
|
48993
|
-
case "Enter":
|
|
48994
|
-
handleStopRenaming(renameItem);
|
|
48995
|
-
handleSave(treeData[renameItem], renameValue);
|
|
48996
|
-
break;
|
|
48997
|
-
case "Escape":
|
|
48998
|
-
handleStopRenaming(renameItem);
|
|
48999
|
-
break;
|
|
49000
|
-
}
|
|
49001
|
-
}
|
|
49002
|
-
}) : /* @__PURE__ */ jsx("button", __spreadProps(__spreadValues(__spreadValues({}, context.itemContainerWithoutChildrenProps), context.interactiveElementProps), {
|
|
49003
|
-
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(" "),
|
|
49004
|
-
children: title
|
|
49005
|
-
}))]
|
|
49006
|
-
}), children]
|
|
49007
|
-
}));
|
|
49008
|
-
},
|
|
49009
|
-
children: /* @__PURE__ */ jsx(Tree, {
|
|
49010
|
-
treeId: "tree-1",
|
|
49011
|
-
rootItem: "/",
|
|
49012
|
-
treeLabel: "File Tree"
|
|
49013
|
-
})
|
|
49014
|
-
})]
|
|
49015
|
-
})
|
|
49016
|
-
});
|
|
49017
|
-
};
|
|
49018
|
-
var index$6 = /* @__PURE__ */ Object.freeze({
|
|
49019
|
-
__proto__: null,
|
|
49020
|
-
[Symbol.toStringTag]: "Module",
|
|
49021
|
-
getStringFromFile,
|
|
49022
|
-
FileTree
|
|
49023
|
-
});
|
|
49024
48508
|
function _format$1(message, args) {
|
|
49025
48509
|
let result;
|
|
49026
48510
|
if (args.length === 0) {
|
|
@@ -174461,6 +173945,783 @@ var monaco = /* @__PURE__ */ Object.freeze({
|
|
|
174461
173945
|
editor: editor$1,
|
|
174462
173946
|
languages
|
|
174463
173947
|
});
|
|
173948
|
+
create$5((set2) => ({
|
|
173949
|
+
cursor: {},
|
|
173950
|
+
setCursor: (arg) => set2((state2) => ({ cursor: arg }))
|
|
173951
|
+
}));
|
|
173952
|
+
const editorStore = create$5((set2) => ({
|
|
173953
|
+
fileTreeStack: [],
|
|
173954
|
+
setFileTreeStack: (arg) => set2(() => ({ fileTreeStack: arg }))
|
|
173955
|
+
}));
|
|
173956
|
+
class EditorData {
|
|
173957
|
+
localSetFileTreeStack(arg) {
|
|
173958
|
+
editorStore.getState().setFileTreeStack(arg);
|
|
173959
|
+
}
|
|
173960
|
+
static get fileTreeStack() {
|
|
173961
|
+
const fileTreeStack = editorStore.getState().fileTreeStack;
|
|
173962
|
+
return fileTreeStack;
|
|
173963
|
+
}
|
|
173964
|
+
static setFileTreeStack(arg) {
|
|
173965
|
+
return editorStore.getState().setFileTreeStack(arg);
|
|
173966
|
+
}
|
|
173967
|
+
static updateModel({
|
|
173968
|
+
value,
|
|
173969
|
+
path: path2,
|
|
173970
|
+
language: language2,
|
|
173971
|
+
APP_DIR: APP_DIR2
|
|
173972
|
+
}, callback, cover = false) {
|
|
173973
|
+
let gotModel = editor$1.getModels().find((x2) => x2.uri.path.includes(path2));
|
|
173974
|
+
if (!gotModel && !!cover) {
|
|
173975
|
+
gotModel = editor$1.createModel(value, language2, Uri.parse(`file://${APP_DIR2}${path2}`));
|
|
173976
|
+
}
|
|
173977
|
+
const _fileTreeStack = [
|
|
173978
|
+
...this.fileTreeStack,
|
|
173979
|
+
{
|
|
173980
|
+
label: path2,
|
|
173981
|
+
path: path2,
|
|
173982
|
+
model: gotModel
|
|
173983
|
+
}
|
|
173984
|
+
];
|
|
173985
|
+
this.setFileTreeStack(lodash$2.exports.uniqBy(_fileTreeStack, "path"));
|
|
173986
|
+
if (cover) {
|
|
173987
|
+
gotModel == null ? void 0 : gotModel.setValue(value);
|
|
173988
|
+
}
|
|
173989
|
+
callback && callback(gotModel);
|
|
173990
|
+
}
|
|
173991
|
+
}
|
|
173992
|
+
__publicField(EditorData, "EditorData");
|
|
173993
|
+
const FolderSVG = (props2) => /* @__PURE__ */ jsx("svg", {
|
|
173994
|
+
className: props2.className,
|
|
173995
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
173996
|
+
width: "12",
|
|
173997
|
+
height: "10",
|
|
173998
|
+
viewBox: "0 0 12 10",
|
|
173999
|
+
fill: "none",
|
|
174000
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
174001
|
+
fillRule: "evenodd",
|
|
174002
|
+
clipRule: "evenodd",
|
|
174003
|
+
d: "M0.398438 0.800006C0.398438 0.41341 0.711841 0.100006 1.09844 0.100006H5.29844C5.68503 0.100006 5.99844 0.41341 5.99844 0.800006C5.99844 1.1866 6.31183 1.50001 6.69844 1.50001H10.8984C11.285 1.50001 11.5984 1.81341 11.5984 2.20001V9.20001C11.5984 9.58662 11.285 9.90001 10.8984 9.90001H1.09844C0.711841 9.90001 0.398438 9.58662 0.398438 9.20001V2.90001V2.20001V0.800006ZM10.0234 3.27501H6.17344V4.32501H10.0234V3.27501Z",
|
|
174004
|
+
fill: "#999999"
|
|
174005
|
+
})
|
|
174006
|
+
});
|
|
174007
|
+
const FileSVG = react.exports.forwardRef((_props, ref) => /* @__PURE__ */ jsx("svg", {
|
|
174008
|
+
className: `flex-shrink-0 ${(_props == null ? void 0 : _props.className) ? _props == null ? void 0 : _props.className : ""}`,
|
|
174009
|
+
ref,
|
|
174010
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
174011
|
+
width: "10",
|
|
174012
|
+
height: "11",
|
|
174013
|
+
viewBox: "0 0 10 11",
|
|
174014
|
+
fill: "none",
|
|
174015
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
174016
|
+
fillRule: "evenodd",
|
|
174017
|
+
clipRule: "evenodd",
|
|
174018
|
+
d: "M0.801562 0.100006C0.414966 0.100006 0.101562 0.41341 0.101562 0.800006V9.90001C0.101562 10.2866 0.414966 10.6 0.801562 10.6H9.20156C9.58817 10.6 9.90156 10.2866 9.90156 9.90001V3.88995C9.90156 3.70431 9.82778 3.52625 9.69653 3.39498L8.15156 1.85001L6.60659 0.305029C6.47534 0.173758 6.29726 0.100006 6.11162 0.100006H0.801562ZM6.22656 3.77501V1.67501H5.17656V4.30001C5.17656 4.58995 5.41162 4.82501 5.70156 4.82501H8.32656V3.77501H6.22656Z",
|
|
174019
|
+
fill: "#666666"
|
|
174020
|
+
})
|
|
174021
|
+
}));
|
|
174022
|
+
FileSVG.displayName = "FileSVG";
|
|
174023
|
+
const TreeRootLayout = newStyled.div`
|
|
174024
|
+
height: 100%;
|
|
174025
|
+
overflow: auto;
|
|
174026
|
+
|
|
174027
|
+
.folder-svg {
|
|
174028
|
+
margin: 0 0.5rem 0 0.2rem;
|
|
174029
|
+
}
|
|
174030
|
+
|
|
174031
|
+
.file-svg {
|
|
174032
|
+
margin: 0 0.5rem 0 0.2rem;
|
|
174033
|
+
}
|
|
174034
|
+
|
|
174035
|
+
ul.rct-tree-items-container {
|
|
174036
|
+
position: relative;
|
|
174037
|
+
ul.rct-tree-items-container:after {
|
|
174038
|
+
content: '';
|
|
174039
|
+
position: absolute;
|
|
174040
|
+
top: 0;
|
|
174041
|
+
height: 100%;
|
|
174042
|
+
width: 1px;
|
|
174043
|
+
z-index: 8888;
|
|
174044
|
+
left: 8px;
|
|
174045
|
+
background: rgba(255, 255, 255, 0.1);
|
|
174046
|
+
}
|
|
174047
|
+
}
|
|
174048
|
+
|
|
174049
|
+
.rct-tree-root {
|
|
174050
|
+
background: ${(props2) => props2.bgColor};
|
|
174051
|
+
color: ${(props2) => props2.fontColor};
|
|
174052
|
+
overflow: auto;
|
|
174053
|
+
}
|
|
174054
|
+
|
|
174055
|
+
.rct-tree-root.root-drag-over {
|
|
174056
|
+
background-color: ${(props2) => props2.hoverBgColor};
|
|
174057
|
+
}
|
|
174058
|
+
|
|
174059
|
+
.rct-tree-item-li {
|
|
174060
|
+
.rct-tree-item-title-container {
|
|
174061
|
+
.rct-tree-item-arrow {
|
|
174062
|
+
flex-shrink: 0;
|
|
174063
|
+
}
|
|
174064
|
+
.rct-tree-item-avatar {
|
|
174065
|
+
width: 20px;
|
|
174066
|
+
height: 20px;
|
|
174067
|
+
margin-left: 10px;
|
|
174068
|
+
background-color: white;
|
|
174069
|
+
right: 5px;
|
|
174070
|
+
}
|
|
174071
|
+
.rct-tree-item-toolbar {
|
|
174072
|
+
display: none;
|
|
174073
|
+
}
|
|
174074
|
+
&:hover {
|
|
174075
|
+
.rct-tree-item-toolbar {
|
|
174076
|
+
display: flex;
|
|
174077
|
+
gap: 8px;
|
|
174078
|
+
}
|
|
174079
|
+
}
|
|
174080
|
+
}
|
|
174081
|
+
}
|
|
174082
|
+
|
|
174083
|
+
.rct-tree-root-focus {
|
|
174084
|
+
outline: none;
|
|
174085
|
+
.rct-tree-item-li-selected {
|
|
174086
|
+
.rct-tree-item-title-container-selected {
|
|
174087
|
+
color: ${(props2) => props2.hoverTextColor};
|
|
174088
|
+
background-color: ${(props2) => props2.hoverBgColor};
|
|
174089
|
+
border-radius: 4px;
|
|
174090
|
+
}
|
|
174091
|
+
}
|
|
174092
|
+
}
|
|
174093
|
+
|
|
174094
|
+
.rct-tree-root-focus {
|
|
174095
|
+
.rct-tree-item-title-container-focused {
|
|
174096
|
+
border-color: transparent;
|
|
174097
|
+
}
|
|
174098
|
+
}
|
|
174099
|
+
|
|
174100
|
+
:not(.rct-tree-root-focus) {
|
|
174101
|
+
.rct-tree-item-title-container-focused {
|
|
174102
|
+
border-color: transparent;
|
|
174103
|
+
}
|
|
174104
|
+
.rct-tree-item-li-selected {
|
|
174105
|
+
.rct-tree-item-title-container-selected {
|
|
174106
|
+
color: ${(props2) => props2.hoverTextColor};
|
|
174107
|
+
background-color: ${(props2) => props2.hoverBgColor};
|
|
174108
|
+
border-radius: 4px;
|
|
174109
|
+
}
|
|
174110
|
+
}
|
|
174111
|
+
}
|
|
174112
|
+
`;
|
|
174113
|
+
function addChildrenArray(children, parent2) {
|
|
174114
|
+
var _a2, _b2;
|
|
174115
|
+
for (let i = 0; i < children.length; i++) {
|
|
174116
|
+
if (children[i].type === "DIRECTORY") {
|
|
174117
|
+
(_a2 = parent2 == null ? void 0 : parent2.children) == null ? void 0 : _a2.push(`${parent2.index}${children[i].name}/`);
|
|
174118
|
+
} else {
|
|
174119
|
+
(_b2 = parent2 == null ? void 0 : parent2.children) == null ? void 0 : _b2.push(`${parent2.index}${children[i].name}`);
|
|
174120
|
+
}
|
|
174121
|
+
}
|
|
174122
|
+
}
|
|
174123
|
+
function formatFileToTree(data) {
|
|
174124
|
+
if (!data)
|
|
174125
|
+
return;
|
|
174126
|
+
const formatData = {};
|
|
174127
|
+
const root2 = data.name;
|
|
174128
|
+
formatData[root2] = {
|
|
174129
|
+
index: root2,
|
|
174130
|
+
children: [],
|
|
174131
|
+
hasChildren: true,
|
|
174132
|
+
data: root2
|
|
174133
|
+
};
|
|
174134
|
+
addChildrenArray(data.children, formatData[root2]);
|
|
174135
|
+
let nodeChildren = [...data.children];
|
|
174136
|
+
let pathChildren = [...formatData[root2].children];
|
|
174137
|
+
while (nodeChildren.length) {
|
|
174138
|
+
const size2 = nodeChildren.length;
|
|
174139
|
+
for (let i = 0; i < size2; i++) {
|
|
174140
|
+
const child = nodeChildren.shift();
|
|
174141
|
+
const path2 = pathChildren.shift();
|
|
174142
|
+
nodeChildren = nodeChildren.concat(child.children);
|
|
174143
|
+
switch (child.type) {
|
|
174144
|
+
case "DIRECTORY":
|
|
174145
|
+
const dirPath = path2;
|
|
174146
|
+
formatData[dirPath] = {
|
|
174147
|
+
index: dirPath,
|
|
174148
|
+
hasChildren: true,
|
|
174149
|
+
children: [],
|
|
174150
|
+
data: child.name
|
|
174151
|
+
};
|
|
174152
|
+
addChildrenArray(child.children, formatData[dirPath]);
|
|
174153
|
+
pathChildren = pathChildren.concat(formatData[dirPath].children);
|
|
174154
|
+
break;
|
|
174155
|
+
case "FILE":
|
|
174156
|
+
const filePath = path2;
|
|
174157
|
+
formatData[filePath] = {
|
|
174158
|
+
index: filePath,
|
|
174159
|
+
hasChildren: false,
|
|
174160
|
+
data: child.name
|
|
174161
|
+
};
|
|
174162
|
+
break;
|
|
174163
|
+
}
|
|
174164
|
+
}
|
|
174165
|
+
}
|
|
174166
|
+
return formatData;
|
|
174167
|
+
}
|
|
174168
|
+
const getStringFromFile = async (file) => {
|
|
174169
|
+
const base64String = await new Promise((resolve2) => {
|
|
174170
|
+
const reader2 = new FileReader();
|
|
174171
|
+
reader2.readAsDataURL(file);
|
|
174172
|
+
reader2.onload = (e2) => {
|
|
174173
|
+
resolve2(e2.target.result);
|
|
174174
|
+
};
|
|
174175
|
+
});
|
|
174176
|
+
return base64String;
|
|
174177
|
+
};
|
|
174178
|
+
const FileTree = ({
|
|
174179
|
+
onCustomSelect,
|
|
174180
|
+
dropBgColor = "pink",
|
|
174181
|
+
dropTextColor = "black",
|
|
174182
|
+
hoverBgColor = "rgb(37 45 124 / 80%)",
|
|
174183
|
+
hoverTextColor = "#fff",
|
|
174184
|
+
bgColor = "#15171c",
|
|
174185
|
+
fontColor = "#fff",
|
|
174186
|
+
onClick
|
|
174187
|
+
}) => {
|
|
174188
|
+
const addedFolder = {
|
|
174189
|
+
target: "",
|
|
174190
|
+
files: []
|
|
174191
|
+
};
|
|
174192
|
+
useOT.getState().socket;
|
|
174193
|
+
const [focusedItem, setFocusedItem] = react.exports.useState();
|
|
174194
|
+
const [expandedItems, setExpandedItems] = react.exports.useState([]);
|
|
174195
|
+
const [selectedItems, setSelectedItems] = react.exports.useState([]);
|
|
174196
|
+
const [remoteUserList, setRemoteUserList] = react.exports.useState({});
|
|
174197
|
+
const [renameItem, setRenameItem] = react.exports.useState("");
|
|
174198
|
+
const [renameValue, setRenameValue] = react.exports.useState("");
|
|
174199
|
+
const treeRef = react.exports.useRef(null);
|
|
174200
|
+
const {
|
|
174201
|
+
CRDTInfo: CRDTInfo2,
|
|
174202
|
+
dockerInfo: dockerInfo2
|
|
174203
|
+
} = oTStore((state2) => state2);
|
|
174204
|
+
const {
|
|
174205
|
+
fileTree
|
|
174206
|
+
} = fileTreeStore((state2) => state2);
|
|
174207
|
+
const [treeData, setTreeData] = react.exports.useState({});
|
|
174208
|
+
react.exports.useEffect(() => {
|
|
174209
|
+
if (oTStore.getState().appStatus === "replay") {
|
|
174210
|
+
setSelectedItems([]);
|
|
174211
|
+
setExpandedItems([]);
|
|
174212
|
+
}
|
|
174213
|
+
if (!fileTree.data)
|
|
174214
|
+
return;
|
|
174215
|
+
const newData = formatFileToTree(fileTree == null ? void 0 : fileTree.data);
|
|
174216
|
+
setSelectedItems(selectedItems.filter((item) => newData[item]));
|
|
174217
|
+
setExpandedItems(expandedItems.filter((item) => newData[item]));
|
|
174218
|
+
setTreeData(newData);
|
|
174219
|
+
}, [fileTree]);
|
|
174220
|
+
react.exports.useEffect(() => {
|
|
174221
|
+
setSelectedItems([]);
|
|
174222
|
+
setExpandedItems([]);
|
|
174223
|
+
}, [dockerInfo2]);
|
|
174224
|
+
const onSelect = (items) => {
|
|
174225
|
+
var _a2;
|
|
174226
|
+
if (items.length === 1) {
|
|
174227
|
+
setSelectedItems(items);
|
|
174228
|
+
if (oTStore.getState().appStatus === "code") {
|
|
174229
|
+
const crdt = {
|
|
174230
|
+
timestamp: Date.now(),
|
|
174231
|
+
userInfo: userStore.getState().userInfo,
|
|
174232
|
+
editor: {
|
|
174233
|
+
extraInfo: {
|
|
174234
|
+
messageId: "1",
|
|
174235
|
+
playgroundId: oTStore.getState().playgroundInfo.playgroundId
|
|
174236
|
+
},
|
|
174237
|
+
evtType: "File"
|
|
174238
|
+
},
|
|
174239
|
+
file: {
|
|
174240
|
+
action: "Get",
|
|
174241
|
+
path: items[0]
|
|
174242
|
+
}
|
|
174243
|
+
};
|
|
174244
|
+
onClick && onClick({
|
|
174245
|
+
uri: `${fileTree.data.uri}${items[0]}`,
|
|
174246
|
+
path: items[0]
|
|
174247
|
+
});
|
|
174248
|
+
(_a2 = useOT.getState().socket) == null ? void 0 : _a2.emit("fileContent", JSON.stringify(crdt));
|
|
174249
|
+
}
|
|
174250
|
+
}
|
|
174251
|
+
};
|
|
174252
|
+
const onExpand = (item) => {
|
|
174253
|
+
setExpandedItems([...expandedItems, item]);
|
|
174254
|
+
};
|
|
174255
|
+
const onCollapse = (item) => {
|
|
174256
|
+
setExpandedItems(expandedItems.filter((expandedItemIndex) => expandedItemIndex !== item));
|
|
174257
|
+
};
|
|
174258
|
+
const onUploadFile = (payload) => {
|
|
174259
|
+
var _a2;
|
|
174260
|
+
console.log(payload, 213);
|
|
174261
|
+
(_a2 = useOT.getState().socket) == null ? void 0 : _a2.emit("upload", payload);
|
|
174262
|
+
addedFolder.target = "";
|
|
174263
|
+
addedFolder.files = [];
|
|
174264
|
+
console.log(addedFolder, 217);
|
|
174265
|
+
};
|
|
174266
|
+
const formatUploadFileTarget = (path2) => {
|
|
174267
|
+
if (path2[path2.length - 1] !== "/") {
|
|
174268
|
+
addedFolder.target = `${path2.split("/").slice(0, -1).join("/")}/`;
|
|
174269
|
+
} else {
|
|
174270
|
+
addedFolder.target = path2;
|
|
174271
|
+
}
|
|
174272
|
+
};
|
|
174273
|
+
const traverseFileTree = async (item, path2 = "/") => {
|
|
174274
|
+
const data = await new Promise((resolve2) => {
|
|
174275
|
+
if (item.isFile) {
|
|
174276
|
+
item.file(async (file) => {
|
|
174277
|
+
resolve2([{
|
|
174278
|
+
path: `${path2}${file.name}`,
|
|
174279
|
+
content: await getStringFromFile(file)
|
|
174280
|
+
}]);
|
|
174281
|
+
});
|
|
174282
|
+
} else if (item.isDirectory) {
|
|
174283
|
+
let result = [{
|
|
174284
|
+
path: `${path2}${item.name}/`,
|
|
174285
|
+
content: ""
|
|
174286
|
+
}];
|
|
174287
|
+
const dirReader = item.createReader();
|
|
174288
|
+
dirReader.readEntries(async (entries) => {
|
|
174289
|
+
for (let i = 0; i < entries.length; i++) {
|
|
174290
|
+
result = result.concat(await traverseFileTree(entries[i], `${path2}${item.name}/`));
|
|
174291
|
+
}
|
|
174292
|
+
resolve2(result);
|
|
174293
|
+
});
|
|
174294
|
+
}
|
|
174295
|
+
});
|
|
174296
|
+
return data;
|
|
174297
|
+
};
|
|
174298
|
+
const onOriginDrop = async (event) => {
|
|
174299
|
+
var _a2;
|
|
174300
|
+
event.preventDefault();
|
|
174301
|
+
event.currentTarget.lastElementChild.classList.remove("root-drag-over");
|
|
174302
|
+
let buttonElement = event.target;
|
|
174303
|
+
while (buttonElement && ((_a2 = buttonElement.tagName) == null ? void 0 : _a2.toLowerCase()) !== "button") {
|
|
174304
|
+
buttonElement = buttonElement.lastChild;
|
|
174305
|
+
}
|
|
174306
|
+
const node2 = buttonElement ? buttonElement.dataset["rctItemId"] : "/";
|
|
174307
|
+
formatUploadFileTarget(node2);
|
|
174308
|
+
const items = event.dataTransfer.items;
|
|
174309
|
+
if (items.length === 0)
|
|
174310
|
+
return;
|
|
174311
|
+
const itemsIterate = [];
|
|
174312
|
+
for (const i of items) {
|
|
174313
|
+
itemsIterate.push(i.webkitGetAsEntry());
|
|
174314
|
+
}
|
|
174315
|
+
console.log("drop5", 295);
|
|
174316
|
+
for (const item of itemsIterate) {
|
|
174317
|
+
if (item) {
|
|
174318
|
+
addedFolder.files = addedFolder.files.concat(await traverseFileTree(item));
|
|
174319
|
+
}
|
|
174320
|
+
}
|
|
174321
|
+
buttonElement == null ? void 0 : buttonElement.parentNode.classList.remove("rct-tree-item-title-container-selected");
|
|
174322
|
+
buttonElement == null ? void 0 : buttonElement.parentNode.parentNode.classList.remove("rct-tree-item-li-selected");
|
|
174323
|
+
console.log("drop5", 310);
|
|
174324
|
+
onUploadFile(JSON.stringify(addedFolder));
|
|
174325
|
+
};
|
|
174326
|
+
react.exports.useEffect(() => {
|
|
174327
|
+
if (treeRef.current) {
|
|
174328
|
+
treeRef.current.removeEventListener("drop", onOriginDrop);
|
|
174329
|
+
treeRef.current.addEventListener("drop", onOriginDrop, false);
|
|
174330
|
+
treeRef.current.addEventListener("dragover", (e2) => {
|
|
174331
|
+
if (e2.dataTransfer.items.length === 0)
|
|
174332
|
+
return;
|
|
174333
|
+
e2.preventDefault();
|
|
174334
|
+
e2.stopPropagation();
|
|
174335
|
+
}, false);
|
|
174336
|
+
treeRef.current.addEventListener("dragenter", (e2) => {
|
|
174337
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
174338
|
+
if (((_a2 = e2 == null ? void 0 : e2.dataTransfer) == null ? void 0 : _a2.items.length) === 0)
|
|
174339
|
+
return;
|
|
174340
|
+
e2.preventDefault();
|
|
174341
|
+
e2.stopPropagation();
|
|
174342
|
+
console.log(e2.currentTarget.lastElementChild);
|
|
174343
|
+
e2.currentTarget.lastElementChild.classList.remove("root-drag-over");
|
|
174344
|
+
if (e2.target.classList.contains("rct-tree-root")) {
|
|
174345
|
+
console.log(e2.target);
|
|
174346
|
+
e2.target.classList.add("root-drag-over");
|
|
174347
|
+
}
|
|
174348
|
+
if (((_c2 = (_b2 = e2 == null ? void 0 : e2.target) == null ? void 0 : _b2.tagName) == null ? void 0 : _c2.toLowerCase()) === "button") {
|
|
174349
|
+
(_e2 = (_d2 = e2.target) == null ? void 0 : _d2.parentNode) == null ? void 0 : _e2.classList.add("rct-tree-item-title-container-selected");
|
|
174350
|
+
(_g2 = (_f2 = e2.target) == null ? void 0 : _f2.parentNode) == null ? void 0 : _g2.parentNode.classList.add("rct-tree-item-li-selected");
|
|
174351
|
+
}
|
|
174352
|
+
}, false);
|
|
174353
|
+
treeRef.current.addEventListener("dragleave", (e2) => {
|
|
174354
|
+
if (e2.dataTransfer.items.length === 0)
|
|
174355
|
+
return;
|
|
174356
|
+
e2.preventDefault();
|
|
174357
|
+
e2.stopPropagation();
|
|
174358
|
+
if (e2.target.tagName.toLowerCase() === "button") {
|
|
174359
|
+
e2.target.parentNode.classList.remove("rct-tree-item-title-container-selected");
|
|
174360
|
+
e2.target.parentNode.parentNode.classList.remove("rct-tree-item-li-selected");
|
|
174361
|
+
}
|
|
174362
|
+
}, false);
|
|
174363
|
+
}
|
|
174364
|
+
}, [treeRef]);
|
|
174365
|
+
react.exports.useEffect(() => {
|
|
174366
|
+
var _a2;
|
|
174367
|
+
const user = userListStore.getState().userList.find((item) => item.uuid === CRDTInfo2.userInfo.uuid);
|
|
174368
|
+
if (((_a2 = CRDTInfo2 == null ? void 0 : CRDTInfo2.editor) == null ? void 0 : _a2.evtType) === "File" && user) {
|
|
174369
|
+
const path2 = CRDTInfo2.file.path;
|
|
174370
|
+
if (!IsMe(CRDTInfo2.userInfo)) {
|
|
174371
|
+
setRemoteUserList((oldUserListItem) => {
|
|
174372
|
+
const userListItem = __spreadValues({}, oldUserListItem);
|
|
174373
|
+
const remoteUserListObj = Object.entries(userListItem);
|
|
174374
|
+
for (const iteratorItem of remoteUserListObj) {
|
|
174375
|
+
const [key, value] = iteratorItem;
|
|
174376
|
+
const index2 = value.findIndex((item) => item.uuid === user.uuid);
|
|
174377
|
+
if (index2 > -1) {
|
|
174378
|
+
userListItem[key].splice(index2, 1);
|
|
174379
|
+
if (userListItem[key].length === 0) {
|
|
174380
|
+
delete userListItem[key];
|
|
174381
|
+
}
|
|
174382
|
+
break;
|
|
174383
|
+
}
|
|
174384
|
+
}
|
|
174385
|
+
if (userListItem[path2]) {
|
|
174386
|
+
userListItem[path2].push({
|
|
174387
|
+
uuid: user.uuid,
|
|
174388
|
+
color: user.color,
|
|
174389
|
+
avatar: user.avatar
|
|
174390
|
+
});
|
|
174391
|
+
} else {
|
|
174392
|
+
userListItem[path2] = [{
|
|
174393
|
+
uuid: user.uuid,
|
|
174394
|
+
color: user.color,
|
|
174395
|
+
avatar: user.avatar
|
|
174396
|
+
}];
|
|
174397
|
+
}
|
|
174398
|
+
return userListItem;
|
|
174399
|
+
});
|
|
174400
|
+
if (path2[path2.length - 1] === "/") {
|
|
174401
|
+
const index2 = expandedItems.indexOf(path2);
|
|
174402
|
+
if (index2 === -1) {
|
|
174403
|
+
onExpand(path2);
|
|
174404
|
+
} else {
|
|
174405
|
+
onCollapse(path2);
|
|
174406
|
+
}
|
|
174407
|
+
}
|
|
174408
|
+
} else if (oTStore.getState().appStatus === "replay" && !ignoreReplayerStore.getState().ignoreReplayers.some((d2) => d2 === "file")) {
|
|
174409
|
+
onSelect([path2]);
|
|
174410
|
+
if (path2[path2.length - 1] === "/") {
|
|
174411
|
+
const index2 = expandedItems.indexOf(path2);
|
|
174412
|
+
if (index2 === -1) {
|
|
174413
|
+
onExpand(path2);
|
|
174414
|
+
} else {
|
|
174415
|
+
onCollapse(path2);
|
|
174416
|
+
}
|
|
174417
|
+
}
|
|
174418
|
+
}
|
|
174419
|
+
}
|
|
174420
|
+
}, [CRDTInfo2]);
|
|
174421
|
+
const handleAddFile = (path2) => {
|
|
174422
|
+
onExpand(path2);
|
|
174423
|
+
if (path2[path2.length - 1] !== "/") {
|
|
174424
|
+
path2 = `${path2.split("/").slice(0, -1).join("/")}/`;
|
|
174425
|
+
}
|
|
174426
|
+
setTreeData((treeData2) => {
|
|
174427
|
+
var _a2;
|
|
174428
|
+
const newFilePath = `${path2}${v4$1().substring(0, 6)}`;
|
|
174429
|
+
(_a2 = treeData2[path2].children) == null ? void 0 : _a2.push(newFilePath);
|
|
174430
|
+
treeData2[newFilePath] = {
|
|
174431
|
+
index: newFilePath,
|
|
174432
|
+
hasChildren: false,
|
|
174433
|
+
data: "Untitled"
|
|
174434
|
+
};
|
|
174435
|
+
setRenameItem(newFilePath);
|
|
174436
|
+
setRenameValue("");
|
|
174437
|
+
return treeData2;
|
|
174438
|
+
});
|
|
174439
|
+
};
|
|
174440
|
+
const handleAddFolder = (path2) => {
|
|
174441
|
+
onExpand(path2);
|
|
174442
|
+
if (path2[path2.length - 1] !== "/") {
|
|
174443
|
+
path2 = `${path2.split("/").slice(0, -1).join("/")}/`;
|
|
174444
|
+
}
|
|
174445
|
+
setTreeData((treeData2) => {
|
|
174446
|
+
var _a2;
|
|
174447
|
+
const newFolderPath = `${path2}${v4$1().substring(0, 6)}/`;
|
|
174448
|
+
(_a2 = treeData2[path2].children) == null ? void 0 : _a2.push(newFolderPath);
|
|
174449
|
+
treeData2[newFolderPath] = {
|
|
174450
|
+
index: newFolderPath,
|
|
174451
|
+
hasChildren: true,
|
|
174452
|
+
children: [],
|
|
174453
|
+
data: "Untitled"
|
|
174454
|
+
};
|
|
174455
|
+
setRenameItem(newFolderPath);
|
|
174456
|
+
setRenameValue("");
|
|
174457
|
+
return treeData2;
|
|
174458
|
+
});
|
|
174459
|
+
};
|
|
174460
|
+
const handleStopRenaming = (path2) => {
|
|
174461
|
+
if (renameValue === "") {
|
|
174462
|
+
setTreeData((treeData2) => {
|
|
174463
|
+
delete treeData2[path2];
|
|
174464
|
+
return treeData2;
|
|
174465
|
+
});
|
|
174466
|
+
}
|
|
174467
|
+
setRenameItem("");
|
|
174468
|
+
};
|
|
174469
|
+
const handleSave = (treeNode, name = "") => {
|
|
174470
|
+
var _a2;
|
|
174471
|
+
const payload = {
|
|
174472
|
+
action: "",
|
|
174473
|
+
path: "",
|
|
174474
|
+
newPath: "",
|
|
174475
|
+
userInfo: userStore.getState().userInfo
|
|
174476
|
+
};
|
|
174477
|
+
const newPath = treeNode.index.split("/");
|
|
174478
|
+
if (treeNode.hasChildren) {
|
|
174479
|
+
newPath.splice(-2, 1, name);
|
|
174480
|
+
} else {
|
|
174481
|
+
newPath.splice(-1, 1, name);
|
|
174482
|
+
}
|
|
174483
|
+
if (treeNode.data === "Untitled") {
|
|
174484
|
+
payload.action = "CREATE";
|
|
174485
|
+
payload.path = newPath.join("/");
|
|
174486
|
+
} else {
|
|
174487
|
+
payload.action = "RENAME";
|
|
174488
|
+
payload.path = treeNode.index;
|
|
174489
|
+
payload.newPath = newPath.join("/");
|
|
174490
|
+
}
|
|
174491
|
+
(_a2 = useOT.getState().socket) == null ? void 0 : _a2.emit("fileTreeOp", JSON.stringify(payload));
|
|
174492
|
+
};
|
|
174493
|
+
const handleUpload = (path2, uploadType) => {
|
|
174494
|
+
formatUploadFileTarget(path2);
|
|
174495
|
+
document.getElementById(`manual-upload-${uploadType}`).click();
|
|
174496
|
+
};
|
|
174497
|
+
const handleManualUploadFile = async (files) => {
|
|
174498
|
+
for (const item of files) {
|
|
174499
|
+
addedFolder.files = addedFolder.files.concat([{
|
|
174500
|
+
path: `/${item.name}`,
|
|
174501
|
+
content: await getStringFromFile(item)
|
|
174502
|
+
}]);
|
|
174503
|
+
}
|
|
174504
|
+
onUploadFile(JSON.stringify(addedFolder));
|
|
174505
|
+
};
|
|
174506
|
+
const handleManualUploadFolder = async (files) => {
|
|
174507
|
+
for (const item of files) {
|
|
174508
|
+
addedFolder.files = addedFolder.files.concat([{
|
|
174509
|
+
path: `/${item.webkitRelativePath}`,
|
|
174510
|
+
content: await getStringFromFile(item)
|
|
174511
|
+
}]);
|
|
174512
|
+
}
|
|
174513
|
+
onUploadFile(JSON.stringify(addedFolder));
|
|
174514
|
+
};
|
|
174515
|
+
const handleDeleteFileFolder = (path2) => {
|
|
174516
|
+
var _a2;
|
|
174517
|
+
EditorData.setFileTreeStack(EditorData.fileTreeStack.filter((file) => file.path !== path2));
|
|
174518
|
+
(_a2 = useOT.getState().socket) == null ? void 0 : _a2.emit("fileTreeOp", JSON.stringify({
|
|
174519
|
+
action: "DELETE",
|
|
174520
|
+
path: path2
|
|
174521
|
+
}));
|
|
174522
|
+
oTStore.getState().switchDoc({
|
|
174523
|
+
value: "",
|
|
174524
|
+
path: "/"
|
|
174525
|
+
});
|
|
174526
|
+
};
|
|
174527
|
+
return /* @__PURE__ */ jsx(FollowLayout, {
|
|
174528
|
+
name: "file",
|
|
174529
|
+
children: /* @__PURE__ */ jsxs(TreeRootLayout, {
|
|
174530
|
+
ref: treeRef,
|
|
174531
|
+
className: `tree-root-layout`,
|
|
174532
|
+
dropBgColor,
|
|
174533
|
+
dropTextColor,
|
|
174534
|
+
hoverBgColor,
|
|
174535
|
+
hoverTextColor,
|
|
174536
|
+
bgColor,
|
|
174537
|
+
fontColor,
|
|
174538
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
174539
|
+
id: "manual-upload-file",
|
|
174540
|
+
type: "file",
|
|
174541
|
+
multiple: true,
|
|
174542
|
+
hidden: true,
|
|
174543
|
+
onChange: (event) => {
|
|
174544
|
+
handleManualUploadFile(event.target.files);
|
|
174545
|
+
}
|
|
174546
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
174547
|
+
id: "manual-upload-folder",
|
|
174548
|
+
type: "file",
|
|
174549
|
+
multiple: true,
|
|
174550
|
+
hidden: true,
|
|
174551
|
+
onChange: (event) => {
|
|
174552
|
+
handleManualUploadFolder(event.target.files);
|
|
174553
|
+
}
|
|
174554
|
+
}), /* @__PURE__ */ jsx(ControlledTreeEnvironment, {
|
|
174555
|
+
canDragAndDrop: true,
|
|
174556
|
+
canSearch: false,
|
|
174557
|
+
items: treeData,
|
|
174558
|
+
onFocusItem: (item) => setFocusedItem(item.index),
|
|
174559
|
+
onExpandItem: (item) => {
|
|
174560
|
+
onExpand(item.index);
|
|
174561
|
+
},
|
|
174562
|
+
onCollapseItem: (item) => {
|
|
174563
|
+
onCollapse(item.index);
|
|
174564
|
+
},
|
|
174565
|
+
getItemTitle: (item) => item.data,
|
|
174566
|
+
viewState: {
|
|
174567
|
+
["tree-1"]: {
|
|
174568
|
+
focusedItem,
|
|
174569
|
+
expandedItems,
|
|
174570
|
+
selectedItems
|
|
174571
|
+
}
|
|
174572
|
+
},
|
|
174573
|
+
onSelectItems: (items) => {
|
|
174574
|
+
onSelect(items);
|
|
174575
|
+
onCustomSelect == null ? void 0 : onCustomSelect(items);
|
|
174576
|
+
},
|
|
174577
|
+
renderItem: ({
|
|
174578
|
+
title,
|
|
174579
|
+
arrow,
|
|
174580
|
+
depth,
|
|
174581
|
+
context,
|
|
174582
|
+
children
|
|
174583
|
+
}) => {
|
|
174584
|
+
var _a2;
|
|
174585
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, context.itemContainerWithChildrenProps), {
|
|
174586
|
+
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(" "),
|
|
174587
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
174588
|
+
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(" "),
|
|
174589
|
+
children: [remoteUserList[context.interactiveElementProps["data-rct-item-id"]] && remoteUserList[context.interactiveElementProps["data-rct-item-id"]].map((remoteUser) => /* @__PURE__ */ jsx("div", {
|
|
174590
|
+
className: "rct-tree-item-avatar rounded-full absolute border",
|
|
174591
|
+
style: {
|
|
174592
|
+
borderColor: remoteUser.color,
|
|
174593
|
+
backgroundImage: `url(${remoteUser.avatar})`
|
|
174594
|
+
}
|
|
174595
|
+
}, remoteUser.uuid)), /* @__PURE__ */ jsxs("div", {
|
|
174596
|
+
className: "rct-tree-item-toolbar absolute right-0",
|
|
174597
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
174598
|
+
onClick: () => {
|
|
174599
|
+
handleAddFile(context.interactiveElementProps["data-rct-item-id"]);
|
|
174600
|
+
},
|
|
174601
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
174602
|
+
className: "d42 add-file"
|
|
174603
|
+
})
|
|
174604
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
174605
|
+
onClick: () => {
|
|
174606
|
+
handleAddFolder(context.interactiveElementProps["data-rct-item-id"]);
|
|
174607
|
+
},
|
|
174608
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
174609
|
+
className: "d42 add-folder"
|
|
174610
|
+
})
|
|
174611
|
+
}), /* @__PURE__ */ jsx(Menu$2, {
|
|
174612
|
+
as: "div",
|
|
174613
|
+
className: "relative",
|
|
174614
|
+
children: ({
|
|
174615
|
+
open: open2
|
|
174616
|
+
}) => /* @__PURE__ */ jsxs(Fragment, {
|
|
174617
|
+
children: [/* @__PURE__ */ jsx(Menu$2.Button, {
|
|
174618
|
+
children: /* @__PURE__ */ jsx("i", {
|
|
174619
|
+
className: "d42 more"
|
|
174620
|
+
})
|
|
174621
|
+
}), /* @__PURE__ */ jsx(Transition, {
|
|
174622
|
+
show: open2,
|
|
174623
|
+
as: react.exports.Fragment,
|
|
174624
|
+
enter: "transition ease-out duration-100",
|
|
174625
|
+
enterFrom: "transform opacity-0 scale-95",
|
|
174626
|
+
enterTo: "transform opacity-100 scale-100",
|
|
174627
|
+
leave: "transition ease-in duration-75",
|
|
174628
|
+
leaveFrom: "transform opacity-100 scale-100",
|
|
174629
|
+
leaveTo: "transform opacity-0 scale-95",
|
|
174630
|
+
children: /* @__PURE__ */ jsxs(Menu$2.Items, {
|
|
174631
|
+
static: true,
|
|
174632
|
+
className: "absolute z-1 w-20 right-0 top-full",
|
|
174633
|
+
children: [/* @__PURE__ */ jsx(Menu$2.Item, {
|
|
174634
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
174635
|
+
className: "code-dropdown-btn-item",
|
|
174636
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
174637
|
+
className: "w-full justify-center my-2",
|
|
174638
|
+
onClick: () => {
|
|
174639
|
+
handleUpload(context.interactiveElementProps["data-rct-item-id"], "file");
|
|
174640
|
+
},
|
|
174641
|
+
children: "\u4E0A\u4F20\u6587\u4EF6"
|
|
174642
|
+
})
|
|
174643
|
+
})
|
|
174644
|
+
}), /* @__PURE__ */ jsx(Menu$2.Item, {
|
|
174645
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
174646
|
+
className: "code-dropdown-btn-item",
|
|
174647
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
174648
|
+
className: "w-full justify-center my-2",
|
|
174649
|
+
onClick: () => {
|
|
174650
|
+
handleUpload(context.interactiveElementProps["data-rct-item-id"], "folder");
|
|
174651
|
+
},
|
|
174652
|
+
children: "\u4E0A\u4F20\u6587\u4EF6\u5939"
|
|
174653
|
+
})
|
|
174654
|
+
})
|
|
174655
|
+
}), /* @__PURE__ */ jsx(Menu$2.Item, {
|
|
174656
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
174657
|
+
className: "code-dropdown-btn-item",
|
|
174658
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
174659
|
+
className: "w-full justify-center my-2",
|
|
174660
|
+
onClick: () => {
|
|
174661
|
+
var _a3;
|
|
174662
|
+
setRenameValue((_a3 = title == null ? void 0 : title.props) == null ? void 0 : _a3.children);
|
|
174663
|
+
setRenameItem(context.interactiveElementProps["data-rct-item-id"]);
|
|
174664
|
+
},
|
|
174665
|
+
children: "\u91CD\u547D\u540D"
|
|
174666
|
+
})
|
|
174667
|
+
})
|
|
174668
|
+
}), /* @__PURE__ */ jsx(Menu$2.Item, {
|
|
174669
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
174670
|
+
className: "code-dropdown-btn-item",
|
|
174671
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
174672
|
+
className: "w-full justify-center text-red-800 my-2",
|
|
174673
|
+
onClick: () => handleDeleteFileFolder(context.interactiveElementProps["data-rct-item-id"]),
|
|
174674
|
+
children: "\u5220\u9664"
|
|
174675
|
+
})
|
|
174676
|
+
})
|
|
174677
|
+
})]
|
|
174678
|
+
})
|
|
174679
|
+
})]
|
|
174680
|
+
})
|
|
174681
|
+
})]
|
|
174682
|
+
}), arrow, renameItem === context.interactiveElementProps["data-rct-item-id"] ? /* @__PURE__ */ jsx("input", {
|
|
174683
|
+
className: "text-black focus:outline-none active:outline-none",
|
|
174684
|
+
type: "text",
|
|
174685
|
+
autoFocus: true,
|
|
174686
|
+
value: renameValue,
|
|
174687
|
+
onInput: (event) => setRenameValue(event.target.value),
|
|
174688
|
+
onKeyDown: (event) => {
|
|
174689
|
+
switch (event.key) {
|
|
174690
|
+
case "Enter":
|
|
174691
|
+
handleStopRenaming(renameItem);
|
|
174692
|
+
handleSave(treeData[renameItem], renameValue);
|
|
174693
|
+
break;
|
|
174694
|
+
case "Escape":
|
|
174695
|
+
handleStopRenaming(renameItem);
|
|
174696
|
+
break;
|
|
174697
|
+
}
|
|
174698
|
+
}
|
|
174699
|
+
}) : /* @__PURE__ */ jsxs("button", __spreadProps(__spreadValues(__spreadValues({}, context.itemContainerWithoutChildrenProps), context.interactiveElementProps), {
|
|
174700
|
+
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(" "),
|
|
174701
|
+
children: [((_a2 = arrow == null ? void 0 : arrow.props) == null ? void 0 : _a2.className.includes("rct-tree-item-arrow-hasChildren")) ? /* @__PURE__ */ jsx(FolderSVG, {
|
|
174702
|
+
className: "folder-svg"
|
|
174703
|
+
}) : /* @__PURE__ */ jsx(FileSVG, {
|
|
174704
|
+
className: "file-svg"
|
|
174705
|
+
}), title]
|
|
174706
|
+
}))]
|
|
174707
|
+
}), children]
|
|
174708
|
+
}));
|
|
174709
|
+
},
|
|
174710
|
+
children: /* @__PURE__ */ jsx(Tree, {
|
|
174711
|
+
treeId: "tree-1",
|
|
174712
|
+
rootItem: "/",
|
|
174713
|
+
treeLabel: "File Tree"
|
|
174714
|
+
})
|
|
174715
|
+
})]
|
|
174716
|
+
})
|
|
174717
|
+
});
|
|
174718
|
+
};
|
|
174719
|
+
var index$6 = /* @__PURE__ */ Object.freeze({
|
|
174720
|
+
__proto__: null,
|
|
174721
|
+
[Symbol.toStringTag]: "Module",
|
|
174722
|
+
getStringFromFile,
|
|
174723
|
+
FileTree
|
|
174724
|
+
});
|
|
174464
174725
|
var FExtension;
|
|
174465
174726
|
(function(FExtension2) {
|
|
174466
174727
|
FExtension2["erb"] = "erb";
|
|
@@ -174650,41 +174911,14 @@ const EditorLayout = newStyled.div`
|
|
|
174650
174911
|
color: #666;
|
|
174651
174912
|
}
|
|
174652
174913
|
|
|
174653
|
-
.
|
|
174654
|
-
|
|
174655
|
-
height: 35px;
|
|
174656
|
-
transform: translate(0, -1px);
|
|
174657
|
-
overflow-x: auto;
|
|
174658
|
-
flex-wrap: nowrap;
|
|
174659
|
-
li {
|
|
174660
|
-
/* width: 100px; */
|
|
174661
|
-
height: 100%;
|
|
174662
|
-
padding: 5px 25px;
|
|
174663
|
-
color: #fff;
|
|
174664
|
-
font-size: 12px;
|
|
174665
|
-
flex: 0 0 auto;
|
|
174666
|
-
&:hover {
|
|
174667
|
-
background: #005391;
|
|
174668
|
-
}
|
|
174669
|
-
}
|
|
174670
|
-
|
|
174671
|
-
.active {
|
|
174672
|
-
background: #004172;
|
|
174914
|
+
.margin-view-overlays {
|
|
174915
|
+
background-color: ${(props2) => props2.theme.marginViewOverlays};
|
|
174673
174916
|
|
|
174674
|
-
|
|
174675
|
-
|
|
174676
|
-
/* border-left: 1px solid rgb(42 96 231); */
|
|
174677
|
-
/* background: red; */
|
|
174678
|
-
}
|
|
174917
|
+
.line-numbers {
|
|
174918
|
+
color: ${(props2) => props2.theme.lineNumbers};
|
|
174679
174919
|
|
|
174680
|
-
|
|
174681
|
-
|
|
174682
|
-
font-size: 14px;
|
|
174683
|
-
opacity: 0;
|
|
174684
|
-
line-height: 0;
|
|
174685
|
-
transition: opacity 0.2s ease-in-out;
|
|
174686
|
-
&.hover {
|
|
174687
|
-
opacity: 1;
|
|
174920
|
+
&.active-line-number {
|
|
174921
|
+
color: ${(props2) => props2.theme.activeLineNumber};
|
|
174688
174922
|
}
|
|
174689
174923
|
}
|
|
174690
174924
|
}
|
|
@@ -190152,51 +190386,6 @@ class MonacoAdapter {
|
|
|
190152
190386
|
return new Cursor(start, end);
|
|
190153
190387
|
}
|
|
190154
190388
|
}
|
|
190155
|
-
create$5((set2) => ({
|
|
190156
|
-
cursor: {},
|
|
190157
|
-
setCursor: (arg) => set2((state2) => ({ cursor: arg }))
|
|
190158
|
-
}));
|
|
190159
|
-
const editorStore = create$5((set2) => ({
|
|
190160
|
-
fileTreeStack: [],
|
|
190161
|
-
setFileTreeStack: (arg) => set2(() => ({ fileTreeStack: arg }))
|
|
190162
|
-
}));
|
|
190163
|
-
class EditorData {
|
|
190164
|
-
localSetFileTreeStack(arg) {
|
|
190165
|
-
editorStore.getState().setFileTreeStack(arg);
|
|
190166
|
-
}
|
|
190167
|
-
static get fileTreeStack() {
|
|
190168
|
-
const fileTreeStack = editorStore.getState().fileTreeStack;
|
|
190169
|
-
return fileTreeStack;
|
|
190170
|
-
}
|
|
190171
|
-
static setFileTreeStack(arg) {
|
|
190172
|
-
return editorStore.getState().setFileTreeStack(arg);
|
|
190173
|
-
}
|
|
190174
|
-
static updateModel({
|
|
190175
|
-
value,
|
|
190176
|
-
path: path2,
|
|
190177
|
-
language: language2,
|
|
190178
|
-
APP_DIR: APP_DIR2
|
|
190179
|
-
}, callback, cover = false) {
|
|
190180
|
-
let gotModel = editor$1.getModels().find((x2) => x2.uri.path.includes(path2));
|
|
190181
|
-
if (!gotModel && !!cover) {
|
|
190182
|
-
gotModel = editor$1.createModel(value, language2, Uri.parse(`file://${APP_DIR2}${path2}`));
|
|
190183
|
-
}
|
|
190184
|
-
const _fileTreeStack = [
|
|
190185
|
-
...this.fileTreeStack,
|
|
190186
|
-
{
|
|
190187
|
-
label: path2,
|
|
190188
|
-
path: path2,
|
|
190189
|
-
model: gotModel
|
|
190190
|
-
}
|
|
190191
|
-
];
|
|
190192
|
-
this.setFileTreeStack(lodash$2.exports.uniqBy(_fileTreeStack, "path"));
|
|
190193
|
-
if (cover) {
|
|
190194
|
-
gotModel == null ? void 0 : gotModel.setValue(value);
|
|
190195
|
-
}
|
|
190196
|
-
callback && callback(gotModel);
|
|
190197
|
-
}
|
|
190198
|
-
}
|
|
190199
|
-
__publicField(EditorData, "EditorData");
|
|
190200
190389
|
class ClientMeta {
|
|
190201
190390
|
constructor(editor2, clientList) {
|
|
190202
190391
|
__publicField(this, "clientList");
|
|
@@ -220145,6 +220334,214 @@ const Markdown = ({
|
|
|
220145
220334
|
})
|
|
220146
220335
|
}), document.body);
|
|
220147
220336
|
};
|
|
220337
|
+
const Dracula = {
|
|
220338
|
+
base: "vs-dark",
|
|
220339
|
+
inherit: true,
|
|
220340
|
+
rules: [
|
|
220341
|
+
{
|
|
220342
|
+
background: "282a36",
|
|
220343
|
+
token: ""
|
|
220344
|
+
},
|
|
220345
|
+
{
|
|
220346
|
+
foreground: "6272a4",
|
|
220347
|
+
token: "comment"
|
|
220348
|
+
},
|
|
220349
|
+
{
|
|
220350
|
+
foreground: "f1fa8c",
|
|
220351
|
+
token: "string"
|
|
220352
|
+
},
|
|
220353
|
+
{
|
|
220354
|
+
foreground: "bd93f9",
|
|
220355
|
+
token: "constant.numeric"
|
|
220356
|
+
},
|
|
220357
|
+
{
|
|
220358
|
+
foreground: "bd93f9",
|
|
220359
|
+
token: "constant.language"
|
|
220360
|
+
},
|
|
220361
|
+
{
|
|
220362
|
+
foreground: "bd93f9",
|
|
220363
|
+
token: "constant.character"
|
|
220364
|
+
},
|
|
220365
|
+
{
|
|
220366
|
+
foreground: "bd93f9",
|
|
220367
|
+
token: "constant.other"
|
|
220368
|
+
},
|
|
220369
|
+
{
|
|
220370
|
+
foreground: "ffb86c",
|
|
220371
|
+
token: "variable.other.readwrite.instance"
|
|
220372
|
+
},
|
|
220373
|
+
{
|
|
220374
|
+
foreground: "ff79c6",
|
|
220375
|
+
token: "constant.character.escaped"
|
|
220376
|
+
},
|
|
220377
|
+
{
|
|
220378
|
+
foreground: "ff79c6",
|
|
220379
|
+
token: "constant.character.escape"
|
|
220380
|
+
},
|
|
220381
|
+
{
|
|
220382
|
+
foreground: "ff79c6",
|
|
220383
|
+
token: "string source"
|
|
220384
|
+
},
|
|
220385
|
+
{
|
|
220386
|
+
foreground: "ff79c6",
|
|
220387
|
+
token: "string source.ruby"
|
|
220388
|
+
},
|
|
220389
|
+
{
|
|
220390
|
+
foreground: "ff79c6",
|
|
220391
|
+
token: "keyword"
|
|
220392
|
+
},
|
|
220393
|
+
{
|
|
220394
|
+
foreground: "ff79c6",
|
|
220395
|
+
token: "storage"
|
|
220396
|
+
},
|
|
220397
|
+
{
|
|
220398
|
+
foreground: "8be9fd",
|
|
220399
|
+
fontStyle: "italic",
|
|
220400
|
+
token: "storage.type"
|
|
220401
|
+
},
|
|
220402
|
+
{
|
|
220403
|
+
foreground: "50fa7b",
|
|
220404
|
+
fontStyle: "underline",
|
|
220405
|
+
token: "entity.name.class"
|
|
220406
|
+
},
|
|
220407
|
+
{
|
|
220408
|
+
foreground: "50fa7b",
|
|
220409
|
+
fontStyle: "italic underline",
|
|
220410
|
+
token: "entity.other.inherited-class"
|
|
220411
|
+
},
|
|
220412
|
+
{
|
|
220413
|
+
foreground: "50fa7b",
|
|
220414
|
+
token: "entity.name.function"
|
|
220415
|
+
},
|
|
220416
|
+
{
|
|
220417
|
+
foreground: "ffb86c",
|
|
220418
|
+
fontStyle: "italic",
|
|
220419
|
+
token: "variable.parameter"
|
|
220420
|
+
},
|
|
220421
|
+
{
|
|
220422
|
+
foreground: "ff79c6",
|
|
220423
|
+
token: "entity.name.tag"
|
|
220424
|
+
},
|
|
220425
|
+
{
|
|
220426
|
+
foreground: "50fa7b",
|
|
220427
|
+
token: "entity.other.attribute-name"
|
|
220428
|
+
},
|
|
220429
|
+
{
|
|
220430
|
+
foreground: "8be9fd",
|
|
220431
|
+
token: "support.function"
|
|
220432
|
+
},
|
|
220433
|
+
{
|
|
220434
|
+
foreground: "6be5fd",
|
|
220435
|
+
token: "support.constant"
|
|
220436
|
+
},
|
|
220437
|
+
{
|
|
220438
|
+
foreground: "66d9ef",
|
|
220439
|
+
fontStyle: " italic",
|
|
220440
|
+
token: "support.type"
|
|
220441
|
+
},
|
|
220442
|
+
{
|
|
220443
|
+
foreground: "66d9ef",
|
|
220444
|
+
fontStyle: " italic",
|
|
220445
|
+
token: "support.class"
|
|
220446
|
+
},
|
|
220447
|
+
{
|
|
220448
|
+
foreground: "f8f8f0",
|
|
220449
|
+
background: "ff79c6",
|
|
220450
|
+
token: "invalid"
|
|
220451
|
+
},
|
|
220452
|
+
{
|
|
220453
|
+
foreground: "f8f8f0",
|
|
220454
|
+
background: "bd93f9",
|
|
220455
|
+
token: "invalid.deprecated"
|
|
220456
|
+
},
|
|
220457
|
+
{
|
|
220458
|
+
foreground: "cfcfc2",
|
|
220459
|
+
token: "meta.structure.dictionary.json string.quoted.double.json"
|
|
220460
|
+
},
|
|
220461
|
+
{
|
|
220462
|
+
foreground: "6272a4",
|
|
220463
|
+
token: "meta.diff"
|
|
220464
|
+
},
|
|
220465
|
+
{
|
|
220466
|
+
foreground: "6272a4",
|
|
220467
|
+
token: "meta.diff.header"
|
|
220468
|
+
},
|
|
220469
|
+
{
|
|
220470
|
+
foreground: "ff79c6",
|
|
220471
|
+
token: "markup.deleted"
|
|
220472
|
+
},
|
|
220473
|
+
{
|
|
220474
|
+
foreground: "50fa7b",
|
|
220475
|
+
token: "markup.inserted"
|
|
220476
|
+
},
|
|
220477
|
+
{
|
|
220478
|
+
foreground: "e6db74",
|
|
220479
|
+
token: "markup.changed"
|
|
220480
|
+
},
|
|
220481
|
+
{
|
|
220482
|
+
foreground: "bd93f9",
|
|
220483
|
+
token: "constant.numeric.line-number.find-in-files - match"
|
|
220484
|
+
},
|
|
220485
|
+
{
|
|
220486
|
+
foreground: "e6db74",
|
|
220487
|
+
token: "entity.name.filename"
|
|
220488
|
+
},
|
|
220489
|
+
{
|
|
220490
|
+
foreground: "f83333",
|
|
220491
|
+
token: "message.error"
|
|
220492
|
+
},
|
|
220493
|
+
{
|
|
220494
|
+
foreground: "eeeeee",
|
|
220495
|
+
token: "punctuation.definition.string.begin.json - meta.structure.dictionary.value.json"
|
|
220496
|
+
},
|
|
220497
|
+
{
|
|
220498
|
+
foreground: "eeeeee",
|
|
220499
|
+
token: "punctuation.definition.string.end.json - meta.structure.dictionary.value.json"
|
|
220500
|
+
},
|
|
220501
|
+
{
|
|
220502
|
+
foreground: "8be9fd",
|
|
220503
|
+
token: "meta.structure.dictionary.json string.quoted.double.json"
|
|
220504
|
+
},
|
|
220505
|
+
{
|
|
220506
|
+
foreground: "f1fa8c",
|
|
220507
|
+
token: "meta.structure.dictionary.value.json string.quoted.double.json"
|
|
220508
|
+
},
|
|
220509
|
+
{
|
|
220510
|
+
foreground: "50fa7b",
|
|
220511
|
+
token: "meta meta meta meta meta meta meta.structure.dictionary.value string"
|
|
220512
|
+
},
|
|
220513
|
+
{
|
|
220514
|
+
foreground: "ffb86c",
|
|
220515
|
+
token: "meta meta meta meta meta meta.structure.dictionary.value string"
|
|
220516
|
+
},
|
|
220517
|
+
{
|
|
220518
|
+
foreground: "ff79c6",
|
|
220519
|
+
token: "meta meta meta meta meta.structure.dictionary.value string"
|
|
220520
|
+
},
|
|
220521
|
+
{
|
|
220522
|
+
foreground: "bd93f9",
|
|
220523
|
+
token: "meta meta meta meta.structure.dictionary.value string"
|
|
220524
|
+
},
|
|
220525
|
+
{
|
|
220526
|
+
foreground: "50fa7b",
|
|
220527
|
+
token: "meta meta meta.structure.dictionary.value string"
|
|
220528
|
+
},
|
|
220529
|
+
{
|
|
220530
|
+
foreground: "ffb86c",
|
|
220531
|
+
token: "meta meta.structure.dictionary.value string"
|
|
220532
|
+
}
|
|
220533
|
+
],
|
|
220534
|
+
colors: {
|
|
220535
|
+
"editor.foreground": "#f8f8f2",
|
|
220536
|
+
"editor.background": "#282a36",
|
|
220537
|
+
"editor.selectionBackground": "#44475a",
|
|
220538
|
+
"editor.lineHighlightBackground": "#44475a",
|
|
220539
|
+
"editorCursor.foreground": "#f8f8f0",
|
|
220540
|
+
"editorWhitespace.foreground": "#3B3A32",
|
|
220541
|
+
"editorIndentGuide.activeBackground": "#9D550FB0",
|
|
220542
|
+
"editor.selectionHighlightBorder": "#222218"
|
|
220543
|
+
}
|
|
220544
|
+
};
|
|
220148
220545
|
const APP_DIR = "/home/runner/app";
|
|
220149
220546
|
let editor;
|
|
220150
220547
|
const docServer = new Map();
|
|
@@ -220162,7 +220559,8 @@ const Editor = ({
|
|
|
220162
220559
|
menuStyle,
|
|
220163
220560
|
editorStyle,
|
|
220164
220561
|
serviceWorkerOrigin,
|
|
220165
|
-
useLsp
|
|
220562
|
+
useLsp,
|
|
220563
|
+
theme
|
|
220166
220564
|
}) => {
|
|
220167
220565
|
const divEl = react.exports.useRef(null);
|
|
220168
220566
|
const [clientEditor, setClientEditor] = react.exports.useState(null);
|
|
@@ -220176,9 +220574,11 @@ const Editor = ({
|
|
|
220176
220574
|
} = oTStore.getState();
|
|
220177
220575
|
const CRDTInfo2 = oTStore((state2) => state2.CRDTInfo);
|
|
220178
220576
|
const dockerInfo2 = oTStore((state2) => state2.dockerInfo);
|
|
220577
|
+
const fileTree = fileTreeStore((state2) => state2.fileTree);
|
|
220179
220578
|
oTStore((state2) => state2.CRDTInfo.file);
|
|
220180
220579
|
const docFile = oTStore((state2) => state2.doc);
|
|
220181
220580
|
const globalData = oTStore((state2) => state2.globalData);
|
|
220581
|
+
const [keepVal, setKeepVal] = react.exports.useState("");
|
|
220182
220582
|
const userList = userListStore((state2) => state2.userList);
|
|
220183
220583
|
const userInfo = userStore((state2) => state2.userInfo);
|
|
220184
220584
|
const io = useOT((state2) => state2.socket);
|
|
@@ -220242,6 +220642,7 @@ const Editor = ({
|
|
|
220242
220642
|
const onChange = (operation) => {
|
|
220243
220643
|
var _a2;
|
|
220244
220644
|
const applyDoc = oTStore.getState().doc;
|
|
220645
|
+
console.log(clientEditor.liveOperationCode);
|
|
220245
220646
|
setTimeout(() => {
|
|
220246
220647
|
client.applyClient(operation);
|
|
220247
220648
|
setLocalFile((applyDoc == null ? void 0 : applyDoc.path) ? applyDoc == null ? void 0 : applyDoc.path : "singleFile", {
|
|
@@ -220252,6 +220653,7 @@ const Editor = ({
|
|
|
220252
220653
|
if ((_a2 = applyDoc == null ? void 0 : applyDoc.path) == null ? void 0 : _a2.includes("md")) {
|
|
220253
220654
|
setMarkdownVal(editor.getValue());
|
|
220254
220655
|
}
|
|
220656
|
+
setKeepVal(editor.getValue());
|
|
220255
220657
|
};
|
|
220256
220658
|
const onDidScroll = (evt) => {
|
|
220257
220659
|
var _a2;
|
|
@@ -220407,24 +220809,30 @@ const Editor = ({
|
|
|
220407
220809
|
enabled: true
|
|
220408
220810
|
}
|
|
220409
220811
|
});
|
|
220410
|
-
editor
|
|
220411
|
-
|
|
220412
|
-
|
|
220413
|
-
|
|
220414
|
-
|
|
220415
|
-
|
|
220416
|
-
|
|
220417
|
-
|
|
220418
|
-
|
|
220419
|
-
|
|
220420
|
-
|
|
220421
|
-
|
|
220422
|
-
|
|
220423
|
-
|
|
220424
|
-
|
|
220425
|
-
|
|
220812
|
+
editor.onDidAttemptReadOnlyEdit(() => {
|
|
220813
|
+
var _a2, _b2;
|
|
220814
|
+
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";
|
|
220815
|
+
if (confirm(text2)) {
|
|
220816
|
+
editor.updateOptions({
|
|
220817
|
+
readOnly: false
|
|
220818
|
+
});
|
|
220819
|
+
const _fileTreeStack = EditorData.fileTreeStack.map((value) => {
|
|
220820
|
+
return __spreadProps(__spreadValues({}, value), {
|
|
220821
|
+
deleted: false,
|
|
220822
|
+
label: value.label.replace(" has deleted", "")
|
|
220823
|
+
});
|
|
220824
|
+
});
|
|
220825
|
+
EditorData.setFileTreeStack(_fileTreeStack);
|
|
220826
|
+
const payload = {
|
|
220827
|
+
action: "RECORVERY",
|
|
220828
|
+
path: (_b2 = (_a2 = oTStore.getState()) == null ? void 0 : _a2.doc) == null ? void 0 : _b2.path,
|
|
220829
|
+
newPath: ""
|
|
220830
|
+
};
|
|
220831
|
+
io == null ? void 0 : io.emit("fileTreeOp", JSON.stringify(payload));
|
|
220426
220832
|
}
|
|
220427
220833
|
});
|
|
220834
|
+
editor$1.defineTheme("myCoolTheme", Dracula);
|
|
220835
|
+
editor$1.setTheme("myCoolTheme");
|
|
220428
220836
|
setClientEditor(new MonacoAdapter(editor, serviceWorkerOrigin));
|
|
220429
220837
|
setOtherClients(new ClientMeta(editor, userList.filter((x2) => !IsMe(x2))));
|
|
220430
220838
|
serviceBinder();
|
|
@@ -220537,6 +220945,9 @@ const Editor = ({
|
|
|
220537
220945
|
} = oTStore.getState();
|
|
220538
220946
|
if (appStatus === "replay")
|
|
220539
220947
|
return;
|
|
220948
|
+
if (docFile.path === "/") {
|
|
220949
|
+
editor.setValue("");
|
|
220950
|
+
}
|
|
220540
220951
|
if (/\/$/.test(docFile.path))
|
|
220541
220952
|
return;
|
|
220542
220953
|
updateModel(docFile);
|
|
@@ -220561,6 +220972,23 @@ const Editor = ({
|
|
|
220561
220972
|
readOnly: globalData.disableEditor
|
|
220562
220973
|
});
|
|
220563
220974
|
}, [globalData]);
|
|
220975
|
+
react.exports.useEffect(() => {
|
|
220976
|
+
const _fileTreeStack = EditorData.fileTreeStack.map((value) => {
|
|
220977
|
+
if (checkIfTheFileHasDeleted(fileTree, value.path)) {
|
|
220978
|
+
return __spreadProps(__spreadValues({}, value), {
|
|
220979
|
+
deleted: true,
|
|
220980
|
+
label: `${value.label} has deleted`
|
|
220981
|
+
});
|
|
220982
|
+
}
|
|
220983
|
+
return value;
|
|
220984
|
+
});
|
|
220985
|
+
EditorData.setFileTreeStack(_fileTreeStack);
|
|
220986
|
+
if ((docFile == null ? void 0 : docFile.path) && checkIfTheFileHasDeleted(fileTree, docFile.path)) {
|
|
220987
|
+
editor.updateOptions({
|
|
220988
|
+
readOnly: true
|
|
220989
|
+
});
|
|
220990
|
+
}
|
|
220991
|
+
}, [fileTree]);
|
|
220564
220992
|
return /* @__PURE__ */ jsxs(FollowLayout, {
|
|
220565
220993
|
name: "editor",
|
|
220566
220994
|
children: [/* @__PURE__ */ jsx(Markdown, {
|
|
@@ -220571,7 +220999,8 @@ const Editor = ({
|
|
|
220571
220999
|
}
|
|
220572
221000
|
}), /* @__PURE__ */ jsxs(EditorLayout, {
|
|
220573
221001
|
style: containerStyle,
|
|
220574
|
-
|
|
221002
|
+
theme,
|
|
221003
|
+
className: `editor-layout flex flex-col`,
|
|
220575
221004
|
children: [/* @__PURE__ */ jsx(FileTreeStack, {
|
|
220576
221005
|
editor,
|
|
220577
221006
|
menuStyle,
|
|
@@ -220586,13 +221015,59 @@ const Editor = ({
|
|
|
220586
221015
|
})]
|
|
220587
221016
|
});
|
|
220588
221017
|
};
|
|
221018
|
+
const FileTreeStackLayout = newStyled.ul`
|
|
221019
|
+
.active {
|
|
221020
|
+
background-color: ${(props2) => props2.menuStyle.backgroundColor};
|
|
221021
|
+
box-shadow: 0px 1px 0px 0 #333;
|
|
221022
|
+
border-right: 1px solid ${(props2) => props2.menuStyle.backgroundColor};
|
|
221023
|
+
}
|
|
221024
|
+
|
|
221025
|
+
width: 100%;
|
|
221026
|
+
height: 35px;
|
|
221027
|
+
transform: translate(0, -1px);
|
|
221028
|
+
overflow-x: auto;
|
|
221029
|
+
flex-wrap: nowrap;
|
|
221030
|
+
li {
|
|
221031
|
+
/* width: 100px; */
|
|
221032
|
+
height: 100%;
|
|
221033
|
+
padding: 5px 25px;
|
|
221034
|
+
color: ${(props2) => props2.menuStyle.textColor};
|
|
221035
|
+
font-size: 12px;
|
|
221036
|
+
flex: 0 0 auto;
|
|
221037
|
+
&:hover {
|
|
221038
|
+
background: ${(props2) => props2.menuStyle.hoverBgColor};
|
|
221039
|
+
color: ${(props2) => props2.menuStyle.hoverTextColor};
|
|
221040
|
+
}
|
|
221041
|
+
}
|
|
221042
|
+
|
|
221043
|
+
.tree-closer {
|
|
221044
|
+
right: 4px;
|
|
221045
|
+
font-size: 14px;
|
|
221046
|
+
opacity: 0;
|
|
221047
|
+
line-height: 0;
|
|
221048
|
+
transition: opacity 0.2s ease-in-out;
|
|
221049
|
+
color: ${(props2) => props2.menuStyle.iconColor};
|
|
221050
|
+
&.hover {
|
|
221051
|
+
opacity: 1;
|
|
221052
|
+
color: ${(props2) => props2.menuStyle.hoverIconColor};
|
|
221053
|
+
}
|
|
221054
|
+
}
|
|
221055
|
+
`;
|
|
220589
221056
|
const FileTreeStack = ({
|
|
220590
221057
|
editor: editor2,
|
|
220591
|
-
menuStyle,
|
|
220592
221058
|
switchModel,
|
|
220593
|
-
clearPlayground
|
|
221059
|
+
clearPlayground,
|
|
221060
|
+
menuStyle = {
|
|
221061
|
+
backgroundColor: "#005391",
|
|
221062
|
+
textColor: "#fff",
|
|
221063
|
+
hoverBgColor: "rgb(37 45 124 / 80%)",
|
|
221064
|
+
hoverTextColor: "#fff",
|
|
221065
|
+
iconColor: "#fff",
|
|
221066
|
+
hoverIconColor: "#fff"
|
|
221067
|
+
}
|
|
220594
221068
|
}) => {
|
|
220595
221069
|
const switchDoc2 = oTStore((state2) => state2.switchDoc);
|
|
221070
|
+
oTStore((state2) => state2.dockerInfo);
|
|
220596
221071
|
const docFile = oTStore((state2) => state2.doc);
|
|
220597
221072
|
const fileTreeStack = editorStore((state2) => state2.fileTreeStack);
|
|
220598
221073
|
const setFileTreeStack = editorStore((state2) => state2.setFileTreeStack);
|
|
@@ -220613,11 +221088,11 @@ const FileTreeStack = ({
|
|
|
220613
221088
|
switchModel(_fileTreeStackList.slice(-1)[0].model);
|
|
220614
221089
|
}
|
|
220615
221090
|
};
|
|
220616
|
-
return fileTreeStack && fileTreeStack.length > 0 ? /* @__PURE__ */ jsx(
|
|
220617
|
-
|
|
221091
|
+
return fileTreeStack && fileTreeStack.length > 0 ? /* @__PURE__ */ jsx(FileTreeStackLayout, {
|
|
221092
|
+
menuStyle,
|
|
220618
221093
|
id: "menu-list",
|
|
220619
221094
|
ref,
|
|
220620
|
-
className: "
|
|
221095
|
+
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",
|
|
220621
221096
|
children: fileTreeStack == null ? void 0 : fileTreeStack.map((f2, index2) => /* @__PURE__ */ jsxs("li", {
|
|
220622
221097
|
className: `
|
|
220623
221098
|
flex
|
|
@@ -227885,6 +228360,7 @@ const Console = (_e2) => {
|
|
|
227885
228360
|
}, [dockerStatus]);
|
|
227886
228361
|
return /* @__PURE__ */ jsx(FollowLayout, {
|
|
227887
228362
|
children: /* @__PURE__ */ jsx("div", {
|
|
228363
|
+
className: props2.className ? props2.className : "",
|
|
227888
228364
|
style: {
|
|
227889
228365
|
height: "100%",
|
|
227890
228366
|
width: "100%"
|
|
@@ -227901,12 +228377,25 @@ var index$3 = /* @__PURE__ */ Object.freeze({
|
|
|
227901
228377
|
"default": Console
|
|
227902
228378
|
});
|
|
227903
228379
|
const PROTOCOL = "https://";
|
|
228380
|
+
const BrowserLayout = newStyled.div``;
|
|
227904
228381
|
const NavBar = newStyled.div`
|
|
227905
228382
|
background-color: white;
|
|
227906
228383
|
height: 30px;
|
|
227907
228384
|
display: flex;
|
|
227908
228385
|
align-items: center;
|
|
227909
228386
|
|
|
228387
|
+
.reload {
|
|
228388
|
+
color: ${(props2) => props2.freshIconColor};
|
|
228389
|
+
}
|
|
228390
|
+
|
|
228391
|
+
.file-copy {
|
|
228392
|
+
color: ${(props2) => props2.openIconColor};
|
|
228393
|
+
}
|
|
228394
|
+
|
|
228395
|
+
input {
|
|
228396
|
+
color: ${(props2) => props2.inputColor};
|
|
228397
|
+
}
|
|
228398
|
+
|
|
227910
228399
|
i {
|
|
227911
228400
|
margin: 0 10px;
|
|
227912
228401
|
width: 24px;
|
|
@@ -227951,7 +228440,17 @@ const StopMask = newStyled.div`
|
|
|
227951
228440
|
opacity: 0.6;
|
|
227952
228441
|
`;
|
|
227953
228442
|
const OutputBrowser = (_g2) => {
|
|
227954
|
-
var
|
|
228443
|
+
var _h2 = _g2, {
|
|
228444
|
+
showURL = false,
|
|
228445
|
+
freshIconColor = "#00bcd4",
|
|
228446
|
+
inputColor = "#adacac",
|
|
228447
|
+
openIconColor = "#adacac"
|
|
228448
|
+
} = _h2, props2 = __objRest(_h2, [
|
|
228449
|
+
"showURL",
|
|
228450
|
+
"freshIconColor",
|
|
228451
|
+
"inputColor",
|
|
228452
|
+
"openIconColor"
|
|
228453
|
+
]);
|
|
227955
228454
|
var _a2;
|
|
227956
228455
|
const pStatus = oTStore((state2) => state2.playgroundStatus);
|
|
227957
228456
|
const dStatus = oTStore((state2) => state2.dockerStatus);
|
|
@@ -228004,33 +228503,39 @@ const OutputBrowser = (_g2) => {
|
|
|
228004
228503
|
}
|
|
228005
228504
|
}
|
|
228006
228505
|
}, [playgroundStatus, dockerStatus]);
|
|
228007
|
-
return /* @__PURE__ */
|
|
228506
|
+
return /* @__PURE__ */ jsx(FollowLayout, {
|
|
228008
228507
|
name: "browser",
|
|
228009
|
-
children:
|
|
228010
|
-
|
|
228011
|
-
|
|
228012
|
-
|
|
228013
|
-
|
|
228014
|
-
|
|
228015
|
-
|
|
228016
|
-
|
|
228017
|
-
|
|
228018
|
-
|
|
228019
|
-
|
|
228020
|
-
|
|
228508
|
+
children: /* @__PURE__ */ jsxs(BrowserLayout, {
|
|
228509
|
+
className: "w-full h-full",
|
|
228510
|
+
children: [showURL ? /* @__PURE__ */ jsxs(NavBar, {
|
|
228511
|
+
freshIconColor,
|
|
228512
|
+
inputColor,
|
|
228513
|
+
openIconColor,
|
|
228514
|
+
children: [/* @__PURE__ */ jsx("i", {
|
|
228515
|
+
className: "d42 text-xl reload cursor-pointer",
|
|
228516
|
+
onClick: onRefresh
|
|
228517
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
228518
|
+
type: "text",
|
|
228519
|
+
value: iframeSrc,
|
|
228520
|
+
onChange: (e2) => setIframeSrc(e2.target.value),
|
|
228521
|
+
onKeyDown: onEnterKey
|
|
228522
|
+
}), /* @__PURE__ */ jsx("i", {
|
|
228523
|
+
className: "d42 text-xl file-copy cursor-pointer",
|
|
228524
|
+
onClick: onOpenInNewTab
|
|
228525
|
+
})]
|
|
228526
|
+
}) : null, dockerStatus === "STOP" && /* @__PURE__ */ jsx(StopMask, {
|
|
228527
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
228528
|
+
children: "\u70B9\u51FB\u201C\u8FD0\u884C\u201D\uFF0C\u542F\u52A8\u5E94\u7528"
|
|
228529
|
+
})
|
|
228530
|
+
}), /* @__PURE__ */ jsx("iframe", {
|
|
228531
|
+
ref: iframeRef,
|
|
228532
|
+
src: iframeSrc,
|
|
228533
|
+
style: {
|
|
228534
|
+
width: "100%",
|
|
228535
|
+
height: "calc(100% - 30px)"
|
|
228536
|
+
}
|
|
228021
228537
|
})]
|
|
228022
|
-
})
|
|
228023
|
-
children: /* @__PURE__ */ jsx("span", {
|
|
228024
|
-
children: "\u70B9\u51FB\u201C\u8FD0\u884C\u201D\uFF0C\u542F\u52A8\u5E94\u7528"
|
|
228025
|
-
})
|
|
228026
|
-
}), /* @__PURE__ */ jsx("iframe", {
|
|
228027
|
-
ref: iframeRef,
|
|
228028
|
-
src: iframeSrc,
|
|
228029
|
-
style: {
|
|
228030
|
-
width: "100%",
|
|
228031
|
-
height: "calc(100% - 30px)"
|
|
228032
|
-
}
|
|
228033
|
-
})]
|
|
228538
|
+
})
|
|
228034
228539
|
});
|
|
228035
228540
|
};
|
|
228036
228541
|
var index$2 = /* @__PURE__ */ Object.freeze({
|
|
@@ -228038,10 +228543,10 @@ var index$2 = /* @__PURE__ */ Object.freeze({
|
|
|
228038
228543
|
[Symbol.toStringTag]: "Module",
|
|
228039
228544
|
"default": OutputBrowser
|
|
228040
228545
|
});
|
|
228041
|
-
const TerminalComponent = (
|
|
228042
|
-
var
|
|
228546
|
+
const TerminalComponent = (_i) => {
|
|
228547
|
+
var _j = _i, {
|
|
228043
228548
|
options
|
|
228044
|
-
} =
|
|
228549
|
+
} = _j, props2 = __objRest(_j, [
|
|
228045
228550
|
"options"
|
|
228046
228551
|
]);
|
|
228047
228552
|
const defaultOptions2 = __spreadValues({}, options);
|
|
@@ -228161,6 +228666,7 @@ const TerminalComponent = (_h2) => {
|
|
|
228161
228666
|
return /* @__PURE__ */ jsx(FollowLayout, {
|
|
228162
228667
|
name: "terminal",
|
|
228163
228668
|
children: /* @__PURE__ */ jsx("div", {
|
|
228669
|
+
className: props2.className ? props2.className : "",
|
|
228164
228670
|
id: "terminal",
|
|
228165
228671
|
style: {
|
|
228166
228672
|
height: "100%",
|
|
@@ -228178,12 +228684,12 @@ var index$1 = /* @__PURE__ */ Object.freeze({
|
|
|
228178
228684
|
[Symbol.toStringTag]: "Module",
|
|
228179
228685
|
"default": TerminalComponent
|
|
228180
228686
|
});
|
|
228181
|
-
const Tabs = (
|
|
228182
|
-
var
|
|
228687
|
+
const Tabs = (_k) => {
|
|
228688
|
+
var _l = _k, {
|
|
228183
228689
|
activeKey,
|
|
228184
228690
|
onSelect,
|
|
228185
228691
|
tabItems
|
|
228186
|
-
} =
|
|
228692
|
+
} = _l, props2 = __objRest(_l, [
|
|
228187
228693
|
"activeKey",
|
|
228188
228694
|
"onSelect",
|
|
228189
228695
|
"tabItems"
|
|
@@ -228501,10 +229007,10 @@ const AvatarLayout = newStyled.div`
|
|
|
228501
229007
|
border-color: ${(props2) => props2.user.color};
|
|
228502
229008
|
background-image: ${(props2) => 'url("' + props2.user.avatar + '")'};
|
|
228503
229009
|
`;
|
|
228504
|
-
const Avatar = (
|
|
228505
|
-
var
|
|
229010
|
+
const Avatar = (_m) => {
|
|
229011
|
+
var _n = _m, {
|
|
228506
229012
|
user
|
|
228507
|
-
} =
|
|
229013
|
+
} = _n, props2 = __objRest(_n, [
|
|
228508
229014
|
"user"
|
|
228509
229015
|
]);
|
|
228510
229016
|
return /* @__PURE__ */ jsx(AvatarLayout, __spreadValues({
|
|
@@ -228513,8 +229019,8 @@ const Avatar = (_l) => {
|
|
|
228513
229019
|
}, props2));
|
|
228514
229020
|
};
|
|
228515
229021
|
const SkeletonThemeContext = React.createContext({});
|
|
228516
|
-
function SkeletonTheme(
|
|
228517
|
-
var
|
|
229022
|
+
function SkeletonTheme(_o) {
|
|
229023
|
+
var _p = _o, { children } = _p, styleOptions = __objRest(_p, ["children"]);
|
|
228518
229024
|
return React.createElement(SkeletonThemeContext.Provider, { value: styleOptions }, children);
|
|
228519
229025
|
}
|
|
228520
229026
|
const defaultEnableAnimation = true;
|
|
@@ -228540,8 +229046,8 @@ function styleOptionsToCssProperties({ baseColor, highlightColor, width, height,
|
|
|
228540
229046
|
style2["--highlight-color"] = highlightColor;
|
|
228541
229047
|
return style2;
|
|
228542
229048
|
}
|
|
228543
|
-
function Skeleton$1(
|
|
228544
|
-
var
|
|
229049
|
+
function Skeleton$1(_q) {
|
|
229050
|
+
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"]);
|
|
228545
229051
|
var _a2, _b2;
|
|
228546
229052
|
const contextStyleOptions = React.useContext(SkeletonThemeContext);
|
|
228547
229053
|
const styleOptions = __spreadProps(__spreadValues(__spreadValues({}, contextStyleOptions), propsStyleOptions), {
|
|
@@ -228664,8 +229170,8 @@ const ButtonContent = ({
|
|
|
228664
229170
|
})()
|
|
228665
229171
|
});
|
|
228666
229172
|
};
|
|
228667
|
-
const ToolBar = (
|
|
228668
|
-
var props2 = __objRest(
|
|
229173
|
+
const ToolBar = (_s) => {
|
|
229174
|
+
var props2 = __objRest(_s, []);
|
|
228669
229175
|
const io = useOT.getState().socket;
|
|
228670
229176
|
const pStatus = oTStore((state2) => state2.playgroundStatus);
|
|
228671
229177
|
const dStatus = oTStore((state2) => state2.dockerStatus);
|
|
@@ -228783,7 +229289,7 @@ const MainLayout = newStyled.div`
|
|
|
228783
229289
|
const PreviewWrapper = newStyled.div`
|
|
228784
229290
|
height: 40vh;
|
|
228785
229291
|
color: #333333;
|
|
228786
|
-
background-color: #eaeaea;
|
|
229292
|
+
/* background-color: #eaeaea; */
|
|
228787
229293
|
`;
|
|
228788
229294
|
const TermWrapper = newStyled.div`
|
|
228789
229295
|
height: calc(100% - 40vh - 51px);
|
|
@@ -228794,9 +229300,9 @@ const HeaderLayout = newStyled.header`
|
|
|
228794
229300
|
`;
|
|
228795
229301
|
const ContainerLayout = newStyled.div`
|
|
228796
229302
|
height: calc(100% - 4.625rem);
|
|
228797
|
-
section {
|
|
229303
|
+
/* section {
|
|
228798
229304
|
height: calc(100% - 0.625rem);
|
|
228799
|
-
}
|
|
229305
|
+
} */
|
|
228800
229306
|
`;
|
|
228801
229307
|
const RunnerLayout = newStyled.section`
|
|
228802
229308
|
background: #202327;
|
|
@@ -228878,7 +229384,8 @@ const Index = (props2) => {
|
|
|
228878
229384
|
children: [/* @__PURE__ */ jsx(PreviewWrapper, {
|
|
228879
229385
|
className: "mb-2.5 relative",
|
|
228880
229386
|
children: /* @__PURE__ */ jsx(OutputBrowser, {
|
|
228881
|
-
url: url2
|
|
229387
|
+
url: url2,
|
|
229388
|
+
showURL: true
|
|
228882
229389
|
})
|
|
228883
229390
|
}), /* @__PURE__ */ jsx(Tabs, {
|
|
228884
229391
|
className: "mb-1",
|