Skip to content

Commit

Permalink
adjust file-saving
Browse files Browse the repository at this point in the history
  • Loading branch information
tk04 committed Apr 9, 2024
1 parent 65e1145 commit c34e63a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/Editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const Editor: React.FC<props> = ({
mdContent += htmlToMarkdown(editor?.getHTML() || "");
await writeTextFile(file.path, mdContent);
updateTOC();
setUpdateContent(0);
} catch {
alert(
"An error occurred when trying to save this file. Let us know by opening an issue at https://github.com/tk04/marker",
Expand Down Expand Up @@ -96,6 +95,7 @@ const Editor: React.FC<props> = ({

useEffect(() => {
if (!editor) return;
setUpdateContent(0);
editor?.commands.setContent(content);
editor?.setOptions({
editorProps: {
Expand All @@ -122,8 +122,9 @@ const Editor: React.FC<props> = ({
{editor.storage.characterCount.words()} words
</p>
<div
className={`duration-75 transition-all h-fit pb-2 flex items-center justify-between px-5 z-20 pt-[7px] ${collapse ? (isMacOS() ? "ml-[130px]" : "ml-[55px]") : "ml-[210px]"
}`}
className={`duration-75 transition-all h-fit pb-2 flex items-center justify-between px-5 z-20 pt-[7px] ${
collapse ? (isMacOS() ? "ml-[130px]" : "ml-[55px]") : "ml-[210px]"
}`}
>
<div className="flex items-center gap-5">
<div className="flex items-center gap-2 text-neutral-400 text-sm">
Expand All @@ -144,8 +145,9 @@ const Editor: React.FC<props> = ({
<TableOfContents toc={toc} />
</div>
<div
className={`editor transition-all duration-50 h-full overflow-auto ${!collapse ? "ml-[200px] px-5 lg:px-0 lg:ml-0" : "ml-0"
} transition-all duration-75`}
className={`editor transition-all duration-50 h-full overflow-auto ${
!collapse ? "ml-[200px] px-5 lg:px-0 lg:ml-0" : "ml-0"
} transition-all duration-75`}
>
<div className={`flex flex-col pt-20 h-full`}>
<div className="text-editor grow justify-center flex flex-col max-w-[580px] lg:pl-20 xl:pl-0 lg:max-w-[736px] m-auto w-full">
Expand Down

0 comments on commit c34e63a

Please sign in to comment.