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

CMD+E (to open "edit with AI") should not work when viewing a published document #158

Open
lucasfcosta opened this issue Oct 22, 2024 · 2 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@lucasfcosta
Copy link
Member

lucasfcosta commented Oct 22, 2024

If possible, re-check all shortcuts

@lucasfcosta lucasfcosta added good first issue Good for newcomers help wanted Extra attention is needed labels Oct 22, 2024
@lucasfcosta lucasfcosta changed the title Refreshing the page while "edit with AI" runs makes it stuck (clicking on "x" too) CMD+E (to open "edit with AI") should not work when viewing a published document Oct 22, 2024
@vtfg
Copy link
Contributor

vtfg commented Oct 22, 2024

Alt + Enter also works in view mode.

@vieiralucas
Copy link
Member

The fix should be changing this function:

function getExtensions(source: Y.Text, disabled: boolean) {
return [
...brieferKeyMaps({
onBlur: editorAPI.blur,
onEditWithAI: props.onEditWithAI,
onRun: props.onRun,
onRunSelectNext,
onRunInsertBlock,
}),
basicSetup,
EditorView.lineWrapping,
...(props.language === 'python'
? [python]
: props.language === 'sql'
? [sql]
: []),
keymap.of(vscodeKeymap),
EditorState.readOnly.of(props.disabled || props.readOnly),
createTextSync(source),
materialLight(disabled),
]
}

Basically we should call brieferKeyMaps conditionally. If the editor is in read-only or disabled it should not have the brieferKeyMaps extension.

Anyone interested in submitting a PR for this issue? Let me know and I can assign and give further help if needed.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants