Skip to content

Configuration ​

This page describes @likhaeditor/likhaeditor 0.0.3 on npm. See release status for pre-1.0 limits and roadmap items.

js
const instance = createEditor({
  element: '#editor',
  content: '<p>Initial content</p>',
  placeholder: 'Start writing…',
  editable: true,
  toolbar: true,
  toolbarButtons: ['heading', 'bold', 'italic', 'link', 'table', 'tableControls', 'find'],
  darkTheme: false,
  onChange: html => console.log(html)
});
OptionBehavior
elementRequired HTMLElement or CSS selector
contentInitial HTML; defaults to an empty paragraph
placeholderPer-editor placeholder text
editableUser input enabled by default
toolbarEnabled by default; false hides the toolbar
toolbarContainerOptional existing element or selector; missing targets throw
toolbarButtonsButton-name array or 'all'; controls for missing plugins are hidden
pluginsArray of built-in plugin names; omitted loads defaults, [] loads none
darkThemeAdds the editor-local dark theme class; load the distributed CSS
onChangeSynchronous callback for document changes; selection changes do not invoke it
autosaveOptional application-owned persistence adapter
imageUploadOptional application-owned file upload adapter
commentsOptional reviewer identity, stored annotations, and metadata callback
versionsOptional version snapshot store
js
instance.getContent();
instance.setContent('<p>Updated content</p>');
instance.getText();
instance.getJSON();
instance.setEditable(false);
instance.destroy();

Read-only mode prevents user input; programmatic commands remain available. Always destroy an instance when its component unmounts. See professional editing for storage adapters, comments, tables, and import/export.