feat(Search) Search hotkey now working. CMD + K

This commit is contained in:
2022-04-16 22:47:09 -04:00
parent 0f67fc18c1
commit ba2eeec13f
42 changed files with 235 additions and 246 deletions
+13 -14
View File
@@ -24,22 +24,27 @@ public class NoteContentModel
public string Description { get; set; }
public string Content { get; set; }
[NotMapped]
public virtual string LoadedContent { get; set; }
[NotMapped] public virtual string LoadedContent { get; set; }
public string IsHidden { get; set; } = "False";
public string IsPreAlpha { get; set; } = "True";
[NotMapped]
public virtual ICollection<NoteContentModel> NoteContentModels { get; set; } = new List<NoteContentModel>();
[NotMapped] public virtual NoteContentModel Parent { get; set; }
[NotMapped] public virtual int PageOrder { get; set; }
public List<SearchPointModel> GetHeaders()
{
var regex = new Regex(@"^#* (.*)$", RegexOptions.Multiline);
var listOfMatches = regex.Matches(LoadedContent);
List<SearchPointModel> foundHeaders = new List<SearchPointModel>();
var foundHeaders = new List<SearchPointModel>();
foreach (var capture in listOfMatches)
{
var cleanUp = capture.ToString();
@@ -49,18 +54,12 @@ public class NoteContentModel
cleanUp = cleanUp.Replace("\"", "");
cleanUp = cleanUp.Trim();
cleanUp = cleanUp.Replace(" ", "-");
foundHeaders.Add(new SearchPointModel(){ Title = capture.ToString().Trim(), Href = cleanUp});
foundHeaders.Add(new SearchPointModel { Title = capture.ToString().Trim(), Href = cleanUp });
Console.WriteLine($"Capture: {cleanUp}");
}
return foundHeaders;
}
[NotMapped]
public virtual ICollection<NoteContentModel> NoteContentModels { get; set; } = new List<NoteContentModel>();
[NotMapped] public virtual NoteContentModel Parent { get; set; }
[NotMapped] public virtual int PageOrder { get; set; }
private string GetLink()