From 3d5fb12ad178a27f6d01857252cbad3216084e08 Mon Sep 17 00:00:00 2001 From: Mongkii Date: Wed, 4 Nov 2020 16:03:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=9D=E5=AD=98=E5=88=B0=20Notion=20?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E5=90=8E=EF=BC=8C=E6=94=AF=E6=8C=81=E7=AB=8B?= =?UTF-8?q?=E5=88=BB=E6=89=93=E5=BC=80=20Notion=20=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/export.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/service/export.js b/src/service/export.js index 7745e3b2f..17c6f54b6 100644 --- a/src/service/export.js +++ b/src/service/export.js @@ -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" ); }); }); @@ -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 秒钟后将会自动重新授权,请勿关闭此页面..." );