@deskpro/product-content-editor
v3.2.11-alpha.0
Published
Custom DeskPro editors built with @deskpro/react-content-editor.
Downloads
94
Readme
This package contains specific editor implementations built with sane defaults for use internally within Deskpro.
Usage
Installation
Install the react package with npm/yarn:
npm install --save @deskpro/content-editor
Overview
Currently, only the KB Editor has been developed for integration. It mainly serves just as a simple wrapper to encapsulate all the options and features needed for KB Article editing.
You can use the editor directly from the package:
import { useRef } from 'react';
import { ArticleEditor } from '@deskpro/product-content-editor';
function KBEditorComponent(props) {
const ref = useRef(null);
const saveChanges = () => {
const editor = ref.current.editor;
if (editor) {
const html = editor.getHTML();
// call external web service
// or pass contents upstream
}
}
return (
<>
<button onClick={saveChanges}>Save Changes<button>
<ArticleEditor ref={ref} />
</>
);
}
Development
As this is part of a monorepo, make sure you have installed all dependencies through Lerna on the root folder:
lerna bootstrap --hoist
You can start the typescript watcher locally on this package using:
npm run watch