Coder Social home page Coder Social logo

3mcd / remirror Goto Github PK

View Code? Open in Web Editor NEW

This project forked from remirror/remirror

0.0 1.0 0.0 31.91 MB

Your fave, multi-framework ProseMirror toolkit 馃帀

Home Page: https://remirror.io

License: MIT License

JavaScript 3.16% TypeScript 93.28% CSS 3.51% Dockerfile 0.06%

remirror's Introduction

animated remirror logo

A toolkit for building cross-platform text editors
in the framework of your choice.


MotivationStatusDocumentationPlaygroundContributing


Bundled sized of core library Continuous integration badge for automatic releases Continuous integration badge for docs deployment Project maintainability provided by CodeClimate Unit test coverage for the codebase Discord


Motivation

remirror was started as a personal challenge. Would it be possible to build an editor that combined great performance with ease of use? It was also important to give users of all frameworks, the ability to build an editor by picking and choosing their desired building blocks.

In order to meet these goals, ProseMirror was picked as the best choice for the core editor layer. The second decision was to base the structure of the editor on blocks of functionality called Extensions. Each extension would be designed to fulfil a specific purpose in the editor. Due to this structure, users would be able to craft a fully custom implementation.

In the next version of remirror, some of these initial goals are starting to be met. Every single part of the editor is controlled by extensions. For example, the core (Schema) is managed by a built-in extension. This means that the editor you choose to build is completely customizable.

The API has also improved a lot. Multi-framework support is now possible. Currently there is support for React and the DOM with support being added for Preact in the next few weeks and Svelte after that.

There are also a host of drop in components and hooks being developed. For example to add a drop down emoji picker to your react editor the following code is all you need.

import React from 'react';
import { SocialEmojiComponent, SocialProvider } from 'remirror/react/social';

const Editor = () => {
  return (
    <SocialProvider>
      <SocialEmojiComponent />
    </SocialProvider>
  );
};

With this small snippet your editor now supports some complex UI Functionality. And it's all customisable with ordinary css. If you prefer CSS-in-JS the styles are also available with emotion and styled-components.

There's so much more to come and I'm glad you're taking a look. I hope remirror proves to be everything you need for your next text editor project.


Status

This is the next version of remirror. It is undergoing heavy development at the moment and documentation is still being rewritten to capture the updated API.

While exploring this project, if you find errors or would like to suggest improvements there are several options.

  • Open an issue in our github repo.
  • Join our discord server and discuss the problem with our community.
  • Create a pull request with your proposed improvement by clicking the edit button on the relevant page.
  • Move on, because deadlines are looming and life is too short.

Whatever you decide thanks for taking the time to explore the remirror project.


Documentation

View our documentation website here.


Features

  • A11y focused and ARIA compatible.
  • I18n support via lingui.
  • Collaborative editing with yjs.
  • Prebuilt editors social and wysiwyg and a markdown option is coming soon.
  • 30+ extensions and 8 presets available to create your very own editor.
  • Zero configuration support for Server Side Rendering (SSR).
  • Cross platform and cross-framework, with an Angular solution coming later this year.

Prerequisites


Getting Started

To add an editor to your codebase, first install the required dependencies. Make sure to include the @next tag so that the correct version is installed.

# yarn
yarn add remirror@next @remirror/pm@next

# pnpm
pnpm add remirror@next @remirror/pm@next

# npm
npm install remirror@next @remirror/pm@next

@remirror/pm is a peer dependency which manages all the ProseMirror packages for you. It means that the conflicts which can sometimes happen between versions are no longer an issue. It's also important because it's quite easy to bundle multiple versions of the same library in your codebase.

Usage

Once installed you will be able to add the following code which creates an editor with the bold extension active. Clicking the button when text is selected will toggle between bold.

import React, { useCallback } from 'react';
import { BoldExtension } from 'remirror/extension/bold';
import { RemirrorProvider, useManager, useRemirror } from 'remirror/react';

const Button = () => {
  // `autoUpdate` means that every editor update will recalculate the output
  // from `active.bold()` and keep the bold status up to date in the editor.
  const { active, commands } = useRemirror({ autoUpdate: true });

  return (
    <>
      <button
        onClick={() => commands.toggleBold()}
        style={{ fontWeight: active.bold() ? 'bold' : undefined }}
      >
        Bold
      </button>
    </>
  );
};

const Editor = () => {
  // The `getRootProps` adds the ref to the div element below to inject the
  // ProseMirror dom. You have full control over where it should be placed.
  // The first call is the one that is used.
  const { getRootProps } = useRemirror();

  return <div {...getRootProps()} />;
};

const EditorWrapper = () => {
  const manager = useManager(() => [new BoldExtension()]);

  // The editor is built up like lego blocks of functionality within the editor
  // provider.
  return (
    <RemirrorProvider manager={manager}>
      <Editor />
      <Button />
    </RemirrorProvider>
  );
};

Contributing

Please read our contribution guide for details on our code of conduct, and the process for submitting pull requests. It also outlines the project structure so you can find help when navigating your way around the codebase.

In addition each folder in this codebase includes a readme describing why it exists.

You might also notice there are surprisingly few files in the root directory of this project. All the configuration files have been moved to the support/root directory and are symlinked to the root directory in a preinstall hook. For more information take a look at folder and readme.

Finally you can keep track on what's being worked on via the projects.


Versioning

This project uses SemVer for versioning. For the versions available, see the tags on this repository.


License

This project is licensed under the MIT License - see the LICENSE file for details

remirror's People

Contributors

ifiokjr avatar benjie avatar github-actions[bot] avatar ocavue avatar ronnyroeller avatar ankon avatar allcontributors[bot] avatar aarongreenlee avatar hcharley avatar renovate-bot avatar tomas-c avatar bertg avatar hennessyevan avatar stefkors avatar lanyusan avatar domq avatar bart-kneepkens avatar zhaoyao91 avatar splitinfinities avatar jashmenn avatar juanpicado avatar lightpohl avatar hboylan avatar ffloriel avatar emilschutte avatar aried3r avatar anotheri avatar enalmada avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.