Allow uploading of files and folders.

This commit is contained in:
2025-07-28 11:07:40 +02:00
committed by Jens Luedicke
parent 87471e033e
commit f98e8f3e71
13 changed files with 2805 additions and 8 deletions

View File

@@ -152,9 +152,31 @@
<!-- Note Content -->
<div class="content-card">
{% if note.is_file_based and note.file_type == 'document' and note.original_filename.endswith('.pdf') %}
<!-- PDF Preview -->
<div class="pdf-preview-container">
<div class="pdf-toolbar">
<button class="btn btn-sm btn-secondary" onclick="pdfZoomIn()">
<i class="ti ti-zoom-in"></i> Zoom In
</button>
<button class="btn btn-sm btn-secondary" onclick="pdfZoomOut()">
<i class="ti ti-zoom-out"></i> Zoom Out
</button>
<button class="btn btn-sm btn-secondary" onclick="pdfZoomReset()">
<i class="ti ti-zoom-reset"></i> Reset
</button>
<a href="{{ note.file_url }}" class="btn btn-sm btn-primary" download>
<i class="ti ti-download"></i> Download PDF
</a>
</div>
<iframe id="pdf-viewer" src="{{ note.file_url }}" class="pdf-viewer"></iframe>
</div>
{% else %}
<!-- Regular Content -->
<div class="markdown-content">
{{ note.render_html()|safe }}
</div>
{% endif %}
</div>
<!-- Linked Notes Section -->
@@ -857,9 +879,181 @@
justify-content: center;
}
}
/* Wiki-style Links */
.wiki-link {
color: var(--primary-color);
text-decoration: none;
border-bottom: 1px dotted var(--primary-color);
transition: all 0.2s ease;
}
.wiki-link:hover {
border-bottom-style: solid;
text-decoration: none;
}
.wiki-link-broken {
color: #dc3545;
text-decoration: line-through;
cursor: not-allowed;
opacity: 0.7;
}
/* Wiki-style Embeds */
.wiki-embed {
margin: 1.5rem 0;
border: 1px solid #dee2e6;
border-radius: 8px;
overflow: hidden;
background: #f8f9fa;
}
.wiki-embed-header {
padding: 0.75rem 1rem;
background: white;
border-bottom: 1px solid #dee2e6;
display: flex;
align-items: center;
gap: 0.5rem;
}
.wiki-embed-title {
font-weight: 600;
color: #333;
text-decoration: none;
display: flex;
align-items: center;
gap: 0.5rem;
}
.wiki-embed-title:hover {
color: var(--primary-color);
}
.wiki-embed-content {
padding: 1rem;
background: white;
max-height: 400px;
overflow-y: auto;
}
.wiki-embed-content .markdown-content {
margin: 0;
}
.wiki-embed-error {
margin: 1rem 0;
padding: 0.75rem 1rem;
background: #f8d7da;
border: 1px solid #f5c6cb;
border-radius: 6px;
color: #721c24;
font-style: italic;
}
/* Nested embeds have reduced padding */
.wiki-embed .wiki-embed {
margin: 1rem 0;
}
.wiki-embed .wiki-embed .wiki-embed-content {
max-height: 200px;
}
/* Font families based on user preferences */
{% if g.user.preferences and g.user.preferences.note_preview_font %}
{% set font = g.user.preferences.note_preview_font %}
{% if font == 'sans-serif' %}
.markdown-content { font-family: Arial, Helvetica, sans-serif; }
{% elif font == 'serif' %}
.markdown-content { font-family: "Times New Roman", Times, serif; }
{% elif font == 'monospace' %}
.markdown-content { font-family: "Courier New", Courier, monospace; }
{% elif font == 'georgia' %}
.markdown-content { font-family: Georgia, serif; }
{% elif font == 'palatino' %}
.markdown-content { font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif; }
{% elif font == 'garamond' %}
.markdown-content { font-family: Garamond, serif; }
{% elif font == 'bookman' %}
.markdown-content { font-family: "Bookman Old Style", serif; }
{% elif font == 'comic-sans' %}
.markdown-content { font-family: "Comic Sans MS", cursive; }
{% elif font == 'trebuchet' %}
.markdown-content { font-family: "Trebuchet MS", sans-serif; }
{% elif font == 'arial-black' %}
.markdown-content { font-family: "Arial Black", sans-serif; }
{% elif font == 'impact' %}
.markdown-content { font-family: Impact, sans-serif; }
{% endif %}
{% endif %}
/* PDF Preview Styles */
.pdf-preview-container {
display: flex;
flex-direction: column;
height: 100%;
min-height: 600px;
}
.pdf-toolbar {
display: flex;
gap: 0.5rem;
padding: 1rem;
background: #f8f9fa;
border-bottom: 1px solid #dee2e6;
border-radius: 8px 8px 0 0;
}
.pdf-viewer {
width: 100%;
height: 800px;
border: none;
background: #f8f9fa;
}
/* Responsive PDF viewer */
@media (max-width: 768px) {
.pdf-viewer {
height: 600px;
}
.pdf-toolbar {
flex-wrap: wrap;
}
}
</style>
<script>
// PDF viewer controls
let pdfZoom = 1.0;
function pdfZoomIn() {
pdfZoom += 0.1;
updatePdfZoom();
}
function pdfZoomOut() {
if (pdfZoom > 0.5) {
pdfZoom -= 0.1;
updatePdfZoom();
}
}
function pdfZoomReset() {
pdfZoom = 1.0;
updatePdfZoom();
}
function updatePdfZoom() {
const viewer = document.getElementById('pdf-viewer');
if (viewer) {
viewer.style.transform = `scale(${pdfZoom})`;
viewer.style.transformOrigin = 'top center';
}
}
document.addEventListener('DOMContentLoaded', function() {
// Download dropdown functionality
const downloadBtn = document.getElementById('downloadDropdown');