Skip to content

Commit

Permalink
feat: tab/untab list
Browse files Browse the repository at this point in the history
  • Loading branch information
afeiship committed Feb 4, 2021
1 parent fa69282 commit 5176ce7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
16 changes: 15 additions & 1 deletion public/assets/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,21 @@
font-size: 14px;
}

blockquote{
ol,
ul {
li {
margin-left: 14px;
}
}

ul{
list-style: circle;
ul{
margin-left: 14px;
}
}

blockquote {
border-left: 3px solid #ccc;
padding: 10px;
background: #eee;
Expand Down
5 changes: 4 additions & 1 deletion public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ class App extends React.Component {

constructor(inProps) {
super(inProps);
this.state = { value: '<p>hello world</p>' };
this.state = {
value:
'<blockquote>hello world</blockquote><p>Are you ok?</p><ul><li>thanks</li><li>and you?</li></ul>'
};
}

handleClick1 = (e) => {
Expand Down
14 changes: 14 additions & 0 deletions public/plugins/bulleted-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ import { jsx } from 'slate-hyperscript';
* Active:
* Transforms.setNodes(editor, { type:'list-item' })
* Transforms.wrapNodes(editor, { type: 'bulleted-list', children: [] })
*
* https://github.com/GitbookIO/slate-edit-list
* https://gitbookio.github.io/slate-edit-list/
*
* indent: 缩进一个单位
Transforms.wrapNodes(editor, { type: 'bulleted-list', children: [] })
Transforms.setNodes(editor, { type:'list-item' })
* dedent: 反向缩进一个单位
Transforms.unwrapNodes(editor, {
match: n => n.type === 'bulleted-list' || n.type === 'numbered-list' ,
split: true,
})
*/

export default {
Expand Down

0 comments on commit 5176ce7

Please sign in to comment.