1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Chore: Remove unused NoteTypeToggle event (#10521)

This commit is contained in:
Henry Heino 2024-05-30 00:31:54 -07:00 committed by GitHub
parent 59b26f2c63
commit 789d19b18c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 16 deletions

View File

@ -1,7 +1,6 @@
import { CommandRuntime, CommandDeclaration, CommandContext } from '@joplin/lib/services/CommandService';
import { _ } from '@joplin/lib/locale';
import Note from '@joplin/lib/models/Note';
import eventManager, { EventName } from '@joplin/lib/eventManager';
export const declaration: CommandDeclaration = {
name: 'toggleNoteType',
@ -15,14 +14,7 @@ export const runtime = (): CommandRuntime => {
for (let i = 0; i < noteIds.length; i++) {
const note = await Note.load(noteIds[i]);
const newNote = await Note.save(Note.toggleIsTodo(note), { userSideValidation: true });
const eventNote = {
id: newNote.id,
is_todo: newNote.is_todo,
todo_due: newNote.todo_due,
todo_completed: newNote.todo_completed,
};
eventManager.emit(EventName.NoteTypeToggle, { noteId: note.id, note: eventNote });
await Note.save(Note.toggleIsTodo(note), { userSideValidation: true });
}
},
enabledCondition: '!noteIsReadOnly',

View File

@ -1,6 +1,5 @@
import { utils as pluginUtils, PluginStates } from '@joplin/lib/services/plugins/reducer';
import CommandService from '@joplin/lib/services/CommandService';
import eventManager, { EventName } from '@joplin/lib/eventManager';
import InteropService from '@joplin/lib/services/interop/InteropService';
import MenuUtils from '@joplin/lib/services/commands/MenuUtils';
import InteropServiceHelper from '../../InteropServiceHelper';
@ -77,8 +76,7 @@ export default class NoteListUtils {
const note = await Note.load(noteIds[i]);
const newNote = Note.changeNoteType(note, type);
if (newNote === note) continue;
const savedNote = await Note.save(newNote, { userSideValidation: true });
eventManager.emit(EventName.NoteTypeToggle, { noteId: note.id, note: savedNote });
await Note.save(newNote, { userSideValidation: true });
}
};

View File

@ -9,7 +9,6 @@ export enum EventName {
ResourceChange = 'resourceChange',
SettingsChange = 'settingsChange',
TodoToggle = 'todoToggle',
NoteTypeToggle = 'noteTypeToggle',
SyncStart = 'syncStart',
SessionEstablished = 'sessionEstablished',
SyncComplete = 'syncComplete',
@ -48,7 +47,7 @@ interface SettingsChangeEvent {
keys: string[];
}
interface NoteChangeEvent {
interface AlarmChangeEvent {
noteId: string;
note: NoteEntity;
}
@ -58,13 +57,12 @@ type EventArgs = {
[EventName.ResourceChange]: [ResourceChangeEvent];
[EventName.SettingsChange]: [SettingsChangeEvent];
[EventName.TodoToggle]: [];
[EventName.NoteTypeToggle]: [NoteChangeEvent];
[EventName.SyncStart]: [];
[EventName.SessionEstablished]: [];
[EventName.SyncComplete]: [SyncCompleteEvent];
[EventName.ItemChange]: [ItemChangeEvent];
[EventName.NoteAlarmTrigger]: [NoteAlarmTriggerEvent];
[EventName.AlarmChange]: [NoteChangeEvent];
[EventName.AlarmChange]: [AlarmChangeEvent];
[EventName.KeymapChange]: [];
[EventName.NoteContentChange]: [NoteContentChangeEvent];
[EventName.OcrServiceResourcesProcessed]: [];