@astl/editor
v0.8.0
Published
Editor-agnostic authoring kit: templates, ids, inspector, issues, insert menu and preview over an EditorAdapter. Bring any WYSIWYG editor.
Maintainers
Readme
@astl/editor
Editor-agnostic authoring kit: templates, ids, inspector, issues, insert menu and preview over an EditorAdapter. Bring any WYSIWYG editor.
Install
npm install @astl/editor @astl/engine @astl/componentsUse
import { builtInDefinitions } from '@astl/components/definitions';
import { builtInEditors } from '@astl/components/editors';
import { builtInElements } from '@astl/components/elements';
import { createAuthoring, createTextareaAdapter, defineAuthoringElements } from '@astl/editor';
import { createEngine } from '@astl/engine';
const engine = createEngine({ components: builtInDefinitions, secret: 'editor-preview-only-key' });
const authoring = createAuthoring({ engine, descriptors: builtInEditors, elements: builtInElements, locale: 'en' });
defineAuthoringElements(); // nothing is defined on import
const adapter = createTextareaAdapter(document.querySelector<HTMLTextAreaElement>('#source')!);
for (const el of document.querySelectorAll('astl-toolbar, astl-insert-menu, astl-inspector, astl-issues, astl-preview')) {
Object.assign(el, { authoring, adapter });
}Your own editor plugs in through an EditorAdapter; the textarea adapter above is the smallest one.
This package or @astl/astrolabe
For a ready editor, use <astl-editor> from @astl/astrolabe/editor or @astl/editor-tiptap. Pick @astl/editor
to put the kit around a WYSIWYG editor of your own.
Documentation: https://astrolabe.starship.education/reference/authoring-kit/ and https://astrolabe.starship.education/guides/any-editor/
License
Apache-2.0, see LICENSE.
