feat(demo): build a static editor preview for GitHub Pages

This commit is contained in:
eezd committed 2026-10-27 14:15:57 +08:00
1 parent 12d13327a6
commit 4645d3d11c
10 files changed
+57 -5

No files matched your search

+1
View File
@@ -1,4 +1,5 @@
{
"demo_notice": "Editor preview only. Changes are not saved; refreshing restores the sample.",
"retry_b8784c": "Retry",
"fonts_could_not_be_loaded_42a574": "Fonts could not be loaded. Check your connection and refresh the page.",
"refresh_page_9366e1": "Refresh page",
+1
View File
@@ -1,4 +1,5 @@
{
"demo_notice": "仅供编辑器预览。修改不会保存,刷新后恢复示例。",
"retry_b8784c": "重试",
"fonts_could_not_be_loaded_42a574": "字体加载失败,请检查网络后刷新页面。",
"refresh_page_9366e1": "刷新页面",
+27
View File
@@ -0,0 +1,27 @@
body {
margin: 0;
}
header {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px 16px;
padding: 12px 20px;
border-bottom: 1px solid var(--rm-divider);
font-size: var(--rm-ui-font-size);
}
header span {
flex: 1;
color: var(--rm-text-muted);
}
header a {
color: var(--rm-accent);
}
#app {
max-width: 960px;
margin-inline: auto;
}
+12
View File
@@ -1,14 +1,26 @@
import { watchFontLoading } from '@@/appearance/font-loading'
import { t } from '@@/i18n/runtime'
// Unauthenticated editor demo for automated performance and interaction tests.
import { createEditorState, createEditorView } from '../editor'
import sample from './sample.md?raw'
import '@/i18n'
import '@@/appearance/base.css'
import './demo.css'
// ?repeat=N repeats the sample N times for large-document performance testing.
const repeat = Number(new URLSearchParams(location.search).get('repeat') ?? 1)
const doc = Array.from({ length: Math.max(1, repeat) }).fill(sample).join('\n')
watchFontLoading()
const header = document.createElement('header')
const title = document.createElement('strong')
title.textContent = `RawMark ${__RAWMARK_RELEASE__}`
const notice = document.createElement('span')
notice.textContent = t('common.demo_notice')
const github = document.createElement('a')
github.href = 'https://github.com/eezd/RawMark'
github.textContent = 'GitHub'
header.append(title, notice, github)
document.body.prepend(header)
const view = createEditorView(document.getElementById('app')!, createEditorState({ doc }))
;(window as unknown as { rawmarkView: typeof view }).rawmarkView = view
+1 -1
View File
@@ -52,7 +52,7 @@ func main() {
## Images
![Sample image](https://vuejs.org/images/logo.png)
![RawMark icon](./icon.svg)
## Tables