We need a reliable way to open a note by filename and replace the contents
@EduardMe 已经在做这个了。
开始于 2022年11月30日。
评估
这个 Issue 还没有评估数据。
描述
@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
- 主要语言
- JavaScript
- 星标
- 204
- 派生
- 82
- 平均合并
- 22 小时 27 分钟
- 30 天内合并 PR
- 3
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NotePlan/plugins 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
-
bug
难度 4/5 3-5 天 新手友好度 48/100
-
难度 5/5 一周以上 新手友好度 35/100
-
bug
-
bug
难度 3/5 1-2 天 新手友好度 38/100
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
avniproject/avni-client#2135 ·
-
automated broken-link
难度 1/5 1 小时以内 新手友好度 85/100
-
agent/security hive/hosted-available-lke648397-260827-5n31 security
难度 2/5 1-3 小时 新手友好度 84/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
难度 2/5 1-3 小时 新手友好度 72/100
bevyengine/bevy-website#2595 ·