mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #2462 from omnivore-app/fix/wechat-published-date
fix/wechat published date
This commit is contained in:
commit
ccc69d01d5
2 changed files with 24 additions and 23 deletions
|
|
@ -16,12 +16,16 @@ export class WeixinQqHandler extends ContentHandler {
|
|||
const publishTime = dom.querySelector('#publish_time')?.textContent
|
||||
if (publishTime) {
|
||||
const dateTimeFormat = 'yyyy-LL-dd HH:mm'
|
||||
// convert the publish time to a string in the format of "2023-01-01 00:00" in GMT+8
|
||||
const publishTimeInGMT8 = DateTime.fromFormat(publishTime, dateTimeFormat)
|
||||
.setZone('Asia/Shanghai')
|
||||
.toFormat(dateTimeFormat)
|
||||
// replace the publish time in the dom
|
||||
dom.querySelector('#publish_time')?.replaceWith(publishTimeInGMT8)
|
||||
const publishTimeISO = DateTime.fromFormat(
|
||||
publishTime,
|
||||
dateTimeFormat
|
||||
).toISO()
|
||||
|
||||
// create a meta node to store the publish time in ISO format
|
||||
const metaNode = dom.createElement('meta')
|
||||
metaNode.setAttribute('name', 'date')
|
||||
metaNode.setAttribute('content', publishTimeISO)
|
||||
dom.querySelector('head')?.appendChild(metaNode)
|
||||
}
|
||||
// This replace the class name of the article info to preserve the block
|
||||
dom
|
||||
|
|
|
|||
|
|
@ -1,23 +1,20 @@
|
|||
import dayjs, { Dayjs } from 'dayjs'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { updatePageMutation } from '../../../lib/networking/mutations/updatePageMutation'
|
||||
import { ArticleAttributes } from '../../../lib/networking/queries/useGetArticleQuery'
|
||||
import { LibraryItem } from '../../../lib/networking/queries/useGetLibraryItemsQuery'
|
||||
import { showErrorToast, showSuccessToast } from '../../../lib/toastHelpers'
|
||||
import { CloseButton } from '../../elements/CloseButton'
|
||||
import { FormInput } from '../../elements/FormElements'
|
||||
import { Box, HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives'
|
||||
import {
|
||||
ModalButtonBar,
|
||||
ModalContent,
|
||||
ModalOverlay,
|
||||
ModalRoot,
|
||||
} from '../../elements/ModalPrimitives'
|
||||
import { Box, HStack, SpanBox, VStack } from '../../elements/LayoutPrimitives'
|
||||
import { Button } from '../../elements/Button'
|
||||
import { StyledText } from '../../elements/StyledText'
|
||||
|
||||
import { FormInput } from '../../elements/FormElements'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { LibraryItem } from '../../../lib/networking/queries/useGetLibraryItemsQuery'
|
||||
import { StyledTextArea } from '../../elements/StyledTextArea'
|
||||
import { updatePageMutation } from '../../../lib/networking/mutations/updatePageMutation'
|
||||
import { showErrorToast, showSuccessToast } from '../../../lib/toastHelpers'
|
||||
import dayjs, { Dayjs } from 'dayjs'
|
||||
import { ArticleAttributes } from '../../../lib/networking/queries/useGetArticleQuery'
|
||||
import { CloseButton } from '../../elements/CloseButton'
|
||||
|
||||
type EditLibraryItemModalProps = {
|
||||
onOpenChange: (open: boolean) => void
|
||||
item: LibraryItem
|
||||
|
|
@ -227,7 +224,7 @@ function EditItemModal(props: EditItemModalProps): JSX.Element {
|
|||
>
|
||||
<ModalOverlay />
|
||||
<ModalContent
|
||||
css={{ bg: '$grayBg', p: '20px', maxWidth: '420px' }}
|
||||
css={{ bg: '$grayBg', p: '20px', maxWidth: '480px' }}
|
||||
onInteractOutside={() => {
|
||||
// remove focus from modal
|
||||
;(document.activeElement as HTMLElement).blur()
|
||||
|
|
@ -244,10 +241,10 @@ function EditItemModal(props: EditItemModalProps): JSX.Element {
|
|||
>
|
||||
<HStack distribution="start" css={{ width: '100%' }}>
|
||||
<VStack css={{ width: '45%' }}>
|
||||
<StyledText css={titleStyle}>SAVED AT:</StyledText>
|
||||
<StyledText css={titleStyle}>SAVED AT</StyledText>
|
||||
<FormInput
|
||||
type="datetime-local"
|
||||
value={props.savedAt.format('YYYY-MM-DDTHH:mm')}
|
||||
value={savedAt.format('YYYY-MM-DDTHH:mm')}
|
||||
placeholder="Edit Date"
|
||||
onChange={(event) => {
|
||||
const dateStr = event.target.value
|
||||
|
|
@ -264,8 +261,8 @@ function EditItemModal(props: EditItemModalProps): JSX.Element {
|
|||
<FormInput
|
||||
type="datetime-local"
|
||||
value={
|
||||
props.publishedAt
|
||||
? props.publishedAt.format('YYYY-MM-DDTHH:mm')
|
||||
publishedAt
|
||||
? publishedAt.format('YYYY-MM-DDTHH:mm')
|
||||
: undefined
|
||||
}
|
||||
placeholder="Edit Published Date"
|
||||
|
|
|
|||
Loading…
Reference in a new issue