feat: restructure wiki and notes, enhance Viewer component

- Removed obsolete theme index and documentation files.
- Deleted unused images and canvas files.
- Added new images for notes and updated canvas files.
- Enhanced Viewer component with improved zoom and fullscreen functionalities.
- Updated wiki configuration with new navigation and sidebar structure.
- Created new index pages for notes and wiki with categorized content.
- Updated links and references in markdown files to reflect new structure.
This commit is contained in:
2026-04-22 12:02:32 +08:00
parent 890105302a
commit d2425dc2be
26 changed files with 248 additions and 1248 deletions

6
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule ".obsidian/plugins/vitepress-exporter"]
path = .obsidian/plugins/vitepress-exporter
url = https://git.omoolab.xyz/icrdr/vitepress-exporter.git
[submodule ".obsidian/plugins/odox"]
path = .obsidian/plugins/odox
url = https://git.omoolab.xyz/icrdr/odox.git

1
.obsidian/plugins/odox vendored Submodule

Submodule .obsidian/plugins/odox added at 0e051b7293

View File

@@ -9,7 +9,7 @@
- 使用的依赖越少越好
- 选用简单直接的方式实现
- 代码、执行方式改变,调整已有的文档、计划,而非新建
- Markdown 中不使用`---`分割器
本地运行 action
```bash

View File

@@ -1,18 +1,36 @@
#!/bin/bash
# 检查 wiki 目录是否有变更
CHANGED_FILES=$(git diff --name-only wiki && git ls-files --others --exclude-standard wiki)
if [ -n "$CHANGED_FILES" ]; then
echo "检测到 wiki 目录有变更,正在提交..."
git add wiki
git commit -m "Update wiki"
else
echo "wiki 目录没有变更,跳过提交"
fi
# 自动获取当前 Git 分支名
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
# 获取仓库名称
REMOTE_URL=$(git remote get-url origin)
REPO_NAME=$(basename -s .git "$REMOTE_URL")
# 拼接 Tag 名称:wiki-分支名
TAG_NAME="wiki-$BRANCH_NAME"
echo "当前分支:$BRANCH_NAME"
echo "即将创建 Tag:$TAG_NAME"
# 创建本地 Tag
git tag "$TAG_NAME"
git tag -f "$TAG_NAME"
# 推送到远程仓库
git push origin "$TAG_NAME"
echo -e "\n✅ Tag 创建并推送成功:$TAG_NAME"
if git push origin -f "$TAG_NAME"; then
echo -e "\n✅ $BRANCH_NAME 创建并推送成功,等待部署完毕"
echo -e "\n🌍 部署地址:https://wiki.omoolab.com/$REPO_NAME/$BRANCH_NAME/"
else
echo -e "\n❌ $BRANCH_NAME 推送失败!"
exit 1
fi

View File

@@ -1,8 +0,0 @@
import { defineConfig } from 'vitepress'
// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "OmooLab",
description: "An OmooLab Project",
base: '/', // Replace with your repository name if deploying to GitHub Pages
})

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +0,0 @@
import DefaultTheme from 'vitepress/theme'
import Viewer from './components/Viewer.vue'
/** @type {import('vitepress').Theme} */
export default {
extends: DefaultTheme,
enhanceApp({ app }) {
app.component('Viewer', Viewer)
}
}

View File

@@ -1 +0,0 @@
# OmooLab Wiki

View File

@@ -1,7 +0,0 @@
# 测试笔记 - Canvas 导出
这是一个用于测试 Canvas 导出功能的笔记。
<Viewer src="/Untitled.png" />
<Viewer src="/canvas.png" />

Binary file not shown.

Binary file not shown.

BIN
notes/assets/20260421-074743.png LFS Normal file

Binary file not shown.

BIN
notes/assets/Untitled.png LFS Normal file

Binary file not shown.

View File

@@ -1,7 +0,0 @@
{
"nodes":[
{"id":"860c29754b1b08bf","type":"text","text":"sdfasdf\nasdfasdfasdf\n# fsadfs fasdf asdf asdf ","x":8640,"y":-4480,"width":496,"height":293},
{"id":"ad3484c9e0322d05","type":"text","text":"发色粉撒而非","x":5200,"y":-1840,"width":1920,"height":4946}
],
"edges":[]
}

View File

@@ -2,6 +2,6 @@
这是一个用于测试 Canvas 导出功能的笔记。
![](Untitled.canvas)
![](测试画板-2.canvas)
![[canvas.canvas]]
![[测试画板-1.canvas]]

View File

@@ -0,0 +1,14 @@
{
"nodes":[
{"id":"b42845a8ff7d51dc","x":6380,"y":-3440,"width":1330,"height":1418,"color":"3","type":"group","label":"Untitled group"},
{"id":"2780851064da9bdb","type":"file","file":"notes/assets/Untitled.png","x":6580,"y":-3160,"width":460,"height":460},
{"id":"596415dba7899135","type":"text","text":"发生的方式方式大幅\n\n撒地方士大夫三大发生的f\n\n的萨芬阿斯蒂芬撒地方\n\n\n撒地方撒地方啊色粉啊色粉\n\n啊色粉啊色粉啊色粉","x":7744,"y":-2649,"width":376,"height":313},
{"id":"860c29754b1b08bf","type":"text","text":"sdfasdf\nasdfasdfasdf\n# fsadfs fasdf asdf asdf ","x":6810,"y":-3310,"width":496,"height":300},
{"id":"ad3484c9e0322d05","type":"text","text":"发色粉撒而非","x":6360,"y":-2740,"width":500,"height":280},
{"id":"c494f34282f42d91","type":"file","file":"notes/assets/20260421-074743.png","x":7306,"y":-2938,"width":198,"height":198}
],
"edges":[
{"id":"a7a9eb1b8977f036","fromNode":"ad3484c9e0322d05","fromSide":"right","toNode":"c494f34282f42d91","toSide":"left"},
{"id":"fdb0bd6d9376876f","fromNode":"c494f34282f42d91","fromSide":"right","toNode":"596415dba7899135","toSide":"left"}
]
}

View File

@@ -5,4 +5,49 @@ export default defineConfig({
title: "OmooLab",
description: "An OmooLab Project",
base: '/', // Replace with your repository name if deploying to GitHub Pages
themeConfig: {
logo: '/logo.png',
siteTitle: false,
nav: [
{ text: '首页', link: '/' },
{ text: '记录', link: '/notes/' },
{ text: '我们', link: 'https://www.omoolab.xyz' }
],
sidebar: {
'/': [
{
text: '导航',
items: [
{ text: '首页', link: '/' },
{ text: '笔记列表', link: '/notes/' },
{ text: '测试笔记', link: '/notes/测试导出/' }
]
}
],
'/notes/': [
{
text: '笔记',
items: [
{ text: '所有笔记', link: '/notes/' },
{ text: '测试笔记', link: '/notes/测试导出/' }
]
},
{
text: '画板',
items: [
{ text: '测试画板 1', link: '/notes/测试画板-1.canvas/' },
{ text: '测试画板 2', link: '/notes/测试画板-2.canvas/' }
]
}
]
},
footer: {
message: '<a href="https://beian.miit.gov.cn/" target="_blank">浙ICP备2025208399号-1</a>',
copyright: 'Copyright © 2025-present OmooLab'
},
search: {
provider: 'local'
}
},
})

View File

@@ -1,10 +1,10 @@
<template>
<div class="viewer-wrapper">
<!-- 正常模式 -->
<div
v-show="!isFullscreen"
class="zoom-container"
ref="containerRef"
v-bind="attrs"
@wheel.prevent="handleWheel"
@mousedown="handleMouseDown"
@touchstart="handleTouchStart"
@@ -88,13 +88,19 @@
</div>
</div>
</Teleport>
</div>
</template>
<script setup>
import { ref, computed, onMounted, onUnmounted, watch, nextTick } from 'vue'
import { ref, computed, onMounted, onUnmounted, watch, nextTick, useAttrs } from 'vue'
import { withBase } from 'vitepress'
// 禁用自动属性继承,手动控制 style 应用
defineOptions({
inheritAttrs: false
})
const attrs = useAttrs()
const props = defineProps({
src: {
type: String,
@@ -297,6 +303,14 @@ const updateMinimapSize = () => {
width: `${width}px`,
height: `${height}px`
}
// 等待 DOM 更新后重新初始化小地图 canvas
nextTick(() => {
initMinimapCanvas(minimapCanvasRef.value, minimapRef.value, minimapCtx)
if (isFullscreen.value) {
initMinimapCanvas(fullscreenMinimapCanvasRef.value, fullscreenMinimapRef.value, fullscreenMinimapCtx)
}
})
}
// 获取当前应该使用的图片
@@ -340,6 +354,24 @@ const loadImage = () => {
img.src = withBase(props.src)
}
// 初始化小地图 canvas 的尺寸和 context
const initMinimapCanvas = (canvas, minimap, context) => {
if (!canvas || !minimap || !context) return
const dpr = window.devicePixelRatio || 1
const rect = minimap.getBoundingClientRect()
// 重置变换矩阵
context.setTransform(1, 0, 0, 1, 0, 0)
// 设置 canvas 实际分辨率
canvas.width = rect.width * dpr
canvas.height = rect.height * dpr
// 应用设备像素比缩放
context.scale(dpr, dpr)
}
// 调整Canvas尺寸
const resizeCanvas = () => {
if (!canvasRef.value || !containerRef.value) return
@@ -581,14 +613,10 @@ const renderMinimap = () => {
minimapAnimationFrameId = requestAnimationFrame(() => {
const dpr = window.devicePixelRatio || 1
// 设置小地图canvas尺寸
const rect = minimap.getBoundingClientRect()
canvas.width = rect.width * dpr
canvas.height = rect.height * dpr
// 清空小地图
ctx.clearRect(0, 0, canvas.width, canvas.height)
// 清空小地图(注意:canvas 已经在 initMinimapCanvas 中设置了正确的尺寸和 scale)
ctx.clearRect(0, 0, rect.width, rect.height)
// 计算小地图中图片的显示尺寸(保持宽高比)
const imgAspectRatio = currentImage.width / currentImage.height
@@ -613,10 +641,10 @@ const renderMinimap = () => {
0,
currentImage.width,
currentImage.height,
offsetX * dpr,
offsetY * dpr,
minimapImgWidth * dpr,
minimapImgHeight * dpr
offsetX,
offsetY,
minimapImgWidth,
minimapImgHeight
)
})
}
@@ -915,9 +943,10 @@ const toggleFullscreen = () => {
}
}
// 初始化全屏小地图 canvas
if (fullscreenMinimapCanvasRef.value) {
// 初始化全屏小地图 canvas 和 context
if (fullscreenMinimapCanvasRef.value && fullscreenMinimapRef.value) {
fullscreenMinimapCtx = fullscreenMinimapCanvasRef.value.getContext('2d')
initMinimapCanvas(fullscreenMinimapCanvasRef.value, fullscreenMinimapRef.value, fullscreenMinimapCtx)
}
document.body.style.overflow = 'hidden'
@@ -951,8 +980,9 @@ onMounted(() => {
loadImage()
window.addEventListener('resize', handleResize)
// 初始化小地图
// 初始化小地图 canvas
nextTick(() => {
initMinimapCanvas(minimapCanvasRef.value, minimapRef.value, minimapCtx)
renderMinimap()
})
})
@@ -994,16 +1024,10 @@ onUnmounted(() => {
</script>
<style scoped>
.viewer-wrapper {
width: 100%;
height: 100%;
}
.zoom-container {
position: relative;
width: 100%;
height: 100%;
min-height: 200px;
height: 400px;
overflow: hidden;
background: var(--vp-c-bg-soft);
border: 1px solid var(--vp-c-border);

View File

@@ -1 +1,26 @@
# OmooLab Wiki
# 风风风
## 📚 最新内容
### 测试笔记
测试 Canvas 导出功能和图片查看器组件
[查看笔记 →](/notes/测试导出/)
## 🗂️ 内容分类
### 笔记 & 文档
- [测试笔记](/notes/测试导出/) - Canvas 导出功能测试
### 画板
- [测试画板 1](/notes/测试画板-1.canvas/)
- [测试画板 2](/notes/测试画板-2.canvas/)
## 🔗 快速链接
- [关于我们](https://www.omoolab.xyz) - 了解更多关于 OmooLab 的信息
- [备案信息](https://beian.miit.gov.cn/) - 浙ICP备2025208399号-1

17
wiki/notes/index.md Normal file
View File

@@ -0,0 +1,17 @@
# 📝 笔记记录
这里收录了我们的学习和工作笔记。
## 📂 笔记列表
### 测试笔记
- [测试笔记 - Canvas 导出](./测试导出/) - 测试 Canvas 导出功能和图片查看器组件
## 🎨 画板
- [测试画板 1](./测试画板-1.canvas/) - 第一个测试画板
- [测试画板 2](./测试画板-2.canvas/) - 第二个测试画板
---
> 💡 **提示**:使用上方搜索框可以快速查找你需要的内容。

View File

@@ -1 +1 @@
<Viewer src="/测试画板-1.canvas.png" />
![](/测试画板-1.canvas.png)

BIN
wiki/public/logo.png LFS Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.