From 29f7d9fbb6df90e802aecf613a3843b8da9cab5a Mon Sep 17 00:00:00 2001 From: LinkinStars Date: Fri, 22 Nov 2024 09:50:21 +0000 Subject: [PATCH 1/4] chore: Sync Plugin Info --- captcha-basic/package.json | 2 +- captcha-google-v2/package.json | 2 +- connector-wallet/package.json | 2 +- editor-chart/package.json | 2 +- editor-formula/package.json | 2 +- embed-basic/package.json | 2 +- plugins_desc.json | 200 ++++++++++----------- render-markdown-codehighlight/package.json | 2 +- 8 files changed, 107 insertions(+), 107 deletions(-) diff --git a/captcha-basic/package.json b/captcha-basic/package.json index 87f32b2a8..4e686cbf7 100644 --- a/captcha-basic/package.json +++ b/captcha-basic/package.json @@ -3,7 +3,7 @@ "private": true, "author": "Answer.dev", "description": "Basic for captcha", - "version": "1.0.3", + "version": "1.0.4", "files": [ "dist", "README.md" diff --git a/captcha-google-v2/package.json b/captcha-google-v2/package.json index 008177ba7..743928362 100644 --- a/captcha-google-v2/package.json +++ b/captcha-google-v2/package.json @@ -3,7 +3,7 @@ "private": true, "author": "Answer.dev", "description": "google reCaptcha v2", - "version": "1.0.3", + "version": "1.0.4", "files": [ "dist", "README.md" diff --git a/connector-wallet/package.json b/connector-wallet/package.json index c8daa746d..3be3a035d 100644 --- a/connector-wallet/package.json +++ b/connector-wallet/package.json @@ -1,6 +1,6 @@ { "name": "connector-wallet", - "version": "0.0.1", + "version": "1.0.0", "description": "Connect to Web3 wallet for third-party login", "author": "Ourai L. ", "type": "module", diff --git a/editor-chart/package.json b/editor-chart/package.json index 5c44a9bd4..0fbbcd546 100644 --- a/editor-chart/package.json +++ b/editor-chart/package.json @@ -2,7 +2,7 @@ "name": "editor-chart", "private": true, "author": "Answer.dev", - "version": "1.2.9", + "version": "1.2.10", "files": [ "dist", "README.md" diff --git a/editor-formula/package.json b/editor-formula/package.json index 4738b7a1b..fbbbb4ede 100644 --- a/editor-formula/package.json +++ b/editor-formula/package.json @@ -2,7 +2,7 @@ "name": "editor-formula", "private": true, "author": "Answer.dev", - "version": "1.2.12", + "version": "1.2.13", "files": [ "dist", "README.md" diff --git a/embed-basic/package.json b/embed-basic/package.json index eee44e208..eadd0b3eb 100644 --- a/embed-basic/package.json +++ b/embed-basic/package.json @@ -1,6 +1,6 @@ { "name": "embed-basic", - "version": "1.1.1", + "version": "1.1.2", "description": "", "files": [ "dist", diff --git a/plugins_desc.json b/plugins_desc.json index 555909920..13487cd53 100644 --- a/plugins_desc.json +++ b/plugins_desc.json @@ -1,83 +1,83 @@ { - "zh_CN": [ + "en_US": [ { - "name": "Redis缓存", - "desc": "使用Redis作为缓存", + "name": "Redis Cache", + "desc": "Use Redis as cache", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cache-redis" }, { - "name": "基础验证码", - "desc": "默认图形验证码", + "name": "Basic Captcha", + "desc": "Default graphic verification code", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/captcha-basic" }, { "name": "Google reCAPTCHA v2", - "desc": "Google reCAPTCHA v2 插件", + "desc": "Google reCAPTCHA v2 plugin", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/captcha-google-v2" }, { - "name": "阿里云CDN", - "desc": "通过阿里云CDN提升静态资源加速", + "name": "Aliyun CDN", + "desc": "Speed up your website and enjoy greatly improved loading times around the world.", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cdn-aliyun" }, { "name": "Amazon CloudFront", - "desc": "通过AWS CDN提升静态资源加速", + "desc": "Speed up your website and enjoy greatly improved loading times around the world.", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cdn-s3" }, { - "name": "Apache 连接器", - "desc": "用于接入 Apache Oauth", + "name": "Apache Connector", + "desc": "Connect to Apache Oauth", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-apache" }, { - "name": "通用连接器", - "desc": "适用于各种 OAuth 登录的通用插件", + "name": "OAuth2 Basic", + "desc": "Generic OAuth2 Plugin", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-basic" }, { - "name": "钉钉连接器", - "desc": "用于接入钉钉第三方登录", + "name": "Dingtalk Connector", + "desc": "Connect to Dingtalk for third-party login", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-dingtalk" }, { - "name": "Google 连接器", - "desc": "用于接入 Google 第三方登录", + "name": "Google Connector", + "desc": "Connect to Google for third-party login", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-google" }, { - "name": "Wallet 连接器", - "desc": "用于接入 Wallet 第三方登录", + "name": "Wallet Connector", + "desc": "Connect to Wallet for third-party login", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-wallet" }, { - "name": "图表编辑器", - "desc": "在编辑器中渲染图表", + "name": "Chart Editor", + "desc": "Render chart in editor", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/editor-chart" }, { - "name": "公式编辑器", - "desc": "在编辑器中渲染公式", + "name": "Formula Editor", + "desc": "Render formula in editor", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/editor-formula" }, { - "name": "内容嵌入", - "desc": "在内容中嵌入其他网站", + "name": "Embed", + "desc": "Embed content from other sites", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/embed-basic" }, { - "name": "钉钉通知", - "desc": "发送通知到钉钉", + "name": "Ding talk Notification", + "desc": "Send notifications to Ding Talk", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/notification-dingtalk" }, { - "name": "Slack 通知", - "desc": "发送通知到 Slack", + "name": "Slack Notification", + "desc": "Send notifications to Slack", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/notification-slack" }, { - "name": "代码高亮", - "desc": "高亮显示 Markdown 内容中的代码块", + "name": "Code Highlight", + "desc": "Highlight code blocks in Markdown content", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/render-markdown-codehighlight" }, { @@ -86,135 +86,135 @@ "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-akismet" }, { - "name": "百度反垃圾", - "desc": "百度反垃圾用于检查帖子和评论内容,通过百度内容审核平台查看它们是否像垃圾内容。", + "name": "Baidu Anti-Spam", + "desc": "Baidu Anti-Spam is used to check the content of posts and comments against the Baidu web service to see if they look like spam.", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-baidu" }, { - "name": "基础审核插件", - "desc": "基础的通用审核插件", + "name": "Review Basic", + "desc": "Generic review rule plugin", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-basic" }, { - "name": "Algolia 搜索", - "desc": "使用 Algolia 作为搜索引擎.", + "name": "Algolia Search", + "desc": "Use Algolia as a search engine.", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-algolia" }, { - "name": "Elasticsearch 引擎", - "desc": "使用 Elasticsearch 作为搜索引擎", + "name": "Elasticsearch Engine", + "desc": "Use Elasticsearch as search engine", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-elasticsearch" }, { "name": "MeiliSearch", - "desc": "MeiliSearch 是一个强大、快速、开源、易于使用和部署的搜索引擎。", + "desc": "MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine.", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-meilisearch" }, { - "name": "阿里云OSS存储", - "desc": "上传文件到阿里云OSS存储", + "name": "Aliyun OSS storage", + "desc": "Upload files to AliCloud OSS storage", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-aliyunoss" }, { - "name": "S3 存储", - "desc": "上传文件到S3存储", + "name": "S3 storage", + "desc": "Upload files to S3 storage", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-s3" }, { - "name": "腾讯云COS对象存储", - "desc": "上传文件到腾讯云COS对象存储", + "name": "Tencent COS storage", + "desc": "Upload files to Tencent COS storage", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-tencentyuncos" }, { - "name": "Slack", - "desc": "通过Slack进行登录", + "name": "Slack User Center", + "desc": "A plugin for integrating Slack user management", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/user-center-slack" }, { - "name": "企业微信", - "desc": "从企业微信获取用户信息并同步到用户中心", + "name": "WeCom", + "desc": "Get user info from WeCom and sync to User Center", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/user-center-wecom" } ], - "en_US": [ + "zh_CN": [ { - "name": "Redis Cache", - "desc": "Use Redis as cache", + "name": "Redis缓存", + "desc": "使用Redis作为缓存", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cache-redis" }, { - "name": "Basic Captcha", - "desc": "Default graphic verification code", + "name": "基础验证码", + "desc": "默认图形验证码", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/captcha-basic" }, { "name": "Google reCAPTCHA v2", - "desc": "Google reCAPTCHA v2 plugin", + "desc": "Google reCAPTCHA v2 插件", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/captcha-google-v2" }, { - "name": "Aliyun CDN", - "desc": "Speed up your website and enjoy greatly improved loading times around the world.", + "name": "阿里云CDN", + "desc": "通过阿里云CDN提升静态资源加速", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cdn-aliyun" }, { "name": "Amazon CloudFront", - "desc": "Speed up your website and enjoy greatly improved loading times around the world.", + "desc": "通过AWS CDN提升静态资源加速", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/cdn-s3" }, { - "name": "Apache Connector", - "desc": "Connect to Apache Oauth", + "name": "Apache 连接器", + "desc": "用于接入 Apache Oauth", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-apache" }, { - "name": "OAuth2 Basic", - "desc": "Generic OAuth2 Plugin", + "name": "通用连接器", + "desc": "适用于各种 OAuth 登录的通用插件", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-basic" }, { - "name": "Dingtalk Connector", - "desc": "Connect to Dingtalk for third-party login", + "name": "钉钉连接器", + "desc": "用于接入钉钉第三方登录", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-dingtalk" }, { - "name": "Google Connector", - "desc": "Connect to Google for third-party login", + "name": "Google 连接器", + "desc": "用于接入 Google 第三方登录", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-google" }, { - "name": "Wallet Connector", - "desc": "Connect to Wallet for third-party login", + "name": "Wallet 连接器", + "desc": "用于接入 Wallet 第三方登录", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/connector-wallet" }, { - "name": "Chart Editor", - "desc": "Render chart in editor", + "name": "图表编辑器", + "desc": "在编辑器中渲染图表", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/editor-chart" }, { - "name": "Formula Editor", - "desc": "Render formula in editor", + "name": "公式编辑器", + "desc": "在编辑器中渲染公式", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/editor-formula" }, { - "name": "Embed", - "desc": "Embed content from other sites", + "name": "内容嵌入", + "desc": "在内容中嵌入其他网站", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/embed-basic" }, { - "name": "Ding talk Notification", - "desc": "Send notifications to Ding Talk", + "name": "钉钉通知", + "desc": "发送通知到钉钉", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/notification-dingtalk" }, { - "name": "Slack Notification", - "desc": "Send notifications to Slack", + "name": "Slack 通知", + "desc": "发送通知到 Slack", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/notification-slack" }, { - "name": "Code Highlight", - "desc": "Highlight code blocks in Markdown content", + "name": "代码高亮", + "desc": "高亮显示 Markdown 内容中的代码块", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/render-markdown-codehighlight" }, { @@ -223,53 +223,53 @@ "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-akismet" }, { - "name": "Baidu Anti-Spam", - "desc": "Baidu Anti-Spam is used to check the content of posts and comments against the Baidu web service to see if they look like spam.", + "name": "百度反垃圾", + "desc": "百度反垃圾用于检查帖子和评论内容,通过百度内容审核平台查看它们是否像垃圾内容。", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-baidu" }, { - "name": "Review Basic", - "desc": "Generic review rule plugin", + "name": "基础审核插件", + "desc": "基础的通用审核插件", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/reviewer-basic" }, { - "name": "Algolia Search", - "desc": "Use Algolia as a search engine.", + "name": "Algolia 搜索", + "desc": "使用 Algolia 作为搜索引擎.", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-algolia" }, { - "name": "Elasticsearch Engine", - "desc": "Use Elasticsearch as search engine", + "name": "Elasticsearch 引擎", + "desc": "使用 Elasticsearch 作为搜索引擎", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-elasticsearch" }, { "name": "MeiliSearch", - "desc": "MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine.", + "desc": "MeiliSearch 是一个强大、快速、开源、易于使用和部署的搜索引擎。", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/search-meilisearch" }, { - "name": "Aliyun OSS storage", - "desc": "Upload files to AliCloud OSS storage", + "name": "阿里云OSS存储", + "desc": "上传文件到阿里云OSS存储", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-aliyunoss" }, { - "name": "S3 storage", - "desc": "Upload files to S3 storage", + "name": "S3 存储", + "desc": "上传文件到S3存储", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-s3" }, { - "name": "Tencent COS storage", - "desc": "Upload files to Tencent COS storage", + "name": "腾讯云COS对象存储", + "desc": "上传文件到腾讯云COS对象存储", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/storage-tencentyuncos" }, { - "name": "Slack User Center", - "desc": "A plugin for integrating Slack user management", + "name": "Slack", + "desc": "通过Slack进行登录", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/user-center-slack" }, { - "name": "WeCom", - "desc": "Get user info from WeCom and sync to User Center", + "name": "企业微信", + "desc": "从企业微信获取用户信息并同步到用户中心", "link": "https://github.com/apache/incubator-answer-plugins/tree/main/user-center-wecom" } ] diff --git a/render-markdown-codehighlight/package.json b/render-markdown-codehighlight/package.json index 6c36762de..76d25fdf7 100644 --- a/render-markdown-codehighlight/package.json +++ b/render-markdown-codehighlight/package.json @@ -1,6 +1,6 @@ { "name": "render-markdown-codehighlight", - "version": "0.1.1", + "version": "0.1.2", "description": "", "type": "module", "files": [ From 5a20983c1f298e404438db77e7ec94ea80571409 Mon Sep 17 00:00:00 2001 From: robin Date: Mon, 2 Dec 2024 11:32:59 +0800 Subject: [PATCH 2/4] refactor(hooks): improve code readability and update default theme --- render-markdown-codehighlight/hooks.ts | 47 +++++++++++++++++--------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/render-markdown-codehighlight/hooks.ts b/render-markdown-codehighlight/hooks.ts index 3b5c51c7b..37e1d31f6 100644 --- a/render-markdown-codehighlight/hooks.ts +++ b/render-markdown-codehighlight/hooks.ts @@ -27,20 +27,27 @@ const get = async (url: string) => { const { data } = await response.json(); return data; }; - -const useHighlightCode: FC = (props: HTMLElement | null | { - current: HTMLElement | null; -}, request: Request = { - get -}) => { - const [selectTheme, setSelectTheme] = useState('default'); +const useHighlightCode: FC = ( + props: + | HTMLElement + | null + | { + current: HTMLElement | null; + }, + request: Request = { + get, + }, +) => { + const [selectTheme, setSelectTheme] = useState('stackoverflow'); // Fetch theme from API useEffect(() => { - request.get('/answer/api/v1/render/config') + request + .get('/answer/api/v1/render/config') .then((result) => { - console.log('Fetched theme:', result.select_theme); - setSelectTheme(result.select_theme); + if (result.select_theme) { + setSelectTheme(result.select_theme); + } }) .catch((error) => { console.error('Error fetching theme:', error); @@ -58,7 +65,9 @@ const useHighlightCode: FC = (props: HTMLElement | null | { } const applyThemeCSS = async (theme: string) => { - const existingStyleElement = document.querySelector('style[data-theme-style="highlight"]'); + const existingStyleElement = document.querySelector( + 'style[data-theme-style="highlight"]', + ); if (existingStyleElement) existingStyleElement.remove(); const styleElement = document.createElement('style'); @@ -81,24 +90,30 @@ const useHighlightCode: FC = (props: HTMLElement | null | { }; // Get and apply the initial theme - const currentTheme = document.documentElement.getAttribute('data-bs-theme') || 'light'; + const currentTheme = + document.documentElement.getAttribute('data-bs-theme') || 'light'; applyThemeCSS(currentTheme); // Observe DOM changes (e.g., code block content changes) const contentObserver = new MutationObserver(() => { - const newTheme = document.documentElement.getAttribute('data-bs-theme') || 'light'; - console.log('Detected code content change, reapplying syntax highlighting, current theme:', newTheme); + const newTheme = + document.documentElement.getAttribute('data-bs-theme') || 'light'; + console.log( + 'Detected code content change, reapplying syntax highlighting, current theme:', + newTheme, + ); applyThemeCSS(newTheme); }); contentObserver.observe(element, { childList: true, // Observe changes to child elements - subtree: true, // Observe the entire subtree + subtree: true, // Observe the entire subtree }); // Observe theme changes const themeObserver = new MutationObserver(() => { - const newTheme = document.documentElement.getAttribute('data-bs-theme') || 'light'; + const newTheme = + document.documentElement.getAttribute('data-bs-theme') || 'light'; console.log('Detected theme change:', newTheme); applyThemeCSS(newTheme); }); From 33757b2848fe03b08386fd4b10cb174a3030cf18 Mon Sep 17 00:00:00 2001 From: robin Date: Mon, 2 Dec 2024 11:33:52 +0800 Subject: [PATCH 3/4] chore(render-markdown-codehighlight): bump version to 0.2.0 --- render-markdown-codehighlight/info.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/render-markdown-codehighlight/info.yaml b/render-markdown-codehighlight/info.yaml index 8de459b4c..5e60175b5 100644 --- a/render-markdown-codehighlight/info.yaml +++ b/render-markdown-codehighlight/info.yaml @@ -17,6 +17,6 @@ slug_name: render_markdown_codehighlight type: render -version: 0.1.2 +version: 0.2.0 author: Chen Jiaji, Zhu Xuanlyu link: https://github.com/apache/incubator-answer-plugins/tree/main/render-markdown-codehighlight From a0851fb4d1edae806b737a3840c40edc2e1e8cfe Mon Sep 17 00:00:00 2001 From: robinv8 Date: Mon, 2 Dec 2024 03:35:05 +0000 Subject: [PATCH 4/4] chore: Sync Plugin Info --- render-markdown-codehighlight/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/render-markdown-codehighlight/package.json b/render-markdown-codehighlight/package.json index 76d25fdf7..fe7a534bc 100644 --- a/render-markdown-codehighlight/package.json +++ b/render-markdown-codehighlight/package.json @@ -1,6 +1,6 @@ { "name": "render-markdown-codehighlight", - "version": "0.1.2", + "version": "0.2.0", "description": "", "type": "module", "files": [