diff --git a/OneMore/Models/PageEditor.cs b/OneMore/Models/PageEditor.cs index 224d1d8797..f18ca8e995 100644 --- a/OneMore/Models/PageEditor.cs +++ b/OneMore/Models/PageEditor.cs @@ -154,6 +154,15 @@ public async Task ExtractSelectedContent() (AllContent || e.Attributes().Any(a => a.Name == "selected" && a.Value == "all"))) .ToList(); + if (runs.Any() && AllContent) + { + // filter out the blank cursor to avoid inadvertently inserting a newline + runs = runs.Except(runs.Where(e => + e.Attributes().Any(a => a.Name == "selected" && a.Value == "all") && + e.GetCData().Value == string.Empty)) + .ToList(); + } + // no selections found in body if (!runs.Any()) { diff --git a/OneMore/Models/PageReader.cs b/OneMore/Models/PageReader.cs index bae9aecec7..c864d9db7e 100644 --- a/OneMore/Models/PageReader.cs +++ b/OneMore/Models/PageReader.cs @@ -103,6 +103,11 @@ public string GetSelectedText(bool withTitle = true) /// public string ReadTextFrom(IEnumerable paragraphs, bool allText) { + if (!paragraphs.Any()) + { + return string.Empty; + } + var builder = new StringBuilder(); foreach (var paragraph in paragraphs)