Fixed the file browser modal
parent
bd721bf13e
commit
f7c62fbbe0
|
@ -3,6 +3,8 @@
|
||||||
- Made the permission editor popoutable
|
- Made the permission editor popoutable
|
||||||
- Now using SVG flags for higher quality.
|
- Now using SVG flags for higher quality.
|
||||||
- Fixed issue [#74](https://github.com/TeaSpeak/TeaWeb/issues/74) (Swiss flag box has black background)
|
- Fixed issue [#74](https://github.com/TeaSpeak/TeaWeb/issues/74) (Swiss flag box has black background)
|
||||||
|
- Fixed issue that middle clicking on the channel does not shows the channel file browser instead it shows the global one
|
||||||
|
|
||||||
* **21.03.21**
|
* **21.03.21**
|
||||||
- Reworked the server group assignment modal. It now better reacts to the user input as well is now popoutable
|
- Reworked the server group assignment modal. It now better reacts to the user input as well is now popoutable
|
||||||
|
|
||||||
|
|
|
@ -73,10 +73,19 @@ function parsePath(path: string, connection: ConnectionHandler): PathInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function initializeRemoteFileBrowserController(connection: ConnectionHandler, events: Registry<FileBrowserEvents>) {
|
export function initializeRemoteFileBrowserController(connection: ConnectionHandler, events: Registry<FileBrowserEvents>) {
|
||||||
|
/* currently selected files */
|
||||||
|
let currentPath = "/";
|
||||||
|
let currentPathInfo: PathInfo;
|
||||||
|
let selection: { name: string, type: FileType }[] = [];
|
||||||
|
|
||||||
events.on("action_navigate_to", event => {
|
events.on("action_navigate_to", event => {
|
||||||
try {
|
try {
|
||||||
const info = parsePath(event.path, connection);
|
const info = parsePath(event.path, connection);
|
||||||
|
|
||||||
|
currentPathInfo = info;
|
||||||
|
currentPath = event.path;
|
||||||
|
selection = [];
|
||||||
|
|
||||||
events.fire_react("notify_current_path", {
|
events.fire_react("notify_current_path", {
|
||||||
path: event.path || "/",
|
path: event.path || "/",
|
||||||
status: "success",
|
status: "success",
|
||||||
|
@ -370,20 +379,6 @@ export function initializeRemoteFileBrowserController(connection: ConnectionHand
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/* currently selected files */
|
|
||||||
let currentPath = "/";
|
|
||||||
let currentPathInfo: PathInfo;
|
|
||||||
let selection: { name: string, type: FileType }[] = [];
|
|
||||||
events.on("notify_current_path", result => {
|
|
||||||
if (result.status !== "success") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentPathInfo = result.pathInfo;
|
|
||||||
currentPath = result.path;
|
|
||||||
selection = [];
|
|
||||||
});
|
|
||||||
|
|
||||||
events.on("query_current_path", () => events.fire_react("notify_current_path", {
|
events.on("query_current_path", () => events.fire_react("notify_current_path", {
|
||||||
status: "success",
|
status: "success",
|
||||||
path: currentPath,
|
path: currentPath,
|
||||||
|
|
|
@ -148,15 +148,20 @@ export class NavigationBar extends ReactComponentBase<NavigationBarProperties, N
|
||||||
protected defaultState(): NavigationBarState {
|
protected defaultState(): NavigationBarState {
|
||||||
return {
|
return {
|
||||||
currentPath: this.props.initialPath,
|
currentPath: this.props.initialPath,
|
||||||
state: "normal",
|
state: "navigating",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.props.events.fire("query_current_path");
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let input;
|
let input;
|
||||||
let path = this.state.currentPath;
|
let path = this.state.currentPath;
|
||||||
if (!path.endsWith("/"))
|
if (!path.endsWith("/")) {
|
||||||
path += "/";
|
path += "/";
|
||||||
|
}
|
||||||
|
|
||||||
if (this.state.state === "editing") {
|
if (this.state.state === "editing") {
|
||||||
input = (
|
input = (
|
||||||
|
@ -239,17 +244,19 @@ export class NavigationBar extends ReactComponentBase<NavigationBarProperties, N
|
||||||
|
|
||||||
componentDidUpdate(prevProps: Readonly<NavigationBarProperties>, prevState: Readonly<NavigationBarState>, snapshot?: any): void {
|
componentDidUpdate(prevProps: Readonly<NavigationBarProperties>, prevState: Readonly<NavigationBarState>, snapshot?: any): void {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (this.refRendered.current)
|
if (this.refRendered.current) {
|
||||||
this.refRendered.current.scrollLeft = 999999;
|
this.refRendered.current.scrollLeft = 999999;
|
||||||
|
}
|
||||||
}, 10);
|
}, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onPathClicked(event: React.MouseEvent, index: number) {
|
private onPathClicked(event: React.MouseEvent, index: number) {
|
||||||
let path;
|
let path;
|
||||||
if (index === -1)
|
if (index === -1) {
|
||||||
path = "/";
|
path = "/";
|
||||||
else
|
} else {
|
||||||
path = "/" + this.state.currentPath.split("/").filter(e => !!e).slice(0, index + 1).join("/") + "/";
|
path = "/" + this.state.currentPath.split("/").filter(e => !!e).slice(0, index + 1).join("/") + "/";
|
||||||
|
}
|
||||||
this.props.events.fire("action_navigate_to", {path: path});
|
this.props.events.fire("action_navigate_to", {path: path});
|
||||||
|
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
@ -266,8 +273,9 @@ export class NavigationBar extends ReactComponentBase<NavigationBarProperties, N
|
||||||
}
|
}
|
||||||
|
|
||||||
private onInputPathBluer() {
|
private onInputPathBluer() {
|
||||||
if (this.state.state !== "editing" || this.ignoreBlur)
|
if (this.state.state !== "editing" || this.ignoreBlur) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
state: "normal"
|
state: "normal"
|
||||||
|
@ -1144,9 +1152,6 @@ export class FileBrowserRenderer extends ReactComponentBase<FileListTablePropert
|
||||||
this.currentPath = this.props.initialPath;
|
this.currentPath = this.props.initialPath;
|
||||||
|
|
||||||
this.props.events.fire("query_current_path", {});
|
this.props.events.fire("query_current_path", {});
|
||||||
this.props.events.fire("query_files", {
|
|
||||||
path: this.currentPath
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private onDrop(event: React.DragEvent) {
|
private onDrop(event: React.DragEvent) {
|
||||||
|
|
|
@ -27,18 +27,17 @@ class FileTransferModal extends InternalModal {
|
||||||
this.remoteBrowseEvents.enableDebug("remote-file-browser");
|
this.remoteBrowseEvents.enableDebug("remote-file-browser");
|
||||||
this.transferInfoEvents.enableDebug("transfer-info");
|
this.transferInfoEvents.enableDebug("transfer-info");
|
||||||
|
|
||||||
|
const path = this.defaultChannelId ? "/" + channelPathPrefix + this.defaultChannelId + "/" : "/";
|
||||||
initializeRemoteFileBrowserController(server_connections.getActiveConnectionHandler(), this.remoteBrowseEvents);
|
initializeRemoteFileBrowserController(server_connections.getActiveConnectionHandler(), this.remoteBrowseEvents);
|
||||||
initializeTransferInfoController(server_connections.getActiveConnectionHandler(), this.transferInfoEvents);
|
initializeTransferInfoController(server_connections.getActiveConnectionHandler(), this.transferInfoEvents);
|
||||||
}
|
|
||||||
|
|
||||||
protected onInitialize() {
|
|
||||||
const path = this.defaultChannelId ? "/" + channelPathPrefix + this.defaultChannelId + "/" : "/";
|
|
||||||
this.remoteBrowseEvents.fire("action_navigate_to", { path: path });
|
this.remoteBrowseEvents.fire("action_navigate_to", { path: path });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected onDestroy() {
|
protected onDestroy() {
|
||||||
this.remoteBrowseEvents.fire("notify_destroy");
|
this.remoteBrowseEvents.fire("notify_destroy");
|
||||||
this.transferInfoEvents.fire("notify_destroy");
|
this.transferInfoEvents.fire("notify_destroy");
|
||||||
|
this.remoteBrowseEvents.destroy();
|
||||||
|
this.transferInfoEvents.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
renderTitle() {
|
renderTitle() {
|
||||||
|
|
Loading…
Reference in New Issue