feat: Editor mit Zeilennummern und deutlich mehr Textformaten
- Zeilennummern in Ansicht und Editor, Statuszeile mit Zeile/Spalte, Zeilenanzahl, Kodierung, Zeilenende und Änderungsmarker. - Tab/Umschalt+Tab rücken (auch mehrere Zeilen) ein/aus, Enter übernimmt die Einrückung, Strg+G springt zu einer Zeile. - Vor dem Speichern: JSON muss gültig sein, YAML darf nicht mit Tabs eingerückt sein (mit Option, trotzdem zu speichern). - Über 200 Endungen und typische Dateinamen (go, hosts, Dockerfile …); unbekannte Dateien werden am Inhalt als Text erkannt, "Als Text öffnen". - Windows-1252-Dateien werden angezeigt und in ihrer Kodierung gespeichert (vorher leere Antwort); CRLF bleibt erhalten. - Paket 2026.11.21.r006. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0592a02c8e
commit
1ca0d5aaae
9 files changed
+457
-31
No files matched your search
+241
-19
@@ -91,8 +91,32 @@ const uiIcons = {
|
||||
tree: '<path d="M4 5h6"></path><path d="M4 12h10"></path><path d="M4 19h14"></path><path d="M4 5v14"></path><circle cx="4" cy="5" r="1.5"></circle><circle cx="4" cy="12" r="1.5"></circle><circle cx="4" cy="19" r="1.5"></circle>',
|
||||
upload: '<path d="M12 16V5"></path><path d="m8 9 4-4 4 4"></path><path d="M5 16v3h14v-3"></path>'
|
||||
};
|
||||
const previewExtensions = new Set(['txt', 'log', 'md', 'rd', 'rst', 'yaml', 'yml', 'json', 'xml', 'csv', 'tsv', 'ini', 'cfg', 'conf', 'env', 'toml', 'sql', 'nfo', 'srt', 'sub', 'vtt', 'm3u', 'm3u8', 'pls', 'sh', 'bash', 'zsh', 'php', 'js', 'ts', 'tsx', 'jsx', 'css', 'html', 'py', 'go', 'rs', 'java', 'c', 'cpp', 'h', 'hpp', 'bat', 'ps1', 'properties', 'service', 'timer', 'mount', 'rules', 'cron', 'plg', 'page', 'jpg', 'jpeg', 'png', 'gif', 'webp', 'svg', 'pdf', 'mp3', 'flac', 'm4a', 'ogg', 'wav', 'mp4', 'mkv', 'webm', 'mov']);
|
||||
const previewFilenames = new Set(['dockerfile', 'makefile']);
|
||||
// Keep in sync with unav_preview_type() in api/preview.php.
|
||||
const previewExtensions = new Set([
|
||||
'ac', 'adoc', 'ahk', 'am', 'asc', 'asciidoc', 'ass', 'automount', 'awk', 'bash', 'bash_profile', 'bashrc', 'bat',
|
||||
'bib', 'c', 'cc', 'cf', 'cfg', 'cjs', 'clj', 'cmake', 'cmd', 'cnf', 'compose', 'conf', 'config', 'containerfile',
|
||||
'cpp', 'cron', 'crontab', 'cs', 'csh', 'csr', 'css', 'csv', 'cue', 'curlrc', 'cxx', 'dart', 'desktop', 'diff',
|
||||
'diz', 'dockerfile', 'dockerignore', 'editorconfig', 'el', 'env', 'erl', 'err', 'ex', 'exports', 'exs', 'fish',
|
||||
'flac', 'fs', 'fstab', 'geojson', 'gif', 'gitattributes', 'gitignore', 'gitmodules', 'go', 'gql', 'gradle',
|
||||
'graphql', 'groovy', 'h', 'hbs', 'hcl', 'hh', 'hosts', 'hpp', 'hs', 'htaccess', 'htm', 'html', 'htpasswd', 'ics',
|
||||
'in', 'inf', 'ini', 'inputrc', 'j2', 'java', 'jinja', 'jinja2', 'jl', 'jpeg', 'jpg', 'js', 'json', 'json5',
|
||||
'jsonc', 'jsonl', 'jsx', 'ksh', 'kt', 'kts', 'less', 'link', 'lisp', 'list', 'lock', 'log', 'lst', 'lua', 'm3u',
|
||||
'm3u8', 'm4', 'm4a', 'mak', 'make', 'markdown', 'md', 'md5', 'mdown', 'mdx', 'mjs', 'mk', 'mkd', 'mkv', 'ml',
|
||||
'mod', 'mount', 'mov', 'mp3', 'mp4', 'mustache', 'ndjson', 'netdev', 'network', 'nfo', 'nix', 'npmrc', 'nvmrc',
|
||||
'nzb', 'ogg', 'opml', 'org', 'out', 'page', 'patch', 'path', 'pdf', 'pem', 'php', 'phtml', 'pl', 'plg', 'plist',
|
||||
'pls', 'pm', 'png', 'prefs', 'profile', 'properties', 'proto', 'ps1', 'psd1', 'psm1', 'pub', 'py', 'pyw', 'r',
|
||||
'rb', 'rc', 'rd', 'repo', 'rs', 'rst', 'rtf', 'rules', 'sass', 'scala', 'screenrc', 'scss', 'sed', 'service',
|
||||
'sfv', 'sh', 'sha1', 'sha256', 'sha512', 'socket', 'sources', 'spec', 'sql', 'srt', 'ssa', 'sub', 'sum', 'svelte',
|
||||
'svg', 'swift', 'target', 'tcl', 'tex', 'text', 'tf', 'tfvars', 'timer', 'tmpl', 'tmux', 'toml', 'tpl', 'ts',
|
||||
'tsv', 'tsx', 'twig', 'txt', 'vb', 'vbs', 'vcf', 'vim', 'vimrc', 'vtt', 'vue', 'wav', 'webm', 'webp', 'wgetrc',
|
||||
'xhtml', 'xml', 'xsd', 'xsl', 'xslt', 'xspf', 'yaml', 'yarnrc', 'yml', 'zsh', 'zshrc'
|
||||
]);
|
||||
const previewFilenames = new Set([
|
||||
'authorized_keys', 'authors', 'brewfile', 'caddyfile', 'changelog', 'codeowners', 'config', 'containerfile',
|
||||
'copying', 'crontab', 'dockerfile', 'exports', 'fstab', 'gemfile', 'gnumakefile', 'go', 'group', 'hosts',
|
||||
'jenkinsfile', 'known_hosts', 'licence', 'license', 'makefile', 'notice', 'passwd', 'procfile', 'rakefile',
|
||||
'readme', 'shells', 'todo', 'vagrantfile', 'version'
|
||||
]);
|
||||
|
||||
document.querySelector('#newExplorerButton').addEventListener('click', () => openExplorer());
|
||||
document.querySelector('#newPropertiesButton').addEventListener('click', () => openProperties());
|
||||
@@ -190,8 +214,8 @@ function openProperties(entry = state.selectedEntry) {
|
||||
});
|
||||
}
|
||||
|
||||
function openPreview(entry, sourceWindowId = state.focusedId) {
|
||||
if (!entry || !isPreviewable(entry)) {
|
||||
function openPreview(entry, sourceWindowId = state.focusedId, options = {}) {
|
||||
if (!entry || (!options.force && !isPreviewable(entry))) {
|
||||
showError(new Error('Für diesen Dateityp ist keine Vorschau verfügbar.'));
|
||||
return null;
|
||||
}
|
||||
@@ -874,7 +898,10 @@ function renderPreview(body, win) {
|
||||
</div>
|
||||
</div>
|
||||
${renderPreviewContent(data)}
|
||||
${isCodeView(data) ? `<div class="editor-status">${editorStatusMarkup(data)}</div>` : ''}
|
||||
`;
|
||||
if (isCodeView(data)) body.classList.add('with-status');
|
||||
else body.classList.remove('with-status');
|
||||
body.querySelector('[data-action="preview-prev"]')?.addEventListener('click', () => openPreview(navigation.previous, data.sourceWindowId));
|
||||
body.querySelector('[data-action="preview-next"]')?.addEventListener('click', () => openPreview(navigation.next, data.sourceWindowId));
|
||||
body.querySelector('[data-action="preview-edit"]')?.addEventListener('click', () => {
|
||||
@@ -889,23 +916,19 @@ function renderPreview(body, win) {
|
||||
});
|
||||
const editor = body.querySelector('.preview-editor');
|
||||
if (editor) {
|
||||
editor.addEventListener('input', () => {
|
||||
data.draft = editor.value;
|
||||
});
|
||||
editor.addEventListener('keydown', (event) => {
|
||||
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 's') {
|
||||
event.preventDefault();
|
||||
savePreview(win, editor.value);
|
||||
}
|
||||
});
|
||||
requestAnimationFrame(() => editor.focus());
|
||||
bindCodeEditor(body, editor, win);
|
||||
}
|
||||
body.querySelector('[data-action="preview-save"]')?.addEventListener('click', () => savePreview(win, editor?.value ?? data.draft ?? ''));
|
||||
}
|
||||
|
||||
function renderPreviewContent(data) {
|
||||
if (data.editing) {
|
||||
return `<textarea class="preview-editor" aria-label="Datei bearbeiten" spellcheck="false">${escapeHtml(data.draft ?? data.content ?? '')}</textarea>`;
|
||||
const value = data.draft ?? data.content ?? '';
|
||||
return `
|
||||
<div class="code-view editing">
|
||||
<pre class="line-gutter" aria-hidden="true">${lineNumbers(value)}</pre>
|
||||
<textarea class="preview-editor" aria-label="Datei bearbeiten" spellcheck="false" wrap="off" autocapitalize="off" autocomplete="off">${escapeHtml(value)}</textarea>
|
||||
</div>`;
|
||||
}
|
||||
if (data.type === 'markdown') {
|
||||
return `<article class="preview-rendered">${renderMarkdown(data.content || '')}</article>`;
|
||||
@@ -925,7 +948,11 @@ function renderPreviewContent(data) {
|
||||
if (data.type === 'video') {
|
||||
return `<div class="preview-media"><video controls src="${escapeAttr(apiUrl(data.rawUrl))}"></video></div>`;
|
||||
}
|
||||
return `<pre class="preview-text">${escapeHtml(data.content || '')}</pre>`;
|
||||
return `
|
||||
<div class="code-view">
|
||||
<pre class="line-gutter" aria-hidden="true">${lineNumbers(data.content || '')}</pre>
|
||||
<pre class="preview-text">${escapeHtml(data.content || '')}</pre>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function previewNavigation(data) {
|
||||
@@ -962,6 +989,10 @@ async function loadPreview(win, entry) {
|
||||
win.data.editing = false;
|
||||
win.data.draft = '';
|
||||
win.data.revision = result.revision || '';
|
||||
win.data.encoding = result.encoding || 'utf-8';
|
||||
win.data.lineEnding = /\r\n/.test(result.content || '') ? 'crlf' : 'lf';
|
||||
// The textarea works with \n only; CRLF is restored on save.
|
||||
win.data.content = win.data.lineEnding === 'crlf' ? String(result.content).replace(/\r\n/g, '\n') : result.content;
|
||||
} catch (error) {
|
||||
win.data.error = error.message;
|
||||
} finally {
|
||||
@@ -972,10 +1003,23 @@ async function loadPreview(win, entry) {
|
||||
|
||||
async function savePreview(win, content) {
|
||||
if (win.data.saving || !win.data.editable || isReadOnly()) return;
|
||||
const problem = validateEditorContent(win.data, content);
|
||||
if (problem) {
|
||||
const proceed = await showConfirmDialog('Möglicher Fehler in der Datei', problem.message, problem.detail, {
|
||||
confirmLabel: 'Trotzdem speichern',
|
||||
danger: true
|
||||
});
|
||||
if (!proceed) {
|
||||
if (problem.line) {
|
||||
requestAnimationFrame(() => goToEditorLine(win, problem.line));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
win.data.saving = true;
|
||||
render();
|
||||
const body = new URLSearchParams();
|
||||
body.set('content', content);
|
||||
body.set('content', win.data.lineEnding === 'crlf' ? content.replace(/\r?\n/g, '\r\n') : content);
|
||||
body.set('revision', win.data.revision || '');
|
||||
appendCsrf(body);
|
||||
try {
|
||||
@@ -984,7 +1028,7 @@ async function savePreview(win, content) {
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' },
|
||||
body
|
||||
});
|
||||
win.data.content = result.content;
|
||||
win.data.content = win.data.lineEnding === 'crlf' ? String(result.content).replace(/\r\n/g, '\n') : result.content;
|
||||
win.data.draft = '';
|
||||
win.data.editing = false;
|
||||
win.data.revision = result.revision;
|
||||
@@ -3115,7 +3159,8 @@ function extensionOf(name) {
|
||||
function isPreviewable(entry) {
|
||||
if (entry?.type !== 'file') return false;
|
||||
const name = String(entry.name || entry.path || '').toLowerCase();
|
||||
return previewFilenames.has(name) || previewExtensions.has(extensionOf(name));
|
||||
// Files without an extension (e.g. /boot/config/go) are checked by the server for text content.
|
||||
return previewFilenames.has(name) || previewExtensions.has(extensionOf(name)) || !name.slice(1).includes('.');
|
||||
}
|
||||
|
||||
function joinPath(parent, name) {
|
||||
@@ -4060,6 +4105,8 @@ function contextMenuActions(win, entry) {
|
||||
actions.push({ label: 'In neuem Explorer öffnen', icon: 'columns', action: () => openInNewExplorer(entry.path) });
|
||||
} else if (isPreviewable(entry)) {
|
||||
actions.push({ label: 'Vorschau', icon: 'preview', hint: 'Enter', action: () => openPreview(entry, win.id) });
|
||||
} else if (entry.type === 'file') {
|
||||
actions.push({ label: 'Als Text öffnen', icon: 'file', action: () => openPreview(entry, win.id, { force: true }) });
|
||||
}
|
||||
if (win.data.search) {
|
||||
actions.push({ label: 'Speicherort öffnen', icon: 'folder', action: () => loadExplorer(win, dirname(entry.path), { select: entry.path }) });
|
||||
@@ -4130,3 +4177,178 @@ function applyHostTheme() {
|
||||
element = element.parentElement;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Text editor: line numbers, cursor status, indentation, go-to-line, checks.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function isCodeView(data) {
|
||||
return !data.loading && !data.error && (data.editing || (data.type === 'text' && typeof data.content === 'string'));
|
||||
}
|
||||
|
||||
function lineCount(text) {
|
||||
return String(text ?? '').split('\n').length;
|
||||
}
|
||||
|
||||
function lineNumbers(text) {
|
||||
const count = lineCount(text);
|
||||
let out = '';
|
||||
for (let i = 1; i <= count; i += 1) out += `${i}\n`;
|
||||
return out;
|
||||
}
|
||||
|
||||
function editorStatusMarkup(data, position = null) {
|
||||
const text = data.editing ? (data.draft ?? data.content ?? '') : (data.content ?? '');
|
||||
const parts = [];
|
||||
if (position) parts.push(`Zeile ${position.line}, Spalte ${position.column}`);
|
||||
parts.push(`${lineCount(text)} Zeilen`);
|
||||
parts.push(data.encoding === 'windows-1252' ? 'Windows-1252' : (data.encoding === 'unknown' ? 'Kodierung unbekannt (nur lesen)' : 'UTF-8'));
|
||||
parts.push(data.lineEnding === 'crlf' ? 'CRLF' : 'LF');
|
||||
const changed = data.editing && (data.draft ?? '') !== (data.content ?? '');
|
||||
return `<span>${escapeHtml(parts.join(' · '))}</span>${changed ? '<span class="editor-dirty">Geändert</span>' : ''}${data.editing ? '<span class="muted">Strg+S speichern · Strg+G Zeile · Tab einrücken</span>' : ''}`;
|
||||
}
|
||||
|
||||
function editorIndentUnit(data, text) {
|
||||
const name = String(data.entry?.name || '').toLowerCase();
|
||||
if (name === 'makefile' || name === 'gnumakefile' || /\.(mk|mak|make|tsv|go)$/.test(name)) return '\t';
|
||||
if (/^\t/m.test(text) && !/\.(ya?ml)$/.test(name)) return '\t';
|
||||
return /\.(py|pyw)$/.test(name) ? ' ' : ' ';
|
||||
}
|
||||
|
||||
function cursorPosition(editor) {
|
||||
const before = editor.value.slice(0, editor.selectionStart);
|
||||
const lines = before.split('\n');
|
||||
return { line: lines.length, column: lines.at(-1).length + 1 };
|
||||
}
|
||||
|
||||
// Uses the browser's insertText so Ctrl+Z keeps working after programmatic edits.
|
||||
function replaceEditorRange(editor, start, end, text) {
|
||||
editor.focus();
|
||||
editor.setSelectionRange(start, end);
|
||||
if (!document.execCommand?.('insertText', false, text)) {
|
||||
editor.setRangeText(text, start, end, 'end');
|
||||
editor.dispatchEvent(new Event('input'));
|
||||
}
|
||||
}
|
||||
|
||||
function bindCodeEditor(body, editor, win) {
|
||||
const data = win.data;
|
||||
const gutter = body.querySelector('.line-gutter');
|
||||
const status = body.querySelector('.editor-status');
|
||||
let lastCount = lineCount(editor.value);
|
||||
const updateStatus = () => {
|
||||
if (status) status.innerHTML = editorStatusMarkup(data, cursorPosition(editor));
|
||||
};
|
||||
editor.addEventListener('input', () => {
|
||||
data.draft = editor.value;
|
||||
const count = lineCount(editor.value);
|
||||
if (count !== lastCount && gutter) {
|
||||
gutter.textContent = lineNumbers(editor.value);
|
||||
lastCount = count;
|
||||
}
|
||||
updateStatus();
|
||||
});
|
||||
editor.addEventListener('scroll', () => {
|
||||
if (gutter) gutter.scrollTop = editor.scrollTop;
|
||||
});
|
||||
for (const type of ['keyup', 'click', 'select']) {
|
||||
editor.addEventListener(type, updateStatus);
|
||||
}
|
||||
editor.addEventListener('keydown', (event) => {
|
||||
const mod = event.ctrlKey || event.metaKey;
|
||||
const key = event.key.toLowerCase();
|
||||
if (mod && key === 's') {
|
||||
event.preventDefault();
|
||||
savePreview(win, editor.value);
|
||||
} else if (mod && key === 'g') {
|
||||
event.preventDefault();
|
||||
showPromptDialog('Gehe zu Zeile', `Zeile (1–${lineCount(editor.value)})`, String(cursorPosition(editor).line)).then((value) => {
|
||||
if (value) goToEditorLine(win, Number.parseInt(value, 10));
|
||||
});
|
||||
} else if (event.key === 'Tab' && !mod && !event.altKey) {
|
||||
event.preventDefault();
|
||||
indentEditorSelection(editor, editorIndentUnit(data, editor.value), event.shiftKey);
|
||||
} else if (event.key === 'Enter' && !mod && !event.altKey && !event.shiftKey) {
|
||||
// Keep the indentation of the current line (handy for YAML and scripts).
|
||||
const start = editor.selectionStart;
|
||||
const lineStart = editor.value.lastIndexOf('\n', start - 1) + 1;
|
||||
const indent = editor.value.slice(lineStart, start).match(/^[\t ]*/)[0];
|
||||
if (indent) {
|
||||
event.preventDefault();
|
||||
replaceEditorRange(editor, start, editor.selectionEnd, `\n${indent}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
requestAnimationFrame(() => {
|
||||
editor.focus();
|
||||
if (data.pendingLine) {
|
||||
goToEditorLine(win, data.pendingLine);
|
||||
data.pendingLine = null;
|
||||
}
|
||||
updateStatus();
|
||||
});
|
||||
}
|
||||
|
||||
function indentEditorSelection(editor, unit, outdent) {
|
||||
const value = editor.value;
|
||||
const start = editor.selectionStart;
|
||||
const end = editor.selectionEnd;
|
||||
const multiLine = value.slice(start, end).includes('\n');
|
||||
if (!outdent && !multiLine) {
|
||||
replaceEditorRange(editor, start, end, unit);
|
||||
return;
|
||||
}
|
||||
const blockStart = value.lastIndexOf('\n', start - 1) + 1;
|
||||
const blockEnd = end > start && value[end - 1] === '\n' ? end - 1 : end;
|
||||
const lines = value.slice(blockStart, blockEnd).split('\n');
|
||||
const changed = lines.map((line) => {
|
||||
if (!outdent) return unit + line;
|
||||
if (line.startsWith('\t')) return line.slice(1);
|
||||
return line.replace(new RegExp(`^ {1,${Math.max(1, unit === '\t' ? 4 : unit.length)}}`), '');
|
||||
});
|
||||
const replacement = changed.join('\n');
|
||||
replaceEditorRange(editor, blockStart, blockEnd, replacement);
|
||||
editor.setSelectionRange(blockStart, blockStart + replacement.length);
|
||||
}
|
||||
|
||||
function goToEditorLine(win, line) {
|
||||
const editor = workspace.querySelector(`.window[data-window-id="${win.id}"] .preview-editor`);
|
||||
if (!editor || !Number.isFinite(line)) return;
|
||||
const lines = editor.value.split('\n');
|
||||
const target = clamp(line, 1, lines.length);
|
||||
const offset = lines.slice(0, target - 1).reduce((sum, item) => sum + item.length + 1, 0);
|
||||
editor.focus();
|
||||
editor.setSelectionRange(offset, offset + lines[target - 1].length);
|
||||
const lineHeight = Number.parseFloat(getComputedStyle(editor).lineHeight) || 17;
|
||||
editor.scrollTop = Math.max(0, (target - 3) * lineHeight);
|
||||
editor.dispatchEvent(new Event('select'));
|
||||
}
|
||||
|
||||
// Cheap syntax checks before saving: JSON must parse, YAML must not indent with tabs.
|
||||
function validateEditorContent(data, content) {
|
||||
const ext = extensionOf(data.entry?.name || '');
|
||||
if (['json', 'geojson'].includes(ext) && content.trim()) {
|
||||
try {
|
||||
JSON.parse(content);
|
||||
} catch (error) {
|
||||
const match = /position (\d+)/i.exec(error.message);
|
||||
const line = match ? content.slice(0, Number(match[1])).split('\n').length : null;
|
||||
return {
|
||||
message: 'Die Datei ist kein gültiges JSON.',
|
||||
detail: `${error.message}${line ? ` (Zeile ${line})` : ''}`,
|
||||
line
|
||||
};
|
||||
}
|
||||
}
|
||||
if (['yaml', 'yml'].includes(ext)) {
|
||||
const index = content.split('\n').findIndex((line) => /^\s*\t/.test(line));
|
||||
if (index >= 0) {
|
||||
return {
|
||||
message: 'YAML erlaubt keine Tabulatoren zum Einrücken.',
|
||||
detail: `Zeile ${index + 1} ist mit einem Tab eingerückt. Docker Compose & Co. lehnen solche Dateien ab.`,
|
||||
line: index + 1
|
||||
};
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -1806,3 +1806,87 @@
|
||||
.u-nav .transfer-panel-header .link-button {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
/* --- code editor / text view with line numbers ------------------------------- */
|
||||
.u-nav .preview-body.with-status {
|
||||
grid-template-rows: auto minmax(0, 1fr) auto;
|
||||
}
|
||||
|
||||
.u-nav .code-view {
|
||||
background: var(--surface-2);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 7px;
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.u-nav .code-view.editing {
|
||||
border-color: var(--accent);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.u-nav .code-view .line-gutter {
|
||||
background: var(--surface-3);
|
||||
border-right: 1px solid var(--line);
|
||||
color: var(--muted);
|
||||
font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
margin: 0;
|
||||
min-width: 3.2em;
|
||||
overflow: hidden;
|
||||
padding: 10px 8px 10px 6px;
|
||||
position: sticky;
|
||||
left: 0;
|
||||
text-align: right;
|
||||
user-select: none;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.u-nav .code-view .preview-text,
|
||||
.u-nav .code-view .preview-editor {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
min-height: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* View mode: gutter and text grow with the content; the code-view itself scrolls. */
|
||||
.u-nav .code-view:not(.editing) {
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.u-nav .code-view .preview-text {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.u-nav .code-view.editing .line-gutter,
|
||||
.u-nav .code-view.editing .preview-editor {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.u-nav .code-view .preview-editor {
|
||||
overflow: auto;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.u-nav .editor-status {
|
||||
align-items: center;
|
||||
color: var(--muted);
|
||||
display: flex;
|
||||
font-size: 12px;
|
||||
gap: 12px;
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
.u-nav .editor-status .muted {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.u-nav .editor-dirty {
|
||||
color: var(--accent);
|
||||
font-weight: 600;
|
||||
}
|
||||
Reference in new issue
Block a user