1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Plugins: Only call onNoteChange for the current note

Otherwise it could mean hundreds of updates when notes are being imported
or during sync.
This commit is contained in:
Laurent Cozic
2021-02-07 15:29:36 +00:00
parent 3ed19ba9f6
commit 26bce33e98
3 changed files with 4 additions and 230 deletions

View File

@ -76,11 +76,12 @@ export default class JoplinWorkspace {
}
/**
* Called when the content of a note changes.
* Called when the content of the current note changes.
*/
public async onNoteChange(handler: ItemChangeHandler): Promise<Disposable> {
const wrapperHandler = (event: any) => {
if (event.itemType !== ModelType.Note) return;
if (!this.store.getState().selectedNoteIds.includes(event.itemId)) return;
handler({
id: event.itemId,