Skip to content

iAmShakil/slate-js-top-level-nodes-limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

slate-js-top-level-nodes-limiter

A Slate plugin to run a callback function on every change when the specified limit for the top level nodes is reached. The callback functions are provided the change object as an argument when invoked.

import topNodesLimiter from 'slate-js-top-level-nodes-limiter'
import { Editor } from 'slate-react'

const overLimitCb = (change) => {
    // do something    
}
const inLimitCb = (change) => {
    // do something
}
// Add the plugin to your set of plugins...
const plugins = [
    topNodesLimiter({limit: 5}, overLimitCb, inLimitCb)
]

// And later pass it into the Slate editor...
<Editor
  ...
  plugins={plugins}
/>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published