Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 40f10cc

Browse files
feat: just a small delay needed in case of content editable in order to not highlight all lines
1 parent 25d6804 commit 40f10cc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

webcomponents/highlight-code/src/components/highlight-code/deckdeckgo-highlight-code.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ export class DeckdeckgoHighlightCode {
179179
if (container) {
180180
try {
181181
if (this.lineNumbers) {
182-
// clear the container first
182+
// clear the container first
183183
container.children[0].innerHTML = '';
184-
184+
185185
// split the code on linebreaks
186-
const regEx = RegExp(/\n(?!$)/g); //
186+
const regEx = RegExp(/\n(?!$)/g); //
187187
const match = code.split(regEx);
188188
match.forEach(m => {
189189
let div: HTMLElement = document.createElement('div');
@@ -197,13 +197,11 @@ export class DeckdeckgoHighlightCode {
197197
container.children[0].innerHTML = Prism.highlight(code, Prism.languages[this.language], this.language);
198198
}
199199

200-
201-
202200
await this.addAnchors();
203201

204202
setTimeout(async () => {
205203
await this.addHighlight();
206-
}, 0);
204+
}, 100);
207205

208206
resolve();
209207
} catch (err) {

0 commit comments

Comments
 (0)