Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click in editor and preview to toggle a task list item #925

Closed
K4LCIFER opened this issue Mar 30, 2021 · 3 comments
Closed

Click in editor and preview to toggle a task list item #925

K4LCIFER opened this issue Mar 30, 2021 · 3 comments
Labels
Area: Input Related to editor input processing (key presses, key bindings). Area: Preview The Markdown preview is owned by VS Code. We have nearly no control. Area: Task list GitHub Flavored Markdown task list. Issue: Feature Something brand new. Res: External Outside of our control/codebase. Upstream Pertaining to an upstream component, or blocked by an upstream issue.

Comments

@K4LCIFER
Copy link

K4LCIFER commented Mar 30, 2021

Proposal

It would be really nice to be able to just click or double click (maybe with a keyboard modifier like <ALT> for example) a task list item to have it get checked. In addition to this, in the preview pane, a single click on a task list checkbox should toggle it.
Before click or double click:

- [ ] item

After click or double click

- [X] item

References

@yzhang-gh
Copy link
Owner

yzhang-gh commented Mar 31, 2021

Due to the limitation of VS Code APIs, it is (almost) impossible to have these features (double-click events, backward edit).

I would suggest using the keyboard shortcut alt+c to toggle checkboxes.

Also be sure to check out alt+s for strikethrough. (see Keyboard Shortcuts).

@yzhang-gh yzhang-gh added the Res: Answered Discussion closed with no more specific state. label May 7, 2021
@Lemmingh Lemmingh added Area: Input Related to editor input processing (key presses, key bindings). Area: Task list GitHub Flavored Markdown task list. Issue: Feature Something brand new. Res: External Outside of our control/codebase. Upstream Pertaining to an upstream component, or blocked by an upstream issue. and removed Res: Answered Discussion closed with no more specific state. labels Aug 24, 2021
@Lemmingh Lemmingh changed the title Ability to Easily Toggle a Task List Item Click in editor and preview to toggle a task list item Aug 24, 2021
@Lemmingh Lemmingh added the Area: Preview The Markdown preview is owned by VS Code. We have nearly no control. label Aug 24, 2021
@mrienstra
Copy link

shd101wyy.markdown-preview-enhanced (Marketplace; GitHub) has this capability. It relies on @shd101wyy/mume, the relevant method is here:
https://github.com/shd101wyy/mume/blob/d1904b9/src/webview.ts#L1278-L1315


Here's some clues as to how VS Code handles clicks in the preview webview:

extensions/markdown-language-features/preview-src/index.ts:

extensions/markdown-language-features/src/preview/preview.ts:


markdown-it-task-lists (used by this repo) has an enabled: true option, which will need to be set if a click-to-toggle feature is added.

@yzhang-gh
Copy link
Owner

Thanks for the information. We only extend the VS Code's built-in Markdown preview rather than provide a standalone one like in the Markdown Preview Enhanced extension. That's why I said there is no available API as we do not want to re-implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Input Related to editor input processing (key presses, key bindings). Area: Preview The Markdown preview is owned by VS Code. We have nearly no control. Area: Task list GitHub Flavored Markdown task list. Issue: Feature Something brand new. Res: External Outside of our control/codebase. Upstream Pertaining to an upstream component, or blocked by an upstream issue.
Projects
None yet
Development

No branches or pull requests

4 participants