1.0.0 • Published 4 years ago

excalidraw-share-peer-link v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

Excalidraw share peer link

npm package Coveralls

Excalidraw share peer link is a lib for React 16+, he provide a simple <a> link and function for generate the href to open new tab of Excalidraw with peer session.

Installation

npm

npm install --save excalidraw-share-peer-link

yarn

yarn add excalidraw-share-peer-link

Usage

Just add the Widget component and generate the link with the generateLink function

import React, { useState, useEffect } from 'react';
import ExcalidrawLink, { generateLink } from 'excalidraw-share-peer-link';

function App() {
  const [link, setLink] = useState('');

  useEffect(() => {
    generateLink().then(result => {
      setLink(result);
    })
  }, [])

  return (
      <div className="App">
        <ExcalidrawLink link={link} label="Go to whiteboard" />
      </div>
    );
}

export default App;

You can bypass the complete link generation and import generateRandomID and generateEncryptionKey and insert those in arguments of generateLink for custom id and key.