feat: editor language menu, title field, header actions, publish dialogs, read-only rendering and draft recovery
This commit is contained in:
1 parent
a671b81f80
commit
339e646eb8
85 files changed
+6369
-624
No files matched your search
@@ -0,0 +1,20 @@
|
||||
export const TITLE_MIN = 3
|
||||
export const TITLE_MAX = 200
|
||||
export const TITLE_SERVER_MESSAGE = 'Article title must be between 3 and 200 characters.'
|
||||
|
||||
export type TitleVerdict = 'ok' | 'empty' | 'short' | 'long'
|
||||
|
||||
export function titleLength(title: string) {
|
||||
return Array.from(title).length
|
||||
}
|
||||
|
||||
export function titleVerdict(title: string): TitleVerdict {
|
||||
const length = titleLength(title)
|
||||
if (length === 0) {
|
||||
return 'empty'
|
||||
}
|
||||
if (length < TITLE_MIN) {
|
||||
return 'short'
|
||||
}
|
||||
return length > TITLE_MAX ? 'long' : 'ok'
|
||||
}
|
||||
Reference in new issue
Block a user