menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Theia

Eclipse Theia - Cloud & Desktop IDE

Channels
Team

Disable drag-drop of files in project view

April 21, 2020 at 7:56am

Disable drag-drop of files in project view

April 21, 2020 at 7:56am
How can we disable drag-drop feature in project view ? (i.e., the user should not be able to drag-drop any files or folders within project view). Thanks !

April 21, 2020 at 8:27am
What is the project view? The file explorer?
yes, the file explorer. thank you !
You will need to customize FileNavigatorWidget there are different template method to handle drag and drop DOM events.
I hope i need to extend the class FileNavigatorWidget and replace it somehow with MyFileNavigatorWidget? Could you please provide an example ?
Could you kindly review:
one of the extension's xyz-frontend-module.ts
import { createFileNavigatorContainer } from '@theia/navigator/lib/browser/navigator-container';
/**
* container module
*/
export default new ContainerModule((bind, unbind, isBound, rebind) => {
unbind(FileNavigatorWidget);
rebind(TestFileNavigatorWidget).toDynamicValue(ctx =>
createTestFileNavigatorWidget(ctx.container)
);
});
export function createTestFileNavigatorContainer(parent: interfaces.Container): Container {
const container = createFileNavigatorContainer(parent);
container.unbind(FileNavigatorWidget);
container.bind(XpressFileNavigatorWidget).toSelf();
return container;
}
export function createTestFileNavigatorWidget(parent: interfaces.Container): TestFileNavigatorWidget {
return createTestFileNavigatorContainer(parent).get(TestFileNavigatorWidget);
}
Edited
(nit) rebind = unbind + bind