SayLink.ts 673 B

123456789101112131415161718192021222324
  1. /// <reference path="../Say.ts" />
  2. class SayLink extends Say {
  3. private linkedAction : Action;
  4. public setAction (action : Action) {
  5. this.linkedAction = action;
  6. }
  7. public async getPureElements () : Promise<Array<Element | Text>> {
  8. let paragraphs = await this.getParagraphs();
  9. let elements = paragraphs.length == 1 ? paragraphs[0] : Array.prototype.concat.apply([], paragraphs);
  10. let b = document.createElement("b");
  11. b.classList.add("textLink");
  12. elements.forEach((element) => {
  13. b.appendChild(element);
  14. });
  15. Controls.Links.makeLink(b, this.linkedAction);
  16. return [b];
  17. }
  18. }