-
Notifications
You must be signed in to change notification settings - Fork 156
First line defaults to title #164
Comments
I've opened a pull request for this. It's implemented like you've said -- I grab the first suitable line of text and try to form a filename-suggestion out of that. Do you think it would be better to look for the first |
This is a really good idea, trying to find the first |
This could get hairy quickly I think. We would essentially be looping through the whole document for each type of header. Depending on the size of the document, this could be an expensive operation for what is really a very minor usability benefit. |
No, but we'd stop on the first header. E.g: If there's no first class headers but there's one second class header, then we get the first second class header we can find. If not then a third class header and so on |
I think it is a good idea to search for document headers. For example some documents could use YAML headers (#142) which must be ignored. But no need to parse the document again to find the first header, it is already done in the pane for creating the table of contents. In order to avoid lags which can occur when parsing big documents, we currently do this in a separate thread by using a worker: https://github.com/brrd/Abricotine/blob/develop/app/renderer/abr-pane-worker.js It is called there: https://github.com/brrd/Abricotine/blob/develop/app/renderer/abr-pane.js#L82 The worker has no access to the DOM, which explains why we can't use CodeMirror methods here. I think doing this process once is enough. A good solution IMO would be to store the table of contents as a property of |
This is more of a request than a bug. I believe that most of the people don't want to reedit the title of the saved document every first time.
I say this because when you open the editor once and starts a new blank document, upon clicking on save (this is the first save ever for that file), this happens:
Which is the expected behavior, a save dialog.
But what I'm proposing is this:
What if instead of Untitled we could grab the first line of the file, like this:
Then, upon clicking on save we would have this:
The text was updated successfully, but these errors were encountered: