diff --git a/OneMore/Commands/Styles/ApplyStyleCommand.cs b/OneMore/Commands/Styles/ApplyStyleCommand.cs index 1205c8e24b..69e4b38d5b 100644 --- a/OneMore/Commands/Styles/ApplyStyleCommand.cs +++ b/OneMore/Commands/Styles/ApplyStyleCommand.cs @@ -311,9 +311,6 @@ private bool StylizeParagraphs() private void SetQuickStyle(Page page, XElement element, Style style) { - - System.Diagnostics.Debugger.Launch(); - if (style.StyleType == StyleType.Heading && // must be in heading range h1=0..h6=5 style.Index < 6) diff --git a/OneMore/Models/Page.cs b/OneMore/Models/Page.cs index 0157bcb2bc..0c7b0102bc 100644 --- a/OneMore/Models/Page.cs +++ b/OneMore/Models/Page.cs @@ -232,7 +232,11 @@ public string AddTagDef(string symbol, string name, int tagType = 0) int index = 0; if (tags?.Any() == true) { - var tag = tags.FirstOrDefault(e => e.Attribute("symbol").Value == symbol); + var tag = tags.FirstOrDefault(e => + e.Attribute("symbol").Value == symbol && + e.Attribute("fontColor").Value == "automatic" && + e.Attribute("highlightColor").Value == "none"); + if (tag is not null) { return tag.Attribute("index").Value; @@ -259,7 +263,11 @@ public void AddTagDef(TagDef tagdef) var tags = Root.Elements(Namespace + "TagDef"); if (tags?.Any() == true) { - var tag = tags.FirstOrDefault(e => e.Attribute("symbol").Value == tagdef.Symbol); + var tag = tags.FirstOrDefault(e => + e.Attribute("symbol").Value == tagdef.Symbol && + e.Attribute("fontColor").Value == tagdef.FontColor && + e.Attribute("highlightColor").Value == tagdef.HighlightColor); + if (tag is not null) { return; diff --git a/OneMore/Models/TagDef.cs b/OneMore/Models/TagDef.cs index 81e4c6fee9..04a59a0c42 100644 --- a/OneMore/Models/TagDef.cs +++ b/OneMore/Models/TagDef.cs @@ -61,7 +61,19 @@ public int IndexValue /// - /// Static, indicates the specific glyph used for the tag + /// Gets the unique font color of this symbol tag + /// + public string FontColor => Attribute("fontColor").Value; + + + /// + /// Gets the unique highlight color of this symbol tag + /// + public string HighlightColor => Attribute("highlightColor").Value; + + + /// + /// Gets the specific glyph used for the tag /// public string Symbol => Attribute("symbol").Value; @@ -79,10 +91,15 @@ public int IndexValue /// True if the Symbols are equal public override bool Equals(object obj) { - if (obj is XElement other) + if (obj is XElement other && other.Name.LocalName == "TagDef") { - // this is all we care about; OneNote allows exactly one of each symbol, no more - return Attribute("symbol").Value.Equals(other.Attribute("symbol").Value); + // OneNote typically allows one of each symbol, however, you can have multiple + // instances of each symbol as long as the font/highlight colors are unique + + return + Symbol.Equals(other.Attribute("symbol").Value) && + FontColor.Equals(other.Attribute("fontColor").Value) && + HighlightColor.Equals(other.Attribute("highlightColor").Value); } return false; diff --git a/OneMore/Models/TagMapper.cs b/OneMore/Models/TagMapper.cs index 65ca2c72bf..fcc5c8f60e 100644 --- a/OneMore/Models/TagMapper.cs +++ b/OneMore/Models/TagMapper.cs @@ -81,7 +81,7 @@ public void MergeTagDefsFrom(Page sourcePage) // resolve source tagdefs with target tagdefs foreach (var source in sourcedefs) { - var mapping = map.Find(m => m.TagDef.Symbol == source.Symbol); + var mapping = map.Find(m => m.TagDef.Equals(source)); if (mapping is null) { // no match so add it and set index to maxIndex+1