vscode-colaview 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +11 -3
- package/README_CN.md +11 -3
- package/RELEASE_NOTES.md +24 -0
- package/package.json +2 -2
- package/src/export/render-export-images.ts +22 -8
- package/src/export/theme-style.ts +56 -16
- package/src/preview/preview-manager.ts +16 -16
- package/src/preview/webview/app.ts +11 -7
- package/src/preview/webview/index.html +17 -5
- package/src/themes/built-in/bear.css +1 -1
- package/src/themes/built-in/dark.css +9 -1
- package/src/themes/built-in/dracula.css +1 -5
- package/src/themes/built-in/elegant.css +5 -12
- package/src/themes/built-in/gruvbox.css +1 -5
- package/src/themes/built-in/light.css +1 -1
- package/src/themes/built-in/midnight.css +7 -3
- package/src/themes/built-in/nord.css +1 -5
- package/src/themes/built-in/notion.css +9 -11
- package/src/themes/built-in/sepia.css +3 -6
- package/src/themes/built-in/solarized-dark.css +1 -1
- package/src/themes/built-in/writer.css +9 -1
- package/patches/@bytechain.cn+colamd+2.7.11.patch +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.3.3] - 2026-11-14
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- **Engine upgrade: ColaMD 2.7.13-rc.1** — `@bytechain.cn/colamd` bumped from 2.7.12 to 2.7.13-rc.1. The engine now ships the CM6 whole-line `block: true` replace-decoration fix natively (mermaid always, block math / HTML blocks when covering full lines, tables always), and its own `.cm-md-mermaid` palette is page-based. The `patch-package` patch is retired — no more node_modules patching.
|
|
9
|
+
- **All 12 built-in theme files synced with ColaMD-extend** (the 2.7.12+ theme contract): refined border colors in every theme, Elegant drops the dead `--table-border` variable, Dark/Midnight/Writer add strong and inline-code accent colors, Notion replaces the link-underline rules with strong/URL colors, Dracula/Gruvbox/Nord/Midnight drop blockquote text overrides, Elegant/Sepia drop blockquote horizontal padding.
|
|
10
|
+
- **Mermaid diagrams now render on the page, not on the code block** — preview and HTML/PDF exports derive the `--pele-*` tokens from `--bg-color`/`--text-color` (18%/28%/45% mixes, same ratios as the engine) instead of `--code-block-bg`/`--code-block-text`, and no longer paint a code-block background behind the diagram. This matches ColaMD-extend 2.7.13-rc.1: diagrams are dark-lines-on-paper in light themes and light-lines-on-dark in dark themes. Most visible with Elegant/Bear, which previously drew pale lines on the dark code-block background.
|
|
11
|
+
- **Word export color rules hardened** (mirroring ColaMD-extend `docx-style.ts`) — dark themes fall back entirely to the light palette (Word is white paper; light-on-dark text would be invisible), and light themes with a dark code block (Elegant/Bear) render diagrams on a white background with the body text color instead of pale code-block text on white.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
- **Theme-file variables were inert in the preview** — the engine writes the same variables on `body.theme-x` (specificity 0,1,1), which always beat the injected `:root` block (0,1,0), so the built-in and custom theme files' variable values never took effect in the preview (while their element rules did, producing mixed rendering). Theme CSS is now injected as `:root, body.theme-x` so it wins, and HTML exports apply the same scoping — preview and export stay identical.
|
|
15
|
+
|
|
16
|
+
### Removed
|
|
17
|
+
- `patches/` — the CM6 `block: true` patch is no longer needed with engine 2.7.13-rc.1 (`patch-package` stays wired through `postinstall` and simply finds nothing to apply).
|
|
18
|
+
|
|
5
19
|
## [0.3.2] - 2026-11-07
|
|
6
20
|
|
|
7
21
|
### Fixed
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://code.visualstudio.com/)
|
|
4
4
|
[](https://www.typescriptlang.org/)
|
|
5
5
|
[](LICENSE)
|
|
6
|
-
[](package.json)
|
|
7
7
|
|
|
8
8
|
Rich Markdown preview & PDF/HTML/Word export for VS Code — powered by [ColaMD](https://github.com/byteuser1977/ColaMD-extend) rendering engine (CodeMirror 6 based).
|
|
9
9
|
|
|
@@ -206,11 +206,19 @@ npm run package
|
|
|
206
206
|
|
|
207
207
|
### Build System
|
|
208
208
|
|
|
209
|
-
The project uses **esbuild** for bundling — the extension side (`out/extension.js`) is a small CJS bundle with only VS Code API imports. The WebView side (`out/preview/webview/app.js`) is an IIFE bundle containing the full ColaMD 2.7.
|
|
209
|
+
The project uses **esbuild** for bundling — the extension side (`out/extension.js`) is a small CJS bundle with only VS Code API imports. The WebView side (`out/preview/webview/app.js`) is an IIFE bundle containing the full ColaMD 2.7.13-rc.1 rendering engine (CodeMirror 6 + Mermaid + KaTeX) — approximately 3.5MB unminified, gzip ~400KB. Resource files (CSS, WebView HTML, KaTeX stylesheet, Mermaid script) are copied to `out/` during build so they survive `.vscodeignore` packaging.
|
|
210
210
|
|
|
211
211
|
## Changelog
|
|
212
212
|
|
|
213
|
-
### v0.3.
|
|
213
|
+
### v0.3.3 (Current)
|
|
214
|
+
|
|
215
|
+
- **🔧 Engine Upgrade — ColaMD 2.7.13-rc.1, No More Patches** — the CM6 whole-line replace-decoration fix (`block: true`, previously a `patch-package` patch) is now native to the engine and extended to tables and HTML blocks; the `patches/` directory is gone. The engine's mermaid palette is page-based as well.
|
|
216
|
+
- **🎨 Mermaid Diagrams Drawn on the Page** — preview and HTML/PDF exports derive the `--pele-*` tokens from page colors (`--bg-color`/`--text-color`, 18%/28%/45% mixes) instead of code-block colors, and no longer paint a code-block background behind diagrams — matching ColaMD-extend 2.7.13-rc.1. Most visible with Elegant/Bear, which previously drew pale lines on the dark code block.
|
|
217
|
+
- **🐛 Theme Variables Actually Apply Now** — the engine's `body.theme-x` variables (specificity 0,1,1) always beat the injected `:root` (0,1,0), so theme-file variable values were ignored in the preview. Theme CSS is now injected as `:root, body.theme-x`; exports apply the same scoping.
|
|
218
|
+
- **🎨 All 12 Built-in Themes Synced with ColaMD-extend** — border colors refined in every theme; Dark/Midnight/Writer add strong/inline-code accents; Notion swaps link underlines for strong/URL colors; blockquote overrides trimmed; Elegant drops the dead `--table-border` variable.
|
|
219
|
+
- **🎨 Word Export: Readable Colors on White Paper** — dark themes fall back entirely to the light palette; light themes with a dark code block (Elegant/Bear) draw diagrams on white with body-text color.
|
|
220
|
+
|
|
221
|
+
### v0.3.2
|
|
214
222
|
|
|
215
223
|
- **🐛 PDF/HTML Export Fixed (`md is not defined`)** — exporting failed with "PDF export failed: md is not defined": a CSS comment inside the export stylesheet template literal contained unescaped backticks, which closed the literal early and made the parser treat part of the comment as JavaScript. Backticks are now escaped.
|
|
216
224
|
- **🐛 PDF/HTML Mermaid Diagrams Centered** — the engine serializes mermaid blocks as class-stripped `<p><svg class="pele pele-…">…</svg></p>`, so the previous `div:has(> svg.pele)` export rule never matched and diagrams were left-aligned on paper. Centering now applies to `svg.pele` itself (`display: block; margin: 0 auto`), independent of the wrapper element.
|
package/README_CN.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://code.visualstudio.com/)
|
|
4
4
|
[](https://www.typescriptlang.org/)
|
|
5
5
|
[](LICENSE)
|
|
6
|
-
[](package.json)
|
|
7
7
|
|
|
8
8
|
VS Code 富文本 Markdown 预览与 PDF/HTML/Word 导出扩展 — 基于 [ColaMD](https://github.com/byteuser1977/ColaMD-extend) 渲染引擎(CodeMirror 6 内核)。
|
|
9
9
|
|
|
@@ -206,11 +206,19 @@ npm run package
|
|
|
206
206
|
|
|
207
207
|
### 构建系统
|
|
208
208
|
|
|
209
|
-
项目使用 **esbuild** 打包 — 扩展端(`out/extension.js`)是一个仅依赖 VS Code API 的小型 CJS bundle。WebView 端(`out/preview/webview/app.js`)是包含完整 ColaMD 2.7.
|
|
209
|
+
项目使用 **esbuild** 打包 — 扩展端(`out/extension.js`)是一个仅依赖 VS Code API 的小型 CJS bundle。WebView 端(`out/preview/webview/app.js`)是包含完整 ColaMD 2.7.13-rc.1 渲染引擎(CodeMirror 6 + Mermaid + KaTeX)的 IIFE bundle — 未压缩约 3.5MB,gzip 后约 400KB。构建时自动复制资源文件(CSS、WebView HTML、KaTeX 样式表、Mermaid 脚本)到 `out/` 目录,确保打包安装后功能正常。
|
|
210
210
|
|
|
211
211
|
## 更新日志
|
|
212
212
|
|
|
213
|
-
### v0.3.
|
|
213
|
+
### v0.3.3(当前版本)
|
|
214
|
+
|
|
215
|
+
- **🔧 引擎升级 — ColaMD 2.7.13-rc.1,告别补丁** — CM6 整行 replace 装饰的 `block: true` 修复(此前靠 `patch-package` 固化)已随引擎原生发布,并扩展到表格与 HTML 块;`patches/` 目录已移除。引擎自身的 mermaid 配色也已页面化。
|
|
216
|
+
- **🎨 Mermaid 图画在页面上** — 预览与 HTML/PDF 导出的 `--pele-*` 令牌改由页面颜色(`--bg-color`/`--text-color`,18%/28%/45% 混合)推导,不再按代码块配色、不再给图铺代码块底色,与 ColaMD-extend 2.7.13-rc.1 一致。Elegant/Bear 此前把浅色线条画在深色代码块上,差异最明显。
|
|
217
|
+
- **🐛 主题变量真正生效** — 引擎把同一批变量写在 `body.theme-x`(特异性 0,1,1)上,永远压过注入的 `:root`(0,1,0),主题文件里的变量值在预览中一直被忽略。主题 CSS 现以 `:root, body.theme-x` 注入;导出端同样处理。
|
|
218
|
+
- **🎨 12 套内置主题与 ColaMD-extend 同步** — 全部主题边框色微调;Dark/Midnight/Writer 新增加粗/行内代码强调色;Notion 以 strong/URL 颜色替代链接下划线;引用块覆盖规则精简;Elegant 移除失效的 `--table-border` 变量。
|
|
219
|
+
- **🎨 Word 导出:白纸上的可读配色** — 深色主题整体回落浅色板;浅色主题配深色代码块(Elegant/Bear)时图表以白底 + 正文色绘制。
|
|
220
|
+
|
|
221
|
+
### v0.3.2
|
|
214
222
|
|
|
215
223
|
- **🐛 修复 PDF/HTML 导出失败(`md is not defined`)** — 导出时报 "PDF export failed: md is not defined":导出样式模板字符串里的一段 CSS 注释含未转义的反引号,提前闭合了模板字面量,剩余注释被当成 JavaScript 解析。现已转义反引号,注释保持为注释。
|
|
216
224
|
- **🐛 修复 PDF/HTML 导出中 Mermaid 图未居中** — 引擎把 mermaid 块序列化成不带类名的 `<p><svg class="pele pele-…">…</svg></p>`,此前的 `div:has(> svg.pele)` 导出规则匹配不到,居中在纸面上失效。现把居中规则落到 `svg.pele` 自身(`display: block; margin: 0 auto`),与父级是 `<p>` 还是 `<div>` 无关。
|
package/RELEASE_NOTES.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Release Notes
|
|
2
2
|
|
|
3
|
+
## v0.3.3 (2026-11-14)
|
|
4
|
+
|
|
5
|
+
### 🔧 Engine Upgrade — ColaMD 2.7.13-rc.1, No More Patches
|
|
6
|
+
|
|
7
|
+
`@bytechain.cn/colamd` bumped from 2.7.12 to 2.7.13-rc.1. The CM6 multi-line replace-decoration fix (`block: true` for whole-line replace decorations — previously carried as a `patch-package` patch) is now native to the engine, extended upstream to tables and HTML blocks as well. The `patches/` directory is gone; `patch-package` remains wired through `postinstall` but finds nothing to apply.
|
|
8
|
+
|
|
9
|
+
### 🎨 Mermaid Diagrams Drawn on the Page
|
|
10
|
+
|
|
11
|
+
Diagrams used to sit on the theme's code-block background with colors derived from `--code-block-bg`/`--code-block-text`. But a mermaid fence is a whole-block replacement — there is no code block behind it — so Elegant and Bear (light pages with dark code blocks) rendered pale lines on the dark block, washed out against the page.
|
|
12
|
+
|
|
13
|
+
Preview and HTML/PDF exports now derive the `--pele-*` tokens from the page colors (`--bg-color`/`--text-color`, mixed at 18%/28%/45% — the same ratios as the engine) and no longer paint a background behind the diagram, matching ColaMD-extend 2.7.13-rc.1. Light themes get dark lines on paper; dark themes get light lines on the dark page.
|
|
14
|
+
|
|
15
|
+
### 🐛 Theme Variables Actually Apply Now
|
|
16
|
+
|
|
17
|
+
The built-in and custom theme files declare their variables on `:root`, but the engine writes the same variables on `body.theme-x` — higher specificity — so the theme files' values were silently ignored in the preview (their element rules did apply, giving a mix of old variables and new rules). Theme CSS is now injected as `:root, body.theme-x` so the file wins, and exports apply the same scoping.
|
|
18
|
+
|
|
19
|
+
### 🎨 All 12 Built-in Themes Synced with ColaMD-extend
|
|
20
|
+
|
|
21
|
+
The 12 theme files are byte-identical with ColaMD-extend's (the 2.7.12+ theme contract): refined border colors everywhere, Dark/Midnight/Writer gain strong and inline-code accent colors, Notion swaps link underlines for strong/URL colors, blockquote overrides trimmed (Dracula/Gruvbox/Nord/Midnight), Elegant drops the dead `--table-border` variable and horizontal blockquote padding (as do Sepia).
|
|
22
|
+
|
|
23
|
+
### 🎨 Word Export: Readable Colors on White Paper
|
|
24
|
+
|
|
25
|
+
Two rules mirrored from ColaMD-extend's `docx-style.ts`: dark themes fall back entirely to the light palette (light text on white paper is invisible), and light themes with a dark code block (Elegant/Bear) draw diagrams on white with the body text color instead of pale code-block text.
|
|
26
|
+
|
|
3
27
|
## v0.3.2 (2026-11-07)
|
|
4
28
|
|
|
5
29
|
### 🐛 PDF/HTML Export Fixed: `md is not defined`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vscode-colaview",
|
|
3
3
|
"displayName": "ColaView MD",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.3",
|
|
5
5
|
"publisher": "bytechain",
|
|
6
6
|
"description": "ColaMD Preview — Rich Markdown Preview & PDF/HTML Export for VSCode",
|
|
7
7
|
"icon": "icon.png",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"postinstall": "patch-package"
|
|
142
142
|
},
|
|
143
143
|
"dependencies": {
|
|
144
|
-
"@bytechain.cn/colamd": "2.7.
|
|
144
|
+
"@bytechain.cn/colamd": "2.7.13-rc.1",
|
|
145
145
|
"docx": "^9.15.2",
|
|
146
146
|
"katex": "^0.16.47",
|
|
147
147
|
"mermaid": "^11.15.0",
|
|
@@ -119,6 +119,10 @@ function mixSrgb(a: string, b: string, weightA: number): string {
|
|
|
119
119
|
* Mermaid 画图用的调色板令牌(镜像 colamd-extend diagramPrintPalette 的推导规则)。
|
|
120
120
|
* 令牌与 DocxStyle 同源:「浅色跟随主题、深色整体回落浅色」,混合比例照抄
|
|
121
121
|
* colamd.css 的 `.cm-md-mermaid`(18% / 28% / 45% 三档),两边要一起改。
|
|
122
|
+
*
|
|
123
|
+
* 但代码块的底不一定是纸的颜色:elegant、bear 是浅色主题配深色代码块,它们的
|
|
124
|
+
* codeBlockText 是浅色。Word 是白纸、PNG 也先铺白底,照搬就成了浅色线条落在
|
|
125
|
+
* 白纸上,所以这类主题改按正文色画(2026-11-14,与 colamd-extend 一致)。
|
|
122
126
|
*/
|
|
123
127
|
export interface DiagramPalette {
|
|
124
128
|
background: string;
|
|
@@ -142,6 +146,12 @@ function normalizeHex(value: unknown, fallback: string): string {
|
|
|
142
146
|
return fallback;
|
|
143
147
|
}
|
|
144
148
|
|
|
149
|
+
/** 感知亮度,判断代码块底色是深是浅。入参不带 `#`。 */
|
|
150
|
+
function isDarkHex(hex: string): boolean {
|
|
151
|
+
const channel = (index: number): number => (Number.parseInt(hex.slice(index, index + 2), 16) || 0) / 255;
|
|
152
|
+
return 0.2126 * channel(0) + 0.7152 * channel(2) + 0.0722 * channel(4) < 0.5;
|
|
153
|
+
}
|
|
154
|
+
|
|
145
155
|
/** 从主题令牌推导 Mermaid 的 themeVariables(theme: 'base')。 */
|
|
146
156
|
function mermaidThemeVariables(palette: DiagramPalette): Record<string, string> {
|
|
147
157
|
const { background: bg, foreground: fg } = palette;
|
|
@@ -245,15 +255,19 @@ function scan(markdown: string): { content: string; items: RenderItem[] } {
|
|
|
245
255
|
*/
|
|
246
256
|
export async function renderMathAndMermaidToImages(
|
|
247
257
|
markdown: string,
|
|
248
|
-
paletteTokens?: { codeBlockBackground?: unknown; codeBlockText?: unknown; link?: unknown },
|
|
258
|
+
paletteTokens?: { text?: unknown; codeBlockBackground?: unknown; codeBlockText?: unknown; link?: unknown },
|
|
249
259
|
): Promise<RichImageResult> {
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
260
|
+
const bodyText = normalizeHex(paletteTokens?.text, DEFAULT_DIAGRAM_PALETTE.foreground);
|
|
261
|
+
const codeBackground = normalizeHex(paletteTokens?.codeBlockBackground, DEFAULT_DIAGRAM_PALETTE.background);
|
|
262
|
+
const codeText = normalizeHex(paletteTokens?.codeBlockText, bodyText);
|
|
263
|
+
// 浅色主题配深色代码块(elegant / bear)时,codeBlockText 是浅色;Word 的白纸上
|
|
264
|
+
// 会糊成一片。这类主题改按页面正文色画,底色换成白纸。
|
|
265
|
+
const darkCodeBlock = isDarkHex(codeBackground);
|
|
266
|
+
const palette: DiagramPalette = {
|
|
267
|
+
background: darkCodeBlock ? 'FFFFFF' : codeBackground,
|
|
268
|
+
foreground: darkCodeBlock ? bodyText : codeText,
|
|
269
|
+
accent: normalizeHex(paletteTokens?.link, DEFAULT_DIAGRAM_PALETTE.accent),
|
|
270
|
+
};
|
|
257
271
|
const { content, items } = scan(markdown);
|
|
258
272
|
if (items.length === 0) {
|
|
259
273
|
return { content, images: {}, imageSizes: {} };
|
|
@@ -121,30 +121,70 @@ export function translateEngineThemeCssForExport(colamdCss: string): string {
|
|
|
121
121
|
return translateThemeCssForExport(out);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
/**
|
|
125
|
+
* 深色主题导出 Word 时回落的浅色板,字段与 docx-exporter 的 DEFAULT_STYLE 一致。
|
|
126
|
+
* Word 是白纸,深色主题的浅色正文直接搬过去会看不见(镜像 colamd-extend
|
|
127
|
+
* docx-style.ts 的 LIGHT 常量:浅色跟随主题、深色整体回落浅色)。
|
|
128
|
+
*/
|
|
129
|
+
const LIGHT_TOKENS: Record<string, string> = {
|
|
130
|
+
text: '24292F',
|
|
131
|
+
secondaryText: '656D76',
|
|
132
|
+
link: '0969DA',
|
|
133
|
+
inlineCodeBackground: 'EFF1F3',
|
|
134
|
+
codeBlockBackground: 'F6F8FA',
|
|
135
|
+
codeBlockText: '24292F',
|
|
136
|
+
highlightBackground: 'FFF3BF',
|
|
137
|
+
blockquoteBorder: 'D0D7DE',
|
|
138
|
+
border: 'D0D7DE',
|
|
139
|
+
tableHeaderBackground: 'F6F8FA',
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/** 取 #rgb / #rrggbb / #rrggbbaa 的主色,取不到返回 null。入参可带 `#`。 */
|
|
143
|
+
function themeHex(value: string | undefined): string | null {
|
|
144
|
+
if (!value) return null;
|
|
145
|
+
const raw = value.trim().replace(/^#/, '');
|
|
146
|
+
if (/^[0-9a-f]{6}$/i.test(raw)) return raw.toUpperCase();
|
|
147
|
+
if (/^[0-9a-f]{3}$/i.test(raw)) return raw.split('').map((digit) => digit + digit).join('').toUpperCase();
|
|
148
|
+
if (/^[0-9a-f]{8}$/i.test(raw)) return raw.slice(0, 6).toUpperCase();
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** 感知亮度,用来判断主题底色是深是浅。入参不带 `#`。 */
|
|
153
|
+
function hexLuminance(hex: string): number {
|
|
154
|
+
const channel = (index: number): number => (Number.parseInt(hex.slice(index, index + 2), 16) || 0) / 255;
|
|
155
|
+
return 0.2126 * channel(0) + 0.7152 * channel(2) + 0.0722 * channel(4);
|
|
156
|
+
}
|
|
157
|
+
|
|
124
158
|
/**
|
|
125
159
|
* 从主题 CSS 构造 Word 导出用的样式令牌(docx 的 DocxStyle)。只覆盖能可靠取到的字段,
|
|
126
160
|
* 其余由 markdownToDocx 的 normalizeStyle 回退到默认浅色样式。颜色返回原始值(hex),
|
|
127
161
|
* 由 docx-exporter 的 hexColor 归一化。
|
|
162
|
+
*
|
|
163
|
+
* 深色主题(--bg-color 亮度 < 0.5)整体回落浅色板,与 Mermaid 导出挑浅色配色是同一条规则。
|
|
128
164
|
*/
|
|
129
165
|
export function buildDocxStyleFromThemeCss(themeCss: string): Record<string, string | number | null> {
|
|
130
166
|
const { vars, fontFamily, lineHeight } = parseThemeTokens(themeCss);
|
|
131
167
|
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
168
|
+
const bg = themeHex(vars['--bg-color']);
|
|
169
|
+
const isDarkTheme = bg !== null && hexLuminance(bg) < 0.5;
|
|
170
|
+
const style: Record<string, string | number | null> = isDarkTheme ? { ...LIGHT_TOKENS } : {};
|
|
171
|
+
if (!isDarkTheme) {
|
|
172
|
+
const put = (key: string, varName: string) => {
|
|
173
|
+
if (vars[varName]) style[key] = vars[varName];
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
put('text', '--text-color');
|
|
177
|
+
put('secondaryText', '--text-secondary');
|
|
178
|
+
put('link', '--link-color');
|
|
179
|
+
put('inlineCodeBackground', '--code-bg');
|
|
180
|
+
put('codeBlockBackground', '--code-block-bg');
|
|
181
|
+
put('codeBlockText', '--code-block-text');
|
|
182
|
+
put('highlightBackground', '--highlight-bg');
|
|
183
|
+
put('blockquoteBorder', '--blockquote-border');
|
|
184
|
+
put('blockquoteBackground', '--blockquote-bg');
|
|
185
|
+
put('border', '--border-color');
|
|
186
|
+
put('tableHeaderBackground', '--table-header-bg');
|
|
187
|
+
}
|
|
148
188
|
|
|
149
189
|
// 主题若显式定义了等宽字体栈(如自定义 .themes 主题),一并带上
|
|
150
190
|
if (vars['--font-mono']) style.monoFontStack = vars['--font-mono'];
|
|
@@ -389,7 +389,10 @@ export class PreviewManager {
|
|
|
389
389
|
|
|
390
390
|
// 自定义主题的规则不在 colamd.css 里(内置主题的翻译规则是冗余兜底),
|
|
391
391
|
// 翻译成语义选择器后注入到 </head> 前,保证优先级最高。
|
|
392
|
-
|
|
392
|
+
// 变量同样要提到 body.theme-X:引擎把内置主题变量写在 body.theme-X(0,1,1)
|
|
393
|
+
// 上,裸 :root(0,1,0)压不住它,导出会退回引擎旧值、和预览对不上。
|
|
394
|
+
const rawThemeCss = translateThemeCssForExport(ThemeManager.loadThemeCSS(theme));
|
|
395
|
+
const themeOverrideCss = rawThemeCss.replace(/:root\b/g, `:root, body.${themeClass}`);
|
|
393
396
|
const THEME_FIX = themeOverrideCss ? `<style>${themeOverrideCss}</style>` : '';
|
|
394
397
|
// colamd.css 里还有一批 body.theme-X .cm-content .cm-md-* 的正文差异化规则
|
|
395
398
|
// (sepia/dark/notion/midnight/writer 等主题的加粗、行内代码、标题配色只存在于
|
|
@@ -399,22 +402,19 @@ export class PreviewManager {
|
|
|
399
402
|
const PRINT_FIX = `<style>@media print { body > article.colamd-document:not(#_) { display: block !important; } }</style>`;
|
|
400
403
|
// 导出文档里 mermaid 块被引擎序列化成不带类名的 `<p><svg class="pele pele-…">…</svg></p>`
|
|
401
404
|
// (实测 block widget 以非 .cm-line 子节点进入序列化,走段落分支,不是
|
|
402
|
-
// `hte('mermaid')` 的 `<div>` 分支)—— .cm-md-mermaid 上的居中、--pele-*
|
|
403
|
-
//
|
|
404
|
-
//
|
|
405
|
+
// `hte('mermaid')` 的 `<div>` 分支)—— .cm-md-mermaid 上的居中、--pele-* 令牌
|
|
406
|
+
// 随之丢掉。所以这里按导出文档的实际结构补一份:<p> 容器补居中与上下留白。
|
|
407
|
+
// 图不铺底色(与 ColaMD-extend 一致:图画在页面底色上,配色按页面色推导)。
|
|
405
408
|
// 图上的缩放控件(.pele-zoom)是编辑器的东西,不是文档内容 —— 导出纸面上藏掉
|
|
406
409
|
// (镜像 colamd-extend print-layout.ts 的修复;Chromium 打印不执行脚本,
|
|
407
410
|
// pele 没机会收回它们,控件会叠在图上进 PDF)。
|
|
408
411
|
const MERMAID_FIX = `<style>
|
|
409
412
|
/* 图表配色不要在这里重新推导:buildExportHTML 已经把预览里 \`.cm-md-mermaid\` 上
|
|
410
413
|
实际生效的 --pele-* 变量(含自定义主题显式覆盖的值)收进导出文档的 :root,
|
|
411
|
-
|
|
412
|
-
代码块底色背景(图和代码块共用一块底)与居中。 */
|
|
414
|
+
那才是“预览中的配色”。导出端只需要补引擎序列化时丢掉的居中与留白。 */
|
|
413
415
|
.colamd-document .cm-md-mermaid,
|
|
414
416
|
.colamd-document p:has(> svg.pele) {
|
|
415
|
-
|
|
416
|
-
border-radius: 6px;
|
|
417
|
-
padding: 0.8em 1em;
|
|
417
|
+
padding: 0.8em 0;
|
|
418
418
|
text-align: center;
|
|
419
419
|
}
|
|
420
420
|
.colamd-document svg.pele {
|
|
@@ -429,13 +429,13 @@ export class PreviewManager {
|
|
|
429
429
|
const PELE_TOKEN_FALLBACK = /:root\s*\{[^}]*--pele-bg\s*:/i.test(patched)
|
|
430
430
|
? ''
|
|
431
431
|
: `<style>:root {
|
|
432
|
-
--pele-bg: var(--
|
|
433
|
-
--pele-fg: var(--
|
|
434
|
-
--pele-muted: color-mix(in srgb, var(--
|
|
435
|
-
--pele-line: var(--
|
|
436
|
-
--pele-surface: color-mix(in srgb, var(--
|
|
437
|
-
--pele-surface-alt: color-mix(in srgb, var(--
|
|
438
|
-
--pele-border: color-mix(in srgb, var(--
|
|
432
|
+
--pele-bg: var(--bg-color);
|
|
433
|
+
--pele-fg: var(--text-color);
|
|
434
|
+
--pele-muted: color-mix(in srgb, var(--text-color) 70%, var(--bg-color));
|
|
435
|
+
--pele-line: var(--text-color);
|
|
436
|
+
--pele-surface: color-mix(in srgb, var(--text-color) 18%, var(--bg-color));
|
|
437
|
+
--pele-surface-alt: color-mix(in srgb, var(--text-color) 28%, var(--bg-color));
|
|
438
|
+
--pele-border: color-mix(in srgb, var(--text-color) 45%, var(--bg-color));
|
|
439
439
|
--pele-accent: var(--link-color);
|
|
440
440
|
--pele-radius: 6px;
|
|
441
441
|
}</style>`;
|
|
@@ -83,7 +83,7 @@ function scrollToLine(line: number, totalLines: number, topRatio: number = 0.3):
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
function injectThemeCSS(css: string | undefined): void {
|
|
86
|
+
function injectThemeCSS(css: string | undefined, themeName: string, isCustom: boolean): void {
|
|
87
87
|
if (!css) return;
|
|
88
88
|
let el = document.getElementById('colaview-theme-css');
|
|
89
89
|
if (!el) {
|
|
@@ -91,7 +91,11 @@ function injectThemeCSS(css: string | undefined): void {
|
|
|
91
91
|
el.id = 'colaview-theme-css';
|
|
92
92
|
document.head.appendChild(el);
|
|
93
93
|
}
|
|
94
|
-
|
|
94
|
+
// 主题文件的变量写在 :root 上,而引擎把同一批变量写在 body.theme-X 上
|
|
95
|
+
// (特异性 0,1,1 > 0,1,0),直接注入 :root 会被引擎盖掉。这里把选择器
|
|
96
|
+
// 提升到 body.theme-X:与引擎同特异性且后注入,主题文件里的新值才生效。
|
|
97
|
+
const scope = isCustom ? 'body.theme-custom' : `body.theme-${themeName}`;
|
|
98
|
+
el.textContent = css.replace(/:root\b/g, `:root, ${scope}`);
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
/**
|
|
@@ -116,7 +120,7 @@ window.addEventListener('message', async (event: MessageEvent) => {
|
|
|
116
120
|
case 'init': {
|
|
117
121
|
try {
|
|
118
122
|
currentTheme = data.theme || 'elegant';
|
|
119
|
-
injectThemeCSS(data.themeCSS);
|
|
123
|
+
injectThemeCSS(data.themeCSS, currentTheme, !!(data.customCSS && data.theme));
|
|
120
124
|
|
|
121
125
|
// 2.7.9 API: 先创建编辑器(options 中不含 theme)
|
|
122
126
|
handle = await createColaMDEditor({
|
|
@@ -152,13 +156,13 @@ window.addEventListener('message', async (event: MessageEvent) => {
|
|
|
152
156
|
currentMarkdown = data.markdown;
|
|
153
157
|
}
|
|
154
158
|
if (data.theme) {
|
|
155
|
-
|
|
159
|
+
currentTheme = data.theme;
|
|
160
|
+
injectThemeCSS(data.themeCSS, data.theme, !!data.customCSS);
|
|
156
161
|
if (data.customCSS) {
|
|
157
162
|
handle.applyTheme('custom:' + data.theme, data.customCSS);
|
|
158
163
|
} else {
|
|
159
164
|
handle.applyTheme(data.theme);
|
|
160
165
|
}
|
|
161
|
-
currentTheme = data.theme;
|
|
162
166
|
ensureBodyThemeClass();
|
|
163
167
|
}
|
|
164
168
|
break;
|
|
@@ -182,13 +186,13 @@ window.addEventListener('message', async (event: MessageEvent) => {
|
|
|
182
186
|
}
|
|
183
187
|
case 'updateTheme': {
|
|
184
188
|
if (!handle || !data.theme) return;
|
|
185
|
-
|
|
189
|
+
currentTheme = data.theme;
|
|
190
|
+
injectThemeCSS(data.themeCSS, data.theme, !!data.customCSS);
|
|
186
191
|
if (data.customCSS) {
|
|
187
192
|
handle.applyTheme('custom:' + data.theme, data.customCSS);
|
|
188
193
|
} else {
|
|
189
194
|
handle.applyTheme(data.theme);
|
|
190
195
|
}
|
|
191
|
-
currentTheme = data.theme;
|
|
192
196
|
ensureBodyThemeClass();
|
|
193
197
|
break;
|
|
194
198
|
}
|
|
@@ -50,12 +50,24 @@
|
|
|
50
50
|
#editor .cm-scroller {
|
|
51
51
|
overflow: auto;
|
|
52
52
|
}
|
|
53
|
-
/* mermaid
|
|
54
|
-
|
|
53
|
+
/* mermaid 图画在页面底色上(与 ColaMD-extend 一致):围栏是整块替换,
|
|
54
|
+
没有代码块底,图表配色按页面底色/正文色推导。引擎的
|
|
55
|
+
`.cm-content .cm-md-mermaid` 以代码块配色推导 --pele-*,这里用
|
|
56
|
+
#editor 提高特异性覆盖。background 铺页面色是为了盖住 2.7.x 引擎
|
|
57
|
+
可能残留的代码块行底色。 */
|
|
55
58
|
#editor .cm-md-mermaid {
|
|
56
|
-
background: var(--
|
|
57
|
-
border-radius:
|
|
58
|
-
padding: 0.8em
|
|
59
|
+
background: var(--bg-color);
|
|
60
|
+
border-radius: 0;
|
|
61
|
+
padding: 0.8em 0;
|
|
62
|
+
--pele-bg: var(--bg-color);
|
|
63
|
+
--pele-fg: var(--text-color);
|
|
64
|
+
--pele-muted: color-mix(in srgb, var(--text-color) 70%, var(--bg-color));
|
|
65
|
+
--pele-line: var(--text-color);
|
|
66
|
+
--pele-surface: color-mix(in srgb, var(--text-color) 18%, var(--bg-color));
|
|
67
|
+
--pele-surface-alt: color-mix(in srgb, var(--text-color) 28%, var(--bg-color));
|
|
68
|
+
--pele-border: color-mix(in srgb, var(--text-color) 45%, var(--bg-color));
|
|
69
|
+
--pele-accent: var(--link-color);
|
|
70
|
+
--pele-radius: 6px;
|
|
59
71
|
}
|
|
60
72
|
|
|
61
73
|
/* ── Context Menu ── */
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--text-color: #e6edf3;
|
|
10
10
|
--text-secondary: #aab3bd;
|
|
11
11
|
--text-muted: #8b949e;
|
|
12
|
-
--border-color: #
|
|
12
|
+
--border-color: #272d34;
|
|
13
13
|
--link-color: #58a6ff;
|
|
14
14
|
--code-bg: rgba(110, 118, 129, 0.3);
|
|
15
15
|
--code-block-bg: #161b22;
|
|
@@ -18,3 +18,11 @@
|
|
|
18
18
|
--selection-bg: rgba(88, 166, 255, 0.2);
|
|
19
19
|
--highlight-bg: rgba(210, 153, 34, 0.35);
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
#editor .cm-content .cm-md-strong {
|
|
23
|
+
color: #e6edf3;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#editor .cm-content .cm-md-inlinecode {
|
|
27
|
+
color: #ff7b72;
|
|
28
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--text-color: #f8f8f2;
|
|
10
10
|
--text-secondary: #afb7db;
|
|
11
11
|
--text-muted: #7f86a8;
|
|
12
|
-
--border-color: #
|
|
12
|
+
--border-color: #3d4051;
|
|
13
13
|
--link-color: #bd93f9;
|
|
14
14
|
--code-bg: rgba(98, 114, 164, 0.2);
|
|
15
15
|
--code-block-bg: #21222c;
|
|
@@ -32,7 +32,3 @@
|
|
|
32
32
|
#editor .cm-content .cm-md-inlinecode {
|
|
33
33
|
color: #8be9fd;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
#editor .cm-content .cm-md-blockquote {
|
|
37
|
-
color: #c3c8e0;
|
|
38
|
-
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--text-color: #2c2c2c;
|
|
10
10
|
--text-secondary: #6c6c6c;
|
|
11
11
|
--text-muted: #777;
|
|
12
|
-
--border-color: #
|
|
12
|
+
--border-color: #dedad5;
|
|
13
13
|
--link-color: #bc4424;
|
|
14
14
|
--code-bg: #e8e4df;
|
|
15
15
|
--code-block-bg: #2c2c2c;
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
--blockquote-border: #c44b2b;
|
|
18
18
|
--blockquote-bg: #eae6e1;
|
|
19
19
|
--table-header-bg: #eae6e1;
|
|
20
|
-
--table-border: #d8d3ce;
|
|
21
20
|
--selection-bg: rgba(196, 75, 43, 0.2);
|
|
22
21
|
--highlight-bg: #f0d9a8;
|
|
23
22
|
}
|
|
@@ -35,18 +34,12 @@
|
|
|
35
34
|
color: #c44b2b;
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
#editor .cm-content .cm-md-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
padding-right: 20px;
|
|
37
|
+
#editor .cm-content .cm-md-table-widget th,
|
|
38
|
+
#editor .cm-content .cm-md-table-widget td {
|
|
39
|
+
border-left: none;
|
|
40
|
+
border-right: none;
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
#editor .cm-content .cm-md-table-widget th {
|
|
46
44
|
border-bottom: 2px solid #c44b2b;
|
|
47
45
|
}
|
|
48
|
-
|
|
49
|
-
#editor .cm-content .cm-md-table-widget td {
|
|
50
|
-
border-left: none;
|
|
51
|
-
border-right: none;
|
|
52
|
-
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--text-color: #ebdbb2;
|
|
10
10
|
--text-secondary: #c5b5a5;
|
|
11
11
|
--text-muted: #928374;
|
|
12
|
-
--border-color: #
|
|
12
|
+
--border-color: #373432;
|
|
13
13
|
--link-color: #83a598;
|
|
14
14
|
--code-bg: rgba(235, 219, 178, 0.1);
|
|
15
15
|
--code-block-bg: #1d2021;
|
|
@@ -33,10 +33,6 @@
|
|
|
33
33
|
color: #b8bb26;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
#editor .cm-content .cm-md-blockquote {
|
|
37
|
-
color: #bdae93;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
36
|
#editor .cm-content .cm-md-hr {
|
|
41
37
|
border-top-color: #504945;
|
|
42
38
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--text-color: #d6d6d6;
|
|
10
10
|
--text-secondary: #b1b1b1;
|
|
11
11
|
--text-muted: #7a7a7a;
|
|
12
|
-
--border-color: #
|
|
12
|
+
--border-color: #1c1c1c;
|
|
13
13
|
--link-color: #0a84ff;
|
|
14
14
|
--code-bg: rgba(255, 255, 255, 0.08);
|
|
15
15
|
--code-block-bg: #111111;
|
|
@@ -25,7 +25,11 @@
|
|
|
25
25
|
color: #f5f5f5;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
#editor .cm-content .cm-md-
|
|
29
|
-
color: #
|
|
28
|
+
#editor .cm-content .cm-md-strong {
|
|
29
|
+
color: #e8e8e8;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#editor .cm-content .cm-md-inlinecode {
|
|
33
|
+
color: #e5786d;
|
|
30
34
|
}
|
|
31
35
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--text-color: #d8dee9;
|
|
10
10
|
--text-secondary: #aebdd4;
|
|
11
11
|
--text-muted: #7d8ba1;
|
|
12
|
-
--border-color: #
|
|
12
|
+
--border-color: #383e4e;
|
|
13
13
|
--link-color: #88c0d0;
|
|
14
14
|
--code-bg: rgba(136, 192, 208, 0.12);
|
|
15
15
|
--code-block-bg: #262c37;
|
|
@@ -32,7 +32,3 @@
|
|
|
32
32
|
#editor .cm-content .cm-md-inlinecode {
|
|
33
33
|
color: #88c0d0;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
#editor .cm-content .cm-md-blockquote {
|
|
37
|
-
color: #aeb9c9;
|
|
38
|
-
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--text-color: #37352f;
|
|
10
10
|
--text-secondary: #777674;
|
|
11
11
|
--text-muted: #9b9a97;
|
|
12
|
-
--border-color: #
|
|
12
|
+
--border-color: #eeeeed;
|
|
13
13
|
--link-color: #37352f;
|
|
14
14
|
--code-bg: #f7f6f3;
|
|
15
15
|
--code-block-bg: #f7f6f3;
|
|
@@ -19,16 +19,6 @@
|
|
|
19
19
|
--highlight-bg: #fdecc8;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
#editor .cm-content .cm-md-link {
|
|
23
|
-
text-decoration: underline;
|
|
24
|
-
text-decoration-color: #9b9a97;
|
|
25
|
-
text-underline-offset: 2px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
#editor .cm-content .cm-md-link:hover {
|
|
29
|
-
text-decoration-color: #37352f;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
22
|
#editor .cm-content .cm-md-atxheading1,
|
|
33
23
|
#editor .cm-content .cm-md-atxheading2 {
|
|
34
24
|
border-bottom: none;
|
|
@@ -36,6 +26,10 @@
|
|
|
36
26
|
font-weight: 700;
|
|
37
27
|
}
|
|
38
28
|
|
|
29
|
+
#editor .cm-content .cm-md-strong {
|
|
30
|
+
color: #37352f;
|
|
31
|
+
}
|
|
32
|
+
|
|
39
33
|
#editor .cm-content .cm-md-inlinecode {
|
|
40
34
|
color: #eb5757;
|
|
41
35
|
background: #f7f6f3;
|
|
@@ -46,3 +40,7 @@
|
|
|
46
40
|
border-left: none;
|
|
47
41
|
border-right: none;
|
|
48
42
|
}
|
|
43
|
+
|
|
44
|
+
#editor .cm-content .cm-md-url {
|
|
45
|
+
color: #9b9a97;
|
|
46
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--text-color: #4f4032;
|
|
10
10
|
--text-secondary: #7b6b54;
|
|
11
11
|
--text-muted: #9a8a72;
|
|
12
|
-
--border-color: #
|
|
12
|
+
--border-color: #e7ddc7;
|
|
13
13
|
--link-color: #9c5e29;
|
|
14
14
|
--code-bg: rgba(122, 90, 51, 0.1);
|
|
15
15
|
--code-block-bg: #ece2cb;
|
|
@@ -35,11 +35,8 @@
|
|
|
35
35
|
border-bottom-style: dashed;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
#editor .cm-content .cm-md-
|
|
39
|
-
|
|
40
|
-
padding would be added once for every line of the quote. */
|
|
41
|
-
padding-left: 24px;
|
|
42
|
-
padding-right: 20px;
|
|
38
|
+
#editor .cm-content .cm-md-strong {
|
|
39
|
+
color: #7a5a33;
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
#editor .cm-content .cm-md-inlinecode {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--text-color: #1a1a1a;
|
|
10
10
|
--text-secondary: #757571;
|
|
11
11
|
--text-muted: #8e8e8a;
|
|
12
|
-
--border-color: #
|
|
12
|
+
--border-color: #e9e9e5;
|
|
13
13
|
--link-color: #3b6ec4;
|
|
14
14
|
--code-bg: rgba(0, 0, 0, 0.05);
|
|
15
15
|
--code-block-bg: #f2f2ee;
|
|
@@ -42,3 +42,11 @@
|
|
|
42
42
|
#editor .cm-content .cm-md-table-widget td {
|
|
43
43
|
font-size: 0.9em;
|
|
44
44
|
}
|
|
45
|
+
|
|
46
|
+
#editor .cm-content .cm-md-strong {
|
|
47
|
+
color: #2f2f2c;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#editor .cm-content .cm-md-inlinecode {
|
|
51
|
+
color: #3b6ec4;
|
|
52
|
+
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
diff --git a/node_modules/@bytechain.cn/colamd/dist/lib/colamd-renderer.js b/node_modules/@bytechain.cn/colamd/dist/lib/colamd-renderer.js
|
|
2
|
-
index 371c127..b629313 100644
|
|
3
|
-
--- a/node_modules/@bytechain.cn/colamd/dist/lib/colamd-renderer.js
|
|
4
|
-
+++ b/node_modules/@bytechain.cn/colamd/dist/lib/colamd-renderer.js
|
|
5
|
-
@@ -25981,7 +25981,7 @@ function NF(t, e) {
|
|
6
|
-
e.push({
|
|
7
|
-
from: n.from,
|
|
8
|
-
to: n.to,
|
|
9
|
-
- deco: Wt.replace({ widget: new jF(n.code, n.block, n.from, n.to) })
|
|
10
|
-
+ deco: Wt.replace({ widget: new jF(n.code, n.block, n.from, n.to), block: n.block && (function(t, e, r) { return t.doc.lineAt(e).from === e && t.doc.lineAt(Math.min(r, t.doc.length)).to === r; })(t, n.from, n.to) })
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
@@ -26071,7 +26071,7 @@ function KF(t, e, r) {
|
|
15
|
-
O.trim() && e.push({
|
|
16
|
-
from: n.from,
|
|
17
|
-
to: n.to,
|
|
18
|
-
- deco: Wt.replace({ widget: new FF(O, `${n.from}:${O.length}`, n.from, n.to) })
|
|
19
|
-
+ deco: Wt.replace({ widget: new FF(O, `${n.from}:${O.length}`, n.from, n.to), block: !0 })
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
}
|