New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@react-fluent-edit/core

Package Overview
Dependencies
Maintainers
1
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-fluent-edit/core

Slate based editor powered by plugins

  • 1.0.2-next.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
58
decreased by-45.28%
Maintainers
1
Weekly downloads
 
Created
Source

@react-fluent-edit/core

This package includes the core editor component and tools to create plugins.

Installation

Install the package in your project directory with:

// with npm
npm install @react-fluent-edit/core

// with yarn
yarn add @react-fluent-edit/core

API

FluentEdit

import {
  FluentEdit,
  FluentEditProps,
  FluentEditProvider,
} from "@react-fluent-edit/core";

return (
  <FluentEdit 
    singleLine={false}
    markdown={true}
    autoFocus={true}
    placeholder=""
    initialValue=""
    onChange={value => console.log(value)}
    plugins={[...]}
  />
);

Plugin

import { Plugin } from "@react-fluent-edit"

const plugin: Plugin = {
  name: "mentions",
  leaves: [
    { 
      match: ({ leaf }) => ["bold", "italic", "underline"]
        .some(prop => leaf[prop]), 
      component: Leaf,
    }
  ],
  elements: [
    { 
      match: ({ element: { type } }) => ["list", "heading"]
        .some(item => type === item), 
      component: Element,
    }
  ],
  overrides: [{ handler: (editor) => withRichText(editor) }],
  beforeSerialize: {
    handler: (nodes) => replaceTextNodesWithRichTextNodes(nodes),
  },
  afterDeserialize: {
    handler: (nodes) => replaceRichTextNodesWithTextNodes(nodes),
  },
  handlers: {
    onClick: (event, editor) => { ... }
  }
  options,
}

useFluentEdit hook

import { useFluentEdit } from "@react-fluent-edit"

const { editor, focusEditor } = useFluentEdit()

FAQs

Package last updated on 15 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc