mirror of
https://github.com/callumalpass/tasknotes.git
synced 2026-07-22 12:50:26 +00:00
feat: inline task creation now respects "Include Current Note in Project" setting (#727)
- When useParentNoteAsProject is enabled, inline tasks automatically include current note as project - Provides consistency with instant convert functionality - Passes current note link via prePopulatedValues to TaskCreationModal
This commit is contained in:
parent
0a1de2cdc9
commit
5245922a85
2 changed files with 21 additions and 0 deletions
|
|
@ -42,6 +42,11 @@ Example:
|
|||
|
||||
## Changed
|
||||
|
||||
- (#727) "Create New Inline Task" command now respects the "Include Current Note in Project" setting
|
||||
- When enabled, the current note is automatically added as a project to inline tasks
|
||||
- Provides consistency with instant convert functionality
|
||||
- Thanks to @chrisfeagles for the suggestion
|
||||
|
||||
- Improved link handling throughout the plugin using Obsidian's native APIs
|
||||
- Replaced manual wikilink generation with `FileManager.generateMarkdownLink()`
|
||||
- Now respects user's link format settings (wikilink vs markdown, relative paths)
|
||||
|
|
|
|||
16
src/main.ts
16
src/main.ts
|
|
@ -2285,8 +2285,24 @@ export default class TaskNotesPlugin extends Plugin {
|
|||
insertionPoint,
|
||||
};
|
||||
|
||||
// Prepare pre-populated values
|
||||
const prePopulatedValues: Partial<TaskInfo> = {};
|
||||
|
||||
// Include current note as project if enabled
|
||||
if (this.settings.taskCreationDefaults.useParentNoteAsProject) {
|
||||
const currentFile = this.app.workspace.getActiveFile();
|
||||
if (currentFile) {
|
||||
const parentNote = this.app.fileManager.generateMarkdownLink(
|
||||
currentFile,
|
||||
currentFile.path
|
||||
);
|
||||
prePopulatedValues.projects = [parentNote];
|
||||
}
|
||||
}
|
||||
|
||||
// Open task creation modal with callback to insert link
|
||||
const modal = new TaskCreationModal(this.app, this, {
|
||||
prePopulatedValues: Object.keys(prePopulatedValues).length > 0 ? prePopulatedValues : undefined,
|
||||
onTaskCreated: (task: TaskInfo) => {
|
||||
this.handleInlineTaskCreated(task, insertionContext);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue