mirror of
https://github.com/TriliumNext/Trilium.git
synced 2025-12-10 03:53:37 -06:00
fix(markdown): show 'import successful' when canceling markdown import (#7899)
This commit is contained in:
commit
a867a25d5f
@ -34,15 +34,26 @@ export default function MarkdownImportDialog() {
|
||||
}
|
||||
});
|
||||
|
||||
function submit() {
|
||||
setShown(false);
|
||||
if (editorApiRef.current && text) {
|
||||
convertMarkdownToHtml(text, editorApiRef.current);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal
|
||||
className="markdown-import-dialog" title={t("markdown_import.dialog_title")} size="lg"
|
||||
footer={<Button className="markdown-import-button" text={t("markdown_import.import_button")} onClick={() => setShown(false)} keyboardShortcut="Ctrl+Enter" />}
|
||||
footer={
|
||||
<Button
|
||||
className="markdown-import-button"
|
||||
text={t("markdown_import.import_button")}
|
||||
keyboardShortcut="Ctrl+Enter"
|
||||
onClick={submit}
|
||||
/>
|
||||
}
|
||||
onShown={() => markdownImportTextArea.current?.focus()}
|
||||
onHidden={async () => {
|
||||
if (editorApiRef.current) {
|
||||
await convertMarkdownToHtml(text, editorApiRef.current);
|
||||
}
|
||||
onHidden={() => {
|
||||
setShown(false);
|
||||
setText("");
|
||||
}}
|
||||
@ -55,7 +66,7 @@ export default function MarkdownImportDialog() {
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" && e.ctrlKey) {
|
||||
e.preventDefault();
|
||||
setShown(false);
|
||||
submit();
|
||||
}
|
||||
}}></textarea>
|
||||
</Modal>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user