mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-15 15:09:25 +00:00
custom table options
This commit is contained in:
@@ -61,7 +61,7 @@ export default async function getPageProperties(id, block, schema, authToken, ta
|
||||
}
|
||||
}
|
||||
|
||||
// 设置自定义字段
|
||||
// 映射键:用户自定义表头名
|
||||
const fieldNames = BLOG.NOTION_PROPERTY_NAME
|
||||
if (fieldNames) {
|
||||
Object.keys(fieldNames).forEach(key => {
|
||||
@@ -73,24 +73,10 @@ export default async function getPageProperties(id, block, schema, authToken, ta
|
||||
properties.type = properties.type?.[0]
|
||||
properties.status = properties.status?.[0]
|
||||
|
||||
// 映射值:用户个性化type和status字段后,在此映射回代码的英文标识
|
||||
if (properties?.type === BLOG.NOTION_PROPERTY_NAME.type_post) {
|
||||
properties.type = 'Post'
|
||||
}
|
||||
if (properties?.type === BLOG.NOTION_PROPERTY_NAME.type_page) {
|
||||
properties.type = 'Page'
|
||||
}
|
||||
if (properties?.type === BLOG.NOTION_PROPERTY_NAME.type_notice) {
|
||||
properties.type = 'Notice'
|
||||
}
|
||||
if (properties?.status === BLOG.NOTION_PROPERTY_NAME.status_publish) {
|
||||
properties.status = 'Published'
|
||||
}
|
||||
if (properties?.status === BLOG.NOTION_PROPERTY_NAME.status_invisible) {
|
||||
properties.status = 'Invisible'
|
||||
}
|
||||
// 映射值:用户个性化type和status字段的下拉框选项,在此映射回代码的英文标识
|
||||
mapProperties(properties)
|
||||
|
||||
if (properties.type === BLOG.NOTION_PROPERTY_NAME.type_post) {
|
||||
if (properties.type === 'Post') {
|
||||
properties.slug = BLOG.POST_URL_PREFIX ? (BLOG.POST_URL_PREFIX + '/' + (properties.slug ?? properties.id)) : (properties.slug ?? properties.id)
|
||||
} else {
|
||||
properties.slug = (properties.slug ?? properties.id)
|
||||
@@ -139,3 +125,21 @@ function getImageUrl(imgObj, blockVal) {
|
||||
// 其他图片链接 或 emoji
|
||||
return imgObj
|
||||
}
|
||||
|
||||
function mapProperties(properties) {
|
||||
if (properties?.type === BLOG.NOTION_PROPERTY_NAME.type_post) {
|
||||
properties.type = 'Post'
|
||||
}
|
||||
if (properties?.type === BLOG.NOTION_PROPERTY_NAME.type_page) {
|
||||
properties.type = 'Page'
|
||||
}
|
||||
if (properties?.type === BLOG.NOTION_PROPERTY_NAME.type_notice) {
|
||||
properties.type = 'Notice'
|
||||
}
|
||||
if (properties?.status === BLOG.NOTION_PROPERTY_NAME.status_publish) {
|
||||
properties.status = 'Published'
|
||||
}
|
||||
if (properties?.status === BLOG.NOTION_PROPERTY_NAME.status_invisible) {
|
||||
properties.status = 'Invisible'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user