@@ -90,10 +94,10 @@ const SocialButton = () => {
)}
{CONTACT_EMAIL && (
+ onClick={e => handleEmailClick(e, emailIcon, CONTACT_EMAIL)}
+ title='email'
+ className='cursor-pointer'
+ ref={emailIcon}>
)}
diff --git a/themes/matery/components/SocialButton.js b/themes/matery/components/SocialButton.js
index 678ad4fd..74e18597 100644
--- a/themes/matery/components/SocialButton.js
+++ b/themes/matery/components/SocialButton.js
@@ -1,5 +1,6 @@
import { siteConfig } from '@/lib/config'
-import { useEffect, useRef, useState } from 'react'
+import { useRef, useState } from 'react'
+import { handleEmailClick } from '@/lib/plugins/mailEncrypt'
/**
* 社交联系方式按钮组 可折叠的组件
@@ -24,12 +25,7 @@ const SocialButton = () => {
const CONTACT_YOUTUBE = siteConfig('CONTACT_YOUTUBE')
const emailIcon = useRef(null)
- useEffect(() => {
- if (CONTACT_EMAIL && emailIcon.current) {
- emailIcon.current.href =
- 'mailto:' + decodeURIComponent(escape(atob(CONTACT_EMAIL)))
- }
- }, [CONTACT_EMAIL])
+
return (
@@ -97,11 +93,10 @@ const SocialButton = () => {
)}
{CONTACT_EMAIL && (
+ onClick={e => handleEmailClick(e, emailIcon, CONTACT_EMAIL)}
+ title='email'
+ className='cursor-pointer'
+ ref={emailIcon}>
)}
diff --git a/themes/medium/components/SocialButton.js b/themes/medium/components/SocialButton.js
index 40ae1ca4..66899971 100644
--- a/themes/medium/components/SocialButton.js
+++ b/themes/medium/components/SocialButton.js
@@ -1,5 +1,6 @@
import { siteConfig } from '@/lib/config'
-import { useEffect, useRef } from 'react'
+import { useRef } from 'react'
+import { handleEmailClick } from '@/lib/plugins/mailEncrypt'
/**
* 社交联系方式按钮组
@@ -19,12 +20,7 @@ const SocialButton = () => {
const CONTACT_YOUTUBE = siteConfig('CONTACT_YOUTUBE')
const emailIcon = useRef(null)
- useEffect(() => {
- if (CONTACT_EMAIL && emailIcon.current) {
- emailIcon.current.href =
- 'mailto:' + decodeURIComponent(escape(atob(CONTACT_EMAIL)))
- }
- }, [CONTACT_EMAIL])
+
return (
{CONTACT_GITHUB && (
@@ -83,11 +79,10 @@ const SocialButton = () => {
)}
{CONTACT_EMAIL && (
+ onClick={e => handleEmailClick(e, emailIcon, CONTACT_EMAIL)}
+ title='email'
+ className='cursor-pointer'
+ ref={emailIcon}>
)}
diff --git a/themes/nav/components/SocialButton.js b/themes/nav/components/SocialButton.js
index 64aa4cc1..e6992904 100755
--- a/themes/nav/components/SocialButton.js
+++ b/themes/nav/components/SocialButton.js
@@ -1,5 +1,6 @@
import { siteConfig } from '@/lib/config'
-import { useEffect, useRef } from 'react'
+import { useRef } from 'react'
+import { handleEmailClick } from '@/lib/plugins/mailEncrypt'
/**
* 社交联系方式按钮组
@@ -17,12 +18,7 @@ const SocialButton = () => {
const ENABLE_RSS = siteConfig('ENABLE_RSS')
const emailIcon = useRef(null)
- useEffect(() => {
- if (CONTACT_EMAIL && emailIcon.current) {
- emailIcon.current.href =
- 'mailto:' + decodeURIComponent(escape(atob(CONTACT_EMAIL)))
- }
- }, [CONTACT_EMAIL])
+
return (
{CONTACT_GITHUB && (
@@ -81,11 +77,10 @@ const SocialButton = () => {
)}
{CONTACT_EMAIL && (
+ onClick={e => handleEmailClick(e, emailIcon, CONTACT_EMAIL)}
+ title='email'
+ className='cursor-pointer'
+ ref={emailIcon}>
)}
diff --git a/themes/plog/components/SocialButton.js b/themes/plog/components/SocialButton.js
index c48909bd..7d6aa1a8 100644
--- a/themes/plog/components/SocialButton.js
+++ b/themes/plog/components/SocialButton.js
@@ -1,5 +1,6 @@
import { siteConfig } from '@/lib/config'
-import { useEffect, useRef } from 'react'
+import { useRef } from 'react'
+import { handleEmailClick } from '@/lib/plugins/mailEncrypt'
/**
* 社交联系方式按钮组
@@ -19,12 +20,7 @@ const SocialButton = () => {
const CONTACT_YOUTUBE = siteConfig('CONTACT_YOUTUBE')
const emailIcon = useRef(null)
- useEffect(() => {
- if (CONTACT_EMAIL && emailIcon.current) {
- emailIcon.current.href =
- 'mailto:' + decodeURIComponent(escape(atob(CONTACT_EMAIL)))
- }
- }, [CONTACT_EMAIL])
+
return (
@@ -84,11 +80,10 @@ const SocialButton = () => {
)}
{CONTACT_EMAIL && (
+ onClick={e => handleEmailClick(e, emailIcon, CONTACT_EMAIL)}
+ title='email'
+ className='cursor-pointer'
+ ref={emailIcon}>
)}
diff --git a/themes/starter/components/SocialButton.js b/themes/starter/components/SocialButton.js
index a90d533b..2cac8bf6 100644
--- a/themes/starter/components/SocialButton.js
+++ b/themes/starter/components/SocialButton.js
@@ -1,5 +1,6 @@
import { siteConfig } from '@/lib/config'
-import { useEffect, useRef } from 'react'
+import { useRef } from 'react'
+import { handleEmailClick } from '@/lib/plugins/mailEncrypt'
/**
* 社交联系方式按钮组
@@ -19,12 +20,7 @@ const SocialButton = () => {
const CONTACT_YOUTUBE = siteConfig('CONTACT_YOUTUBE')
const emailIcon = useRef(null)
- useEffect(() => {
- if (CONTACT_EMAIL && emailIcon.current) {
- emailIcon.current.href =
- 'mailto:' + decodeURIComponent(escape(atob(CONTACT_EMAIL)))
- }
- }, [CONTACT_EMAIL])
+
return (