You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: helpers/NPParagraph.js
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1831,9 +1831,8 @@ export function removeAllDueDates(filename: string): boolean {
1831
1831
}
1832
1832
1833
1833
/**
1834
-
* WARNING: This was an attempt to work around the issue that .lineIndex in Editor.paragraphs includes frontmatter lines, but in Editor.selectedParagraphs it doesn't.
1835
-
* WARNING: However, it doesn't work, as it throws up "Attempted to assign to readonly property" errors.
1836
1834
* Get the selected paragraphs with the correct line index, taking into account the frontmatter lines.
1835
+
* Note: This attempts to work around the issue that .lineIndex in Editor.paragraphs includes frontmatter lines, but in Editor.selectedParagraphs it doesn't.
1837
1836
* Note: should really live in editor.js, but putting here to avoid a circular dependency.
1838
1837
* @author@jgclark
1839
1838
*
@@ -1846,11 +1845,13 @@ export function getSelectedParagraphsWithCorrectLineIndex(): Array<TParagraph> {
// Note: The strings here must match the strings in userInput.js::processChosenHeading()
1219
+
if(note.type==='Calendar'){
1220
+
headingStrings.unshift('➕#️⃣ (first insert new heading at the start of the note)')
1221
+
}else{
1222
+
headingStrings.unshift(`➕#️⃣ (first insert new heading under the title)`)
1223
+
}
1224
+
if(headingParas.length>0){
1225
+
headingStrings.push(`➕#️⃣ (first insert new heading at the end of the note)`)
1226
+
}else{
1227
+
logDebug('NPnote/getHeadingsFromNote',`No headings found in note ${note.filename}. So not adding 'insert new heading at the end of the note' option as well as 'first insert new heading...' option.`)
1194
1228
}
1195
-
return`${prefix}${p.content.trimLeft()}`
1196
-
})
1197
-
}
1198
-
if(optionCreateNewHeading){
1199
-
if(note.type==='Calendar'){
1200
-
headingStrings.unshift('➕#️⃣ (first insert new heading at the start of the note)')
1201
-
}else{
1202
-
headingStrings.unshift(`➕#️⃣ (first insert new heading under the title)`)
1203
1229
}
1204
-
headingStrings.push(`➕#️⃣ (first insert new heading at the end of the note)`)
1205
-
}
1206
-
if(optionAddATopAndtBottom){
1207
-
headingStrings.unshift('⏫(topofnote)')
1208
-
headingStrings.push('⏬(bottomofnote)')
1209
-
}
1210
-
if(headingStrings.length===0){
1211
-
return['']
1212
-
}
1213
-
if(!includeMarkdown){
1214
-
headingStrings=headingStrings.map((h)=>h.replace(/^#{1,5}\s*/,''))// remove any markdown heading markers
1230
+
logDebug('NPnote/getHeadingsFromNote',`After adding 'insert new heading...' options, headingStrings: ${String(headingStrings)}`)
1231
+
if(optionAddATopAndBottom){
1232
+
headingStrings.unshift('⏫ (top of note)')
1233
+
headingStrings.push('⏬ (bottom of note)')
1234
+
}
1235
+
if(headingStrings.length===0){
1236
+
logDebug('NPnote/getHeadingsFromNote',`No headingStrings generated for note ${note.filename}. Returning empty array.`)
1237
+
return[]
1238
+
}
1239
+
// Remove any markdown heading markers if requested
Copy file name to clipboardExpand all lines: helpers/paragraph.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -583,7 +583,7 @@ export function findStartOfActivePartOfNote(note: CoreNoteFields, allowPreamble?
583
583
// or 'allowPreamble' is true.
584
584
// If there is, run on to next heading or blank line (if found) otherwise, just the next line. Finding a separator or any YouTutype of task or checklist also stops the search.
Copy file name to clipboardExpand all lines: helpers/userInput.js
+79-61Lines changed: 79 additions & 61 deletions
Original file line number
Diff line number
Diff line change
@@ -741,6 +741,7 @@ export async function chooseHeading(
741
741
* Ask user to select a heading from those in a given note (regular or calendar), or optionally create a new heading at top or bottom of note to use, or the top or bottom of the note.
742
742
* Note: Any whitespace on the end of the heading text is left in place, as otherwise this would cause issues with NP API calls that take heading parameter.
743
743
* V2: Can use newer CommandBar decorated options, if running on v3.18 or later.
744
+
* Note: Returns an empty string if no headings found and no other options requested.
744
745
* @author@jgclark
745
746
*
746
747
* @param {TNote} note - note to draw headings from
@@ -763,10 +764,17 @@ export async function chooseHeadingV2(
@@ -787,14 +795,16 @@ export async function chooseHeadingV2(
787
795
alpha: 0.6,
788
796
darkAlpha: 0.6,
789
797
})
790
-
headingOptions.push({
791
-
text: '(insert new heading at the end of the note)',
792
-
icon: 'h'+String(headingLevel),
793
-
shortDescription: 'Add new',
794
-
color: 'orange-500',
795
-
alpha: 0.6,
796
-
darkAlpha: 0.6,
797
-
})
798
+
if(headings.length>0){
799
+
headingOptions.push({
800
+
text: '(insert new heading at the end of the note)',
801
+
icon: 'h'+String(headingLevel),
802
+
shortDescription: 'Add new',
803
+
color: 'orange-500',
804
+
alpha: 0.6,
805
+
darkAlpha: 0.6,
806
+
})
807
+
}
798
808
}
799
809
if(optionAddAtTopAndBottom){
800
810
headingOptions.unshift({
@@ -835,64 +845,72 @@ export async function chooseHeadingV2(
835
845
* @param {TNote} note
836
846
* @param {string} chosenHeading - The text of the new heading to add, or 5 possible special instruction strings.
837
847
* @param {number?} headingLevel - The level of the heading to add (1-5) where requested. If not given, will default to 2.
838
-
* @returns {string} headingToReturn - The heading to return, or one of the special instruction strings <<top of note>>, <<bottom of note>>.
848
+
* @returns {string} headingToReturn - The heading to return, or one of the special instruction strings <<top of note>>, <<bottom of note>>. Or empty string if user cancelled operation.
Copy file name to clipboardExpand all lines: jgclark.Filer/CHANGELOG.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,9 @@
1
1
# What's changed in 📦 Filer plugin?
2
2
Please see the [Readme for this plugin](https://github.com/NotePlan/plugins/tree/main/jgclark.Filer) for more details, including the available settings.
3
3
4
-
## [1.3.3] - 2025-10-18
4
+
## [1.3.3] - 2025-11-07
5
5
- fix duplication in /move block (thanks for the tip, @bido_1977)
6
+
- improved the heading picker used in some of these commands
6
7
7
8
## [1.3.2] - 2025-09-06
8
9
- suppress notes in the special Archive and Template folders from the note chooser in **/add sync'd copy to note** and **/move ...** commands (for @chrismetcalf)
0 commit comments