mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-02 23:16:51 +00:00
@@ -93,13 +93,33 @@ export default function CustomContextMenu(props) {
|
|||||||
/**
|
/**
|
||||||
* 切换主题
|
* 切换主题
|
||||||
*/
|
*/
|
||||||
function handeChangeTheme() {
|
function handleChangeTheme() {
|
||||||
const randomTheme = THEMES[Math.floor(Math.random() * THEMES.length)] // 从THEMES数组中 随机取一个主题
|
const randomTheme = THEMES[Math.floor(Math.random() * THEMES.length)] // 从THEMES数组中 随机取一个主题
|
||||||
const query = router.query
|
const query = router.query
|
||||||
query.theme = randomTheme
|
query.theme = randomTheme
|
||||||
router.push({ pathname: router.pathname, query })
|
router.push({ pathname: router.pathname, query })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制内容
|
||||||
|
*/
|
||||||
|
function handleCopy(){
|
||||||
|
var selectedText = document.getSelection().toString();
|
||||||
|
if (selectedText) {
|
||||||
|
var tempInput = document.createElement("input");
|
||||||
|
tempInput.value = selectedText;
|
||||||
|
document.body.appendChild(tempInput);
|
||||||
|
tempInput.select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
document.body.removeChild(tempInput);
|
||||||
|
// alert("Text copied: " + selectedText);
|
||||||
|
} else {
|
||||||
|
// alert("Please select some text first.");
|
||||||
|
}
|
||||||
|
|
||||||
|
setShow(false)
|
||||||
|
}
|
||||||
|
|
||||||
function handleChangeDarkMode() {
|
function handleChangeDarkMode() {
|
||||||
const newStatus = !isDarkMode
|
const newStatus = !isDarkMode
|
||||||
saveDarkModeToCookies(newStatus)
|
saveDarkModeToCookies(newStatus)
|
||||||
@@ -153,21 +173,29 @@ export default function CustomContextMenu(props) {
|
|||||||
{/* 功能按钮 */}
|
{/* 功能按钮 */}
|
||||||
<div className='w-full px-2'>
|
<div className='w-full px-2'>
|
||||||
|
|
||||||
<div onClick={handleCopyLink} title={locale.MENU.COPY_URL} className='w-full px-2 h-10 flex justify-start items-center flex-nowrap cursor-pointer hover:bg-blue-600 hover:text-white rounded-lg duration-200 transition-all'>
|
{siteConfig('CAN_COPY') && (
|
||||||
|
<div onClick={handleCopy} title={locale.MENU.COPY} className='w-full px-2 h-10 flex justify-start items-center flex-nowrap cursor-pointer hover:bg-blue-600 hover:text-white rounded-lg duration-200 transition-all'>
|
||||||
|
<i className="fa-solid fa-copy mr-2" />
|
||||||
|
<div className='whitespace-nowrap'>{locale.MENU.COPY}</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div onClick={handleCopyLink} title={locale.MENU.SHARE_URL} className='w-full px-2 h-10 flex justify-start items-center flex-nowrap cursor-pointer hover:bg-blue-600 hover:text-white rounded-lg duration-200 transition-all'>
|
||||||
<i className="fa-solid fa-arrow-up-right-from-square mr-2" />
|
<i className="fa-solid fa-arrow-up-right-from-square mr-2" />
|
||||||
<div className='whitespace-nowrap'>{locale.MENU.COPY_URL}</div>
|
<div className='whitespace-nowrap'>{locale.MENU.SHARE_URL}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div onClick={handleChangeDarkMode} title={isDarkMode ? locale.MENU.LIGHT_MODE : locale.MENU.DARK_MODE} className='w-full px-2 h-10 flex justify-start items-center flex-nowrap cursor-pointer hover:bg-blue-600 hover:text-white rounded-lg duration-200 transition-all'>
|
<div onClick={handleChangeDarkMode} title={isDarkMode ? locale.MENU.LIGHT_MODE : locale.MENU.DARK_MODE} className='w-full px-2 h-10 flex justify-start items-center flex-nowrap cursor-pointer hover:bg-blue-600 hover:text-white rounded-lg duration-200 transition-all'>
|
||||||
{isDarkMode ? <i className="fa-regular fa-sun mr-2" /> : <i className="fa-regular fa-moon mr-2" />}
|
{isDarkMode ? <i className="fa-regular fa-sun mr-2" /> : <i className="fa-regular fa-moon mr-2" />}
|
||||||
<div className='whitespace-nowrap'> {isDarkMode ? locale.MENU.LIGHT_MODE : locale.MENU.DARK_MODE}</div>
|
<div className='whitespace-nowrap'> {isDarkMode ? locale.MENU.LIGHT_MODE : locale.MENU.DARK_MODE}</div>
|
||||||
</div>
|
</div>
|
||||||
{siteConfig('CUSTOM_RIGHT_CLICK_CONTEXT_MENU_THEME_SWITCH') && (
|
{siteConfig('CUSTOM_RIGHT_CLICK_CONTEXT_MENU_THEME_SWITCH') && (
|
||||||
<div onClick={handeChangeTheme} title={locale.MENU.THEME_SWITCH} className='w-full px-2 h-10 flex justify-start items-center flex-nowrap cursor-pointer hover:bg-blue-600 hover:text-white rounded-lg duration-200 transition-all'>
|
<div onClick={handleChangeTheme} title={locale.MENU.THEME_SWITCH} className='w-full px-2 h-10 flex justify-start items-center flex-nowrap cursor-pointer hover:bg-blue-600 hover:text-white rounded-lg duration-200 transition-all'>
|
||||||
<i className="fa-solid fa-palette mr-2" />
|
<i className="fa-solid fa-palette mr-2" />
|
||||||
<div className='whitespace-nowrap'>{locale.MENU.THEME_SWITCH}</div>
|
<div className='whitespace-nowrap'>{locale.MENU.THEME_SWITCH}</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ export default {
|
|||||||
WALK_AROUND: 'Walk Around',
|
WALK_AROUND: 'Walk Around',
|
||||||
CATEGORY: 'Category',
|
CATEGORY: 'Category',
|
||||||
TAGS: 'Tags',
|
TAGS: 'Tags',
|
||||||
COPY_URL: 'Copy URL',
|
SHARE_URL: 'Share URL',
|
||||||
DARK_MODE: 'Dark Mode',
|
DARK_MODE: 'Dark Mode',
|
||||||
LIGHT_MODE: 'Light Mode',
|
LIGHT_MODE: 'Light Mode',
|
||||||
THEME_SWITCH: 'Theme Switch'
|
THEME_SWITCH: 'Theme Switch',
|
||||||
|
COPY: 'Copy'
|
||||||
},
|
},
|
||||||
NAV: {
|
NAV: {
|
||||||
INDEX: 'Home',
|
INDEX: 'Home',
|
||||||
|
|||||||
@@ -4,10 +4,11 @@ export default {
|
|||||||
WALK_AROUND: '随便逛逛',
|
WALK_AROUND: '随便逛逛',
|
||||||
CATEGORY: '博客分类',
|
CATEGORY: '博客分类',
|
||||||
TAGS: '博客标签',
|
TAGS: '博客标签',
|
||||||
COPY_URL: '复制地址',
|
SHARE_URL: '分享地址',
|
||||||
DARK_MODE: '深色模式',
|
DARK_MODE: '深色模式',
|
||||||
LIGHT_MODE: '浅色模式',
|
LIGHT_MODE: '浅色模式',
|
||||||
THEME_SWITCH: '主题切换'
|
THEME_SWITCH: '主题切换',
|
||||||
|
COPY:'复制'
|
||||||
},
|
},
|
||||||
NAV: {
|
NAV: {
|
||||||
INDEX: '首页',
|
INDEX: '首页',
|
||||||
|
|||||||
Reference in New Issue
Block a user