mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Update wordsCount in page
This commit is contained in:
parent
16524a8b59
commit
97e560c443
1 changed files with 5 additions and 0 deletions
|
|
@ -94,6 +94,7 @@ import {
|
|||
updatePage,
|
||||
} from '../../elastic/pages'
|
||||
import { searchHighlights } from '../../elastic/highlights'
|
||||
import wordsCounter from 'word-counting'
|
||||
|
||||
export type PartialArticle = Omit<
|
||||
Article,
|
||||
|
|
@ -257,6 +258,9 @@ export const createArticleResolver = authorized<
|
|||
|
||||
const saveTime = new Date()
|
||||
const slug = generateSlug(parsedContent?.title || croppedPathname)
|
||||
const wordsCount = wordsCounter(parsedContent?.content || '', {
|
||||
isHtml: true,
|
||||
}).wordsCount
|
||||
const articleToSave: Page = {
|
||||
id: pageId || '',
|
||||
userId: uid,
|
||||
|
|
@ -289,6 +293,7 @@ export const createArticleResolver = authorized<
|
|||
readingProgressAnchorIndex: 0,
|
||||
state: ArticleSavingRequestStatus.Succeeded,
|
||||
language: parsedContent?.language,
|
||||
wordsCount,
|
||||
}
|
||||
|
||||
let archive = false
|
||||
|
|
|
|||
Loading…
Reference in a new issue