We need a reliable way to open a note by filename and replace the contents
@EduardMe y travaille déjà.
Depuis le 30/11/2022.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
@dwertheimer: "I need a function I can call that will open a file with a certain filename whether it exists or not. No matter what, I can rely on getting a note back."
@jgclark and I have several plugins where the plugin needs to be able to create a note at a specific filename and replace that note's content reliably. I have tried many different approaches and have had challenges getting this to work 100% of the time because of the race conditions with notes being created and a "# " being immediately added to the note.
Lots of discussion on Discord: https://discord.com/channels/763107030223290449/1033958465326026822/1045726596679598092
@eduardme one way you can help me accomplish this objective would be to give us an API or a parameter that allows me to 1) create/open a note with a specific filename and 2) immediately set the content to XXX
Hoping that if you're doing it on the Swift side, it will be more reliable.
So, if the note does not exist, it gets created with the content
If the file does exist, the content is replaced
Maybe this would work if you add a "content" parameter to the end of Editor.openNoteByFilename
We should also have a DataStore version of this functionality as well
/**
* Opens a note using the given filename
* @param {String} filename - Filename of the note file (can be without extension), but has to include the relative folder such as `folder/filename.txt`.
* @param {Boolean} newWindow - (optional) Open note in new window (default = false)?
* @param {Number} highlightStart - (optional) Start position of text highlighting
* @param {Number} highlightEnd - (optional) End position of text highlighting
* @param {Boolean} splitView - (optional) Open note in a new split view (Note: Available from v3.4)
* @param {Boolean} createIfNeeded - (optional) Create the note with the given filename if it doesn't exist (only project notes, v3.5.2+)
* @param {String} content /* dbw added */ - Content to fill the note (replaces contents if the note already existed)
* @return {Promise} Note? - When the note has been opened, a promise will be returned with the note object
*/
.openNoteByFilename(filename, newWindow, highlightStart, highlightEnd, splitView, createIfNeeded, content /*dbw added*/)
```js
- Langage dominant
- JavaScript
- Étoiles
- 204
- Forks
- 82
- Merge moyen
- 22 h 27 min
- PR mergées (30 j)
- 3
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de NotePlan/plugins
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
-
bug
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
-
Dashboard: Task "Comment" Ouverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
-
Tidy: Issue with plugin.json Ouvertebug
-
bug
Difficulté 3/5 1-2 jours Accessibilité débutants 38/100
Toutes les issues de NotePlan/plugins
Issues similaires
-
code-quality refactoring
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100