|
@@ -758,6 +758,40 @@ const processIframeLinks = async () => {
|
|
|
}
|
|
|
else if (iframeSrc.includes('.html') || iframeSrc.includes('.htm')) {
|
|
|
hasIframe = true
|
|
|
+
|
|
|
+ // 先尝试获取iframe的contentWindow,如果获取不到再使用HTML方式
|
|
|
+ try {
|
|
|
+ // 创建一个临时的iframe来测试是否能获取contentWindow
|
|
|
+ const tempIframe = document.createElement('iframe')
|
|
|
+ tempIframe.style.display = 'none'
|
|
|
+ tempIframe.src = iframeSrc
|
|
|
+
|
|
|
+ // 等待iframe加载完成
|
|
|
+ await new Promise((resolve, reject) => {
|
|
|
+ tempIframe.onload = resolve
|
|
|
+ tempIframe.onerror = reject
|
|
|
+ // 设置超时时间
|
|
|
+ setTimeout(() => reject(new Error('Timeout')), 5000)
|
|
|
+ })
|
|
|
+
|
|
|
+ // 尝试获取contentWindow
|
|
|
+ if (tempIframe.contentWindow) {
|
|
|
+ console.log(`iframe ${iframeSrc} 可以获取contentWindow,使用直接加载方式`)
|
|
|
+ // 移除临时iframe
|
|
|
+ document.body.removeChild(tempIframe)
|
|
|
+
|
|
|
+ return {
|
|
|
+ ...element,
|
|
|
+ isHTML: false,
|
|
|
+ url: iframeSrc
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (error) {
|
|
|
+ console.log(`iframe ${iframeSrc} 无法获取contentWindow,使用HTML方式:`, error)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果无法获取contentWindow,使用HTML方式
|
|
|
const html = await api.getHTML(iframeSrc)
|
|
|
// const html = await api.getHTML('https://knowledge.cocorobo.cn/zh-CN/story-telling/a7fa08b8-cf60-11ef-93e3-12e77c4cb76b')
|
|
|
console.log('html', html)
|
|
@@ -1543,8 +1577,10 @@ onUnmounted(() => {
|
|
|
}
|
|
|
|
|
|
.panel-content {
|
|
|
- margin-right: 48px;
|
|
|
+ margin-right: 52px;
|
|
|
padding: 0 8px;
|
|
|
+ height: calc(100% - 76px);
|
|
|
+ overflow: auto;
|
|
|
}
|
|
|
.layout-content-right.collapsed {
|
|
|
width: 48px;
|
|
@@ -1561,7 +1597,7 @@ onUnmounted(() => {
|
|
|
right: 0;
|
|
|
top: 60px;
|
|
|
bottom: 0;
|
|
|
- width: 48px;
|
|
|
+ width: 52px;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
gap: 8px;
|
|
@@ -1573,9 +1609,9 @@ onUnmounted(() => {
|
|
|
}
|
|
|
|
|
|
.side-nav-btn {
|
|
|
- width: 40px;
|
|
|
- height: 40px;
|
|
|
- min-height: 40px;
|
|
|
+ width: 45px;
|
|
|
+ height: 45px;
|
|
|
+ min-height: 45px;
|
|
|
border: 1px solid #d9d9d9;
|
|
|
background: #fff;
|
|
|
border-radius: 6px;
|
|
@@ -1600,8 +1636,8 @@ onUnmounted(() => {
|
|
|
}
|
|
|
|
|
|
img {
|
|
|
- width: 20px;
|
|
|
- height: 20px;
|
|
|
+ width: 25px;
|
|
|
+ height: 25px;
|
|
|
object-fit: contain;
|
|
|
flex-shrink: 0;
|
|
|
}
|
|
@@ -1756,6 +1792,7 @@ onUnmounted(() => {
|
|
|
|
|
|
.thumbnails {
|
|
|
padding: 0;
|
|
|
+ height: 100%;
|
|
|
|
|
|
.viewer-header {
|
|
|
margin-bottom: 16px;
|