Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 保存到 Notion 成功后,支持立刻打开 Notion 页面 #1308

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/service/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -1511,7 +1511,7 @@ class Notion {
console.log( 'WriteFile: ', result )
this.ImportFile( urls.url, `${title}.md`, documentId, result => {
console.log( 'ImportFile: ', result )
result.done && callback( result, undefined );
result.done && callback( { ...(result || {}), documentId }, undefined );
result.fail && callback( undefined, "error" );
});
});
Expand Down Expand Up @@ -2113,7 +2113,15 @@ let noti; // notify variable
*/
function serviceCallback( result, error, name, type, notify ) {
noti && noti.complete();
!error && notify.Render( `已成功保存到 ${name}!` );
if (!error) {
let successMsg = `已成功保存到 ${name}!`;
if (type == "notion") {
successMsg = { content: successMsg, action: "点击查看", callback: type => {
type == "action" && browser.runtime.sendMessage( msg.Add( msg.MESSAGE_ACTION.new_tab, { url: `https://www.notion.so/${String(result.documentId).replace(/-/g,'')}` }));
}}
}
notify.Render(successMsg);
}
![ "evernote", "yinxiang" ].includes( type ) && error && notify.Render( 2, error == "error" ? "保存失败,请稍后重新再试。" : error );
if ( error && error.includes( "重新授权" )) {
notify.Clone().Render( "3 秒钟后将会自动重新授权,请勿关闭此页面..." );
Expand Down