diff --git a/private/attachment-references.rkt b/private/attachment-references.rkt index 27e4e3c..27d61d0 100644 --- a/private/attachment-references.rkt +++ b/private/attachment-references.rkt @@ -5,6 +5,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require db + net/uri-codec racket/string) (provide replace-current-attachment-references! @@ -27,6 +28,12 @@ SQL (define (attachment-url reference stored-name) (format "/uploads/~a/~a" reference stored-name)) +(define (attachment-url-variants reference stored-name) + (list (attachment-url reference stored-name) + (format "/uploads/~a/~a" + reference + (uri-path-segment-unreserved-encode stored-name)))) + (define (page-references db page-id) (let* ((current (query-row db @@ -57,7 +64,8 @@ SQL (stored-name (vector-ref row 2)) (found? #f)) (for ((reference (in-list (page-references db owner-page-id)))) - (when (string-contains? markdown (attachment-url reference stored-name)) + (when (for/or ((url (in-list (attachment-url-variants reference stored-name)))) + (string-contains? markdown url)) (set! found? #t))) (when found? (query-exec db @@ -89,6 +97,21 @@ SQL (record-references! db page-id sql-null markdown #t referenced-at) (void)) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Tests for module attachment-references.rkt. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(module+ test + (require rackunit) + + (define urls + (attachment-url-variants + "review-zuidas-2026:appreciatie" + "1788796826-35348-Review ZuidasDok.docx")) + (check-equal? + urls + (list "/uploads/review-zuidas-2026:appreciatie/1788796826-35348-Review ZuidasDok.docx" + "/uploads/review-zuidas-2026:appreciatie/1788796826-35348-Review%20ZuidasDok.docx"))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; goal : Record attachment references present in an immutable page version. ; pre : page-version-id identifies the stored version represented by markdown. diff --git a/static/css/wiki.css b/static/css/wiki.css index b0c63f5..5b388fe 100644 --- a/static/css/wiki.css +++ b/static/css/wiki.css @@ -122,6 +122,10 @@ button { cursor: pointer; } text-decoration: line-through; } +.EasyMDEContainer .editor-toolbar button.rw-mde-save { + display: none; +} + .EasyMDEContainer .CodeMirror, .EasyMDEContainer .CodeMirror-scroll, .EasyMDEContainer .editor-preview-side { @@ -222,6 +226,62 @@ body { padding: 18px 16px 28px; } +.sidebar-toggle { + display: grid; + width: 34px; + height: 34px; + margin: -8px -8px 8px auto; + place-items: center; + border: 1px solid transparent; + border-radius: 3px; + background: transparent; + color: var(--wiki-link); +} + +.sidebar-toggle:hover, +.sidebar-toggle:focus-visible { + background: #fff; + border-color: var(--wiki-border); + outline: 0; +} + +.sidebar-toggle svg { + width: 18px; + height: 18px; + stroke-width: 1.8; +} + +body.sidebar-collapsed #app { + grid-template-columns: 52px minmax(0, 1fr); +} + +body.sidebar-collapsed #sidebar { + padding: 12px 8px; + overflow: hidden; +} + +body.sidebar-collapsed #sidebar > :not(#sidebar-toggle):not(.sidebar-icon-nav) { + display: none; +} + +body.sidebar-collapsed #sidebar .sidebar-toggle { + margin: 0 auto; +} + +body.sidebar-collapsed #sidebar .sidebar-icon-nav { + flex-direction: column; + margin: 14px 0 0; +} + +body.sidebar-collapsed #sidebar .sidebar-icon-link { + width: 36px; +} + +body.sidebar-collapsed #sidebar .sidebar-icon-link + .sidebar-icon-link { + border-top: 1px solid #c8cbd0; + border-left: 0; +} + .brand { display: block; color: #111; @@ -909,6 +969,10 @@ body.editor-mode .EasyMDEContainer .editor-toolbar.fullscreen { background: white; } +body.editor-mode .EasyMDEContainer .editor-toolbar.fullscreen button.rw-mde-save { + display: inline-block; +} + body.editor-mode .EasyMDEContainer .editor-statusbar.fullscreen { bottom: 0; min-height: 28px; @@ -972,6 +1036,14 @@ body.editor-mode .EasyMDEContainer .editor-preview-side { border-top: 0; } +body.editor-mode .editor-shell .EasyMDEContainer:not(:has(.editor-preview-active-side)) { + grid-template-columns: minmax(0, 1fr); +} + +body.editor-mode .editor-shell .EasyMDEContainer:not(:has(.editor-preview-active-side)) .CodeMirror { + grid-column: 1; +} + body.editor-mode .EasyMDEContainer .CodeMirror-sided { width: 100% !important; } diff --git a/static/index.html b/static/index.html index 124d4f5..7abbb04 100644 --- a/static/index.html +++ b/static/index.html @@ -14,6 +14,9 @@