mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
start adding icons for copying files and folders in the explorer
This commit is contained in:
parent
f96d320ce0
commit
4e392bee8e
2 changed files with 34 additions and 11 deletions
|
|
@ -289,6 +289,7 @@ export interface IFileTemplateData {
|
||||||
readonly templateDisposables: DisposableStore;
|
readonly templateDisposables: DisposableStore;
|
||||||
readonly elementDisposables: DisposableStore;
|
readonly elementDisposables: DisposableStore;
|
||||||
readonly label: IResourceLabel;
|
readonly label: IResourceLabel;
|
||||||
|
readonly voidLabels: IResourceLabel;
|
||||||
readonly container: HTMLElement;
|
readonly container: HTMLElement;
|
||||||
readonly contribs: IExplorerFileContribution[];
|
readonly contribs: IExplorerFileContribution[];
|
||||||
currentContext?: ExplorerItem;
|
currentContext?: ExplorerItem;
|
||||||
|
|
@ -347,15 +348,24 @@ export class FilesRenderer implements ICompressibleTreeRenderer<ExplorerItem, Fu
|
||||||
|
|
||||||
renderTemplate(container: HTMLElement): IFileTemplateData {
|
renderTemplate(container: HTMLElement): IFileTemplateData {
|
||||||
const templateDisposables = new DisposableStore();
|
const templateDisposables = new DisposableStore();
|
||||||
|
|
||||||
|
// Create void buttons container
|
||||||
|
const voidButtonsContainer = DOM.append(container, DOM.$('div'));
|
||||||
|
voidButtonsContainer.style.position = 'absolute'
|
||||||
|
voidButtonsContainer.style.top = '0'
|
||||||
|
voidButtonsContainer.style.right = '0'
|
||||||
|
// const voidButtons = DOM.append(voidButtonsContainer, DOM.$('span'));
|
||||||
|
// voidButtons.textContent = 'voidbuttons'
|
||||||
|
// voidButtons.addEventListener('click', () => {
|
||||||
|
// console.log('ON CLICK', templateData.currentContext?.children)
|
||||||
|
// })
|
||||||
|
const voidLabels = this.labels.create(voidButtonsContainer, { supportHighlights: false, supportIcons: false, });
|
||||||
|
voidLabels.element.textContent = 'hi333'
|
||||||
|
|
||||||
const label = templateDisposables.add(this.labels.create(container, { supportHighlights: true }));
|
const label = templateDisposables.add(this.labels.create(container, { supportHighlights: true }));
|
||||||
templateDisposables.add(label.onDidRender(() => {
|
templateDisposables.add(label.onDidRender(() => {
|
||||||
try {
|
try { if (templateData.currentContext) this.updateWidth(templateData.currentContext); }
|
||||||
if (templateData.currentContext) {
|
catch (e) { /* noop since the element might no longer be in the tree, no update of width necessary*/ }
|
||||||
this.updateWidth(templateData.currentContext);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// noop since the element might no longer be in the tree, no update of width necessary
|
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const contribs = explorerFileContribRegistry.create(this.instantiationService, container, templateDisposables);
|
const contribs = explorerFileContribRegistry.create(this.instantiationService, container, templateDisposables);
|
||||||
|
|
@ -365,10 +375,12 @@ export class FilesRenderer implements ICompressibleTreeRenderer<ExplorerItem, Fu
|
||||||
contr.setResource(templateData.currentContext?.resource);
|
contr.setResource(templateData.currentContext?.resource);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const templateData: IFileTemplateData = { templateDisposables, elementDisposables: templateDisposables.add(new DisposableStore()), label, container, contribs };
|
const templateData: IFileTemplateData = { templateDisposables, elementDisposables: templateDisposables.add(new DisposableStore()), label, voidLabels, container, contribs };
|
||||||
return templateData;
|
return templateData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Void cares about this function, this is where elements in the tree are rendered
|
||||||
renderElement(node: ITreeNode<ExplorerItem, FuzzyScore>, index: number, templateData: IFileTemplateData): void {
|
renderElement(node: ITreeNode<ExplorerItem, FuzzyScore>, index: number, templateData: IFileTemplateData): void {
|
||||||
const stat = node.element;
|
const stat = node.element;
|
||||||
templateData.currentContext = stat;
|
templateData.currentContext = stat;
|
||||||
|
|
@ -382,8 +394,7 @@ export class FilesRenderer implements ICompressibleTreeRenderer<ExplorerItem, Fu
|
||||||
templateData.label.element.style.display = 'flex';
|
templateData.label.element.style.display = 'flex';
|
||||||
this.renderStat(stat, stat.name, undefined, node.filterData, templateData);
|
this.renderStat(stat, stat.name, undefined, node.filterData, templateData);
|
||||||
}
|
}
|
||||||
|
// Input Box (Void - shown only if currently editing - this is the box that appears when user edits the name of the file)
|
||||||
// Input Box
|
|
||||||
else {
|
else {
|
||||||
templateData.label.element.style.display = 'none';
|
templateData.label.element.style.display = 'none';
|
||||||
templateData.contribs.forEach(c => c.setResource(undefined));
|
templateData.contribs.forEach(c => c.setResource(undefined));
|
||||||
|
|
@ -477,6 +488,13 @@ export class FilesRenderer implements ICompressibleTreeRenderer<ExplorerItem, Fu
|
||||||
separator: this.labelService.getSeparator(stat.resource.scheme, stat.resource.authority),
|
separator: this.labelService.getSeparator(stat.resource.scheme, stat.resource.authority),
|
||||||
domId
|
domId
|
||||||
});
|
});
|
||||||
|
|
||||||
|
templateData.voidLabels.setResource({ resource: undefined, name: 'hi', }, {
|
||||||
|
hideIcon: true,
|
||||||
|
extraClasses: realignNestedChildren ? [...extraClasses, 'align-nest-icon-with-parent-icon'] : extraClasses,
|
||||||
|
forceLabel: true,
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderInputBox(container: HTMLElement, stat: ExplorerItem, editableData: IEditableData): IDisposable {
|
private renderInputBox(container: HTMLElement, stat: ExplorerItem, editableData: IEditableData): IDisposable {
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,12 @@ suite('Files - ExplorerView', () => {
|
||||||
label: <any>{
|
label: <any>{
|
||||||
container: label,
|
container: label,
|
||||||
onDidRender: emitter.event
|
onDidRender: emitter.event
|
||||||
}
|
},
|
||||||
|
voidLabels: <any>{
|
||||||
|
container: label,
|
||||||
|
onDidRender: emitter.event
|
||||||
|
},
|
||||||
|
|
||||||
}, 1, false);
|
}, 1, false);
|
||||||
|
|
||||||
ds.add(navigationController);
|
ds.add(navigationController);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue