0.1.0 • Published 2 years ago

@yfs/react v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

YFS

Synchronize text files between the browser and the file system using the File System Access API and Yjs.

Installation

To get started, install the @yfs/react package via npm or yarn:

# npm
npm install @yfs/react

# Yarn
yarn add @yfs/react

Usage

Example:

import React, { useState } from 'react'
import * as Y from 'yjs'
import useYFS from '@yfs/react'

function Editor () {
  const { setRootDirectory, directoryName, syncDoc } = useYFS()
  const [doc] = useState<Y.Doc>(new Y.Doc())

  return (
    <div>
      <button
        onClick={() => {
          if (!directoryName) {
            setRootDirectory(true)
          } else {
            syncDoc('my-file.md', doc)
          }
        }}
      >
        Sync
      </button>
      {/* Editor code... */}
    </div>
  )
}

Authors

This library is created by the team behind Motif (@motifland).

It is based on the great work by Kevin Jahns on Yjs.

License

MIT

0.1.0

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago