MCPcopy Index your code
hub / github.com/utterance/utterances / NewCommentComponent

Class NewCommentComponent

src/new-comment-component.ts:15–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13const nothingToPreview = 'Nothing to preview';
14
15export class NewCommentComponent {
16 public readonly element: HTMLElement;
17
18 private avatarAnchor: HTMLAnchorElement;
19 private avatar: HTMLImageElement;
20 private form: HTMLFormElement;
21 private textarea: HTMLTextAreaElement;
22 private preview: HTMLDivElement;
23 private submitButton: HTMLButtonElement;
24 private signInAnchor: HTMLAnchorElement;
25
26 private submitting = false;
27 private renderTimeout = 0;
28
29 constructor(
30 private user: User | null,
31 private readonly submit: (markdown: string) => Promise<void>
32 ) {
33 this.element = document.createElement('article');
34 this.element.classList.add('timeline-comment');
35
36 this.element.innerHTML = `
37 <a class="avatar" target="_blank" tabindex="-1">
38 <img height="44" width="44">
39 </a>
40 <form class="comment" accept-charset="UTF-8" action="javascript:">
41 <header class="new-comment-header tabnav">
42 <div class="tabnav-tabs" role="tablist">
43 <button type="button" class="tabnav-tab tab-write"
44 role="tab" aria-selected="true">
45 Write
46 </button>
47 <button type="button" class="tabnav-tab tab-preview"
48 role="tab">
49 Preview
50 </button>
51 </div>
52 </header>
53 <div class="comment-body">
54 <textarea class="form-control" placeholder="Leave a comment" aria-label="comment"></textarea>
55 <div class="markdown-body" style="display: none">
56 ${nothingToPreview}
57 </div>
58 </div>
59 <footer class="new-comment-footer">
60 <a class="text-link markdown-info" tabindex="-1" target="_blank"
61 href="https://guides.github.com/features/mastering-markdown/">
62 <svg class="octicon v-align-bottom" viewBox="0 0 16 16" version="1.1"
63 width="16" height="16" aria-hidden="true">
64 <path fill-rule="evenodd" d="M14.85 3H1.15C.52 3 0 3.52 0 4.15v7.69C0 12.48.52 13 1.15
65 13h13.69c.64 0 1.15-.52 1.15-1.15v-7.7C16 3.52 15.48 3 14.85 3zM9 11H7V8L5.5 9.92 4
66 8v3H2V5h2l1.5 2L7 5h2v6zm2.99.5L9.5 8H11V5h2v3h1.5l-2.51 3.5z">
67 </path>
68 </svg>
69 Styling with Markdown is supported
70 </a>
71 <button class="btn btn-primary" type="submit">Comment</button>
72 <a class="btn btn-primary" href="${getLoginUrl(page.url)}" target="_top">

Callers

nothing calls this directly

Calls 4

getRepoConfigFunction · 0.90
scheduleMeasureFunction · 0.90
renderMarkdownFunction · 0.90
processRenderedMarkdownFunction · 0.90

Tested by

no test coverage detected