Skip to content

feat: save as markdown behaviour for web#472

Merged
cguedes merged 11 commits into
mainfrom
455-save-as-markdown-behaviour-for-web
Sep 1, 2023
Merged

feat: save as markdown behaviour for web#472
cguedes merged 11 commits into
mainfrom
455-save-as-markdown-behaviour-for-web

Conversation

@cguedes

@cguedes cguedes commented Sep 1, 2023

Copy link
Copy Markdown
Collaborator

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)

image

image

@cguedes cguedes linked an issue Sep 1, 2023 that may be closed by this pull request
@cguedes cguedes requested a review from sehyod September 1, 2023 13:21
@codecov

codecov Bot commented Sep 1, 2023

Copy link
Copy Markdown

Codecov Report

Merging #472 (2f918c1) into main (303c46a) will increase coverage by 0.13%.
Report is 1 commits behind head on main.
The diff coverage is 33.33%.

@@            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              
Files Changed Coverage Δ
src/application/App.tsx 0.00% <0.00%> (ø)
src/io/__mocks__/filesystem.ts 100.00% <ø> (ø)
src/api/projectsAPI.ts 28.57% <3.44%> (-3.41%) ⬇️
src/features/textEditor/saveAsMarkdown.tsx 15.38% <15.38%> (ø)
...rc/features/textEditor/components/TipTapEditor.tsx 88.88% <57.14%> (-1.50%) ⬇️
src/io/filesystem.ts 86.61% <83.33%> (+17.46%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

);
}

export async function saveAsMarkdown(markdownSerializer: MarkdownSerializer, filePath: string) {

Copy link
Copy Markdown
Collaborator Author

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.

Copy link
Copy Markdown
Collaborator Author

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

Comment thread src/api/projectsAPI.ts
children: undefined,
}));

const exportsFiles = relativePaths

Copy link
Copy Markdown
Collaborator Author

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.

Comment thread src/application/App.tsx

useEventListener('unhandledrejection', (event) => {
notifyError('An error occurred', `Unhandled rejection in promise. Reason: ${event.reason}).`);
notifyError('Unhandled rejection in promise', `Reason: ${event.reason}`);

Copy link
Copy Markdown
Collaborator Author

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.

Comment thread src/features/textEditor/components/TipTapEditor.tsx Outdated
@cguedes cguedes marked this pull request as ready for review September 1, 2023 13:39
Comment thread src/features/textEditor/components/TipTapEditor.tsx Outdated
Comment thread src/io/filesystem.ts
@cguedes cguedes requested a review from sehyod September 1, 2023 16:05
@cguedes cguedes merged commit 43e1000 into main Sep 1, 2023
@cguedes cguedes deleted the 455-save-as-markdown-behaviour-for-web branch September 1, 2023 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Save as Markdown behaviour for web

2 participants