Compare commits
3
Commits
release-v0.6.102
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01fcd1ff9a | ||
|
|
b4fb0e8179 | ||
|
|
067373facd |
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(KSwitcher VERSION 0.6.102 LANGUAGES CXX RC)
|
||||
project(KSwitcher VERSION 0.6.103 LANGUAGES CXX RC)
|
||||
if(NOT WIN32)
|
||||
message(FATAL_ERROR "KSwitcher uses native Windows APIs")
|
||||
endif()
|
||||
|
||||
+11
-2
@@ -86,8 +86,9 @@ Warning і початковий фокус на No.
|
||||
- Ctrl+R перечитує поточну папку активної панелі. Позиція курсора й позначки
|
||||
зберігаються для наявних елементів, а підраховані через F3 розміри папок
|
||||
скидаються. F2 також виконує цю дію.
|
||||
- Ctrl+C копіює весь введений у командний рядок текст, навіть коли виділено
|
||||
лише його частину.
|
||||
- Ctrl+C і Ctrl+Insert копіюють виділений текст із виводу термінала.
|
||||
- За відсутності виділення у виводі Ctrl+C копіює весь введений у командний
|
||||
рядок текст, навіть коли виділено лише його частину.
|
||||
- Ctrl+Insert копіює весь текст непорожнього командного рядка. Якщо рядок
|
||||
порожній, копіюються імена позначених файлів і папок активної панелі в
|
||||
порядку відображення, по одному на рядок. Якщо позначок немає, копіюється
|
||||
@@ -161,6 +162,9 @@ Warning і початковий фокус на No.
|
||||
інтерактивними чекбоксами списків і діаграмами Mermaid. Відмітки в перегляді
|
||||
діють до повторного рендерингу або виходу з цього режиму. F4 відкриває текст
|
||||
із підсвічуванням Markdown.
|
||||
HTML усередині Markdown підтримує таблиці, текстове форматування, посилання,
|
||||
відносні зображення й окремі стилі, зокрема `white-space: nowrap` у клітинках.
|
||||
Скрипти, вбудовані сторінки та обробники подій відфільтровуються.
|
||||
Відносні посилання й зображення відкриваються від каталогу вихідного файла.
|
||||
Вихідний текст приховано, доки Markdown і Mermaid готують перегляд.
|
||||
Звичайний клік відкриває внутрішнє посилання в тому самому вікні,
|
||||
@@ -211,6 +215,11 @@ Warning і початковий фокус на No.
|
||||
кодування. Нередаговані байти копіюються без перетворення.
|
||||
- Команда Options у панелях, редакторі й переглядачі відкриває один діалог
|
||||
KSwitcher Files Options. Розділи Viewer та Editor зберігають окремі профілі.
|
||||
**Viewer → Markdown** задає максимальну ширину документа (0 — усе вікно),
|
||||
гарнітуру та розмір основного тексту. Порожня гарнітура використовує системний
|
||||
шрифт. Apply одразу оновлює відкриті перегляди Markdown.
|
||||
Після повторного відкриття Options відновлюється останній розділ, зокрема
|
||||
після Cancel. Пошуковий запит і чернетка змін не зберігаються.
|
||||
З редактора або переглядача діалог відкриває відповідний розділ. Apply
|
||||
застосовує зміни до відкритих вікон, Cancel відкидає незастосовану чернетку.
|
||||
Доступні перенесення рядків, номери рядків, показ пробілів і
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,11 @@
|
||||
# Latest Windows release
|
||||
|
||||
## v0.6.103 — 2026-11-16
|
||||
|
||||
The KSwitcher Files Markdown preview renders embedded HTML tables and inline styles such as `white-space: nowrap`. **Options → Viewer → Markdown** sets the preview width, font family and font size. Files Options reopens the last section. **Ctrl+C** and **Ctrl+Insert** copy selected terminal output. This release replaces v0.6.102.
|
||||
|
||||
**Українською.** Перегляд Markdown у KSwitcher Files відображає вбудовані HTML-таблиці й стилі, зокрема `white-space: nowrap`. У **Options → Viewer → Markdown** можна задати ширину перегляду, гарнітуру й розмір шрифту. Options відкриває останній відвіданий розділ. **Ctrl+C** і **Ctrl+Insert** копіюють виділений текст із виводу термінала. Цей реліз замінює v0.6.102.
|
||||
|
||||
## v0.6.102 — 2026-11-16
|
||||
|
||||
In KSwitcher Files, Ctrl+Insert copies the full command line when it contains text. With an empty command line, it copies names from the active pane. The LAN host returns Windows PowerShell startup errors without waiting for a system error dialog. Files explains DLL initialization failure `0xC0000142` and accepts another command. This release replaces v0.6.101.
|
||||
|
||||
@@ -1 +1 @@
|
||||
8266fc87658ab708d556132ddc3b94d5628d650aac7971fa7c6570477088b609 KSwitcher-win-x64.zip
|
||||
bfec959126ea7610b084a53dee2972160ed1fbcc9d71542ec521eab1e113d231 KSwitcher-win-x64.zip
|
||||
+69
-69
@@ -1,166 +1,166 @@
|
||||
{
|
||||
"version": "0.6.102",
|
||||
"schema": 1,
|
||||
"version": "0.6.103",
|
||||
"files": [
|
||||
{
|
||||
"size": 2361856,
|
||||
"path": "KSwitcher.exe",
|
||||
"sha256": "510957875f9934aedb0a859bbf3aa7bd2a45731d30978b616192072bbc979a3c"
|
||||
"sha256": "dd3da465620e0d2f97ff829b8dbd2837a703069f21d7003c67829d2c61bf7aca",
|
||||
"path": "KSwitcher.exe"
|
||||
},
|
||||
{
|
||||
"size": 2359296,
|
||||
"path": "KSwitcher.Config.exe",
|
||||
"sha256": "b22888d853626fd39197385b1837f6cd5cb2137dbe3a6e2bd97fb5ad11f231c1"
|
||||
"sha256": "bcb34c5630deeafc3deb2f81f1aea6ea491794e619536721cc38fc5a299bfc7a",
|
||||
"path": "KSwitcher.Config.exe"
|
||||
},
|
||||
{
|
||||
"size": 3337216,
|
||||
"path": "KSwitcher.Screenshot.exe",
|
||||
"sha256": "265d7df3f99427b476842e70ed804069959d006fbf219ac2fce92d73f40d8ab3"
|
||||
"sha256": "9f5e1d474c6c1c22410f153e72ce0eeafd9aae0dc8ec39d87316780bd4827667",
|
||||
"path": "KSwitcher.Screenshot.exe"
|
||||
},
|
||||
{
|
||||
"size": 3739136,
|
||||
"path": "KSwitcher.Files.exe",
|
||||
"sha256": "d546e388a49a23b216286c2b58100f2cb15a408b46a56e72edeecb83da826a8d"
|
||||
"size": 3746816,
|
||||
"sha256": "d9a72c4cf23e7763b7dfe08aa0c146d49092023a0a8125f601be7f1f9bbdedac",
|
||||
"path": "KSwitcher.Files.exe"
|
||||
},
|
||||
{
|
||||
"size": 194912,
|
||||
"path": "WebView2Loader.dll",
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6"
|
||||
"sha256": "d3fce90bdeecb08596e377dea6a316354dd8949e32ff09b89d51be00c14e21b6",
|
||||
"path": "WebView2Loader.dll"
|
||||
},
|
||||
{
|
||||
"size": 1103,
|
||||
"path": "terminal/addon-fit-LICENSE.txt",
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f"
|
||||
"sha256": "e256f01188af527e4d06d21d06fbf785ae9c50d4b328bf03cbe0ba7f0aa4228f",
|
||||
"path": "terminal/addon-fit-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"size": 1521,
|
||||
"path": "terminal/addon-fit.js",
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527"
|
||||
"sha256": "ba3ea256ce0620a0992a197d6c9baea64823fc93d8da07a9e366ca9943c18527",
|
||||
"path": "terminal/addon-fit.js"
|
||||
},
|
||||
{
|
||||
"size": 527,
|
||||
"path": "terminal/index.html",
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef"
|
||||
"sha256": "084d97a727b778fb10d31adcd557ee7840a38377ed60e0ef0f3ece93b349b1ef",
|
||||
"path": "terminal/index.html"
|
||||
},
|
||||
{
|
||||
"size": 1073,
|
||||
"path": "terminal/markdown-it-LICENSE.txt",
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473"
|
||||
"sha256": "792c48c5a849a15fdf9e37e8bcf9e6d1dd13b32b46c642a748a0a46a9919d473",
|
||||
"path": "terminal/markdown-it-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"size": 100786,
|
||||
"path": "terminal/markdown-it.js",
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e"
|
||||
"sha256": "391f2aa638e75e6c7859d0a5c5650ef0956722a45998f17e05b83bc655778e1e",
|
||||
"path": "terminal/markdown-it.js"
|
||||
},
|
||||
{
|
||||
"size": 2171,
|
||||
"path": "terminal/markdown.html",
|
||||
"sha256": "b011e0872c869c48302a37b3e2e462addc1ee11e723f840ad7df1e893fc15336"
|
||||
"size": 2333,
|
||||
"sha256": "bb7c4fcda910d31d0837f506968e8e7a3f5d326f3ad4363952b3d682798fde7d",
|
||||
"path": "terminal/markdown.html"
|
||||
},
|
||||
{
|
||||
"size": 6381,
|
||||
"path": "terminal/markdown.js",
|
||||
"sha256": "21cc15ceb2b8bee9b3f6a816d629677dab61243daf784c10b4c96312729cb149"
|
||||
"size": 9434,
|
||||
"sha256": "3e2e5af2b3a8c0f7223bec102313991032300f08d1ffc6acdaaa19f06b73dcc3",
|
||||
"path": "terminal/markdown.js"
|
||||
},
|
||||
{
|
||||
"size": 1089,
|
||||
"path": "terminal/mermaid-LICENSE.txt",
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80"
|
||||
"sha256": "ec9fb67dcb25eccc416ed56e1aab819222c805a2a4bfe4cb19e7556bf2ffde80",
|
||||
"path": "terminal/mermaid-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"size": 5537838,
|
||||
"path": "terminal/mermaid.js",
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3"
|
||||
"sha256": "336df803d87a38b70a01e736e666c8f7601d2ce42f5e47c8fafe5d721074b9a3",
|
||||
"path": "terminal/mermaid.js"
|
||||
},
|
||||
{
|
||||
"size": 4851,
|
||||
"path": "terminal/terminal.js",
|
||||
"sha256": "bd8413020862860c59a5aac7a2c09ad754ba046e13e0eea436c962daca9fdffc"
|
||||
"size": 5033,
|
||||
"sha256": "0557d251962301940785690a3fc49475dd166bb7d0bd0417dc3279d1f1b3a98a",
|
||||
"path": "terminal/terminal.js"
|
||||
},
|
||||
{
|
||||
"size": 1261,
|
||||
"path": "terminal/xterm-LICENSE.txt",
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd"
|
||||
"sha256": "b569f629d00f2626a8100df2a1798210535621e42164dfd426a6fe5aac7b0ccd",
|
||||
"path": "terminal/xterm-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"size": 7112,
|
||||
"path": "terminal/xterm.css",
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6"
|
||||
"sha256": "854a7c0fb70e8b1a083c16797ab827299fb18744f5ad34f227b48337e33293c6",
|
||||
"path": "terminal/xterm.css"
|
||||
},
|
||||
{
|
||||
"size": 488663,
|
||||
"path": "terminal/xterm.js",
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972"
|
||||
"sha256": "14903579ff54664cd72f8e8699e6961a6272c21863ec1c3b118cdc8af5d4a972",
|
||||
"path": "terminal/xterm.js"
|
||||
},
|
||||
{
|
||||
"size": 4401,
|
||||
"path": "LICENSE",
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c"
|
||||
"sha256": "d3c81140cce01c26bf6cbf52aa40e0825e1fa35b9a91d1387170a65d2597082c",
|
||||
"path": "LICENSE"
|
||||
},
|
||||
{
|
||||
"size": 1075,
|
||||
"path": "json-LICENSE.txt",
|
||||
"sha256": "c0d068392ea65358b798b8c165103560f06e9e3b38c4ab4e2d8810a7b931af86"
|
||||
"sha256": "c0d068392ea65358b798b8c165103560f06e9e3b38c4ab4e2d8810a7b931af86",
|
||||
"path": "json-LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"size": 883,
|
||||
"path": "files-text-license.txt",
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625"
|
||||
"sha256": "185c5a37521316e940ead89cbf0b1ba5862d810c7c966e6c6a14a4a515b23625",
|
||||
"path": "files-text-license.txt"
|
||||
},
|
||||
{
|
||||
"size": 94357,
|
||||
"path": "README.md",
|
||||
"sha256": "fca41227e9b38bf061298d69806ea66fb00086ae03aec49665e4f68ed2c3f8e9"
|
||||
"sha256": "fca41227e9b38bf061298d69806ea66fb00086ae03aec49665e4f68ed2c3f8e9",
|
||||
"path": "README.md"
|
||||
},
|
||||
{
|
||||
"size": 11577,
|
||||
"path": "LAN-PREVIEW.md",
|
||||
"sha256": "1233d6a0ed76564dd034f178a9f65db076244a819137f74dc9f2c27df9d3c930"
|
||||
"sha256": "1233d6a0ed76564dd034f178a9f65db076244a819137f74dc9f2c27df9d3c930",
|
||||
"path": "LAN-PREVIEW.md"
|
||||
},
|
||||
{
|
||||
"size": 682867,
|
||||
"path": "dictionaries/en.txt",
|
||||
"sha256": "5f267c141c3d6837870e1c098f86b89a113ba300343119432644ead88f720c21"
|
||||
"sha256": "5f267c141c3d6837870e1c098f86b89a113ba300343119432644ead88f720c21",
|
||||
"path": "dictionaries/en.txt"
|
||||
},
|
||||
{
|
||||
"size": 20138,
|
||||
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt",
|
||||
"sha256": "28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5"
|
||||
"sha256": "28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5",
|
||||
"path": "dictionaries/LICENSE-CC-BY-SA-4.0.txt"
|
||||
},
|
||||
{
|
||||
"size": 2265,
|
||||
"path": "dictionaries/README.md",
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311"
|
||||
"sha256": "3017bf44d3be9d9dfab21bd6778aa52b7947e61acf9ce2bc86b41d6e949ac311",
|
||||
"path": "dictionaries/README.md"
|
||||
},
|
||||
{
|
||||
"size": 1060364,
|
||||
"path": "dictionaries/ru.txt",
|
||||
"sha256": "9ef922c7699569304a428f6aba0fd13a21341c0d0cb9561f37ef83c41577a28b"
|
||||
"sha256": "9ef922c7699569304a428f6aba0fd13a21341c0d0cb9561f37ef83c41577a28b",
|
||||
"path": "dictionaries/ru.txt"
|
||||
},
|
||||
{
|
||||
"size": 1280,
|
||||
"path": "dictionaries/sources.json",
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408"
|
||||
"sha256": "98e5b3fe7304e37705c9e5ff48b0b399ccb16e806736d21f09921b99e5f2a408",
|
||||
"path": "dictionaries/sources.json"
|
||||
},
|
||||
{
|
||||
"size": 940799,
|
||||
"path": "dictionaries/uk.txt",
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf"
|
||||
"sha256": "d30e990d6ec2983c04f3644a3c61c6c668e8c542323f5931916fdd55b916eebf",
|
||||
"path": "dictionaries/uk.txt"
|
||||
},
|
||||
{
|
||||
"size": 993,
|
||||
"path": "tools/README.txt",
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a"
|
||||
"sha256": "a34b5161a8315af037e1ec71d816bfc688f7c364141d4ee2347cf0515ef0c82a",
|
||||
"path": "tools/README.txt"
|
||||
},
|
||||
{
|
||||
"size": 134656,
|
||||
"path": "tools/StayHere.exe",
|
||||
"sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376"
|
||||
"sha256": "6ef5cf64708d62b7fc63c3c793cc99188a513433ff4774cae01dc014f6664376",
|
||||
"path": "tools/StayHere.exe"
|
||||
},
|
||||
{
|
||||
"size": 2796,
|
||||
"path": "tools/StayHere-README.md",
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413"
|
||||
"sha256": "ba214e2aca7405e698b3ab21ceb1f41ce088edd996b3e30e4a9d58ff496f9413",
|
||||
"path": "tools/StayHere-README.md"
|
||||
}
|
||||
]
|
||||
}
|
||||
+3
-3
@@ -9,8 +9,8 @@ IDC_SCREENSHOT_PENCIL CURSOR "icons/lucide/pencil.cur"
|
||||
1 RT_MANIFEST "app.manifest"
|
||||
201 RCDATA "update.ps1"
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 0,6,102,0
|
||||
PRODUCTVERSION 0,6,102,0
|
||||
FILEVERSION 0,6,103,0
|
||||
PRODUCTVERSION 0,6,103,0
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
BEGIN
|
||||
@@ -20,7 +20,7 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "FileDescription", "KSwitcher — native keyboard and clipboard utility"
|
||||
VALUE "ProductName", "KSwitcher"
|
||||
VALUE "FileVersion", "0.6.102"
|
||||
VALUE "FileVersion", "0.6.103"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -144,6 +144,13 @@ BEGIN
|
||||
PUSHBUTTON "Change color…", 366, 257, 181, 82, 15
|
||||
LTEXT "", 367, 345, 184, 45, 12
|
||||
PUSHBUTTON "&Save scheme…", 368, 131, 163, 118, 15
|
||||
LTEXT "Maximum &width (px, 0 = full window)", 373, 131, 31, 184, 12
|
||||
EDITTEXT 374, 318, 28, 64, 14, ES_NUMBER | ES_AUTOHSCROLL
|
||||
LTEXT "Font &family (blank = system default)", 375, 131, 54, 250, 12
|
||||
EDITTEXT 376, 131, 68, 168, 14, ES_AUTOHSCROLL
|
||||
PUSHBUTTON "Choose &font…", 377, 306, 68, 76, 14
|
||||
LTEXT "Font &size (8–72 pt)", 378, 131, 99, 184, 12
|
||||
EDITTEXT 379, 318, 96, 64, 14, ES_NUMBER | ES_AUTOHSCROLL
|
||||
DEFPUSHBUTTON "OK", IDOK, 222, 289, 50, 14
|
||||
PUSHBUTTON "Cancel", IDCANCEL, 280, 289, 50, 14
|
||||
PUSHBUTTON "&Apply", 283, 338, 289, 50, 14
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
<style>
|
||||
:root { color-scheme: light dark; font: 16px/1.55 system-ui, sans-serif; }
|
||||
:root:not(.rendered) body { visibility: hidden; }
|
||||
body { max-width: 960px; margin: auto; padding: 20px 28px; overflow-wrap: anywhere; }
|
||||
body { max-width: var(--markdown-width, 960px); margin: auto; padding: 20px 28px; overflow-wrap: anywhere; }
|
||||
main { font: var(--markdown-font-size, 12pt)/1.55 var(--markdown-font, system-ui, sans-serif); }
|
||||
nav { position: sticky; top: 0; display: flex; gap: .4em; padding-block: .25em; background: Canvas; }
|
||||
nav button { appearance: none; border: 0; background: transparent; color: LinkText;
|
||||
font: 1.35em/1.25 system-ui, sans-serif; min-width: 1.55em; padding: 0; cursor: pointer; }
|
||||
|
||||
@@ -4,7 +4,7 @@ const bridge = window.chrome.webview;
|
||||
const content = document.querySelector('main');
|
||||
const back = document.querySelector('#back');
|
||||
const forward = document.querySelector('#forward');
|
||||
const markdown = markdownit({ html: false, linkify: true });
|
||||
const markdown = markdownit({ html: true, linkify: true });
|
||||
let generation = 0;
|
||||
let images = [];
|
||||
|
||||
@@ -42,13 +42,60 @@ markdown.renderer.rules.image = (tokens, i) => {
|
||||
return '<img alt="' + escape(alt) + '" data-path="' + escape(token.attrGet('src')) + '">';
|
||||
};
|
||||
|
||||
const htmlTags = new Set(`a abbr address article aside b blockquote br caption code col colgroup dd del
|
||||
details div dl dt em figcaption figure footer h1 h2 h3 h4 h5 h6 header hr i img input ins kbd li
|
||||
mark ol p pre s samp section small span strong sub summary sup table tbody td tfoot th thead time
|
||||
tr u ul var wbr`.split(/\s+/));
|
||||
const htmlAttributes = new Set(['id', 'class', 'title', 'lang', 'dir', 'aria-label']);
|
||||
const tagAttributes = {
|
||||
a: ['href'], col: ['span'], colgroup: ['span'], details: ['open'], img: ['alt', 'width', 'height'],
|
||||
input: ['type', 'checked', 'disabled'], ol: ['start', 'reversed', 'type'], li: ['value'],
|
||||
td: ['colspan', 'rowspan'], th: ['colspan', 'rowspan', 'scope'], time: ['datetime']
|
||||
};
|
||||
const inlineStyles = ['white-space', 'text-align', 'vertical-align', 'color', 'background-color',
|
||||
'font-weight', 'font-style', 'text-decoration-line', 'width', 'max-width'];
|
||||
|
||||
function relativeResource(path) {
|
||||
return path && !/^(?:[a-z][a-z\d+.-]*:|[\\/])/i.test(path) && !/[\u0000-\u001f\u007f]/.test(path);
|
||||
}
|
||||
|
||||
function renderContent(text) {
|
||||
// Parse in an inert template and allow only document markup before attaching it to the preview.
|
||||
const template = document.createElement('template');
|
||||
template.innerHTML = markdown.render(text);
|
||||
for (const element of template.content.querySelectorAll('*')) {
|
||||
const tag = element.localName;
|
||||
if (element.namespaceURI !== 'http://www.w3.org/1999/xhtml' || !htmlTags.has(tag) ||
|
||||
(tag === 'input' && element.type !== 'checkbox')) {
|
||||
element.remove();
|
||||
continue;
|
||||
}
|
||||
const imagePath = tag === 'img' && (element.getAttribute('src') ?? element.getAttribute('data-path'))?.trim();
|
||||
const styles = element.hasAttribute('style')
|
||||
? inlineStyles.map(name => [name, element.style.getPropertyValue(name)]) : [];
|
||||
for (const { name } of [...element.attributes]) {
|
||||
if (!htmlAttributes.has(name) && !tagAttributes[tag]?.includes(name)) element.removeAttribute(name);
|
||||
}
|
||||
for (const [name, value] of styles) {
|
||||
if (value) element.style.setProperty(name, value);
|
||||
}
|
||||
if (relativeResource(imagePath)) element.dataset.path = imagePath;
|
||||
if (tag === 'a' && element.hasAttribute('href')) {
|
||||
const path = element.getAttribute('href').trim();
|
||||
if (relativeResource(path) || /^https?:\/\/[^\s\u0000-\u001f\u007f]+$/i.test(path)) element.setAttribute('href', path);
|
||||
else element.removeAttribute('href');
|
||||
}
|
||||
}
|
||||
content.replaceChildren(template.content);
|
||||
}
|
||||
|
||||
function send(action, options = {}) {
|
||||
bridge.postMessage(JSON.stringify({ action, ...options }));
|
||||
}
|
||||
|
||||
function scrollToHeading(fragment) {
|
||||
if (!fragment) { window.scrollTo(0, 0); return; }
|
||||
try { document.getElementById(decodeURIComponent(fragment))?.scrollIntoView(); } catch {}
|
||||
try { content.querySelector('#' + CSS.escape(decodeURIComponent(fragment)))?.scrollIntoView(); } catch {}
|
||||
}
|
||||
|
||||
function restorePosition({ fragment, scroll }) {
|
||||
@@ -69,10 +116,10 @@ async function render({ text, fragment, scroll, title, keepPosition }) {
|
||||
if (keepPosition) scroll = window.scrollY;
|
||||
document.documentElement.classList.remove('rendered');
|
||||
document.title = title;
|
||||
content.innerHTML = markdown.render(text);
|
||||
renderContent(text);
|
||||
const headings = new Set();
|
||||
for (const heading of content.querySelectorAll('h1,h2,h3,h4,h5,h6')) {
|
||||
const base = heading.textContent.trim().toLowerCase().replace(/[^\p{L}\p{N}\s_-]/gu, '').replace(/\s/g, '-');
|
||||
const base = heading.id || heading.textContent.trim().toLowerCase().replace(/[^\p{L}\p{N}\s_-]/gu, '').replace(/\s/g, '-');
|
||||
let id = base;
|
||||
for (let n = 1; headings.has(id); ++n) id = base + '-' + n;
|
||||
heading.id = id;
|
||||
@@ -138,6 +185,12 @@ bridge.addEventListener('message', ({ data }) => {
|
||||
content.replaceChildren();
|
||||
}
|
||||
if (message.action === 'render') void render(message).catch(() => send('failed'));
|
||||
if (message.action === 'appearance') {
|
||||
const style = document.documentElement.style;
|
||||
style.setProperty('--markdown-width', message.width ? message.width + 'px' : 'none');
|
||||
style.setProperty('--markdown-font-size', message.fontSize + 'pt');
|
||||
style.setProperty('--markdown-font', message.font ? CSS.escape(message.font) + ', system-ui, sans-serif' : 'system-ui, sans-serif');
|
||||
}
|
||||
if (message.action === 'anchor') restorePosition(message);
|
||||
if (message.action === 'back' || message.action === 'forward') navigate(message.action);
|
||||
if (message.action === 'history') {
|
||||
|
||||
@@ -20,6 +20,7 @@ terminal.parser.registerOscHandler(633, data => {
|
||||
terminal.loadAddon(fit);
|
||||
const host = document.getElementById('terminal');
|
||||
terminal.open(host);
|
||||
terminal.onSelectionChange(() => bridge.postMessage('selection:' + terminal.getSelection()));
|
||||
host.addEventListener('pointerup', () => bridge.postMessage('focus-input'), true);
|
||||
const screen = host.querySelector('.xterm-screen');
|
||||
let traceEnabled = false;
|
||||
@@ -83,6 +84,10 @@ terminal.onScroll(() => {
|
||||
anchorOutput();
|
||||
});
|
||||
bridge.addEventListener('message', ({ data }) => {
|
||||
if (data === 'clear-selection') {
|
||||
terminal.clearSelection();
|
||||
return;
|
||||
}
|
||||
if (data === 'scroll-bottom') {
|
||||
terminal.scrollToBottom();
|
||||
anchorOutput();
|
||||
|
||||
+21
-7
@@ -341,6 +341,7 @@ void traceTerminal(const char *event,int a=0,int b=0,int c=0,int d=0,int e=0)
|
||||
terminalTrace<<GetTickCount64()<<' '<<event<<' '<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<std::endl;
|
||||
}
|
||||
FilesTerminalView terminalView;
|
||||
std::wstring terminalSelection;
|
||||
COORD terminalSize{80,25};
|
||||
bool terminalViewRequested{};
|
||||
HWND terminalInput{},terminalOutput{},terminalPrompt{};
|
||||
@@ -453,6 +454,7 @@ void showFileDetails(const Panel &panel);
|
||||
void editOptions(HWND owner);
|
||||
void showFolderShortcuts(Panel &panel,int digit,bool all=false);
|
||||
void layout(HWND window,bool activeOnly=false);
|
||||
void clearTerminalSelection();
|
||||
|
||||
DWORD preference(const wchar_t *name, DWORD fallback)
|
||||
{
|
||||
@@ -590,7 +592,7 @@ bool applyFont(HWND owner, LOGFONTW font, int points)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool chooseDisplayFont(HWND owner,LOGFONTW &font,int &points)
|
||||
bool chooseDisplayFont(HWND owner,LOGFONTW &font,int &points,int maximum=24)
|
||||
{
|
||||
CHOOSEFONTW dialog{};
|
||||
dialog.lStructSize=sizeof(dialog);
|
||||
@@ -599,7 +601,7 @@ bool chooseDisplayFont(HWND owner,LOGFONTW &font,int &points)
|
||||
dialog.iPointSize=points;
|
||||
dialog.Flags=CF_SCREENFONTS|CF_INITTOLOGFONTSTRUCT|CF_LIMITSIZE;
|
||||
dialog.nSizeMin=8;
|
||||
dialog.nSizeMax=24;
|
||||
dialog.nSizeMax=maximum;
|
||||
if(!ChooseFontW(&dialog)) return false;
|
||||
points=dialog.iPointSize;
|
||||
return true;
|
||||
@@ -903,6 +905,7 @@ void layout(HWND window,bool activeOnly)
|
||||
const auto region=CreateRectRgn(0,terminalTop-4,std::max(0,width-8),terminalBottom-4);
|
||||
if(region && !SetWindowRgn(terminalOutput,region,FALSE)) DeleteObject(region);
|
||||
}
|
||||
if(!showOutput) clearTerminalSelection();
|
||||
ShowWindow(terminalOutput,showOutput?SW_SHOWNA:SW_HIDE);
|
||||
ShowWindow(status,terminalVisible?SW_HIDE:SW_SHOWNA);
|
||||
terminalView.layout(terminalOutput,showOutput,terminalBottom-4);
|
||||
@@ -973,12 +976,19 @@ std::wstring terminalInputText()
|
||||
return value;
|
||||
}
|
||||
|
||||
void copyTerminalInput(HWND owner)
|
||||
void clearTerminalSelection()
|
||||
{
|
||||
const auto value=terminalInputText();
|
||||
if(terminalSelection.empty()) return;
|
||||
terminalSelection.clear();
|
||||
terminalView.post(L"clear-selection");
|
||||
}
|
||||
|
||||
void copyTerminalText(HWND owner)
|
||||
{
|
||||
const auto value=terminalSelection.empty()?terminalInputText():terminalSelection;
|
||||
if(value.empty()) return;
|
||||
try { ks::writeClipboard(owner,ks::textClip(value)); }
|
||||
catch(const std::exception &) { setStatus(L"Could not copy the command line."); }
|
||||
catch(const std::exception &) { setStatus(L"Could not copy terminal text."); }
|
||||
}
|
||||
|
||||
LRESULT currentPanelRow(const Panel &panel)
|
||||
@@ -1016,7 +1026,7 @@ void copyPanelNames(HWND owner)
|
||||
|
||||
void copyCommandLineOrPanelNames(HWND owner)
|
||||
{
|
||||
if(GetWindowTextLengthW(terminalInput)) copyTerminalInput(owner);
|
||||
if(!terminalSelection.empty() || GetWindowTextLengthW(terminalInput)) copyTerminalText(owner);
|
||||
else copyPanelNames(owner);
|
||||
}
|
||||
|
||||
@@ -1106,6 +1116,7 @@ bool ensureTerminalView(HWND owner)
|
||||
{
|
||||
if(GetForegroundWindow()==owner) SetFocus(terminalInput);
|
||||
}
|
||||
else if(message.starts_with(L"selection:")) terminalSelection=message.substr(10);
|
||||
else if(message==L"enter" || message==L"shift-enter")
|
||||
submitTerminalReturn(owner,message==L"shift-enter");
|
||||
else if(message==L"insert-path") insertCurrentPanelPath();
|
||||
@@ -1275,9 +1286,10 @@ void runCommandLine()
|
||||
|
||||
LRESULT CALLBACK terminalInputKeys(HWND input,UINT message,WPARAM wp,LPARAM lp,UINT_PTR,DWORD_PTR)
|
||||
{
|
||||
if(message==WM_LBUTTONDOWN || message==WM_RBUTTONDOWN) clearTerminalSelection();
|
||||
if(message==WM_COPY || (message==WM_CHAR && wp==3))
|
||||
{
|
||||
copyTerminalInput(GetParent(input));
|
||||
copyTerminalText(GetParent(input));
|
||||
return 0;
|
||||
}
|
||||
if(message==WM_CHAR && wp==VK_TAB && !terminalVisible) return 0;
|
||||
@@ -4468,6 +4480,7 @@ LRESULT CALLBACK panelKeys(HWND window, UINT message, WPARAM wp, LPARAM lp, UINT
|
||||
if(message==WM_LBUTTONDOWN || message==WM_LBUTTONDBLCLK ||
|
||||
(message==WM_MOUSEMOVE && (wp&MK_LBUTTON) && GetCapture()==window))
|
||||
{
|
||||
if(message==WM_LBUTTONDOWN) clearTerminalSelection();
|
||||
auto &panel=panels[index];
|
||||
activatePanel(static_cast<int>(index));
|
||||
const auto count=SendMessageW(window,LB_GETCOUNT,0,0);
|
||||
@@ -5419,6 +5432,7 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
|
||||
return TRUE;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
if(reinterpret_cast<HWND>(lp)==terminalInput && HIWORD(wp)==EN_CHANGE) clearTerminalSelection();
|
||||
if(copyInProgress || commandHistoryWindow || FilesModalDialog::activeFor(window)) return 0;
|
||||
if(LOWORD(wp)==121 && HIWORD(wp)==LBN_DBLCLK) selectDrive();
|
||||
if(LOWORD(wp)>=130 && LOWORD(wp)<=134 && HIWORD(wp)==BN_CLICKED)
|
||||
|
||||
+104
-11
@@ -19,6 +19,9 @@ constexpr int textTabWidth=357,textLineEnding=359,
|
||||
constexpr int textControls[]{350,351,352,353,356,textTabWidth,
|
||||
362,textTheme,364,textColor,textChangeColor,textColorValue,textSaveScheme};
|
||||
constexpr int editingControls[]{354,355,358,textLineEnding};
|
||||
constexpr int markdownSection=1,markdownWidth=374,markdownFamily=376,markdownChoose=377,markdownSize=379;
|
||||
constexpr int markdownControls[]{373,markdownWidth,375,markdownFamily,markdownChoose,378,markdownSize};
|
||||
constexpr wchar_t optionsLocationKey[]=L"OptionsLocation";
|
||||
constexpr struct
|
||||
{
|
||||
int id;
|
||||
@@ -102,7 +105,9 @@ struct OptionsDraft
|
||||
int styleIndex=0;
|
||||
bool styleSuggestionsLoaded{};
|
||||
int page=PanelModes, section=PanelLayout;
|
||||
HTREEITEM wideColumnsNode{};
|
||||
DWORD location{};
|
||||
int markdownError{};
|
||||
HTREEITEM wideColumnsNode{},markdownNode{};
|
||||
RECT initialClient{};
|
||||
UINT initialDpi=96;
|
||||
OptionsControl controls[8]{
|
||||
@@ -150,7 +155,7 @@ void updateOptionsApply(HWND dialog,const OptionsDraft &draft)
|
||||
DWORD fields=0;
|
||||
for(int i=0;i<4;++i) if(checked(205+i)) fields|=1u<<i;
|
||||
const auto &base=draft.baseline;
|
||||
const bool dirty=!valid || width!=base.width ||
|
||||
const bool dirty=!valid || draft.markdownError || width!=base.width ||
|
||||
checked(273)!=base.wide[0] || checked(274)!=base.wide[1] ||
|
||||
checked(202)!=base.extensions || checked(204)!=base.folders || checked(203)!=base.details ||
|
||||
fields!=base.fields || draft.palette!=base.palette || draft.styles!=base.styles ||
|
||||
@@ -333,9 +338,31 @@ void showTextOptions(HWND dialog,const ks::files::TextSettings &settings,const k
|
||||
refreshTextColor(dialog,profile);
|
||||
}
|
||||
|
||||
void showMarkdownOptions(HWND dialog,const ks::files::MarkdownPreferences &settings)
|
||||
{
|
||||
// SetDlgItemText sends EN_CHANGE synchronously, so take a snapshot first.
|
||||
const auto values=settings;
|
||||
SetDlgItemInt(dialog,markdownWidth,values.width,FALSE);
|
||||
SetDlgItemInt(dialog,markdownSize,values.fontSize,FALSE);
|
||||
SetDlgItemTextW(dialog,markdownFamily,values.font.c_str());
|
||||
}
|
||||
|
||||
int readMarkdownOptions(HWND dialog,ks::files::MarkdownPreferences &settings)
|
||||
{
|
||||
BOOL widthValid{}, sizeValid{};
|
||||
const auto width=GetDlgItemInt(dialog,markdownWidth,&widthValid,FALSE);
|
||||
const auto size=GetDlgItemInt(dialog,markdownSize,&sizeValid,FALSE);
|
||||
if(!widthValid || width>999999) return markdownWidth;
|
||||
if(!sizeValid || size<8 || size>72) return markdownSize;
|
||||
wchar_t font[LF_FACESIZE]{};
|
||||
GetDlgItemTextW(dialog,markdownFamily,font,std::size(font));
|
||||
settings={width,size,font};
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool changeTextOption(HWND dialog,OptionsDraft &draft,WPARAM command)
|
||||
{
|
||||
if(!textOptionsPage(draft.page)) return false;
|
||||
if(!textOptionsPage(draft.page) || (draft.page==TextViewer && draft.section==markdownSection)) return false;
|
||||
auto &profile=draft.text.profiles[draft.page==TextEditor];
|
||||
const auto id=LOWORD(command);
|
||||
const auto row=[&](int control){return SendDlgItemMessageW(dialog,control,CB_GETCURSEL,0,0);};
|
||||
@@ -386,12 +413,14 @@ void showOptionsPage(HWND dialog,OptionsDraft &draft,int page,int section)
|
||||
{
|
||||
draft.page=page;
|
||||
draft.section=section;
|
||||
const bool markdown=page==TextViewer && section==markdownSection;
|
||||
const wchar_t *title=L"No matching settings";
|
||||
if(page==allOptions) title=L"All settings";
|
||||
else if(page>=0)
|
||||
{
|
||||
title=optionsTitles[page];
|
||||
if(section>=0 && !textOptionsPage(page))
|
||||
if(markdown) title=L"Markdown";
|
||||
else if(section>=0 && !textOptionsPage(page))
|
||||
title=page==PanelModes?panelSectionNames[section]:page==PanelColors?
|
||||
(section==fileStyleSection?L"File type styles":colorNames[section]):
|
||||
page==CommandLine?L"Command history":section==DialogFrame?L"Dialog frame":L"Font";
|
||||
@@ -430,9 +459,10 @@ void showOptionsPage(HWND dialog,OptionsDraft &draft,int page,int section)
|
||||
}
|
||||
constexpr int commandLineControls[]{320,321,322,323,optionsRemoteTerminal,optionsRemoteHibernate,optionsRemoteUpdate};
|
||||
show(commandLineControls,page==CommandLine && section==0);
|
||||
show(textControls,textOptionsPage(page));
|
||||
show(markdownControls,markdown);
|
||||
show(textControls,textOptionsPage(page) && !markdown);
|
||||
show(editingControls,page==TextEditor);
|
||||
if(textOptionsPage(page)) showTextOptions(dialog,draft.text,draft.text.profiles[page==TextEditor]);
|
||||
if(textOptionsPage(page) && !markdown) showTextOptions(dialog,draft.text,draft.text.profiles[page==TextEditor]);
|
||||
const bool fileTypes=page==PanelColors && section==fileStyleSection;
|
||||
constexpr int fileStyleControls[]{287,288,289,290,291,292,293,294,295,296,297,298,300,fileStyleState};
|
||||
show(fileStyleControls,fileTypes);
|
||||
@@ -491,6 +521,7 @@ void filterOptions(HWND dialog,OptionsDraft &draft)
|
||||
const int previousPage=draft.page,previousSection=draft.section;
|
||||
TreeView_DeleteAllItems(tree);
|
||||
draft.wideColumnsNode=nullptr;
|
||||
draft.markdownNode=nullptr;
|
||||
const auto root=add(L"All settings",allOptions,-1,TVI_ROOT);
|
||||
HTREEITEM first{},selected{};
|
||||
for(int page=PanelModes;page<allOptions;++page)
|
||||
@@ -500,11 +531,16 @@ void filterOptions(HWND dialog,OptionsDraft &draft)
|
||||
const auto addSection=[&](const wchar_t *label,int section,bool aliasMatches=false)
|
||||
{
|
||||
if(!wholeCategory && !aliasMatches && !matches(label)) return;
|
||||
if(!category) category=add(optionsTitles[page],page,-1,root);
|
||||
if(!category)
|
||||
{
|
||||
category=add(optionsTitles[page],page,-1,root);
|
||||
if(page==previousPage && previousSection<0) selected=category;
|
||||
}
|
||||
const auto node=add(label,page,section,category);
|
||||
if(!first) first=node;
|
||||
if(page==previousPage && section==previousSection) selected=node;
|
||||
if(page==PanelModes && section==WideColumns) draft.wideColumnsNode=node;
|
||||
if(page==TextViewer && section==markdownSection) draft.markdownNode=node;
|
||||
};
|
||||
if(page==PanelModes)
|
||||
{
|
||||
@@ -535,6 +571,8 @@ void filterOptions(HWND dialog,OptionsDraft &draft)
|
||||
{return (page==TextEditor || check.id<354) && matches(check.name);}) ||
|
||||
std::any_of(std::begin(ks::files::textColorNames),std::end(ks::files::textColorNames),matches);
|
||||
addSection(page==TextEditor?L"Editing and appearance":L"Viewing and appearance",0,propertyMatches);
|
||||
if(page==TextViewer) addSection(L"Markdown",markdownSection,
|
||||
matches(L"Maximum width") || matches(L"Full window") || matches(L"Font family") || matches(L"Font size"));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -569,6 +607,10 @@ INT_PTR CALLBACK optionsDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
}
|
||||
SetDlgItemInt(dialog,201,sizeWidth,FALSE);
|
||||
SendDlgItemMessageW(dialog,201,EM_SETLIMITTEXT,2,0);
|
||||
SendDlgItemMessageW(dialog,markdownWidth,EM_SETLIMITTEXT,6,0);
|
||||
SendDlgItemMessageW(dialog,markdownSize,EM_SETLIMITTEXT,2,0);
|
||||
SendDlgItemMessageW(dialog,markdownFamily,EM_SETLIMITTEXT,LF_FACESIZE-1,0);
|
||||
showMarkdownOptions(dialog,draft.text.markdown);
|
||||
SendDlgItemMessageW(dialog,optionsSearch,EM_SETLIMITTEXT,255,0);
|
||||
for(const auto &option:frameOptions)
|
||||
for(DWORD value=0;value<=option.maximum;++value)
|
||||
@@ -626,7 +668,12 @@ INT_PTR CALLBACK optionsDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
{
|
||||
const auto &change=*reinterpret_cast<const NMTREEVIEWW*>(lp);
|
||||
if(change.hdr.code==TVN_SELCHANGEDW && change.itemNew.hItem)
|
||||
showOptionsPage(dialog,*draft,static_cast<int>(change.itemNew.lParam>>8),static_cast<int>(change.itemNew.lParam&255)-1);
|
||||
{
|
||||
const auto page=static_cast<int>(change.itemNew.lParam>>8);
|
||||
if(page!=allOptions || !GetWindowTextLengthW(GetDlgItem(dialog,optionsSearch)))
|
||||
draft->location=static_cast<DWORD>(change.itemNew.lParam);
|
||||
showOptionsPage(dialog,*draft,page,static_cast<int>(change.itemNew.lParam&255)-1);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
if(message==WM_CLOSE || (message==WM_COMMAND && LOWORD(wp)==IDCANCEL))
|
||||
@@ -654,6 +701,27 @@ INT_PTR CALLBACK optionsDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
showOptionsPage(dialog,*draft,Appearance,Font);
|
||||
updateOptionsApply(dialog,*draft);
|
||||
return TRUE;
|
||||
case markdownWidth: case markdownSize: case markdownFamily:
|
||||
if(HIWORD(wp)==EN_CHANGE)
|
||||
{
|
||||
draft->markdownError=readMarkdownOptions(dialog,draft->text.markdown);
|
||||
updateOptionsApply(dialog,*draft);
|
||||
}
|
||||
return TRUE;
|
||||
case markdownChoose:
|
||||
{
|
||||
LOGFONTW font{};
|
||||
const auto &settings=draft->text.markdown;
|
||||
wcsncpy_s(font.lfFaceName,settings.font.empty()?L"Segoe UI":settings.font.c_str(),_TRUNCATE);
|
||||
auto size=static_cast<int>(settings.fontSize)*10;
|
||||
font.lfHeight=-MulDiv(size,GetDpiForWindow(dialog),720);
|
||||
if(chooseDisplayFont(dialog,font,size,72))
|
||||
{
|
||||
SetDlgItemTextW(dialog,markdownFamily,font.lfFaceName);
|
||||
SetDlgItemInt(dialog,markdownSize,(size+5)/10,FALSE);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
case outerFramePadding: case innerFramePadding: case rowTextPadding:
|
||||
if(HIWORD(wp)==CBN_SELCHANGE)
|
||||
{
|
||||
@@ -731,8 +799,10 @@ INT_PTR CALLBACK optionsDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
draft->framePadding=defaultDialogFramePadding;
|
||||
if(draft->page==allOptions || textOptionsPage(draft->page))
|
||||
for(int page=TextViewer;page<=TextEditor;++page)
|
||||
if(draft->page==allOptions || draft->page==page)
|
||||
if(draft->page==allOptions || (draft->page==page && draft->section!=markdownSection))
|
||||
draft->text.profiles[page==TextEditor]=ks::files::TextPreferences{};
|
||||
if(draft->page==allOptions || (draft->page==TextViewer && (draft->section<0 || draft->section==markdownSection)))
|
||||
showMarkdownOptions(dialog,ks::files::MarkdownPreferences{});
|
||||
showOptionsPage(dialog,*draft,draft->page,draft->section);
|
||||
updateOptionsApply(dialog,*draft);
|
||||
return TRUE;
|
||||
@@ -759,6 +829,14 @@ INT_PTR CALLBACK optionsDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
case optionsApply:
|
||||
case IDOK:
|
||||
{
|
||||
if(draft->markdownError)
|
||||
{
|
||||
if(!draft->markdownNode) SetDlgItemTextW(dialog,optionsSearch,L"");
|
||||
TreeView_SelectItem(GetDlgItem(dialog,optionsTree),draft->markdownNode);
|
||||
showFilesNotice(dialog,L"Enter a width in pixels (0 for full window) and a font size from 8 to 72 pt.",L"Markdown");
|
||||
SetFocus(GetDlgItem(dialog,draft->markdownError));
|
||||
return TRUE;
|
||||
}
|
||||
BOOL valid{};
|
||||
const auto width=GetDlgItemInt(dialog,201,&valid,FALSE);
|
||||
if(!valid || width<6 || width>16)
|
||||
@@ -780,6 +858,16 @@ INT_PTR CALLBACK optionsDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
const auto &base=draft->baseline;
|
||||
const bool textChanged=draft->text!=base.text;
|
||||
auto textSettings=ks::files::loadTextPreferences();
|
||||
if(draft->text.markdown!=base.text.markdown)
|
||||
{
|
||||
if(textSettings.markdown!=base.text.markdown && textSettings.markdown!=draft->text.markdown)
|
||||
{
|
||||
showFilesNotice(dialog,L"Markdown settings changed in another window. Reopen Options before editing them again.",
|
||||
L"KSwitcher Files Options");
|
||||
return TRUE;
|
||||
}
|
||||
textSettings.markdown=draft->text.markdown;
|
||||
}
|
||||
for(size_t i=0;i<textSettings.profiles.size();++i)
|
||||
{
|
||||
if(draft->text.profiles[i]==base.text.profiles[i]) continue;
|
||||
@@ -884,6 +972,7 @@ INT_PTR CALLBACK optionsDialog(HWND dialog,UINT message,WPARAM wp,LPARAM lp)
|
||||
SendMessageW(dialogOwner,filesPreferencesChanged,reinterpret_cast<WPARAM>(owner),0);
|
||||
draft->baseline=OptionsBaseline{};
|
||||
draft->text=draft->baseline.text;
|
||||
showMarkdownOptions(dialog,draft->text.markdown);
|
||||
populateTextSchemes(dialog,draft->text);
|
||||
draft->font=displayFont;
|
||||
draft->points=fontPoints;
|
||||
@@ -919,12 +1008,16 @@ void runOptions(HWND owner,int page)
|
||||
{
|
||||
OptionsDraft draft;
|
||||
draft.filesWindow=GetAncestor(owner,GA_ROOTOWNER);
|
||||
draft.page=page;
|
||||
draft.section=textOptionsPage(page)?0:PanelLayout;
|
||||
const DWORD initial=static_cast<DWORD>((page<<8)|1);
|
||||
const auto saved=preference(optionsLocationKey,initial);
|
||||
draft.location=(saved>>8)<=allOptions?saved:initial;
|
||||
draft.page=static_cast<int>(draft.location>>8);
|
||||
draft.section=static_cast<int>(draft.location&255)-1;
|
||||
std::copy(std::begin(colors),std::end(colors),draft.palette.begin());
|
||||
const auto result=FilesModalDialog::run(GetModuleHandleW(nullptr),MAKEINTRESOURCEW(101),owner,optionsDialog,
|
||||
reinterpret_cast<LPARAM>(&draft));
|
||||
if(result==-1) setStatus(L"Could not open Files Options.");
|
||||
else savePreference(optionsLocationKey,draft.location);
|
||||
}
|
||||
|
||||
void editOptions(HWND owner)
|
||||
|
||||
@@ -44,10 +44,18 @@ struct NamedTextPalette
|
||||
};
|
||||
inline constexpr size_t maxTextPalettes = 48;
|
||||
inline constexpr size_t maxTextPaletteName = 48;
|
||||
struct MarkdownPreferences
|
||||
{
|
||||
unsigned width{960}, fontSize{12};
|
||||
std::wstring font;
|
||||
bool operator==(const MarkdownPreferences &) const = default;
|
||||
};
|
||||
|
||||
struct TextSettings
|
||||
{
|
||||
TextPreferencesSet profiles;
|
||||
std::vector<NamedTextPalette> schemes;
|
||||
MarkdownPreferences markdown;
|
||||
bool operator==(const TextSettings &) const = default;
|
||||
};
|
||||
TextSettings loadTextPreferences();
|
||||
|
||||
@@ -83,6 +83,15 @@ TextSettings loadTextPreferences()
|
||||
const auto data = nlohmann::json::parse(readFile(combined, 64 * 1024));
|
||||
for (size_t i = 0; i < profiles.size(); ++i)
|
||||
if (data.contains(profileNames[i])) readTextProfile(profiles[i], data.at(profileNames[i]));
|
||||
if (const auto markdown=data.find("markdown");markdown!=data.end() && markdown->is_object())
|
||||
{
|
||||
if (const auto width=markdown->find("width");width!=markdown->end() && width->is_number_unsigned() && *width<=999999)
|
||||
settings.markdown.width=width->get<unsigned>();
|
||||
if (const auto size=markdown->find("fontSize");size!=markdown->end() && size->is_number_unsigned() && *size>=8 && *size<=72)
|
||||
settings.markdown.fontSize=size->get<unsigned>();
|
||||
if (const auto family=markdown->find("font");family!=markdown->end() && family->is_string())
|
||||
settings.markdown.font=wide(family->get<std::string>()).substr(0,LF_FACESIZE-1);
|
||||
}
|
||||
if (data.contains("schemes") && data.at("schemes").is_array())
|
||||
for (const auto &entry : data.at("schemes"))
|
||||
{
|
||||
@@ -126,6 +135,8 @@ void saveTextPreferences(const TextSettings &settings)
|
||||
auto &schemes = data["schemes"] = nlohmann::json::array();
|
||||
for (const auto &scheme : settings.schemes)
|
||||
schemes.push_back({{"name", utf8(scheme.name)}, {"colors", scheme.colors}});
|
||||
data["markdown"]={{"width",settings.markdown.width},{"fontSize",settings.markdown.fontSize},
|
||||
{"font",utf8(settings.markdown.font)}};
|
||||
const auto json = data.dump(2);
|
||||
atomicWrite(dataDirectory() / L"files-text.json", Bytes(json.begin(), json.end()));
|
||||
}
|
||||
@@ -863,6 +874,7 @@ private:
|
||||
void updatePreview();
|
||||
void stopPreview(bool refresh=true,bool keepBrowser=false);
|
||||
void renderPreview(bool keepPosition=false);
|
||||
void applyMarkdownPreferences(const MarkdownPreferences &preferences);
|
||||
std::optional<FileStamp> previewFileStamp() const;
|
||||
void refreshPreview();
|
||||
void cancelPreviewImages();
|
||||
@@ -1134,7 +1146,9 @@ void TextWindow::reloadPreferences()
|
||||
return;
|
||||
}
|
||||
pendingPreferences = false;
|
||||
auto profile = loadTextPreferences().profiles[edit];
|
||||
auto settings = loadTextPreferences();
|
||||
applyMarkdownPreferences(settings.markdown);
|
||||
auto &profile = settings.profiles[edit];
|
||||
const auto font = search.style.readFont();
|
||||
const bool fontChanged = font.tenthsOfPoint != filesFont.tenthsOfPoint ||
|
||||
std::memcmp(&font.font, &filesFont.font, sizeof(LOGFONTW)) != 0;
|
||||
@@ -1547,6 +1561,7 @@ std::optional<TextWindow::FileStamp> TextWindow::previewFileStamp() const
|
||||
|
||||
void TextWindow::renderPreview(bool keepPosition)
|
||||
{
|
||||
applyMarkdownPreferences(loadTextPreferences().markdown);
|
||||
previewDeadline=GetTickCount64()+30000;
|
||||
std::string text;
|
||||
for(uint64_t index=0;index<document->pages();++index)
|
||||
@@ -1560,6 +1575,13 @@ void TextWindow::renderPreview(bool keepPosition)
|
||||
preview.post(wide(message.dump(-1,' ',false,nlohmann::json::error_handler_t::replace)));
|
||||
}
|
||||
|
||||
void TextWindow::applyMarkdownPreferences(const MarkdownPreferences &preferences)
|
||||
{
|
||||
if(!preview.initialized()) return;
|
||||
preview.post(wide(nlohmann::json{{"action","appearance"},{"width",preferences.width},
|
||||
{"fontSize",preferences.fontSize},{"font",utf8(preferences.font)}}.dump()));
|
||||
}
|
||||
|
||||
void TextWindow::refreshPreview()
|
||||
{
|
||||
if(remote || !previewVisible || navigation.valid() || GetTickCount64()<nextFileCheck) return;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
#include "platform.h"
|
||||
namespace ks
|
||||
{
|
||||
inline constexpr wchar_t AppVersion[] = L"0.6.102";
|
||||
inline constexpr wchar_t AppVersion[] = L"0.6.103";
|
||||
inline constexpr UINT UpdateMessage = WM_APP + 7;
|
||||
inline constexpr UINT UpdateCheckIntervalMs = 6 * 60 * 60 * 1000;
|
||||
inline constexpr UINT UpdateNotificationRetryMs = 5 * 60 * 1000;
|
||||
|
||||
@@ -296,6 +296,9 @@ try {
|
||||
}
|
||||
Write-Output 'Verified Enter from the terminal WebView runs the command exactly once.'
|
||||
Select-Row $left '[Test folder]'
|
||||
$outputSelection = 'terminal-output-copy-fixture'
|
||||
Send-InteractiveTerminal "Write-Output '$outputSelection'"
|
||||
Wait-Until 'output selection fixture command submitted' { !(Read-Text $inputBox) }
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
$savedClipboard = [Windows.Forms.Clipboard]::GetDataObject()
|
||||
try {
|
||||
@@ -313,18 +316,31 @@ try {
|
||||
Wait-Until 'Ctrl+Insert copying the command line with focus in the terminal WebView' {
|
||||
[Windows.Forms.Clipboard]::GetText() -ceq $webviewDraft
|
||||
}
|
||||
& $Node (Join-Path $PSScriptRoot 'files_markdown_browser.mjs') $port 'terminal-select-output'
|
||||
if($LASTEXITCODE){throw 'Could not select the terminal output fixture.'}
|
||||
Wait-Until 'focus returned to the command line after selecting terminal output' {
|
||||
[FilesActivationUi]::Focus($window) -eq $inputBox
|
||||
}
|
||||
foreach($key in '^c','^{INSERT}') {
|
||||
[Windows.Forms.Clipboard]::SetText($webviewDraft)
|
||||
$keys.SendKeys($key)
|
||||
Wait-Until "$key copying only the selected terminal output with a command present" {
|
||||
[Windows.Forms.Clipboard]::GetText() -ceq $outputSelection
|
||||
}
|
||||
if ((Read-Text $inputBox) -cne $webviewDraft) { throw 'Copying output changed the command line.' }
|
||||
}
|
||||
[void][FilesActivationUi]::Write($inputBox,0x0C,[IntPtr]::Zero,'')
|
||||
$keys.SendKeys('^{INSERT}')
|
||||
Wait-Until 'Ctrl+Insert copying the selected folder name when the command line is empty' {
|
||||
[Windows.Forms.Clipboard]::GetText() -ceq 'Test folder'
|
||||
}
|
||||
} finally {
|
||||
if ([Windows.Forms.Clipboard]::GetText() -cin @($nativeDraft,$webviewDraft,'Test folder')) {
|
||||
if ([Windows.Forms.Clipboard]::GetText() -cin @($nativeDraft,$webviewDraft,$outputSelection,'Test folder')) {
|
||||
if ($savedClipboard) { [Windows.Forms.Clipboard]::SetDataObject($savedClipboard,$true) }
|
||||
else { [Windows.Forms.Clipboard]::Clear() }
|
||||
}
|
||||
}
|
||||
Write-Output 'Verified Ctrl+Insert copies the command line first and falls back to the selected item.'
|
||||
Write-Output 'Verified Ctrl+C and Ctrl+Insert copy the selected output, then fall back to the command line or panel.'
|
||||
& $Node (Join-Path $PSScriptRoot 'files_markdown_browser.mjs') $port 'terminal-enter'
|
||||
if($LASTEXITCODE){throw 'Could not send Enter through the terminal WebView.'}
|
||||
Wait-Until 'Enter from the terminal opening the selected folder in the pane' {
|
||||
|
||||
@@ -104,7 +104,7 @@ $docs = Join-Path $root 'docs'
|
||||
$profileCaptured = $false
|
||||
$profile = [Microsoft.Win32.Registry]::CurrentUser.CreateSubKey('Software\KSwitcher\Files')
|
||||
$saved = @{}
|
||||
$profileValues = 'LeftPath','RightPath','LeftCursor','RightCursor','WindowPlacement'
|
||||
$profileValues = 'LeftPath','RightPath','LeftCursor','RightCursor','WindowPlacement','OptionsLocation'
|
||||
$process = $null
|
||||
$flags = $env:WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS
|
||||
$data = $env:WEBVIEW2_USER_DATA_FOLDER
|
||||
@@ -117,13 +117,21 @@ try {
|
||||
| Header |
|
||||
| ------ |
|
||||
| Cell |
|
||||
| <span id="nowrap-cell" style="white-space: nowrap; color: red; position: fixed" onclick="void 0">In Development</span> |
|
||||
|
||||
<table id="html-table">
|
||||
<caption>Raw HTML table</caption>
|
||||
<tr><th colspan="2">Priority</th></tr>
|
||||
<tr><td><strong>Highest</strong></td><td>—</td></tr>
|
||||
</table>
|
||||
|
||||
- [ ] Pending
|
||||
- [x] Complete
|
||||
|
||||

|
||||

|
||||
[Child](child/Other.md#target-heading)
|
||||
<img alt="HTML relative image" src="images/tiny%20image.png">
|
||||
<a href="child/Other.md#target-heading">Child</a>
|
||||
|
||||
~~~mermaid
|
||||
flowchart TD
|
||||
@@ -160,7 +168,7 @@ const value = 42;
|
||||
$profileCaptured = $true
|
||||
$profile.SetValue('LeftPath',$docs)
|
||||
$profile.SetValue('RightPath',$docs)
|
||||
foreach ($name in 'LeftCursor','RightCursor','WindowPlacement') { $profile.DeleteValue($name,$false) }
|
||||
foreach ($name in 'LeftCursor','RightCursor','WindowPlacement','OptionsLocation') { $profile.DeleteValue($name,$false) }
|
||||
|
||||
$listener = [Net.Sockets.TcpListener]::new([Net.IPAddress]::Loopback,0)
|
||||
$listener.Start()
|
||||
@@ -179,6 +187,37 @@ const value = 42;
|
||||
throw 'F3 showed the source text while starting the Markdown preview.'
|
||||
}
|
||||
Browser 'render' $Screenshot
|
||||
Post $main 0x111 133
|
||||
$options = Wait-For 'the shared Files Options dialog' { Find-Window '#32770' 'KSwitcher Files Options' }
|
||||
[void][MarkdownUi]::SendText([MarkdownUi]::GetDlgItem($options,270),0x0C,0,'Markdown')
|
||||
[void](Wait-For 'the Markdown settings section' { [MarkdownUi]::IsWindowVisible([MarkdownUi]::GetDlgItem($options,374)) })
|
||||
foreach($field in @(@(374,'1200'),@(376,'Georgia'),@(379,'18'))){
|
||||
[void][MarkdownUi]::SendText([MarkdownUi]::GetDlgItem($options,$field[0]),0x0C,0,$field[1])
|
||||
}
|
||||
Post $options 0x111 1
|
||||
[void](Wait-For 'Options to close after saving Markdown settings' { ![MarkdownUi]::IsWindowVisible($options) })
|
||||
Browser 'appearance-width'
|
||||
|
||||
Post $main 0x111 133
|
||||
$options = Wait-For 'reopened Files Options' { Find-Window '#32770' 'KSwitcher Files Options' }
|
||||
if (![MarkdownUi]::IsWindowVisible([MarkdownUi]::GetDlgItem($options,374))) {
|
||||
throw 'Files Options did not restore its last section.'
|
||||
}
|
||||
[void][MarkdownUi]::SendText([MarkdownUi]::GetDlgItem($options,374),0x0C,0,'0')
|
||||
Post $options 0x111 2
|
||||
[void](Wait-For 'Options to close on Cancel' { ![MarkdownUi]::IsWindowVisible($options) })
|
||||
Browser 'appearance-width'
|
||||
|
||||
Post $main 0x111 133
|
||||
$options = Wait-For 'Files Options after Cancel' { Find-Window '#32770' 'KSwitcher Files Options' }
|
||||
if (![MarkdownUi]::IsWindowVisible([MarkdownUi]::GetDlgItem($options,374))) {
|
||||
throw 'Cancel did not preserve the last Options section.'
|
||||
}
|
||||
[void][MarkdownUi]::SendText([MarkdownUi]::GetDlgItem($options,374),0x0C,0,'0')
|
||||
Post $options 0x111 1
|
||||
[void](Wait-For 'Options to close after saving full width' { ![MarkdownUi]::IsWindowVisible($options) })
|
||||
Browser 'appearance-full'
|
||||
Write-Output 'Verified live Markdown width and font settings, Cancel and reopening the last Options section.'
|
||||
if ([IO.File]::ReadAllText($original) -cne $fixture) { throw 'Checking a task modified the read-only file.' }
|
||||
[IO.File]::WriteAllText($original,($fixture.Replace('Перегляд Markdown','Зміна на диску')))
|
||||
Browser 'Зміна на диску' '' 'Preview.md'
|
||||
@@ -196,6 +235,7 @@ const value = 42;
|
||||
Wait-Foreground $main
|
||||
[MarkdownUi]::CycleWindow()
|
||||
Wait-Foreground $window
|
||||
Write-Output 'Verified Ctrl+Tab between Files and the Markdown editor.'
|
||||
$control = Scintilla $window
|
||||
if ([MarkdownUi]::Send($control,2140,0,0).ToInt64()) { throw 'The editor is read-only.' }
|
||||
Append-Character $control 'X'
|
||||
@@ -216,6 +256,7 @@ const value = 42;
|
||||
$child = Wait-For 'the Shift+click Markdown window' { Find-Window 'KSwitcher.Files.Text' 'Other.md' $window }
|
||||
Browser 'Linked Markdown' '' 'Other.md'
|
||||
[MarkdownUi]::Activate($child)
|
||||
Wait-Foreground $child
|
||||
Browser 'cycle' '' 'Other.md'
|
||||
Wait-Foreground $main
|
||||
[MarkdownUi]::CycleWindow()
|
||||
@@ -247,6 +288,7 @@ const value = 42;
|
||||
Post $control 0x100 0x75
|
||||
Answer-Save 6
|
||||
Browser 'Перегляд Markdown'
|
||||
Browser 'appearance-full'
|
||||
if (![IO.File]::ReadAllText($original).EndsWith('Y')) { throw 'F6 rendered before saving.' }
|
||||
Post $window 0x10 0
|
||||
[void](Wait-For 'the saved Markdown viewer to close' { !(Find-Window 'KSwitcher.Files.Text') })
|
||||
|
||||
@@ -3,7 +3,7 @@ import { writeFile } from 'node:fs/promises';
|
||||
import { setTimeout as delay } from 'node:timers/promises';
|
||||
|
||||
const [port, scenario, artifact, title] = process.argv.slice(2);
|
||||
const terminalKey = scenario === 'terminal-enter' || scenario === 'terminal-copy';
|
||||
const terminalScenario = ['terminal-enter', 'terminal-copy', 'terminal-select-output'].includes(scenario);
|
||||
let socket;
|
||||
const pending = new Map();
|
||||
let sequence = 0;
|
||||
@@ -42,7 +42,7 @@ async function evaluate(expression) {
|
||||
const target = await waitFor(async () => {
|
||||
const response = await fetch('http://127.0.0.1:' + port + '/json/list').catch(() => null);
|
||||
if (!response?.ok) return;
|
||||
const url = terminalKey
|
||||
const url = terminalScenario
|
||||
? 'https://kswitcher-terminal.invalid/index.html'
|
||||
: 'https://kswitcher-markdown.invalid/markdown.html';
|
||||
return (await response.json()).find(item => item.url === url &&
|
||||
@@ -63,7 +63,19 @@ await new Promise((resolve, reject) => {
|
||||
});
|
||||
|
||||
try {
|
||||
if (terminalKey) {
|
||||
if (scenario === 'terminal-select-output') {
|
||||
const selection = await waitFor(() => evaluate(`(() => {
|
||||
const marker = 'terminal-output-copy-fixture';
|
||||
const buffer = terminal.buffer.active;
|
||||
for (let row = buffer.viewportY; row < buffer.viewportY + terminal.rows; row++) {
|
||||
if (buffer.getLine(row)?.translateToString(true) !== marker) continue;
|
||||
terminal.select(0, row, marker.length);
|
||||
document.querySelector('#terminal').dispatchEvent(new PointerEvent('pointerup', { bubbles:true }));
|
||||
return terminal.getSelection();
|
||||
}
|
||||
})()`), 'the terminal output fixture');
|
||||
assert.equal(selection, 'terminal-output-copy-fixture');
|
||||
} else if (terminalScenario) {
|
||||
await evaluate('document.querySelector(".xterm-helper-textarea").focus()');
|
||||
const key = scenario === 'terminal-copy'
|
||||
? { key:'Insert', code:'Insert', modifiers:2, windowsVirtualKeyCode:45 }
|
||||
@@ -80,6 +92,18 @@ try {
|
||||
return style.borderTopWidth === '0px' && style.backgroundColor === 'rgba(0, 0, 0, 0)';
|
||||
})`), true);
|
||||
assert.equal(await evaluate(`document.querySelector('td').textContent`), 'Cell');
|
||||
assert.deepEqual(await evaluate(`(() => {
|
||||
const span = document.querySelector('td #nowrap-cell');
|
||||
return span && [span.textContent, getComputedStyle(span).whiteSpace,
|
||||
getComputedStyle(span).color, span.style.position, span.hasAttribute('onclick')];
|
||||
})()`), ['In Development', 'nowrap', 'rgb(255, 0, 0)', '', false]);
|
||||
assert.deepEqual(await evaluate(`(() => {
|
||||
const table = document.querySelector('#html-table');
|
||||
return table && [table.caption.textContent, table.querySelector('th').colSpan,
|
||||
table.querySelector('td strong').textContent];
|
||||
})()`), ['Raw HTML table', 2, 'Highest']);
|
||||
await waitFor(() => evaluate(`document.querySelector('img[alt="HTML relative image"]')?.naturalWidth === 1`),
|
||||
'the relative image in HTML');
|
||||
assert.equal(await evaluate(`document.querySelector('figure svg').getBoundingClientRect().height > 0`), true);
|
||||
assert.equal(await evaluate(`document.querySelector('figure svg').textContent.includes('Render target')`), true);
|
||||
assert.equal(await evaluate(`!!document.querySelector('pre code.language-mermaid') &&
|
||||
@@ -93,9 +117,18 @@ try {
|
||||
assert.deepEqual(await evaluate(`[...document.querySelectorAll('input')].map(box => { box.click(); return box.checked; })`), [true, false]);
|
||||
assert.deepEqual(await evaluate(`[...document.querySelectorAll('input')].map(box => { box.click(); return box.checked; })`), [false, true]);
|
||||
if (artifact) {
|
||||
const { data } = await command('Page.captureScreenshot');
|
||||
const { cssContentSize } = await command('Page.getLayoutMetrics');
|
||||
const { data } = await command('Page.captureScreenshot', { captureBeyondViewport: true,
|
||||
clip: { x:0, y:0, width:cssContentSize.width, height:Math.min(cssContentSize.height, 620), scale:1 } });
|
||||
await writeFile(artifact, Buffer.from(data, 'base64'));
|
||||
}
|
||||
} else if (scenario === 'appearance-width' || scenario === 'appearance-full') {
|
||||
const width = scenario === 'appearance-full' ? 'none' : '1200px';
|
||||
await waitFor(() => evaluate(`(() => {
|
||||
const text = getComputedStyle(document.querySelector('main'));
|
||||
return getComputedStyle(document.body).maxWidth === ${JSON.stringify(width)} &&
|
||||
text.fontSize === '24px' && text.fontFamily.startsWith('Georgia,');
|
||||
})()`), 'the saved Markdown width, font family and font size');
|
||||
} else if (scenario === 'edit') {
|
||||
await command('Input.dispatchKeyEvent', { type: 'keyDown', key: 'F6', code: 'F6', windowsVirtualKeyCode: 117 });
|
||||
} else if (['follow', 'shift-follow', 'ctrl-follow'].includes(scenario)) {
|
||||
|
||||
Reference in new issue
Block a user