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

Use new api for Artalk v2.5.0+ update #7

Merged
merged 1 commit into from
Mar 16, 2023
Merged

Conversation

qwqcode
Copy link
Contributor

@qwqcode qwqcode commented Mar 16, 2023

v2.5.0+ 新版更新了一些新的函数,有助于方便在 Pjax、SPA 的用例中快速集成 Artalk,对性能优化有助于解决内存泄露等问题。

https://artalk.js.org/develop/fe-api.html

但是还没在 hexo 中具体测试过,麻烦帮忙测一测 😁

Signed-off-by: qwqcode <qwqcode@gmail.com>
@@ -13,8 +13,8 @@ artalk:

# Frontend resources CDN, you can set this to your preferred CDN
## Reference: https://artalk.js.org/guide/frontend/install.html
jsUrl: https://unpkg.com/artalk@2/dist/Artalk.js
cssUrl: https://unpkg.com/artalk@2/dist/Artalk.css
jsUrl: https://artalk.example.com/dist/Artalk.js
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后端程序中包含了对应版本的前端资源文件,可保证版本一致性,但同时也推荐使用 CDN 资源加快速度。

@@ -17,15 +16,15 @@
condition: window.Artalk
}))
.then(() => {
new Artalk(CONFIG.artalk);
Artalk.init(CONFIG.artalk);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new Artalk 创建新实例对象替换为新版提供的函数,防止反复创建实例浪费资源

@@ -1,8 +1,7 @@
{{ next_data('artalk', config.artalk, {
el: '#comments',
pageKey: url_for(page.path) | replace(r/index\.html$/, ''),
pageTitle: page.title,
locale: page.lang | default('zh-CN', true)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

语言可以在侧边栏控制中心修改

useBackendConf: true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新版 useBackendConf 已修改为默认开启

@leirock leirock merged commit 78a1152 into leirock:main Mar 16, 2023
@leirock
Copy link
Owner

leirock commented Mar 16, 2023

@qwqcode 谢谢PR!

@qwqcode
Copy link
Contributor Author

qwqcode commented Mar 17, 2023

我又发现了点 BUG,将在下一个版本修复 😅

@qwqcode
Copy link
Contributor Author

qwqcode commented Mar 19, 2023

我又发现了点 BUG,将在下一个版本修复 😅

最新版 v2.5.2 应该修好了

@leirock
Copy link
Owner

leirock commented Mar 20, 2023

@qwqcode 多谢多谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants