Dictionary<string, string[]> MakeCombinedElementList()
{
var elementCombineWhiteList = new Dictionary<string, string[]>();
foreach(HtmlEditorExtenderButton button in ToolbarButtons) {
if(button.ElementWhiteList != null) {
// loop through each element for the button
foreach(KeyValuePair<string, string[]> keyvalue in button.ElementWhiteList) {
// check if key contains in the combine elementWhiteList
if(elementCombineWhiteList.ContainsKey(keyvalue.Key)) {
string[] combineAtt;
List<string> listCombineAtt;
var isChanged = false;
// check if attribute value is already exist in the element
if(elementCombineWhiteList.TryGetValue(keyvalue.Key, out combineAtt)) {
listCombineAtt = combineAtt.ToList();
foreach(var value in keyvalue.Value) {
if(!combineAtt.Contains(value)) {
listCombineAtt.Add(value);
isChanged = true;
}
}
if(isChanged) {
// associate updated attribute list with the element
elementCombineWhiteList[keyvalue.Key] = listCombineAtt.ToArray();
}
}
} else {
//add element and its related attributes
elementCombineWhiteList.Add(keyvalue.Key, keyvalue.Value);
}
}
}
}
return elementCombineWhiteList;
}