mirror of
https://github.com/zadam/trilium.git
synced 2025-12-17 21:59:55 +01:00
fix(markdown): show 'import successful' when canceling markdown import
This commit is contained in:
@@ -37,12 +37,21 @@ export default function MarkdownImportDialog() {
|
|||||||
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={async () => {
|
||||||
|
setShown(false);
|
||||||
|
if (editorApiRef.current) {
|
||||||
|
await convertMarkdownToHtml(text, editorApiRef.current);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
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("");
|
||||||
}}
|
}}
|
||||||
@@ -56,6 +65,9 @@ export default function MarkdownImportDialog() {
|
|||||||
if (e.key === "Enter" && e.ctrlKey) {
|
if (e.key === "Enter" && e.ctrlKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setShown(false);
|
setShown(false);
|
||||||
|
if (editorApiRef.current) {
|
||||||
|
convertMarkdownToHtml(text, editorApiRef.current);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}}></textarea>
|
}}></textarea>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
Reference in New Issue
Block a user