Examples: Syntax highlighting for React (#1583)
* Docs: Syntax highlighting - add react example * Docs: Clean up syntax highlighting demo, make use of functional component * fix: focus view asynchronously, fix #1520 Co-authored-by: Sven Adlung <info@svenadlung.de> Co-authored-by: Philipp Kühn <kontakt@philipp-kuehn.com>
This commit is contained in:
@@ -73,7 +73,13 @@ export const focus: RawCommands['focus'] = (position = null) => ({
|
||||
tr.setStoredMarks(storedMarks)
|
||||
}
|
||||
|
||||
view.focus()
|
||||
// focus async because in some situations weird things happen
|
||||
// see: https://github.com/ueberdosis/tiptap/issues/1520
|
||||
setTimeout(() => {
|
||||
if (!editor.isDestroyed) {
|
||||
view.focus()
|
||||
}
|
||||
}, 0)
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user