Wiki doesn't allow concurrent edits

When two or more people edit a page at the same time it will only apply the changes that were sent last, the other changes get overwritten completely.

I don’t see a way to fix this without rewriting it completely (I’m guessing here).
Maybe add a warning that the page changed/is being edited?
Also would be nice to have a way to save drafts, as of now I’m saving stuff in a notepad.

One possible solution would be to disallow changes when the page was changed while you edit it. So when you press confirm an error will appear. You then could copy your changes, reload and then compare your changes with the new version.

This is how MediaWiki/Wikipedia does it