Example #1
0
 function setNodeContentFromCommand(node: HTMLElement, commands: CommandRegistry, id: string): void {
   let iconClass = commands.iconClass(id);
   let iconLabel = commands.iconLabel(id);
   node.innerHTML = '';
   if (iconClass || iconLabel) {
     let icon = document.createElement('div');
     icon.innerText = commands.iconLabel(id);
     icon.className += ` ${iconClass}`;
     node.appendChild(icon);
   } else {
     node.innerText = commands.label(id);
   }
 }
Example #2
0
  function setNodeContentFromCommand(node: HTMLElement, commands: CommandRegistry, id: string): void {
    const iconClass = commands.iconClass(id);
    const iconLabel = commands.iconLabel(id);
    const label = commands.label(id);

    node.innerHTML = '';
    if (iconClass) {
      node.className += ` ${iconClass}`;
      node.setAttribute('title', iconLabel || label);
    } else {
      node.innerText = label;
    }
  }