mirror of
https://github.com/devonthesofa/obsidian-note-status.git
synced 2026-07-22 12:30:24 +00:00
chore: partial with bugs
This commit is contained in:
parent
579b95099d
commit
6eab30bc2c
4 changed files with 38 additions and 31 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -20,3 +20,4 @@ data.json
|
|||
|
||||
# Exclude macOS Finder (System Explorer) View States
|
||||
.DS_Store
|
||||
styles.css
|
||||
|
|
|
|||
|
|
@ -299,16 +299,18 @@ export class StatusDropdownComponent {
|
|||
private async removeStatus(status: string): Promise<void> {
|
||||
if (!this.targetFile) return;
|
||||
|
||||
await this.statusService.handleStatusChange({
|
||||
await this.statusService.modifyNoteStatus({
|
||||
files: this.targetFile,
|
||||
statuses: status,
|
||||
allowMultipleStatuses: false, // Queremos eliminar específicamente
|
||||
afterChange: (updatedStatuses) => {
|
||||
this.currentStatuses = updatedStatuses;
|
||||
this.refreshDropdownContent();
|
||||
this.onStatusChange(updatedStatuses);
|
||||
}
|
||||
operation: 'remove',
|
||||
showNotice: false
|
||||
});
|
||||
|
||||
// Get fresh statuses after the change
|
||||
const updatedStatuses = this.statusService.getFileStatuses(this.targetFile);
|
||||
this.currentStatuses = updatedStatuses;
|
||||
this.refreshDropdownContent();
|
||||
this.onStatusChange(updatedStatuses);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -396,7 +398,7 @@ export class StatusDropdownComponent {
|
|||
/**
|
||||
* Handle click on a status option
|
||||
*/
|
||||
private async handleStatusOptionClick(optionEl: HTMLElement, status: Status): void {
|
||||
private handleStatusOptionClick(optionEl: HTMLElement, status: Status): void {
|
||||
optionEl.addClass('note-status-option-selecting');
|
||||
|
||||
setTimeout(async () => {
|
||||
|
|
|
|||
|
|
@ -149,13 +149,17 @@ export class StatusDropdown {
|
|||
* Update a file's status
|
||||
*/
|
||||
private async updateFileStatus(file: TFile, statuses: string[]): Promise<void> {
|
||||
await this.statusService.handleStatusChange({
|
||||
const operation = this.settings.useMultipleStatuses ? 'toggle' : 'set';
|
||||
|
||||
await this.statusService.modifyNoteStatus({
|
||||
files: file,
|
||||
statuses: statuses,
|
||||
afterChange: (updatedStatuses) => {
|
||||
this.notifyStatusChanged(updatedStatuses);
|
||||
}
|
||||
operation: operation,
|
||||
showNotice: false
|
||||
});
|
||||
|
||||
const updatedStatuses = this.statusService.getFileStatuses(file);
|
||||
this.notifyStatusChanged(updatedStatuses);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -125,30 +125,30 @@ export class StatusContextMenu {
|
|||
*/
|
||||
private async handleStatusUpdateForFile(file: TFile, statuses: string[]): Promise<void> {
|
||||
if (!(file instanceof TFile) || file.extension !== 'md' || statuses.length === 0) return;
|
||||
const operation = this.settings.useMultipleStatuses ? 'toggle' : 'set';
|
||||
|
||||
await this.statusService.handleStatusChange({
|
||||
await this.statusService.modifyNoteStatus({
|
||||
files: file,
|
||||
statuses: statuses,
|
||||
afterChange: (updatedStatuses) => {
|
||||
// Force explorer icon update
|
||||
this.app.metadataCache.trigger('changed', file);
|
||||
this.updateExplorerIcon(file);
|
||||
|
||||
// Dispatch events to update other UI components
|
||||
window.dispatchEvent(new CustomEvent('note-status:status-changed', {
|
||||
detail: { statuses: updatedStatuses, file: file.path }
|
||||
}));
|
||||
|
||||
window.dispatchEvent(new CustomEvent('note-status:refresh-ui'));
|
||||
|
||||
// Force a full UI refresh with slight delay
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(new CustomEvent('note-status:force-refresh'));
|
||||
}, 100);
|
||||
}
|
||||
operation: operation,
|
||||
showNotice: false
|
||||
});
|
||||
|
||||
// Get fresh statuses
|
||||
const updatedStatuses = this.statusService.getFileStatuses(file);
|
||||
this.notifyStatusChanged(updatedStatuses);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify that status has changed
|
||||
*/
|
||||
private notifyStatusChanged(statuses: string[]): void {
|
||||
window.dispatchEvent(new CustomEvent('note-status:status-changed', {
|
||||
detail: { statuses }
|
||||
}));
|
||||
window.dispatchEvent(new CustomEvent('note-status:refresh-ui'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update file status based on settings
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue