mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
feat: 新增页面防复制功能
This commit is contained in:
@@ -15,6 +15,7 @@ const BLOG = {
|
||||
// 3.14.1版本后,欢迎语在此配置,英文逗号隔开 , 即可支持多个欢迎语打字效果。
|
||||
GREETING_WORDS: process.env.NEXT_PUBLIC_GREETING_WORDS || 'Hi,我是一个程序员, Hi,我是一个打工人,Hi,我是一个干饭人,欢迎来到我的博客🎉',
|
||||
|
||||
CAN_COPY: process.env.NEXT_PUBLIC_CAN_COPY || true, // 是否允许复制页面内容 默认允许
|
||||
CUSTOM_MENU: process.env.NEXT_PUBLIC_CUSTOM_MENU || false, // 支持Menu 类型,从3.12.0版本起,各主题将逐步支持灵活的二级菜单配置,替代了原来的Page类型,此配置是试验功能、默认关闭。
|
||||
|
||||
AUTHOR: process.env.NEXT_PUBLIC_AUTHOR || 'NotionNext', // 您的昵称 例如 tangly1024
|
||||
|
||||
@@ -29,6 +29,13 @@ export function GlobalContextProvider(props) {
|
||||
initTheme()
|
||||
}, [])
|
||||
|
||||
// 是否允许复制页面内容
|
||||
useEffect(() => {
|
||||
if (!BLOG.CAN_COPY) {
|
||||
document.getElementsByTagName('html')[0].classList.add('forbid-copy')
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const handleStart = (url) => {
|
||||
NProgress.start()
|
||||
|
||||
@@ -10,6 +10,12 @@ const Style = () => {
|
||||
.dark body{
|
||||
background-color: black;
|
||||
}
|
||||
// 文本不可选取
|
||||
.forbid-copy {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
|
||||
`}</style>
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@ const Style = () => {
|
||||
.dark body{
|
||||
background-color: black;
|
||||
}
|
||||
// 文本不可选取
|
||||
.forbid-copy {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
|
||||
/* fukasawa的首页响应式分栏 */
|
||||
#theme-fukasawa .grid-item {
|
||||
|
||||
@@ -11,6 +11,12 @@ const Style = () => {
|
||||
.dark body{
|
||||
background-color: black;
|
||||
}
|
||||
// 文本不可选取
|
||||
.forbid-copy {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
|
||||
`}</style>
|
||||
}
|
||||
|
||||
@@ -10,6 +10,12 @@ const Style = () => {
|
||||
background-color: #f7f9fe;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
// 文本不可选取
|
||||
.forbid-copy {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
|
||||
// 公告栏中的字体固定白色
|
||||
#theme-heo #announcement-content .notion{
|
||||
|
||||
@@ -13,6 +13,12 @@ const Style = () => {
|
||||
.dark body{
|
||||
background-color: black;
|
||||
}
|
||||
// 文本不可选取
|
||||
.forbid-copy {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
|
||||
/* 菜单下划线动画 */
|
||||
#theme-hexo .menu-link {
|
||||
|
||||
@@ -10,6 +10,12 @@ const Style = () => {
|
||||
.test {
|
||||
text-color: red;
|
||||
}
|
||||
// 文本不可选取
|
||||
.forbid-copy {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
|
||||
`}</style>
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@ const Style = () => {
|
||||
.dark body{
|
||||
background-color: black;
|
||||
}
|
||||
// 文本不可选取
|
||||
.forbid-copy {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
|
||||
/* 设置了从上到下的渐变黑色 */
|
||||
#theme-matery .header-cover::before {
|
||||
|
||||
@@ -11,6 +11,12 @@ const Style = () => {
|
||||
.dark body{
|
||||
background-color: black;
|
||||
}
|
||||
// 文本不可选取
|
||||
.forbid-copy {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
|
||||
`}</style>
|
||||
}
|
||||
|
||||
@@ -14,6 +14,12 @@ const Style = () => {
|
||||
.dark body{
|
||||
background-color: black;
|
||||
}
|
||||
// 文本不可选取
|
||||
.forbid-copy {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
|
||||
`}</style>
|
||||
}
|
||||
|
||||
@@ -11,6 +11,12 @@ const Style = () => {
|
||||
.dark body{
|
||||
background-color: black;
|
||||
}
|
||||
// 文本不可选取
|
||||
.forbid-copy {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
|
||||
`}</style>
|
||||
}
|
||||
|
||||
@@ -10,6 +10,12 @@ const Style = () => {
|
||||
.dark body{
|
||||
background-color: black;
|
||||
}
|
||||
// 文本不可选取
|
||||
.forbid-copy {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
`}</style>
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,12 @@ const Style = () => {
|
||||
.dark body{
|
||||
background-color: black;
|
||||
}
|
||||
// 文本不可选取
|
||||
.forbid-copy {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
}
|
||||
|
||||
#theme-simple #announcement-content {
|
||||
/* background-color: #f6f6f6; */
|
||||
|
||||
Reference in New Issue
Block a user