Mailspring/docs/getting-started.md
Ben Gotow 1e8fd46342 fix(drafts): Various improvements and fixes to drafts, draft state management
Summary:
This diff contains a few major changes:

1. Scribe is no longer used for the text editor. It's just a plain contenteditable region. The toolbar items (bold, italic, underline) still work. Scribe was causing React inconcistency issues in the following scenario:
   - View thread with draft, edit draft
   - Move to another thread
   - Move back to thread with draft
   - Move to another thread. Notice that one or more messages from thread with draft are still there.

There may be a way to fix this, but I tried for hours and there are Github Issues open on it's repository asking for React compatibility, so it may be fixed soon. For now contenteditable is working great.

2. Action.saveDraft() is no longer debounced in the DraftStore. Instead, firing that action causes the save to happen immediately, and the DraftStoreProxy has a new "DraftChangeSet" class which is responsbile for batching saves as the user interacts with the ComposerView. There are a couple big wins here:

   - In the future, we may want to be able to call Action.saveDraft() in other situations and it should behave like a normal action. We may also want to expose the DraftStoreProxy as an easy way of backing interactive draft UI.

   - Previously, when you added a contact to To/CC/BCC, this happened:

     <input> -> Action.saveDraft -> (delay!!) -> Database -> DraftStore -> DraftStoreProxy -> View Updates

Increasing the delay to something reasonable like 200msec meant there was 200msec of lag before you saw the new view state.

To fix this, I created a new class called DraftChangeSet which is responsible for accumulating changes as they're made and firing Action.saveDraft. "Adding" a change to the change set also causes the Draft provided by the DraftStoreProxy to change immediately (the changes are a temporary layer on top of the database object). This means no delay while changes are being applied. There's a better explanation in the source!

This diff includes a few minor fixes as well:

1. Draft.state is gone—use Message.object = draft instead
2. String model attributes should never be null
3. Pre-send checks that can cancel draft send
4. Put the entire curl history and task queue into feedback reports
5. Cache localIds for extra speed
6. Move us up to latest React

Test Plan: No new tests - once we lock down this new design I'll write tests for the DraftChangeSet

Reviewers: evan

Reviewed By: evan

Differential Revision: https://review.inboxapp.com/D1125
2015-02-03 16:24:31 -08:00

4.5 KiB

Getting Started

Welcome to Atom! This guide provides a quick introduction so you can be productive as quickly as possible. There are also guides which cover configuring, theming, and extending Atom.

The Command Palette

If there's one key-command you remember in Atom, it should be cmd-shift-P. You can always press cmd-shift-P to bring up a list of commands (and key bindings) that are relevant to the currently focused interface element. This is a great way to explore the system and learn key bindings interactively. For information about adding or changing a key binding refer to the customizing key bindings section.

Command Palette

The Basics

Working With Files

Atom windows are scoped to a single directory on disk. If you launch Atom from the command line via the atom command and don't specify a path, Atom opens a window for the current working directory. The current window's directory will be visible as the root of the tree view on the left, and also serve as the context for all file-related operations.

Finding Files

The fastest way to find a file is to use the fuzzy finder. Press cmd-t and begin typing the name of the file you're looking for. If you are looking for a file that is already open press cmd-b to bring up a searchable list of open files. If you are using Git you can use cmd-shift-b to search the list of files modified and untracked in your project's repository.

You can also use the tree view to navigate to a file. To open and focus the tree view, press ctrl-0. The tree view can be toggled open and closed with cmd-\.

Adding, Moving, Deleting Files

You can add, move, and delete files and folders by right-clicking them in the tree view and selecting the desired operation from the context menu. You can also perform these operations from the keyboard by selecting a file or folder and using a to add, m to move, and delete to delete.

Searching

Find and Replace

To search within a buffer use cmd-f. To search the entire project use cmd-shift-f.

Navigating By Symbols

To jump to a symbol such as a method definition, press cmd-r. This opens a list of all symbols in the current file, which you can fuzzy filter similarly to cmd-t.

To search for symbols across your project, use cmd-shift-r. First you'll need to make sure you have tags (or TAGS) file generated for your project. This can be done by installing ctags and running a command such as ctags -R src/ from the command line in your project's root directory. Using Homebrew? Just run brew install ctags.

You can customize how tags are generated by creating your own .ctags file in your home directory (~/.ctags). Here is a good example to start from.

Split Panes

You can split any editor pane horizontally or vertically by using cmd-k right or cmd-k down. Once you have a split pane, you can move focus between them with cmd-k cmd-right or cmd-k cmd-down. To close a pane, close all its editors with cmd-w, then press cmd-w one more time to close the pane. You can configure panes to auto-close when empty in the Settings view.

Folding

You can fold blocks of code by clicking the arrows that appear when you hover your mouse cursor over the gutter. You can also fold and unfold from the keyboard with alt-cmd-[ and alt-cmd-]. To fold everything, use alt-cmd-shift-{ and to unfold everything use alt-cmd-shift-}. You can also fold at a specific indentation level with cmd-k cmd-N where N is the indentation depth.

Soft-Wrap

If you want to toggle soft wrap, trigger the command from the command palette. Press cmd-shift-P to open the palette, then type "wrap" to find the correct command. By default, lines will wrap based on the size of the editor. If you prefer to wrap at a specific line length, toggle "Wrap at preferred line length" in preferences.

Configuration

Press cmd-, to open the Settings view. This is the place to change settings, install packages, and change the theme.

For more advanced configuration see the customization guide.