| 89 | } |
| 90 | |
| 91 | fetchTopicHtml(roadmapId, topicId) { |
| 92 | const topicPartial = topicId.replace(/^\d+-/, '').replaceAll(/:/g, '/'); |
| 93 | const fullUrl = `/${roadmapId}/${topicPartial}/`; |
| 94 | |
| 95 | return fetch(fullUrl) |
| 96 | .then((res) => { |
| 97 | return res.text(); |
| 98 | }) |
| 99 | .then((topicHtml) => { |
| 100 | // It's full HTML with page body, head etc. |
| 101 | // We only need the inner HTML of the #main-content |
| 102 | const node = new DOMParser().parseFromString(topicHtml, 'text/html'); |
| 103 | |
| 104 | return node.getElementById('main-content'); |
| 105 | }); |
| 106 | } |
| 107 | |
| 108 | handleTopicClick(e) { |
| 109 | const { roadmapId, topicId } = e.detail; |