Thanks. That looks promising. I’m trying to implement something based on this example.
But my JavaScript skills are minimal.
I either get an error from Anki saying Invalid HTML on card: ReferenceError: keyman is not defined
or it just doesn’t work. Do you see any obvious errors below?
Here’s the code I’m trying:
{{type:Back}}
<script>
function injectScript(src) {
return new Promise((resolve, reject) => {
const script = document.createElement('script');
script.src = src;
script.addEventListener('load', resolve);
script.addEventListener('error', e => reject(e.error));
document.head.appendChild(script);
});
}
injectScript('https://s.keyman.com/kmw/engine/13.0.108/keymanweb.js');
injectScript('https://s.keyman.com/kmw/engine/13.0.108/kmwuitoggle.js');
(function(kmw) {
kmw.init({attachType:'auto'});
kmw.addKeyboards('@eng'); // Loads default English keyboard from Keyman Cloud (CDN)
kmw.addKeyboards('@tha'); // Loads default Thai keyboard from Keyman Cloud (CDN)
})(keyman);
</script>