diff --git a/lib/tauri.js b/lib/tauri.js index 131acb117..e733154d3 100644 --- a/lib/tauri.js +++ b/lib/tauri.js @@ -11,6 +11,18 @@ * **/ +// open links with the Tauri API +document.querySelector('body').addEventListener('click', e => { + let target = e.target + while (target != null) { + if (target.matches ? target.matches('a') : target.msMatchesSelector('a')) { + tauri.open(target.href) + break + } + target = target.parentElement + } +}, true) + /** * @module tauri * @description This API interface makes powerful interactions available