A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: test custome content
shuaif2120ff582e3
diff --git a/answer.db b/answer.dbnew file mode 100644index 00000000..e69de29bdiff --git a/cmd/wire_gen.go b/cmd/wire_gen.goindex e9967e83..8701284a 100644--- a/cmd/wire_gen.go+++ b/cmd/wire_gen.go@@ -1,28 +1,8 @@-//go:build !wireinject-// +build !wireinject--/*- * Licensed to the Apache Software Foundation (ASF) under one- * or more contributor license agreements. See the NOTICE file- * distributed with this work for additional information- * regarding copyright ownership. The ASF licenses this file- * to you under the Apache License, Version 2.0 (the- * "License"); you may not use this file except in compliance- * with the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing,- * software distributed under the License is distributed on an- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY- * KIND, either express or implied. See the License for the- * specific language governing permissions and limitations- * under the License.- */-// Code generated by Wire. DO NOT EDIT.//go:generate go run github.com/google/wire/cmd/wire+//go:build !wireinject+// +build !wireinjectpackage answercmddiff --git a/internal/service/mock/siteinfo_repo_mock.go b/internal/service/mock/siteinfo_repo_mock.goindex abc1fe07..cdc72b80 100644--- a/internal/service/mock/siteinfo_repo_mock.go+++ b/internal/service/mock/siteinfo_repo_mock.go@@ -1,22 +1,3 @@-/*- * Licensed to the Apache Software Foundation (ASF) under one- * or more contributor license agreements. See the NOTICE file- * distributed with this work for additional information- * regarding copyright ownership. The ASF licenses this file- * to you under the Apache License, Version 2.0 (the- * "License"); you may not use this file except in compliance- * with the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing,- * software distributed under the License is distributed on an- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY- * KIND, either express or implied. See the License for the- * specific language governing permissions and limitations- * under the License.- */-// Code generated by MockGen. DO NOT EDIT.// Source: ./siteinfo_service.godiff --git a/ui/public/index.html b/ui/public/index.htmlindex f15dd970..d6b62ab2 100644--- a/ui/public/index.html+++ b/ui/public/index.html@@ -30,7 +30,10 @@<body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root">-+ <!--customize_header-->+ 这部分是header233+ <h1>123</h1>+ <!--customize_header--><div id="spin-mask"><noscript><style>diff --git a/ui/src/components/Customize/index.tsx b/ui/src/components/Customize/index.tsxindex 314244a6..aa233678 100644--- a/ui/src/components/Customize/index.tsx+++ b/ui/src/components/Customize/index.tsx@@ -68,6 +68,7 @@ type pos = 'afterbegin' | 'beforeend';const renderCustomArea = (el, part, pos: pos, content: string = '') => {let startMarkNode;let endMarkNode;+ let accumulatedContent = ''; //const { childNodes } = el;for (let i = 0; i < childNodes.length; i += 1) {const node = childNodes[i];@@ -80,6 +81,30 @@ const renderCustomArea = (el, part, pos: pos, content: string = '') => {}}}++ // Iterate over all nodes between startMarkNode and endMarkNode.+ if (startMarkNode && endMarkNode) {+ let contentNode = startMarkNode.nextSibling;+ while (contentNode && contentNode !== endMarkNode) {+ if (contentNode.nodeType === 1) {+ // element node+ accumulatedContent += contentNode.outerHTML;+ } else if (contentNode.nodeType === 3) {+ // text node+ accumulatedContent += contentNode.textContent;+ }+ contentNode = contentNode.nextSibling;+ }+ }++ console.log('====', accumulatedContent);++ // 比较累积的内容和指定的内容+ if (accumulatedContent.includes(content)) {+ console.log('Content already exists. No insertion needed.');+ return;+ }+if (startMarkNode && endMarkNode) {while (startMarkNode.nextSibling &&@@ -106,6 +131,7 @@ const handleCustomHead = (content) => {const handleCustomHeader = (content) => {const el = document.body;+ console.log('====11', content);renderCustomArea(el, CUSTOM_MARK_HEADER, 'afterbegin', content);};