Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/editors/slate/elements/blockquote.tsx
1700 views
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { mark_block } from "../util";
7
import { register, SlateElement } from "./register";
8
9
export interface BlockQuote extends SlateElement {
10
type: "blockquote";
11
}
12
13
const Element = ({ attributes, children }) => {
14
return <blockquote {...attributes}>{children}</blockquote>;
15
};
16
17
register({
18
slateType: "blockquote",
19
20
fromSlate: ({ children }) => mark_block(children, ">"),
21
22
Element,
23
StaticElement: Element,
24
25
toSlate: ({ type, children }) => {
26
return { type, children };
27
},
28
29
rules: {
30
autoFocus: true,
31
autoAdvance: false,
32
},
33
});
34
35