-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: save as markdown behaviour for web #472
Conversation
Codecov Report
@@ Coverage Diff @@
## main #472 +/- ##
==========================================
+ Coverage 80.32% 80.45% +0.13%
==========================================
Files 188 189 +1
Lines 11151 11160 +9
Branches 1077 1082 +5
==========================================
+ Hits 8957 8979 +22
+ Misses 2180 2167 -13
Partials 14 14
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -102,3 +108,26 @@ export function TipTapEditor({ editorContent, editorId, isActive, saveFileInMemo | |||
</div> | |||
); | |||
} | |||
|
|||
export async function saveAsMarkdown(markdownSerializer: MarkdownSerializer, filePath: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved this file here as he depends in the markdownSerializer that belong to the "text editor".
I've also simplified the code by using the new getFileNameAndExtension
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After our chat I moved this to own file in src/features/textEditor
@@ -81,14 +85,31 @@ export async function readProjectFiles(projectId: string): Promise<TauriFileEntr | |||
children: undefined, | |||
})); | |||
|
|||
const exportsFiles = relativePaths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added this support while we don't have #414 ready.
@@ -43,7 +43,7 @@ export function App() { | |||
); | |||
|
|||
useEventListener('unhandledrejection', (event) => { | |||
notifyError('An error occurred', `Unhandled rejection in promise. Reason: ${event.reason}).`); | |||
notifyError('Unhandled rejection in promise', `Reason: ${event.reason}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Improve this a bit further.
This PR fixes #455 by implementing the same codebase for desktop and web, saving the files (markdown, and optionally the .bib) in the exports folder inside the project.
We can't add the operation to the explorer context menu because we can't ensure that the entry is hidden/inactive for other file types (pdf, .md), and also the current codebase exports the active editor (has a dependency on the TipTap editor instance)