style: code format
This commit is contained in:
parent
c6f136caa2
commit
b9affe3eb8
@ -143,6 +143,7 @@
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"sass": "^1.77.2",
|
||||
"shiki": "^1.22.2",
|
||||
"string-width": "^7.2.0",
|
||||
"styled-components": "^6.1.11",
|
||||
"tinycolor2": "^1.6.0",
|
||||
"typescript": "^5.6.2",
|
||||
|
||||
@ -95,14 +95,14 @@ export const Box = styled.div<BoxProps>`
|
||||
box-sizing: border-box;
|
||||
border: ${(props) => props?.border || 'none'};
|
||||
gap: ${(p) => (p.gap ? getElementValue(p.gap) : 0)};
|
||||
margin: ${(props) => (props.m || props.margin ? props.m ?? props.margin : 'none')};
|
||||
margin: ${(props) => (props.m || props.margin ? (props.m ?? props.margin) : 'none')};
|
||||
margin-top: ${(props) => (props.mt || props.marginTop ? getElementValue(props.mt || props.marginTop) : 'default')};
|
||||
margin-bottom: ${(props) =>
|
||||
props.mb || props.marginBottom ? getElementValue(props.mb ?? props.marginBottom) : 'default'};
|
||||
margin-left: ${(props) => (props.ml || props.marginLeft ? getElementValue(props.ml ?? props.marginLeft) : 'default')};
|
||||
margin-right: ${(props) =>
|
||||
props.mr || props.marginRight ? getElementValue(props.mr ?? props.marginRight) : 'default'};
|
||||
padding: ${(props) => (props.p || props.padding ? props.p ?? props.padding : 'none')};
|
||||
padding: ${(props) => (props.p || props.padding ? (props.p ?? props.padding) : 'none')};
|
||||
padding-top: ${(props) => (props.pt || props.paddingTop ? getElementValue(props.pt ?? props.paddingTop) : 'auto')};
|
||||
padding-bottom: ${(props) =>
|
||||
props.pb || props.paddingBottom ? getElementValue(props.pb ?? props.paddingBottom) : 'auto'};
|
||||
|
||||
@ -5,7 +5,8 @@ import {
|
||||
EditOutlined,
|
||||
FolderOutlined,
|
||||
PushpinOutlined,
|
||||
UploadOutlined} from '@ant-design/icons'
|
||||
UploadOutlined
|
||||
} from '@ant-design/icons'
|
||||
import DragableList from '@renderer/components/DragableList'
|
||||
import PromptPopup from '@renderer/components/Popups/PromptPopup'
|
||||
import Scrollbar from '@renderer/components/Scrollbar'
|
||||
@ -162,7 +163,7 @@ const Topics: FC<Props> = ({ assistant: _assistant, activeTopic, setActiveTopic
|
||||
label: t('chat.topics.export.notion'),
|
||||
key: 'notion',
|
||||
onClick: () => exportTopicToNotion(topic)
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@ -86,8 +86,7 @@ const runtimeSlice = createSlice({
|
||||
},
|
||||
setExportState: (state, action: PayloadAction<Partial<ExportState>>) => {
|
||||
state.export = { ...state.export, ...action.payload }
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -49,8 +49,8 @@ export const exportTopicToNotion = async (topic: Topic) => {
|
||||
return
|
||||
}
|
||||
try {
|
||||
const notion = new Client({ auth: notionApiKey });
|
||||
const markdown = await topicToMarkdown(topic);
|
||||
const notion = new Client({ auth: notionApiKey })
|
||||
const markdown = await topicToMarkdown(topic)
|
||||
const requestBody = JSON.stringify({ md: markdown })
|
||||
|
||||
const res = await fetch('https://md2notion.hilars.dev', {
|
||||
@ -59,10 +59,10 @@ export const exportTopicToNotion = async (topic: Topic) => {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: requestBody
|
||||
});
|
||||
})
|
||||
|
||||
const data = await res.json();
|
||||
const notionBlocks = data;
|
||||
const data = await res.json()
|
||||
const notionBlocks = data
|
||||
|
||||
const response = await notion.pages.create({
|
||||
parent: { database_id: notionDatabaseID },
|
||||
@ -72,12 +72,11 @@ export const exportTopicToNotion = async (topic: Topic) => {
|
||||
}
|
||||
},
|
||||
children: notionBlocks // 使用转换后的块
|
||||
});
|
||||
})
|
||||
|
||||
window.message.success({ content: i18n.t('message.success.notion.export'), key: 'notion-success' })
|
||||
return response
|
||||
|
||||
} catch (error:any) {
|
||||
} catch (error: any) {
|
||||
window.message.error({ content: i18n.t('message.error.notion.export'), key: 'notion-error' })
|
||||
return null
|
||||
} finally {
|
||||
@ -85,4 +84,4 @@ export const exportTopicToNotion = async (topic: Topic) => {
|
||||
isExporting: false
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
28
yarn.lock
28
yarn.lock
@ -3072,6 +3072,7 @@ __metadata:
|
||||
rollup-plugin-visualizer: "npm:^5.12.0"
|
||||
sass: "npm:^1.77.2"
|
||||
shiki: "npm:^1.22.2"
|
||||
string-width: "npm:^7.2.0"
|
||||
styled-components: "npm:^6.1.11"
|
||||
tinycolor2: "npm:^1.6.0"
|
||||
tokenx: "npm:^0.4.1"
|
||||
@ -5405,6 +5406,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"emoji-regex@npm:^10.3.0":
|
||||
version: 10.4.0
|
||||
resolution: "emoji-regex@npm:10.4.0"
|
||||
checksum: 10c0/a3fcedfc58bfcce21a05a5f36a529d81e88d602100145fcca3dc6f795e3c8acc4fc18fe773fbf9b6d6e9371205edb3afa2668ec3473fa2aa7fd47d2a9d46482d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"emoji-regex@npm:^8.0.0":
|
||||
version: 8.0.0
|
||||
resolution: "emoji-regex@npm:8.0.0"
|
||||
@ -6558,6 +6566,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"get-east-asian-width@npm:^1.0.0":
|
||||
version: 1.3.0
|
||||
resolution: "get-east-asian-width@npm:1.3.0"
|
||||
checksum: 10c0/1a049ba697e0f9a4d5514c4623781c5246982bdb61082da6b5ae6c33d838e52ce6726407df285cdbb27ec1908b333cf2820989bd3e986e37bb20979437fdf34b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"get-intrinsic@npm:^1.2.4, get-intrinsic@npm:^1.2.5, get-intrinsic@npm:^1.2.6, get-intrinsic@npm:^1.2.7":
|
||||
version: 1.2.7
|
||||
resolution: "get-intrinsic@npm:1.2.7"
|
||||
@ -13016,6 +13031,17 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"string-width@npm:^7.2.0":
|
||||
version: 7.2.0
|
||||
resolution: "string-width@npm:7.2.0"
|
||||
dependencies:
|
||||
emoji-regex: "npm:^10.3.0"
|
||||
get-east-asian-width: "npm:^1.0.0"
|
||||
strip-ansi: "npm:^7.1.0"
|
||||
checksum: 10c0/eb0430dd43f3199c7a46dcbf7a0b34539c76fe3aa62763d0b0655acdcbdf360b3f66f3d58ca25ba0205f42ea3491fa00f09426d3b7d3040e506878fc7664c9b9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"string.prototype.matchall@npm:^4.0.12":
|
||||
version: 4.0.12
|
||||
resolution: "string.prototype.matchall@npm:4.0.12"
|
||||
@ -13131,7 +13157,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"strip-ansi@npm:^7.0.1":
|
||||
"strip-ansi@npm:^7.0.1, strip-ansi@npm:^7.1.0":
|
||||
version: 7.1.0
|
||||
resolution: "strip-ansi@npm:7.1.0"
|
||||
dependencies:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user