nbspRemover [Official Support]

AnkiWeb: nbspRemover - AnkiWeb

Automatically removes non-breaking spaces during editing and offers a purge button in the Tools menu to clear the collection.

Reasons for its existence:


After 5 days of use, i gotta say i dont know how i was doing without this before

At least a hundred unintended spaces removed so far. And the first purge was around another hundred :slight_smile: (not that many, because i had done the replace manually a week before :wink: )

Would it be possible to do the purge when leaving the text box instead of while typing? Right now, if it detects one space, it removes it and put you at the end of the textbox, even if you are actively typing in between text

Not sure if it would work if you close the window without exiting the text box

Thanks for considering!

1 Like

Thanks for that report!

editor.loadNoteKeepingFocus() moves the caret to the end - but sadly that call is required so changes made in the backend are reflected in the editing screen. The caret position shift is annoying, so I removed the instantaneus correction altogether. From now on, the add-on will only remove   after clicking on Add. Along with the manual collection purge, this should still suffice.

I might add instant replacements in the future with JS. But that’s really just for fun, it wouldn’t add any benefit other than the satisfaction of more frequent nbsp-kill-notifications.

will that cover normal edit of the card or edits in the browser window? I would like to forget about this forever (not having to click on the remove all nbsp from time time :slight_smile: )

Is there not an losing focus or detroying event for text boxes?

Good point, no it won’t. I’ll see to it in the coming days.

There are hooks like that, but using loadNoteKeepingFocus together with them results in infinite loops.

If you don’t mind that the HTML editor still shows   (even though they’re immediately removed in the backend), then I could add the instant correction back and simply drop that refresh.

If you don’t mind that the HTML editor still shows   (even though they’re immediately removed in the backend), then I could add the instant correction back and simply drop that refresh

Yes, this sounds like the perfect solution tbh :slight_smile:

And just so you know, in its current state it works good enough. Losing focus from time to time is a very small price to pay for not having to deal with nbsp again :wink:

After the update, It doesnt work on the edit or browser window. Only on new cards

Im okay with nbsp while im editing, but id like them to be removed when the field is actually saved. Is it saved every time you type a key?

That’s because I haven’t updated it to reflect this idea yet. The version you got is that one:

You can expect an update today that works in any editor instance, though.

Oh, okay, sorry, since i just got the update right now, i thought i had the latest

No rush or anything!

Thanks again for working on this!

Anki only periodically checks for updates automatically. To get an update immediately after publication, you’ll have to manually check in the add-on screen :slight_smile:

Not immediately, as this would result in unnecessary CPU load. There’s a typing timer of a few hundred ms. If no key is pressed after that time, it saves the content to the database. Anki calls a hook that can be used to alter the field content before it’s saved.

I see, i thought that maybe it was like localc, where you dont save until you exit the cell, which would make it a little easier i guess

Well, no rush! It is doing its job pretty well already! :wink: