📝 Rich text / WYSIWYG editor focus on modularity and extensibility, build on top of Slate framework with beautiful designs and high-level APIs.
- 20+ Editor Features, support list
- Markdown Syntax, support list
- Hot Keys, support list
- Full Screen Edit mode
- Serialize and Deserialize into HTML
- Copy and Paste HTML in Editor
- Support Toolbar
- Support Sidebar
👇 canner-slate-editor is a modulized editor, everything is a npm module! You could 100% compose to your personal usage!
Since this project is originally started from Canner, we notice that there is NO SINGLE editor is going to fit in all varieties of requirements, so we think the only way to solve this issue is to design a modular-first editor.
There are many other rich text and WYSIWYG editors online, but as slate - why section mentioned that most of these solutions are
- Not small and reusable
- Hardcoded and hard to customize
- Re-inventing the view layer seemed inefficient and limiting
- ...
Hence, this repository will try to keep all the advantages slate framework provides and create a more high level APIs for developers could also easily reuse and customize their own version of editor. Also we are always welcome to all kinds of contributions! 🙌
This project is using Antd as our primiary UI library.
Why
- Complete React UI solutions.
- Easy to customize styles: https://ant.design/docs/react/customize-theme
- Build-in i18n: https://ant.design/docs/react/i18n
One of the downside of using it, is it will increase your bundle size. see here for solution
You will need to add css
and less
test rules in your webpack setting.
...
rules: [
{
test: /\.js$/,
use: {
loader: "babel-loader"
},
exclude: /node_modules/
},
{
test: /\.css$/,
use: [
{
loader: "style-loader"
},
{
loader: "css-loader"
}
]
},
{
test: /\.less$/,
use: [
{
loader: "style-loader"
},
{
loader: "css-loader"
},
{
loader: "less-loader"
}
]
}
]
...
This projects currently contains over 47+ npm modules, every features are packaged into npm modules, such as icons, helpers, plugins, utils, etc..., so this enable developers to pick modules to assemble into your own usages.
Another rich text editor using Slate framework, with beautiful design
$ npm install --save canner-slate-editor
You will also need to install
$ npm install antd slate slate-react
- Learn more canner-slate-editor
- Demo
A markdown editor, that allows you to edit live with hot keys support!
$ npm install --save slate-md-editor
You will also need to install
$ npm install antd slate slate-react
- Learn more slate-md-editor
- Demo
20+ shared slate icons and helpers for Slate editors.
Supported features:
- Align - @canner/slate-icon-align - center, left, right
- Blockquote - @canner/slate-icon-blockquote
- Bold - @canner/slate-icon-bold
- Clean - @canner/slate-icon-clean
- Code - @canner/slate-icon-code
- CodeBlock - @canner/slate-icon-codeblock
- Emoji - @canner/slate-icon-emoji
- Font background color - @canner/slate-icon-fontbgcolor
- Font color - @canner/slate-icon-fontcolor
- Hr - @canner/slate-icon-hr
- Header - @canner/slate-icon-header - header 1, header 2, header 3, header 4, header 5, header 6
- Image - @canner/slate-icon-image
- Indent - @canner/slate-icon-indent - indent, outdent
- Italic - @canner/slate-icon-italic
- Link - @canner/slate-icon-link
- List - @canner/slate-icon-list - Ol list, Ul list
- Strike through - @canner/slate-icon-strikethrough
- Underline - @canner/slate-icon-underline
- Undo - @canner/slate-icon-undo
- Redo - @canner/slate-icon-redo
- Video - @canner/slate-icon-video
- Table - @canner/slate-icon-table
👉 Learn more slate-icons
shared slate selectors for Slate editors.
Supported selectors:
- Font size - @canner/slate-select-fontsize
- Line height - @canner/slate-select-lineheight
- Letter spacing - @canner/slate-letterspacing
👉 Learn more slate-selectors
Icons extract from quill editor with React component wrapper, support 65+ icons!
$ npm install --save quill-icons
- Learn more quill-icons
- Complete list
A set of slate plugins.
A set of changes and utility functions for Slate editors
A set of editor utility components.
Share constants through repos.
👉 Learn more slate-constant
We are using yarn
workspace to manage all repos, learn more about Yarn workspace
To install packages
yarn
See demos
npm start
You need to build js files through babel by entering
yarn run build:watch
yarn jest <...path/to/pkg> [--coverage]
Slate
is a well-designed powerful editor framework that helps you deal with difficult parts when building an editor, such as data modeling, updating states, rendering, editor schemas, serializing... (you could learn more here), while you are trying to build your own editors, it still need a lot of efforts to build a simple beautiful editor up and running with the framework.
This repository aims to provide complete editors and plugins solutions that allows you to use it right away, instead of digging through slate documentations and using our high-level components you could almost build editors without any slate framework knowledge to use.
canner-slate-editor
is using an awesome React library called Ant Design, the library provides many commonly used React components such as Tooltip, Table, Modal, etc... which is widely used in rendering our editors. One of the downside of using the library is it's bundle size. If you are trying to tackle size issue, we recommend following solutions:
- At Canner, our solution is to external antd in your bundler, and use CDN instead.
- Use modularized antd to reduce your bundle size.