Skip to content

Commit

Permalink
🎨 Initial force redraw, which now requests measure
Browse files Browse the repository at this point in the history
  • Loading branch information
gaelj committed Jan 7, 2024
1 parent a2f379e commit 4533445
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CodeMirror6/NodeLib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ export async function initCodeMirror(
// add a class to allow resizing of the editor
setResize(id, initialConfig.resize)

forceRedraw(id)

} catch (error) {
console.error(`Error in initializing CodeMirror`, error)
}
Expand Down Expand Up @@ -294,6 +296,10 @@ export function setMentionCompletions(id: string, mentionCompletions: Completion

export function forceRedraw(id: string) {
const view = CMInstances[id].view

view.requestMeasure()
view.update([])

const changes = view.state.changeByRange((range: SelectionRange) => {
return { range }
})
Expand Down

0 comments on commit 4533445

Please sign in to comment.