-
Notifications
You must be signed in to change notification settings - Fork 43
Description
Bug description
In Positron, if you have not previously used the Quarto Visual Editor (e.g. in a fresh environment where Positron doesn't have user state yet), specifying editor: visual
in the frontmatter of a Quarto document can result in a couple awkward UI experiences:
-
The first time you "Preview" the document, you get this modal, which is un-cancellable (clicking Cancel seems to cause the editor to reopen and trigger the modal again)
-
When
editor: visual
is specified and you try to toggle back to Source mode using the toggle in the Editor Actions, you get kicked back to Visual mode after a similar editor reopen (~1:15 in the video)
quarto_positron_visual_toggle.mp4
Steps to reproduce
PRE-REQ: a fresh Positron installation with no existing Quarto extension state
- Create a quarto document that has
editor: visual
in the YAML frontmatter of the document - Save the file
- Click the "Preview" button in the Editor Actions bar
- See the modal as described above
Quarto code for the modal:
quarto/apps/vscode/src/providers/editor/editor.ts
Lines 363 to 387 in 3fe790b
if (this.context.globalState.get(kVisualModeConfirmed) !== true) { | |
const kUseVisualMode = "Use Visual Mode"; | |
const kLearnMore = "Learn More..."; | |
const result = await window.showInformationMessage<string>( | |
"You are activating Quarto visual markdown editing mode.", | |
{ | |
modal: true, | |
detail: | |
"Visual mode enables you to author using a familiar word processor style interface.\n\n" + | |
"Markdown code will be re-formatted using the Pandoc markdown writer." | |
}, | |
kUseVisualMode, | |
kLearnMore | |
); | |
if (!result) { | |
await reopenSourceMode(); | |
return; | |
} else if (result === kLearnMore) { | |
await env.openExternal(Uri.parse("https://quarto.org/docs/visual-editor/vscode/#markdown-output")); | |
await reopenSourceMode(); | |
return; | |
} else { | |
this.context.globalState.update(kVisualModeConfirmed, true); | |
} | |
} |
Actual behavior
No response
Expected behavior
Some ideas for expected behaviour:
- The first time you "Preview" the document, you get this modal, which is un-cancellable (clicking Cancel seems to cause the editor to reopen and trigger the modal again)
- When Cancel is clicked, the user should be allowed back to Source mode, even though
editor: visual
is in the frontmatter? - or, note to the user that they could can
editor: visual
from the frontmatter to avoid this
- When
editor: visual
is specified and you try to toggle back to Source mode using the toggle in the Editor Actions, you get kicked back to Visual mode
editor: <MODE>
should set the default mode when the editor for the file is first opened, but if the user manually toggles to a different mode, they should be able to?- or, note to the user that
editor: visual
must be removed if they want to switch to source?
Your environment
See posit-dev/positron#9268 for additional context and environments.
This is 100% reproducible in a fresh demo environment in Workbench. For Desktop builds, I think a state reset is needed before reproducing, as the problem is no longer reproducible once the user has clicked Use Visual Mode in the modal.