Skip to content

Commit

Permalink
Merge pull request #1275 from stevencohn/1273-scope-images-to-edit
Browse files Browse the repository at this point in the history
update SelectImagesCommand
  • Loading branch information
stevencohn authored Jan 20, 2024
2 parents aca4db3 + 4a9264d commit e2e4296
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions OneMore/Commands/Edit/SelectImagesCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,24 @@ public SelectImagesCommand()
public override async Task Execute(params object[] args)
{
using var one = new OneNote(out var page, out var ns);
var images = page.Root.Descendants(ns + "Image");
if (images.Any())

// find foreground images
var images = page.Root
.Elements(ns + "Outline")
.Descendants(ns + "Image")?
.ToList();

if (!images.Any())
{
// else find background images
images = page.Root
.Elements(ns + "Image")
.ToList();
}

if (images != null && images.Any())
{
// deselect selected images incase collision between back and fore
var selections = page.Root.Descendants()
.Where(e => e.Attribute("selected")?.Value == "all")
.ToList();
Expand Down

0 comments on commit e2e4296

Please sign in to comment.