Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions cdn/dev/js/kbd-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,9 @@ function loaded(){
link.css('margin-top',diff);
}

(function(){
function loadKeymanWebKeyboard(keyboardName) {
// Insert keyboard into osk div

var url = location.pathname.split('/');
var keyboardName = url[url.length-3]; //, keyboardVersion = url[url.length-2];

// Ensure that the Web engine itself fetches the cloud metadata about the keyboard
// so that the OSK knows about the fonts.
keyman.addKeyboards(keyboardName).then(function () {
Expand Down Expand Up @@ -153,10 +150,16 @@ function loaded(){
addKeyboards('#osk', 'desktop');
addKeyboards('#osk-phone', 'phone');
addKeyboards('#osk-tablet', 'tablet');
}).catch(function(e) {
console.error(e);
});
//var keyboardPath = keyman.util.getOption('keyboards') + keyboardName + '/' + keyboardVersion + '/' + keyboardName + '-' + keyboardVersion + '.js';
}

(function() {
var fontFamily = null, fontSource = null;
var url = location.pathname.split('/');
var keyboardName = url[url.length-3]; //, keyboardVersion = url[url.length-2];

// This retrieves font info from latest version of keyboard; we don't currently have that available for earlier versions. No worries.
// TODO: this would be better integrated into using KeymanWeb to retrieve this information directly. However, it will do for now.
Expand All @@ -175,12 +178,17 @@ function loaded(){
}

// Even with KMW loading the fonts for itself, we wish for them to be available on all page elements,
// not just in Web's OSK.
// not just in Web's OSK.
// TODO: consider using the retrieved stub to get that in future
$.ajax({
url: 'https://api.keyman.com/keyboard/' + keyboardName,
success:function(data) {
if(typeof data != 'object') return;

if(data.platformSupport?.desktopWeb || data.platformSupport?.mobileWeb) {
loadKeymanWebKeyboard(keyboardName);
}
Comment on lines +188 to +190
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the test for a keyboard supporting web has been added, so this call now happens before the KeymanWeb call.


for(var lang in data.languages) {
if(data.languages[lang].font) {
// pick the first font
Expand Down
Loading