diff --git a/www/common/sframe-common-interface.js b/www/common/sframe-common-interface.js index 29a852435..97ee20663 100644 --- a/www/common/sframe-common-interface.js +++ b/www/common/sframe-common-interface.js @@ -383,9 +383,18 @@ define([ var $avatar = $userAdmin.find('.cp-dropdown-button-title'); var oldUrl; + var loadingAvatar; + var to; var updateButton = function () { var myData = metadataMgr.getUserData(); if (!myData) { return; } + if (loadingAvatar) { + // Try again in 200ms + window.clearTimeout(to); + to = window.setTimeout(updateButton, 200); + return; + } + loadingAvatar = true; var newName = myData.name; var url = myData.avatar; $displayName.text(newName || Messages.anonymous); @@ -396,8 +405,11 @@ define([ if ($img) { $userAdmin.find('button').addClass('cp-avatar'); } + loadingAvatar = false; }); + return; } + loadingAvatar = false; }; metadataMgr.onChange(updateButton); updateButton(); @@ -465,12 +477,13 @@ define([ } } }; - common.initFilePicker(common, fileDialogCfg); + common.initFilePicker(fileDialogCfg); var pickerCfg = { types: [type], where: ['template'] }; - common.openFilePicker(common, pickerCfg); + console.log(pickerCfg); + common.openFilePicker(pickerCfg); }; return UI; diff --git a/www/common/sframe-protocol.js b/www/common/sframe-protocol.js index 8c76546f9..53bace770 100644 --- a/www/common/sframe-protocol.js +++ b/www/common/sframe-protocol.js @@ -17,6 +17,9 @@ define({ // When either the outside or inside registers a query handler, this is sent. 'EV_REGISTER_HANDLER': true, + // When an iframe is ready to receive messages + 'EV_RPC_READY': true, + // Realtime events called from the outside. // When someone joins the pad, argument is a string with their netflux id. 'EV_RT_JOIN': true, diff --git a/www/drive/main.js b/www/drive/main.js index b0d90b01b..0282cdfc8 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -1263,7 +1263,8 @@ define([ if (APP.mobile() && !noStyle) { // noStyle means title in search result return $container; } - var el = path[0] === SEARCH ? undefined : filesOp.find(path); + var isVirtual = virtualCategories.indexOf(path[0]) !== -1; + var el = isVirtual ? undefined : filesOp.find(path); path = path[0] === SEARCH ? path.slice(0,1) : path; path.forEach(function (p, idx) { if (isTrash && [2,3].indexOf(idx) !== -1) { return; } diff --git a/www/filepicker/inner.js b/www/filepicker/inner.js index a1b5fa9d6..a2402dd78 100644 --- a/www/filepicker/inner.js +++ b/www/filepicker/inner.js @@ -78,7 +78,7 @@ define([ }; var updateContainer; var createFileDialog = function () { - var types = filters.types; + var types = filters.types || []; // Create modal var $blockContainer = Cryptpad.createModal({ id: 'cp-filepicker-dialog', diff --git a/www/slide/inner.js b/www/slide/inner.js index 043e7018b..b822d94e6 100644 --- a/www/slide/inner.js +++ b/www/slide/inner.js @@ -608,7 +608,6 @@ define([ initializing = false; onLocal(); // push local state to avoid parse errors later. - console.log(editor.getValue()); Slide.update(editor.getValue()); Cryptpad.removeLoadingScreen(); @@ -736,9 +735,11 @@ define([ onConnectError(); } }); - common.isPresentUrl(function (err, val) { - isPresentMode = val; - andThen(editor, CodeMirror, common); + common.getSframeChannel().onReady(function () { + common.isPresentUrl(function (err, val) { + isPresentMode = val; + andThen(editor, CodeMirror, common); + }); }); }); }; diff --git a/www/slide/slide.js b/www/slide/slide.js index 7676a9279..3b75c87a7 100644 --- a/www/slide/slide.js +++ b/www/slide/slide.js @@ -239,8 +239,6 @@ define([ }); }; - $(window).resize(Slide.updateFontSize); - // Swipe var addSwipeEvents = function () { var touch = { @@ -294,6 +292,7 @@ define([ options = Slide.options = opt; addEvent(); addSwipeEvents(); + $(window).resize(Slide.updateFontSize); }; Slide.setTitle = function (titleObj) {