From 7f53b60dfb3eb5aa12e2b94e1c3a95b15aa1f451 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sat, 8 Aug 2026 17:18:40 -0400 Subject: [PATCH] fix: various markdown editor fixes --- frontend/src/assets/icons.generated.js | 3 +- frontend/src/components/EditorMarkdown.vue | 39 ++++++++++--- frontend/src/components/PageHeader.vue | 13 ----- frontend/src/css/_page-contents.scss | 64 +++++++++++++++++++++- frontend/src/renderers/markdown.js | 30 ++++++++++ 5 files changed, 126 insertions(+), 23 deletions(-) diff --git a/frontend/src/assets/icons.generated.js b/frontend/src/assets/icons.generated.js index c2aaa1f16..b95dd51f6 100644 --- a/frontend/src/assets/icons.generated.js +++ b/frontend/src/assets/icons.generated.js @@ -5,7 +5,7 @@ never waits on (or depends on) the icon service. Regenerate with `npm run icons` after adding or removing an icon; `check-icons.mjs` fails the build if this drifts. - 259 icons. + 260 icons. */ export const BUNDLED_ICONS = { "la:angle-double-right": {"body":"","width":32,"height":32}, @@ -266,5 +266,6 @@ export const BUNDLED_ICONS = { "mdi:transfer-down": {"body":"","width":24,"height":24}, "mdi:transfer-up": {"body":"","width":24,"height":24}, "mdi:undo-variant": {"body":"","width":24,"height":24}, + "mdi:view-split-vertical": {"body":"","width":24,"height":24}, "mdi:web": {"body":"","width":24,"height":24} } diff --git a/frontend/src/components/EditorMarkdown.vue b/frontend/src/components/EditorMarkdown.vue index 1b5e1944f..d73a93a28 100644 --- a/frontend/src/components/EditorMarkdown.vue +++ b/frontend/src/components/EditorMarkdown.vue @@ -233,6 +233,19 @@ t('editor.markup.keyboardKey') }} + + @@ -857,10 +870,6 @@ function processContent(newContent) { }) } -function openEditorSettings() { - siteStore.$patch({ overlay: 'EditorMarkdownConfig' }) -} - /** * Take files the author brought in — pasted or dropped — and write markdown for them at the cursor. * @@ -1203,7 +1212,6 @@ onMounted(async () => { EVENT_BUS.on('insertAsset', insertAssetClb) EVENT_BUS.on('insertTable', insertTableClb) EVENT_BUS.on('insertBlock', insertBlockClb) - EVENT_BUS.on('openEditorSettings', openEditorSettings) EVENT_BUS.on('reloadEditorContent', reloadEditorContent) // this.$root.$on('editorInsert', opts => { @@ -1243,7 +1251,6 @@ onBeforeUnmount(() => { EVENT_BUS.off('insertAsset', insertAssetClb) EVENT_BUS.off('insertTable', insertTableClb) EVENT_BUS.off('insertBlock', insertBlockClb) - EVENT_BUS.off('openEditorSettings', openEditorSettings) EVENT_BUS.off('reloadEditorContent', reloadEditorContent) pasteCaptureNode?.removeEventListener('paste', onEditorPaste, true) monacoRef.value?.removeEventListener('dragover', onEditorDragOver) @@ -1283,6 +1290,14 @@ $editor-height-mobile: calc(100vh - 112px - 16px); height: $editor-height; position: relative; border-right: 5px solid $primary; + /* + Monaco writes its measured width in pixels onto its own elements, so this item's automatic + min-width -- min-content, i.e. whatever Monaco last laid itself out at -- pins it to the full + width it took while the preview was closed. Bringing the preview back then leaves it the few + pixels the flex line has left over, and Monaco never re-measures because its container never + shrinks. Zero lets the basis decide instead. + */ + min-width: 0; } &-editor { display: block; @@ -1318,16 +1333,21 @@ $editor-height-mobile: calc(100vh - 112px - 16px); // @include until($tablet) { // display: none; // } + /* + `-enter-from` is the Vue 3 name; as `-enter` it matched nothing, so the pane animated shut but + snapped open. The inner selector was stale in the same way -- the content class is + `-preview-content` -- which left the render reflowing for the length of the transition. + */ &-enter-active, &-leave-active { transition: max-width 0.5s ease; max-width: 50vw; - .editor-code-preview-content { + .editor-markdown-preview-content { width: 50vw; overflow: hidden; } } - &-enter, + &-enter-from, &-leave-to { max-width: 0; } @@ -1445,6 +1465,9 @@ $editor-height-mobile: calc(100vh - 112px - 16px); border-left: 60px solid color.adjust($primary, $lightness: -5%); color: #fff; height: 32px; + // -> Flex so the preview toggle can be pushed to the far right by `w-space` + display: flex; + align-items: center; } &-sidebar { background-color: $dark-4; diff --git a/frontend/src/components/PageHeader.vue b/frontend/src/components/PageHeader.vue index e7cd39d28..880628977 100644 --- a/frontend/src/components/PageHeader.vue +++ b/frontend/src/components/PageHeader.vue @@ -197,15 +197,6 @@ type="a"> {{ t(`common.actions.viewDocs`) }} - - {{ t(`editor.settings`) }} -