Bespin Developer's Guide

Code Tour

Taking It From The Top

At the highest level, there are two separate projects that make up the whole of the Bespin codebase:

Most people hacking on Bespin will never need to do anything inside of the bespinserver project.

Inside bespinclient

In a fresh bespinclient checkout, there are four top-level directories of note:

When things are fully set up, there are also some other directories of interest:

There are a couple of directories that are not interesting:

Frameworks

Inside bespin

If you look in the frameworks/bespin directory, you will see the JavaScript code for the editor, and a Buildfile. The Buildfile provides instructions to SproutCore's Abbot build system.

There are four categories of code in bespin:

  1. bespin:* - infrastructure code, such as bespin/plugins, which is required for the editor to work
  2. bespin:util - utility code that is not necessarily Bespin-specific but is also required for the editor
  3. bespin:editor - this is where all of the code that is specific to the Bespin text editor lives
  4. bespin:tests - unit test suites

bespin:embed notably provides the useBespin function, which is how the embedded editor gets dropped into pages.

bespin:editor/controller is the controller in the "model/view/controller" sense. It provides the main API for managing the text editor control and for connecting the data with the view.

bespin:editor/views/editor.js provides the visible editor component. It is responsible for drawing on the canvas and for managing events that come in.