Aa 0.14.1

Plain text

createPlainEditor(host, options) is one block of plain text, for a name, a title or a short specimen where a document would be too much. It has Aa’s selection and takes the surrounding type, and nothing else.

import { createPlainEditor } from '@0001-labs/aa'const field = createPlainEditor(host, {  value: 'A title',  onChange: text => save(text),})
  • One block. The browser edits it as plain text: lines, the clipboard, composition and undo are all the browser’s.
  • No Markdown. What is typed is what is stored. There is no toolbar, no menus, no atoms and no document model.
  • The page’s type. It inherits the font, size and colour around it.
  • Aa’s selection. The selection is drawn with the same rounded corners as the editor’s.

Use createEditor for anything that is a document.

OptionDefaultWhat it does
valuethe host’s textThe text it starts with
readOnlyfalseThe text can be read and selected, not changed
onChangenoneCalled with the text after each change
MemberWhat it does
valueThe text; set it to change it
readOnlyWhether it can be changed
focus()Puts the caret in it
destroy()Releases its listeners
elementThe host