Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
using attributed string
  • Loading branch information
tomsontom committed Oct 16, 2012
1 parent 658d380 commit 2fe7a13
Showing 1 changed file with 41 additions and 1 deletion.
Expand Up @@ -416,6 +416,46 @@ define("orion/editor/contentAssist", ['i18n!orion/editor/nls/messages', 'orion/t
if (proposal.style === "hr") {
node = document.createElement("hr");
div.appendChild(node, div);
} else if( proposal.style === "attributedString" ) {
div.className = this.calculateClasses(proposal.style, isSelected);
if (isSelected) {
this.parentNode.setAttribute("aria-activedescendant", div.id);
}

var contentDiv = document.createElement("div");
var nobr = document.createElement("nobr");
contentDiv.appendChild(nobr);
var contentNode = nobr;
if( proposal.description ) {
if( proposal.description.styleClass ) {
contentDiv.className = proposal.description.styleClass;
}

if( proposal.description.segments ) {
proposal.description.segments.forEach( function(segment) {
var itemNode = document.createElement("span");
var styleString = "";

if( segment.style ) {
if( segment.style.bold ) {
itemNode.style.fontWeight = "bold";
} else if(segment.style.italic) {
itemNode.style.fontStyle = "italic";
} else if(segment.style.color != null) {
itemNode.style.color = segment.style.color;
} else if(segment.style.fontname != null) {
itemNode.style.fontName = segment.style.fontname;
}
}
itemNode.appendChild(document.createTextNode(segment.value));

contentNode.appendChild(itemNode);
} );

}
}

div.appendChild(contentDiv);
} else if( proposal.style === "html" ) {
div.className = this.calculateClasses(proposal.style, isSelected);
if (isSelected) {
Expand All @@ -429,7 +469,7 @@ define("orion/editor/contentAssist", ['i18n!orion/editor/nls/messages', 'orion/t
if (isSelected) {
this.parentNode.setAttribute("aria-activedescendant", div.id);
}
div.appendChild(node, div);
div.appendChild(node);
}

parent.appendChild(div);
Expand Down

0 comments on commit 2fe7a13

Please sign in to comment.