Skip to content
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

Issue 4921 #5128

Closed
wants to merge 0 commits into from
Closed

Issue 4921 #5128

wants to merge 0 commits into from

Conversation

imalexhu
Copy link

Checklist

yarn test fails, but I can't really work out why

Description

Changes the file preview so that the title display is now the file yamlTitle or firstHeading rather than fileName. This should make the file preview more descriptive.

Changes

The file-find-and-return-meta data query now returns previewTitle in its 0th index rather than descriptor.name

Tested on: MacOs 14.3.1

Copy link

boring-cyborg bot commented Apr 30, 2024

Thank you for opening your first PR! 🎉 We are very happy and would like to thank you very much for your contribution. If everything checks out, we'll make sure to review the PR as soon as possible and give feedback. In the meantime, to make the reviewing process as fast as possible, you can help us by checking the following things:

  • Did you follow the JSStandard coding style? - Did you comment everywhere where the necessity of a piece of code or the
    way it was implemented is not immediately obvious?
  • Did you attempt to stick as much to current coding habits as possible?
    (Note that this does not apply to pieces of code where we ourselves
    obviously violated good coding practices, which unfortunately happens
    sometimes. But please indicate this in your PR so that we know what you
    rectified!)

Furthermore, make sure that the linter does not complain, which will check your code on every new commit. If the linter task fails, make sure to run yarn lint locally and check the file eslint_report.htm which will tell you precisely what went wrong.
Stay sharp, and thanks again!

@nathanlesage
Copy link
Member

I just ran the unit tests, let's see where it complains.

Then, this is a good suggestion, but there are settings that the user can check regarding what to view -- filename, first heading, or YAML title -- and you should respect them. These are simple Boolean toggles that you can access in commands using this._app.config.get() (or similar, but typescript should show you the way in VS Code).

The state machine for these is relatively simple, I've implemented them in a bunch of renderers, just search for const useH1.

If you could implement that, then it should be good to go!

@imalexhu
Copy link
Author

Thanks Nathan, Ill get onto this :)

@imalexhu
Copy link
Author

imalexhu commented May 1, 2024

@nathanlesage Im still unsure why the tests are failing, but I have reimplemented the code so that it satisfies the condition outlined above.

Thanks :)

@imalexhu
Copy link
Author

imalexhu commented May 1, 2024

Looking at the config of zettlr

Screenshot 2024-05-01 at 6 16 36 pm

Im assuming that the config "title+heading" is supposed to be "title|heading"? If that is the case, i can fix my code to render something different.

Thanks :)

@nathanlesage
Copy link
Member

No no the config option is supposed to be one of three strings:

  • title
  • heading
  • title+heading

The character in between doesn't matter so much, but that is why I do the "includes" check -- that will match both "heading" and "heading+title" and the same for the title property.

@nathanlesage
Copy link
Member

But that being said, as you implemented it should work as well. Just two final changes and then it's ready to merge:

  1. I recommend not extending the class and instead using a simple function outside of the class but within the file. I'm planning to convert this whole class instantiation mess into simple callable functions and if the preview title generator is implemented as a simple function inside that file, it'll be easier to do the migration going forward
  2. Convert the Changelog changes you added into a bullet item that simply states fix: The file preview tooltip now respects the filename display settings

@imalexhu
Copy link
Author

@nathanlesage Hello, sorry to ping. But I think I have redone this PR so that it fits what you describe. Please let me know how to progress at this stage

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.

None yet

2 participants