From e8c3efbecb8b47145f6590d103f83f1cf76fa196 Mon Sep 17 00:00:00 2001 From: h4njlg Date: Tue, 16 Jun 2026 14:13:59 +0000 Subject: [PATCH] Add a new regexp to also match uri in the form /proxy/{{port}} closes #14595 --- news/changelog-1.10.md | 3 ++- src/webui/quarto-preview/dist/quarto-preview.js | 2 +- src/webui/quarto-preview/src/server/navigation.ts | 9 +++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/news/changelog-1.10.md b/news/changelog-1.10.md index c4908d9192e..3914adb537a 100644 --- a/news/changelog-1.10.md +++ b/news/changelog-1.10.md @@ -94,4 +94,5 @@ All changes included in 1.10: - ([#14461](https://github.com/quarto-dev/quarto-cli/issues/14461)): Fix `quarto render --to pdf` aborting with `ERROR: Problem running 'fmtutil-sys --all' to rebuild format tree.` when an automatically-installed LaTeX package's post-update format rebuild fails. Format-tree rebuild is now treated as best-effort housekeeping (matching upstream `tinytex` R behavior) — the failure is logged as a warning and the package install completes. - ([#14472](https://github.com/quarto-dev/quarto-cli/issues/14472)): Add support for Kotlin in code annotations and YAML cell options. (author: @barendgehrels) - ([#14529](https://github.com/quarto-dev/quarto-cli/issues/14529)): Fix bundled Julia engine path leaking into rendered YAML metadata and pandoc log output when running an installed Quarto. The internal subtree-engine filter only matched the source-tree share-path layout (`resources/extension-subtrees/`) and missed installed layouts where the path is `share/extension-subtrees/`. -- ([#14582](https://github.com/quarto-dev/quarto-cli/issues/14582)): Fix format detection for extension formats (e.g. `acm-pdf`) in project preview, manuscript notebooks, MECA bundles, and website format ordering. \ No newline at end of file +- ([#14582](https://github.com/quarto-dev/quarto-cli/issues/14582)): Fix format detection for extension formats (e.g. `acm-pdf`) in project preview, manuscript notebooks, MECA bundles, and website format ordering. +- ([#14595](https://github.com/quarto-dev/quarto-cli/issues/14595)): Fix reload preview in code-server environment diff --git a/src/webui/quarto-preview/dist/quarto-preview.js b/src/webui/quarto-preview/dist/quarto-preview.js index f2da53fa9ad..fa2166aeba3 100644 --- a/src/webui/quarto-preview/dist/quarto-preview.js +++ b/src/webui/quarto-preview/dist/quarto-preview.js @@ -1,5 +1,5 @@ (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode(".ansi-display{font-family:monospace;white-space:pre-wrap;--ansiBlack: #000000;--ansiRed: #cd3131;--ansiGreen: #00BC00;--ansiYellow: #949800;--ansiBlue: #0451a5;--ansiMagenta: #bc05bc;--ansiCyan: #0598bc;--ansiWhite: #555555;--ansiBrightBlack: #666666;--ansiBrightRed: #cd3131;--ansiBrightGreen: #14CE14;--ansiBrightYellow: #b5ba00;--ansiBrightBlue: #0451a5;--ansiBrightMagenta: #bc05bc;--ansiBrightCyan: #0598bc;--ansiBrightWhite: #a5a5a5}.dark-mode .ansi-display{--ansiBlack: #000000;--ansiRed: #cd3131;--ansiGreen: #0DBC79;--ansiYellow: #e5e510;--ansiBlue: #2472c8;--ansiMagenta: #bc3fbc;--ansiCyan: #11a8cd;--ansiWhite: #e5e5e5;--ansiBrightBlack: #666666;--ansiBrightRed: #f14c4c;--ansiBrightGreen: #23d18b;--ansiBrightYellow: #f5f543;--ansiBrightBlue: #3b8eea;--ansiBrightMagenta: #d670d6;--ansiBrightCyan: #29b8db;--ansiBrightWhite: #e5e5e5}@keyframes ansi-displaly-run-blink{50%{opacity:0}}.fui-FluentProvider h2{border-bottom:none;padding-bottom:0}")),document.head.appendChild(a)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})(); -(function(Ke,Me){typeof exports=="object"&&typeof module<"u"?Me(exports):typeof define=="function"&&define.amd?define(["exports"],Me):(Ke=typeof globalThis<"u"?globalThis:Ke||self,Me(Ke.QuartoPreview={}))})(this,function(Ke){"use strict";var Q2=Object.defineProperty;var J2=(Ke,Me,Rr)=>Me in Ke?Q2(Ke,Me,{enumerable:!0,configurable:!0,writable:!0,value:Rr}):Ke[Me]=Rr;var fe=(Ke,Me,Rr)=>(J2(Ke,typeof Me!="symbol"?Me+"":Me,Rr),Rr);function Me(e,t){for(var r=0;rn[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function Rr(e){const t=window.location.protocol==="https:"?"wss:":"ws:";let r=window.location.pathname;/\/$/.test(r)||(r+="/");let n=!0;addEventListener("beforeunload",()=>{n=!1});const o=new WebSocket(t+"//"+window.location.host+r);o.onopen=()=>{console.log("Socket connection open. Listening for events."),c0(o,()=>n)};const i=()=>{n=!1,o.send("stop")},l=e.map(a=>a(i));return o.onmessage=a=>{for(const s of l)if(s(a))break},()=>{try{o.close()}catch(a){console.error(a)}}}function c0(e,t){e.onclose=()=>{t()&&(console.log("Socket connection closed. Reloading."),window.location.reload())}}function d0(){return()=>{const e=t=>t.replace(/\/index\.html/,"/");return t=>{if(t.data.startsWith("reload")){let r=e(t.data.replace(/^reload/,""));if(r){const n=window.location.pathname.match(/^.*?\/p\/\w+\//)||window.location.pathname.match(/^.*?\/user\/[\w\d]+\/proxy\/\d+\//);n&&(r=n+r.slice(1))}return r&&r!==e(window.location.pathname)?window.location.replace(r):window.location.reload(),!0}else return!1}}}function bc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var S={exports:{}},$={};/** +(function(Ke,Me){typeof exports=="object"&&typeof module<"u"?Me(exports):typeof define=="function"&&define.amd?define(["exports"],Me):(Ke=typeof globalThis<"u"?globalThis:Ke||self,Me(Ke.QuartoPreview={}))})(this,function(Ke){"use strict";var Q2=Object.defineProperty;var J2=(Ke,Me,Rr)=>Me in Ke?Q2(Ke,Me,{enumerable:!0,configurable:!0,writable:!0,value:Rr}):Ke[Me]=Rr;var fe=(Ke,Me,Rr)=>(J2(Ke,typeof Me!="symbol"?Me+"":Me,Rr),Rr);function Me(e,t){for(var r=0;rn[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function Rr(e){const t=window.location.protocol==="https:"?"wss:":"ws:";let r=window.location.pathname;/\/$/.test(r)||(r+="/");let n=!0;addEventListener("beforeunload",()=>{n=!1});const o=new WebSocket(t+"//"+window.location.host+r);o.onopen=()=>{console.log("Socket connection open. Listening for events."),c0(o,()=>n)};const i=()=>{n=!1,o.send("stop")},l=e.map(a=>a(i));return o.onmessage=a=>{for(const s of l)if(s(a))break},()=>{try{o.close()}catch(a){console.error(a)}}}function c0(e,t){e.onclose=()=>{t()&&(console.log("Socket connection closed. Reloading."),window.location.reload())}}function d0(){return()=>{const e=t=>t.replace(/\/index\.html/,"/");return t=>{if(t.data.startsWith("reload")){let r=e(t.data.replace(/^reload/,""));if(r){const n=window.location.pathname.match(/^.*?\/p\/\w+\//)||window.location.pathname.match(/^.*?\/user\/[\w\d]+\/proxy\/\d+\//)||window.location.pathname.match(/^.*?\/(?:abs)?proxy\/\d+\//);n&&(r=n+r.slice(1))}return r&&r!==e(window.location.pathname)?window.location.replace(r):window.location.reload(),!0}else return!1}}}function bc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var S={exports:{}},$={};/** * @license React * react.production.min.js * diff --git a/src/webui/quarto-preview/src/server/navigation.ts b/src/webui/quarto-preview/src/server/navigation.ts index 35b0c66013d..ca199e14ade 100644 --- a/src/webui/quarto-preview/src/server/navigation.ts +++ b/src/webui/quarto-preview/src/server/navigation.ts @@ -10,15 +10,16 @@ export function navigationHandler() { const normalizeTarget = (target: string) => { return target.replace(/\/index\.html/, "/") }; - - return (ev: MessageEvent) : boolean => { + + return (ev: MessageEvent): boolean => { if (ev.data.startsWith('reload')) { let target = normalizeTarget(ev.data.replace(/^reload/, "")); // prepend proxy path to target if we have one if (target) { - const pathPrefix = + const pathPrefix = window.location.pathname.match(/^.*?\/p\/\w+\//) || - window.location.pathname.match(/^.*?\/user\/[\w\d]+\/proxy\/\d+\//); + window.location.pathname.match(/^.*?\/user\/[\w\d]+\/proxy\/\d+\//) || + window.location.pathname.match(/^.*?\/(?:abs)?proxy\/\d+\//); if (pathPrefix) { target = pathPrefix + target.slice(1); }