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 (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
className="markdown-import-dialog" title={t("markdown_import.dialog_title")} size="lg"
|
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()}
|
onShown={() => markdownImportTextArea.current?.focus()}
|
||||||
onHidden={async () => {
|
onHidden={() => {
|
||||||
if (editorApiRef.current) {
|
|
||||||
await convertMarkdownToHtml(text, editorApiRef.current);
|
|
||||||
}
|
|
||||||
setShown(false);
|
setShown(false);
|
||||||
setText("");
|
setText("");
|
||||||
}}
|
}}
|
||||||
@ -55,7 +66,7 @@ export default function MarkdownImportDialog() {
|
|||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
if (e.key === "Enter" && e.ctrlKey) {
|
if (e.key === "Enter" && e.ctrlKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setShown(false);
|
submit();
|
||||||
}
|
}
|
||||||
}}></textarea>
|
}}></textarea>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user