forked from tangly1024/NotionNext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request tangly1024#2700 from tangly1024/release/4.7.0
Release/4.7.0
- Loading branch information
Showing
21 changed files
with
1,033 additions
and
764 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { siteConfig } from '@/lib/config' | ||
import { isBrowser, loadExternalResource } from '@/lib/utils' | ||
import { useEffect } from 'react' | ||
/** | ||
* OpenWrite公众号导流插件 | ||
* 使用介绍:https://openwrite.cn/guide/readmore/readmore.html#%E4%BA%8C%E3%80%81%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8 | ||
* 登录后台配置你的博客:https://readmore.openwrite.cn/ | ||
* @returns | ||
*/ | ||
const OpenWrite = () => { | ||
const qrcode = siteConfig('OPEN_WRITE_QRCODE', '请配置公众号二维码') | ||
const blogId = siteConfig('OPEN_WRITE_BLOG_ID') | ||
const name = siteConfig('OPEN_WRITE_NAME', '请配置公众号名') | ||
const id = 'article-wrapper' | ||
const keyword = siteConfig('OPEN_WRITE_KEYWORD', '请配置公众号关键词') | ||
const btnText = siteConfig( | ||
'OPEN_WRITE_BTN_TEXT', | ||
'原创不易,完成人机检测,阅读全文' | ||
) | ||
|
||
const loadOpenWrite = async () => { | ||
try { | ||
await loadExternalResource( | ||
'https://readmore.openwrite.cn/js/readmore-2.0.js', | ||
'js' | ||
) | ||
const BTWPlugin = window?.BTWPlugin | ||
|
||
if (BTWPlugin) { | ||
const btw = new BTWPlugin() | ||
window.btw = btw | ||
btw.init({ | ||
qrcode, | ||
id, | ||
name, | ||
btnText, | ||
keyword, | ||
blogId | ||
}) | ||
} | ||
} catch (error) { | ||
console.error('OpenWrite 加载异常', error) | ||
} | ||
} | ||
|
||
useEffect(() => { | ||
if (isBrowser && blogId) { | ||
// Check if the element with id 'read-more-wrap' already exists | ||
const readMoreWrap = document.getElementById('read-more-wrap') | ||
|
||
// Only load the script if the element doesn't exist | ||
if (!readMoreWrap) { | ||
loadOpenWrite() | ||
} | ||
} | ||
}) | ||
|
||
return <></> | ||
} | ||
|
||
export default OpenWrite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -272,3 +272,7 @@ a.avatar-wrapper { | |
margin-right: 20px; | ||
} | ||
} | ||
|
||
img { | ||
display: unset; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.