1.7.0 • Published 6 days ago
@nance/nance-editor v1.7.0
Install
yarn add @nance/nance-editor
or
npm install @nance/nance-editor
Usage
import { MarkdownEditor } from '@nance/nance-editor';
import "@nance/nance-editor/lib/editor.css";
function App() {
return (
<div className="App">
<p>NANCE-EDITOR DEMO</p>
<MarkdownEditor
onEditorChange={(md) => console.log(md)}
/>
</div>
);
}
export default App;
Optionally, pass in IPFS gateway and Infura projectId and projectSecret as props to the MarkdownEditor component. This allows the editor to upload images that are dropped into editor or ctrl-v'ed and .pdf's that are dropped into the editor to your IPFS gateway.
import { MarkdownEditor } from "@nance/nance-editor";
import "@nance/nance-editor/lib/editor.css";
function App() {
const fileUploadIPFS = {
gateway: "https://ipfs.io/ipfs/",
projectId: "yourInfuraProjectId",
projectSecret: "yourInfuraProjectSecret"
};
return (
<div className="App">
<p>NANCE-EDITOR DEMO</p>
<MarkdownEditor fileUploadIPFS={fileUploadIPFS}/>
</div>
);
}
export default App;
see uploadBlob.ts for more details on upload to IPFS
and dropHandler.ts for more details on handling file drops
Development
yarn build
bundled by rollup
see rollup.config.js