latex-studio / frontend /static /css /editor.css
SaiPavankumar22's picture
fix: replace iframe with PDF.js canvas rendering β€” bypasses all HuggingFace sandbox restrictions
3b39190
/* ═══════════════════════════════════════════════
Editor Page Styles
═══════════════════════════════════════════════ */
.editor-body {
overflow: hidden;
height: 100vh;
display: flex;
flex-direction: column;
}
/* ─── EDITOR NAV ─── */
.editor-nav {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20px;
height: 52px;
background: var(--bg2);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
gap: 16px;
}
.nav-brand.compact .nav-name { font-size: 15px; }
.editor-doc-info {
display: flex;
align-items: center;
gap: 12px;
flex: 1;
max-width: 400px;
}
.doc-title-input {
background: transparent;
border: 1px solid transparent;
border-radius: var(--radius);
color: var(--text);
font-family: var(--font-sans);
font-size: 14px;
font-weight: 500;
padding: 5px 10px;
outline: none;
transition: all 0.2s;
min-width: 0;
flex: 1;
}
.doc-title-input:hover { border-color: var(--border2); }
.doc-title-input:focus {
border-color: var(--accent);
background: var(--bg3);
}
.doc-status {
display: flex;
align-items: center;
gap: 6px;
font-size: 12px;
color: var(--text3);
white-space: nowrap;
flex-shrink: 0;
}
.status-dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--text3);
transition: background 0.3s;
}
.status-dot.compiling { background: var(--accent); animation: pulse 1s ease infinite; }
.status-dot.success { background: var(--green); }
.status-dot.error { background: var(--red); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
.editor-actions {
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
}
.btn-icon {
display: flex;
align-items: center;
gap: 6px;
background: var(--bg3);
border: 1px solid var(--border2);
color: var(--text2);
padding: 6px 12px;
border-radius: var(--radius);
font-family: var(--font-sans);
font-size: 13px;
cursor: pointer;
transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-editor-compile {
display: flex;
align-items: center;
gap: 7px;
background: var(--accent);
color: #0f0f0f;
border: none;
padding: 7px 18px;
border-radius: var(--radius);
font-family: var(--font-sans);
font-size: 13px;
font-weight: 700;
cursor: pointer;
transition: all 0.2s;
letter-spacing: 0.3px;
}
.btn-editor-compile:hover { background: #d4b87a; box-shadow: 0 0 20px rgba(200,169,110,0.3); }
.btn-editor-compile:disabled { opacity: 0.5; cursor: not-allowed; }
.download-group {
display: flex;
border: 1px solid var(--border2);
border-radius: var(--radius);
overflow: hidden;
}
.btn-download {
background: var(--bg3);
border: none;
border-right: 1px solid var(--border2);
color: var(--text2);
padding: 6px 14px;
font-family: var(--font-sans);
font-size: 13px;
cursor: pointer;
transition: all 0.2s;
}
.btn-download:last-child { border-right: none; }
.btn-download:hover { background: var(--bg4); color: var(--text); }
.btn-download:disabled { opacity: 0.4; cursor: not-allowed; }
.nav-auth-mini {
display: flex;
align-items: center;
}
/* ─── EDITOR LAYOUT ─── */
.editor-layout {
display: flex;
flex: 1;
overflow: hidden;
min-height: 0;
}
.editor-panel {
display: flex;
flex-direction: column;
overflow: hidden;
}
.code-panel {
width: 50%;
min-width: 280px;
border-right: 1px solid var(--border);
background: var(--bg);
position: relative;
}
.preview-panel {
flex: 1;
background: var(--bg2);
}
/* ─── PANEL TOOLBAR ─── */
.panel-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
height: 38px;
background: var(--bg3);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
.panel-label {
font-size: 11px;
font-weight: 600;
letter-spacing: 1px;
text-transform: uppercase;
color: var(--text3);
}
.toolbar-actions {
display: flex;
align-items: center;
gap: 4px;
}
.tool-btn {
background: none;
border: 1px solid transparent;
color: var(--text3);
padding: 3px 8px;
border-radius: var(--radius);
font-family: var(--font-sans);
font-size: 12px;
cursor: pointer;
transition: all 0.2s;
}
.tool-btn:hover {
background: var(--bg4);
border-color: var(--border2);
color: var(--text2);
}
.zoom-label {
font-size: 12px;
color: var(--text3);
min-width: 40px;
text-align: center;
}
/* ─── CODE EDITOR ─── */
.code-editor-wrap {
flex: 1;
display: flex;
overflow: hidden;
position: relative;
}
.line-numbers {
width: 44px;
padding: 16px 0;
text-align: right;
font-family: var(--font-mono);
font-size: 12px;
line-height: 1.7;
color: var(--text3);
background: var(--bg2);
border-right: 1px solid var(--border);
overflow: hidden;
user-select: none;
flex-shrink: 0;
padding-right: 10px;
}
.code-editor {
flex: 1;
background: var(--bg);
color: var(--text);
border: none;
outline: none;
font-family: var(--font-mono);
font-size: 13px;
line-height: 1.7;
padding: 16px;
resize: none;
tab-size: 2;
overflow-y: scroll;
overflow-x: auto;
white-space: pre;
word-wrap: normal;
}
.code-editor::selection { background: rgba(200,169,110,0.2); }
/* ─── ERROR PANEL ─── */
.error-panel {
background: rgba(224,82,82,0.08);
border-top: 1px solid rgba(224,82,82,0.3);
max-height: 160px;
overflow-y: auto;
flex-shrink: 0;
}
.error-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 16px;
font-size: 12px;
font-weight: 600;
color: var(--red);
border-bottom: 1px solid rgba(224,82,82,0.2);
}
.error-close {
background: none;
border: none;
color: var(--red);
cursor: pointer;
font-size: 14px;
}
.error-list {
padding: 8px 16px;
}
.error-item {
font-family: var(--font-mono);
font-size: 11px;
color: #f87171;
padding: 3px 0;
line-height: 1.4;
}
/* ─── RESIZER ─── */
.resizer {
width: 4px;
background: var(--border);
cursor: col-resize;
flex-shrink: 0;
transition: background 0.2s;
position: relative;
}
.resizer:hover, .resizer.dragging { background: var(--accent); }
/* ─── PREVIEW PANEL ─── */
.preview-container {
flex: 1;
overflow: auto;
position: relative;
display: flex;
align-items: center;
justify-content: center;
background: var(--bg2);
}
.preview-placeholder {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
color: var(--text2);
text-align: center;
padding: 40px;
}
.placeholder-icon { font-size: 48px; opacity: 0.5; }
.preview-placeholder h3 {
font-family: var(--font-serif);
font-size: 20px;
color: var(--text2);
}
.preview-placeholder p {
font-size: 14px;
color: var(--text3);
}
.preview-loading {
display: flex;
flex-direction: column;
align-items: center;
gap: 16px;
color: var(--text2);
}
/* PDF.js canvas-based preview β€” no iframe, works in any sandboxed context */
.pdf-canvas-container {
width: 100%;
height: 100%;
overflow-y: auto;
overflow-x: auto;
background: #525659;
padding: 16px;
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
gap: 0;
}
.pdf-page-wrapper {
box-shadow: 0 4px 20px rgba(0,0,0,0.5);
margin-bottom: 12px;
line-height: 0;
background: #fff;
}
.pdf-page-wrapper canvas {
display: block;
max-width: 100%;
}
/* ─── SNIPPET PANEL ─── */
.snippet-panel {
position: absolute;
top: 38px;
right: 0;
width: 220px;
background: var(--bg3);
border: 1px solid var(--border2);
border-radius: var(--radius);
box-shadow: var(--shadow);
z-index: 50;
}
.snippet-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 14px;
border-bottom: 1px solid var(--border);
font-size: 13px;
font-weight: 600;
color: var(--text2);
}
.snippet-header button {
background: none;
border: none;
color: var(--text3);
cursor: pointer;
font-size: 14px;
}
.snippet-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 4px;
padding: 8px;
}
.snippet-btn {
background: var(--bg4);
border: 1px solid var(--border);
color: var(--text2);
padding: 8px;
border-radius: var(--radius);
font-family: var(--font-sans);
font-size: 12px;
cursor: pointer;
text-align: left;
transition: all 0.2s;
}
.snippet-btn:hover { border-color: var(--accent); color: var(--accent); }
/* ─── SYNTAX HIGHLIGHT COLORS ─── */
.code-editor-wrap {
position: relative;
}