mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-07 15:10:32 +00:00
Merge pull request #2417 from Phillweston/original-main-fix-DOMException
Fix dom exception problem
This commit is contained in:
10
.github/workflows/docker-ghcr.yaml
vendored
10
.github/workflows/docker-ghcr.yaml
vendored
@@ -28,16 +28,16 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
# Login against a Docker registry except on PR
|
# Login against a Docker registry except on PR
|
||||||
# https://github.com/docker/login-action
|
# https://github.com/docker/login-action
|
||||||
- name: Log into registry ${{ env.REGISTRY }}
|
- name: Log into registry ${{ env.REGISTRY }}
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
@@ -47,14 +47,14 @@ jobs:
|
|||||||
# https://github.com/docker/metadata-action
|
# https://github.com/docker/metadata-action
|
||||||
- name: Extract Docker metadata
|
- name: Extract Docker metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v3
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
|
||||||
# Build and push Docker image with Buildx (don't push on PR)
|
# Build and push Docker image with Buildx (don't push on PR)
|
||||||
# https://github.com/docker/build-push-action
|
# https://github.com/docker/build-push-action
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|||||||
4
.github/workflows/pushUrl.yml
vendored
4
.github/workflows/pushUrl.yml
vendored
@@ -24,11 +24,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest # 运行环境为最新版的Ubuntu
|
runs-on: ubuntu-latest # 运行环境为最新版的Ubuntu
|
||||||
steps:
|
steps:
|
||||||
- name: 'Checkout codes' # 步骤一,获取仓库代码
|
- name: 'Checkout codes' # 步骤一,获取仓库代码
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
# - name: 'Run baiduPush' # 步骤二,执行sh命令文件
|
# - name: 'Run baiduPush' # 步骤二,执行sh命令文件
|
||||||
# run: npm install && npm run baiduPush # 运行目录是仓库根目录
|
# run: npm install && npm run baiduPush # 运行目录是仓库根目录
|
||||||
- name: Set up Python 3.8
|
- name: Set up Python 3.8
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.8
|
python-version: 3.8
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/sync.yaml
vendored
2
.github/workflows/sync.yaml
vendored
@@ -17,7 +17,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
# Step 1: run a standard checkout action
|
# Step 1: run a standard checkout action
|
||||||
- name: Checkout target repo
|
- name: Checkout target repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# Step 2: run the sync action
|
# Step 2: run the sync action
|
||||||
- name: Sync upstream changes
|
- name: Sync upstream changes
|
||||||
|
|||||||
@@ -545,7 +545,7 @@ const BLOG = {
|
|||||||
process.env.ENABLE_CACHE ||
|
process.env.ENABLE_CACHE ||
|
||||||
process.env.npm_lifecycle_event === 'build' ||
|
process.env.npm_lifecycle_event === 'build' ||
|
||||||
process.env.npm_lifecycle_event === 'export', // 在打包过程中默认开启缓存,开发或运行时开启此功能意义不大。
|
process.env.npm_lifecycle_event === 'export', // 在打包过程中默认开启缓存,开发或运行时开启此功能意义不大。
|
||||||
isProd: process.env.VERCEL_ENV === 'production' || process.env.EXPORT, // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables) isProd: process.env.VERCEL_ENV === 'production' // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables)
|
isProd: process.env.VERCEL_ENV === 'production' || process.env.EXPORT, // distinguish between development and production environment (ref: https://vercel.com/docs/environment-variables#system-environment-variables)
|
||||||
BUNDLE_ANALYZER: process.env.ANALYZE === 'true' || false, // 是否展示编译依赖内容与大小
|
BUNDLE_ANALYZER: process.env.ANALYZE === 'true' || false, // 是否展示编译依赖内容与大小
|
||||||
VERSION: process.env.NEXT_PUBLIC_VERSION // 版本号
|
VERSION: process.env.NEXT_PUBLIC_VERSION // 版本号
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,19 +24,19 @@ const Ackee = () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Enable or disable tracking of personal data.
|
* Enable or disable tracking of personal data.
|
||||||
* We recommend to ask the user for permission before turning this option on.
|
* We recommend to ask the user for permission before turning this option on.
|
||||||
*/
|
*/
|
||||||
detailed: true,
|
detailed: true,
|
||||||
/*
|
/*
|
||||||
* Enable or disable tracking when on localhost.
|
* Enable or disable tracking when on localhost.
|
||||||
*/
|
*/
|
||||||
ignoreLocalhost: false,
|
ignoreLocalhost: false,
|
||||||
/*
|
/*
|
||||||
* Enable or disable the tracking of your own visits.
|
* Enable or disable the tracking of your own visits.
|
||||||
* This is enabled by default, but should be turned off when using a wildcard Access-Control-Allow-Origin header.
|
* This is enabled by default, but should be turned off when using a wildcard Access-Control-Allow-Origin header.
|
||||||
* Some browsers strictly block third-party cookies. The option won't have an impact when this is the case.
|
* Some browsers strictly block third-party cookies. The option won't have an impact when this is the case.
|
||||||
*/
|
*/
|
||||||
ignoreOwnVisits: false
|
ignoreOwnVisits: false
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -117,12 +117,14 @@ export default function CustomContextMenu(props) {
|
|||||||
function handleCopy() {
|
function handleCopy() {
|
||||||
const selectedText = document.getSelection().toString()
|
const selectedText = document.getSelection().toString()
|
||||||
if (selectedText) {
|
if (selectedText) {
|
||||||
const tempInput = document.createElement('input')
|
const tempInput = document.createElement('input');
|
||||||
tempInput.value = selectedText
|
tempInput.value = selectedText;
|
||||||
document.body.appendChild(tempInput)
|
document.body.appendChild(tempInput);
|
||||||
tempInput.select()
|
tempInput.select();
|
||||||
document.execCommand('copy')
|
document.execCommand('copy');
|
||||||
document.body.removeChild(tempInput)
|
if (tempInput && tempInput.parentNode && tempInput.parentNode.contains(tempInput)) {
|
||||||
|
tempInput.parentNode.removeChild(tempInput);
|
||||||
|
}
|
||||||
// alert("Text copied: " + selectedText);
|
// alert("Text copied: " + selectedText);
|
||||||
} else {
|
} else {
|
||||||
// alert("Please select some text first.");
|
// alert("Please select some text first.");
|
||||||
|
|||||||
@@ -24,7 +24,9 @@ export default function DifyChatbot() {
|
|||||||
return () => {
|
return () => {
|
||||||
// 在组件卸载时清理 script 标签
|
// 在组件卸载时清理 script 标签
|
||||||
const existingScript = document.getElementById(siteConfig('DIFY_CHATBOT_TOKEN')); // 注意调用 siteConfig()
|
const existingScript = document.getElementById(siteConfig('DIFY_CHATBOT_TOKEN')); // 注意调用 siteConfig()
|
||||||
if (existingScript) document.body.removeChild(existingScript);
|
if (existingScript && existingScript.parentNode && existingScript.parentNode.contains(existingScript)) {
|
||||||
|
existingScript.parentNode.removeChild(existingScript);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}, []); // 注意依赖数组为空,意味着脚本将仅在加载页面时执行一次
|
}, []); // 注意依赖数组为空,意味着脚本将仅在加载页面时执行一次
|
||||||
|
|
||||||
|
|||||||
@@ -186,10 +186,19 @@ const ExternalPlugin = props => {
|
|||||||
async
|
async
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: `
|
__html: `
|
||||||
(function(c,l,a,r,i,t,y){
|
(function(c, l, a, r, i, t, y) {
|
||||||
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
c[a] = c[a] || function() {
|
||||||
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
(c[a].q = c[a].q || []).push(arguments);
|
||||||
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
};
|
||||||
|
t = l.createElement(r);
|
||||||
|
t.async = 1;
|
||||||
|
t.src = "https://www.clarity.ms/tag/" + i;
|
||||||
|
y = l.getElementsByTagName(r)[0];
|
||||||
|
if (y && y.parentNode) {
|
||||||
|
y.parentNode.insertBefore(t, y);
|
||||||
|
} else {
|
||||||
|
l.head.appendChild(t);
|
||||||
|
}
|
||||||
})(window, document, "clarity", "script", "${CLARITY_ID}");
|
})(window, document, "clarity", "script", "${CLARITY_ID}");
|
||||||
`
|
`
|
||||||
}}
|
}}
|
||||||
@@ -204,8 +213,24 @@ const ExternalPlugin = props => {
|
|||||||
async
|
async
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: `
|
__html: `
|
||||||
(function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/daf1a94b.js","daovoice")
|
(function(i, s, o, g, r, a, m) {
|
||||||
`
|
i["DaoVoiceObject"] = r;
|
||||||
|
i[r] = i[r] || function() {
|
||||||
|
(i[r].q = i[r].q || []).push(arguments);
|
||||||
|
};
|
||||||
|
i[r].l = 1 * new Date();
|
||||||
|
a = s.createElement(o);
|
||||||
|
m = s.getElementsByTagName(o)[0];
|
||||||
|
a.async = 1;
|
||||||
|
a.src = g;
|
||||||
|
a.charset = "utf-8";
|
||||||
|
if (m && m.parentNode) {
|
||||||
|
m.parentNode.insertBefore(a, m);
|
||||||
|
} else {
|
||||||
|
s.head.appendChild(a);
|
||||||
|
}
|
||||||
|
})(window, document, "script", ('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/daf1a94b.js", "daovoice")
|
||||||
|
`
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<script
|
<script
|
||||||
|
|||||||
@@ -116,7 +116,11 @@ class MessengerCustomerChat extends Component {
|
|||||||
js = d.createElement(s);
|
js = d.createElement(s);
|
||||||
js.id = id;
|
js.id = id;
|
||||||
js.src = `https://connect.facebook.net/${language}/sdk/xfbml.customerchat.js`;
|
js.src = `https://connect.facebook.net/${language}/sdk/xfbml.customerchat.js`;
|
||||||
fjs.parentNode.insertBefore(js, fjs);
|
if (fjs && fjs.parentNode && fjs.parentNode.contains(fjs)) {
|
||||||
|
fjs.parentNode.insertBefore(js, fjs);
|
||||||
|
} else {
|
||||||
|
document.body.appendChild(js);
|
||||||
|
}
|
||||||
})(document, 'script', 'facebook-jssdk');
|
})(document, 'script', 'facebook-jssdk');
|
||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export function PWA(post, siteInfo) {
|
|||||||
|
|
||||||
// 删除已有的 manifest link 元素(如果存在)
|
// 删除已有的 manifest link 元素(如果存在)
|
||||||
const existingManifest = document.querySelector('link[rel="manifest"]')
|
const existingManifest = document.querySelector('link[rel="manifest"]')
|
||||||
if (existingManifest) {
|
if (existingManifest && existingManifest.parentNode && existingManifest.parentNode.contains(existingManifest)) {
|
||||||
existingManifest.parentNode.removeChild(existingManifest)
|
existingManifest.parentNode.removeChild(existingManifest)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ const loadPrismThemeCSS = (isDarkMode, prismThemeSwitch, prismThemeDarkPath, pri
|
|||||||
PRISM_PREVIOUS = prismThemeDarkPath
|
PRISM_PREVIOUS = prismThemeDarkPath
|
||||||
}
|
}
|
||||||
const previousTheme = document.querySelector(`link[href="${PRISM_PREVIOUS}"]`)
|
const previousTheme = document.querySelector(`link[href="${PRISM_PREVIOUS}"]`)
|
||||||
if (previousTheme) {
|
if (previousTheme && previousTheme.parentNode && previousTheme.parentNode.contains(previousTheme)) {
|
||||||
previousTheme.parentNode.removeChild(previousTheme)
|
previousTheme.parentNode.removeChild(previousTheme)
|
||||||
}
|
}
|
||||||
loadExternalResource(PRISM_THEME, 'css')
|
loadExternalResource(PRISM_THEME, 'css')
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { useEffect } from 'react';
|
|||||||
*/
|
*/
|
||||||
const useAdjustStyle = () => {
|
const useAdjustStyle = () => {
|
||||||
/**
|
/**
|
||||||
* 避免 callout 含有图片时溢出撑开父容器
|
* 避免 callout 含有图片时溢出撑开父容器
|
||||||
*/
|
*/
|
||||||
const adjustCalloutImg = () => {
|
const adjustCalloutImg = () => {
|
||||||
const callOuts = document.querySelectorAll('.notion-callout-text');
|
const callOuts = document.querySelectorAll('.notion-callout-text');
|
||||||
callOuts.forEach((callout) => {
|
callOuts.forEach((callout) => {
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ bszCaller = {
|
|||||||
return function (t) {
|
return function (t) {
|
||||||
ready(function () {
|
ready(function () {
|
||||||
try {
|
try {
|
||||||
e(t), scriptTag && scriptTag.parentElement && scriptTag.parentElement.removeChild && scriptTag.parentElement.removeChild(scriptTag)
|
e(t)
|
||||||
|
if (scriptTag && scriptTag.parentElement && scriptTag.parentElement.contains(scriptTag)) {
|
||||||
|
scriptTag.parentElement.removeChild(scriptTag)
|
||||||
|
}
|
||||||
} catch (t) {
|
} catch (t) {
|
||||||
// console.log(t), bszTag.hides()
|
// console.log(t), bszTag.hides()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,6 +185,10 @@ const nextConfig = {
|
|||||||
'themes',
|
'themes',
|
||||||
THEME
|
THEME
|
||||||
)
|
)
|
||||||
|
// Enable source maps in development mode
|
||||||
|
if (process.env.NODE_ENV_API === 'development') {
|
||||||
|
config.devtool = 'source-map'
|
||||||
|
}
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
experimental: {
|
experimental: {
|
||||||
@@ -201,7 +205,6 @@ const nextConfig = {
|
|||||||
},
|
},
|
||||||
publicRuntimeConfig: {
|
publicRuntimeConfig: {
|
||||||
// 这里的配置既可以服务端获取到,也可以在浏览器端获取到
|
// 这里的配置既可以服务端获取到,也可以在浏览器端获取到
|
||||||
NODE_ENV_API: process.env.NODE_ENV_API || 'prod',
|
|
||||||
THEMES: themes
|
THEMES: themes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ const idFlutteringRibbon = 'canvasFlutteringRibbon'
|
|||||||
|
|
||||||
function destroyFlutteringRibbon() {
|
function destroyFlutteringRibbon() {
|
||||||
const ribbon = document.getElementById(idFlutteringRibbon)
|
const ribbon = document.getElementById(idFlutteringRibbon)
|
||||||
if (ribbon && ribbon.parentNode) {
|
if (ribbon && ribbon.parentNode && ribbon.parentNode.contains(ribbon)) {
|
||||||
ribbon.parentNode.removeChild(ribbon)
|
ribbon.parentNode.removeChild(ribbon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ function createNest() {
|
|||||||
|
|
||||||
function destroyNest() {
|
function destroyNest() {
|
||||||
const nest = document.getElementById(idNest)
|
const nest = document.getElementById(idNest)
|
||||||
if(nest && nest.parentNode){
|
if (nest && nest.parentNode && nest.parentNode.contains(nest)) {
|
||||||
nest.parentNode.removeChild(nest)
|
nest.parentNode.removeChild(nest)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ function createRibbon() {
|
|||||||
|
|
||||||
function destroyRibbon() {
|
function destroyRibbon() {
|
||||||
const ribbon = document.getElementById(idRibbon)
|
const ribbon = document.getElementById(idRibbon)
|
||||||
if (ribbon && ribbon.parentNode) {
|
if (ribbon && ribbon.parentNode && ribbon.parentNode.contains(ribbon)) {
|
||||||
ribbon.parentNode.removeChild(ribbon)
|
ribbon.parentNode.removeChild(ribbon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,9 +165,11 @@ function createSakura() {
|
|||||||
function stopp() {
|
function stopp() {
|
||||||
if (staticx) {
|
if (staticx) {
|
||||||
var child = document.getElementById(id)
|
var child = document.getElementById(id)
|
||||||
child.parentNode.removeChild(child)
|
if (child && child.parentNode && child.parentNode.contains(child)) {
|
||||||
window.cancelAnimationFrame(stop)
|
child.parentNode.removeChild(child)
|
||||||
staticx = false
|
window.cancelAnimationFrame(stop)
|
||||||
|
staticx = false
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
startSakura()
|
startSakura()
|
||||||
}
|
}
|
||||||
@@ -177,7 +179,7 @@ function createSakura() {
|
|||||||
// 销毁樱花雨
|
// 销毁樱花雨
|
||||||
function destroySakura() {
|
function destroySakura() {
|
||||||
const sakura = document.getElementById(idSakura)
|
const sakura = document.getElementById(idSakura)
|
||||||
if (sakura && sakura.parentNode) {
|
if (sakura && sakura.parentNode && sakura.parentNode.contains(sakura)) {
|
||||||
sakura.parentNode.removeChild(sakura)
|
sakura.parentNode.removeChild(sakura)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -258,7 +258,11 @@ const LayoutSlug = props => {
|
|||||||
videoWrapper.appendChild(figCaptionWrapper)
|
videoWrapper.appendChild(figCaptionWrapper)
|
||||||
}
|
}
|
||||||
// 放入页面
|
// 放入页面
|
||||||
notionArticle.insertBefore(videoWrapper, notionArticle.firstChild)
|
if (notionArticle.firstChild && notionArticle.contains(notionArticle.firstChild)) {
|
||||||
|
notionArticle.insertBefore(videoWrapper, notionArticle.firstChild)
|
||||||
|
} else {
|
||||||
|
notionArticle.appendChild(videoWrapper)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,9 @@ const checkThemeDOM = () => {
|
|||||||
elements[elements.length - 1].scrollIntoView()
|
elements[elements.length - 1].scrollIntoView()
|
||||||
// 删除前面的元素,只保留最后一个元素
|
// 删除前面的元素,只保留最后一个元素
|
||||||
for (let i = 0; i < elements.length - 1; i++) {
|
for (let i = 0; i < elements.length - 1; i++) {
|
||||||
elements[i].parentNode.removeChild(elements[i])
|
if (elements[i] && elements[i].parentNode && elements[i].parentNode.contains(elements[i])) {
|
||||||
|
elements[i].parentNode.removeChild(elements[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user