Source from https://github.com/simon-thorpe/editor