forked from SparkDevNetwork/Rock
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathquote.ts
More file actions
28 lines (26 loc) · 873 Bytes
/
quote.ts
File metadata and controls
28 lines (26 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import EditorQuote, { QuoteData } from "@editorjs/quote"
/**
* Custom implementation of the Quote block to deny line breaks.
*/
export class Quote extends EditorQuote {
/**
* Do not allow to press Enter inside the Quote. They are meant to be single
* paragraphs. Default implementation had weird rendering bugs if this was
* enabled.
*
* @returns true if line breaks should be allowed, false otherwise.
*/
static get enableLineBreaks() {
return false;
}
/**
* Checks if the block's save data should be included in the structured
* content stream.
*
* @param savedData The data that was returned by the save method.
* @returns true if the block's contents should be included in the save data.
*/
public validate(savedData: QuoteData) {
return savedData.text !== "";
}
}