From f45023ed1f7cf79e350a3562a8bd957e6f6b5339 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 7 Mar 2018 16:48:49 +0100 Subject: [PATCH 1/2] Remove connection lost popup when websocket connection is lost --- customize.dist/translations/messages.fr.js | 4 ++-- customize.dist/translations/messages.js | 2 +- www/common/sframe-app-framework.js | 4 ++-- www/common/toolbar3.js | 7 +++++++ www/drive/inner.js | 2 +- www/poll/inner.js | 4 ++-- www/whiteboard/inner.js | 4 ++-- 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 76767a9a2..32f2bb8f2 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -47,7 +47,7 @@ define(function () { out.disconnected = 'Déconnecté'; out.synchronizing = 'Synchronisation'; - out.reconnecting = 'Reconnexion...'; + out.reconnecting = 'Reconnexion'; out.typing = "Édition"; out.initializing = "Initialisation..."; out.forgotten = 'Déplacé vers la corbeille'; @@ -361,7 +361,7 @@ define(function () { out.fm_templateName = "Modèles"; out.fm_searchName = "Recherche"; out.fm_recentPadsName = "Pads récents"; - out.fm_ownedPadsName = "Possédés"; + out.fm_ownedPadsName = "Pads possédés"; out.fm_searchPlaceholder = "Rechercher..."; out.fm_newButton = "Nouveau"; out.fm_newButtonTitle = "Créer un nouveau pad ou un dossier, importer un fichier dans le dossier courant"; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index a73ce596b..5daa52219 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -48,7 +48,7 @@ define(function () { out.disconnected = 'Disconnected'; out.synchronizing = 'Synchronizing'; - out.reconnecting = 'Reconnecting...'; + out.reconnecting = 'Reconnecting'; out.typing = "Editing"; out.initializing = "Initializing..."; out.forgotten = 'Moved to the trash'; diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index d5a4e7896..a095122d6 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -325,11 +325,11 @@ define([ var onConnectionChange = function (info) { if (state === STATE.DELETED) { return; } stateChange(info.state ? STATE.INITIALIZING : STATE.DISCONNECTED); - if (info.state) { + /*if (info.state) { UI.findOKButton().click(); } else { UI.alert(Messages.common_connectionLost, undefined, true); - } + }*/ }; var onError = function (err) { diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 38cb2d759..f8937d777 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -1048,6 +1048,13 @@ define([ toolbar.reconnecting = function (/*userId*/) { toolbar.connected = false; if (toolbar.spinner) { + var state = -1; + var interval = window.setInterval(function () { + if (toolbar.connected) { clearInterval(interval); } + var dots = Array(state+1).join('.'); + toolbar.spinner.text(Messages.reconnecting + dots); + if (++state > 3) { state = 0; } + }, 500); toolbar.spinner.text(Messages.reconnecting); } }; diff --git a/www/drive/inner.js b/www/drive/inner.js index 58d547b0e..9576bd9d4 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -237,7 +237,7 @@ define([ 'tabindex': '-1', 'data-icon': faFolder, }, Messages.fc_newfolder)), - h('li', h('a.cp-app-drive-context-hashtag.dropdown-item', { + h('li', h('a.cp-app-drive-context-hashtag.dropdown-item.cp-app-drive-context-editable', { 'tabindex': '-1', 'data-icon': faTags, }, Messages.fc_hashtag)), diff --git a/www/poll/inner.js b/www/poll/inner.js index a8deebbfe..577a54ff7 100644 --- a/www/poll/inner.js +++ b/www/poll/inner.js @@ -1117,13 +1117,13 @@ define([ }); } setEditable(false); - UI.alert(Messages.common_connectionLost, undefined, true); + //UI.alert(Messages.common_connectionLost, undefined, true); }; var onReconnect = function () { if (APP.unrecoverable) { return; } setEditable(true); - UI.findOKButton().click(); + //UI.findOKButton().click(); }; var getHeadingText = function () { diff --git a/www/whiteboard/inner.js b/www/whiteboard/inner.js index efa8edd87..8a4da8940 100644 --- a/www/whiteboard/inner.js +++ b/www/whiteboard/inner.js @@ -616,9 +616,9 @@ define([ setEditable(info.state); if (info.state) { initializing = true; - UI.findOKButton().click(); + //UI.findOKButton().click(); } else { - UI.alert(Messages.common_connectionLost, undefined, true); + //UI.alert(Messages.common_connectionLost, undefined, true); } }; From 7a70d69d8eedee3aebb2f026738ddd1baf7dac23 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 7 Mar 2018 17:34:55 +0100 Subject: [PATCH 2/2] Hide editor toolbars by default when using a small screen --- www/common/common-ui-elements.js | 3 +++ www/common/cursor.js | 2 +- www/common/toolbar3.js | 2 +- www/pad/inner.js | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 4c6fd1295..15e3c7b8c 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -852,6 +852,7 @@ define([ var tbState = true; common.getAttribute(['general', 'markdown-help'], function (e, data) { if (e) { return void console.error(e); } + if ($(window).height() < 800) { return; } if (data === true && $toolbarButton.length && tbState) { $toolbarButton.click(); } @@ -868,6 +869,7 @@ define([ } common.getAttribute(['general', 'markdown-help'], function (e, data) { if (e) { return void console.error(e); } + if ($(window).height() < 800) { return; } if (data === true && $toolbarButton) { // Show the toolbar using the button to make sure the icon in the button is // correct (caret-down / caret-up) @@ -923,6 +925,7 @@ define([ }); common.getAttribute(['hideHelp', type], function (err, val) { + if ($(window).height() < 800) { return void toggleHelp(true); } if (val === true) { toggleHelp(true); } }); diff --git a/www/common/cursor.js b/www/common/cursor.js index 845067a80..be4ad1e2c 100644 --- a/www/common/cursor.js +++ b/www/common/cursor.js @@ -116,7 +116,7 @@ define([ } else { var errText = "[cursor.fixSelection] At least one of the " + "cursor nodes did not exist, could not fix selection"; - console.error(errText); + //console.error(errText); return errText; } } catch (e) { console.error(e); } diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index f8937d777..0c9d3c8f3 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -400,7 +400,7 @@ define([ }); show(); Common.getAttribute(['toolbar', 'userlist-drawer'], function (err, val) { - if (val === false) { return void hide(); } + if (val === false || $(window).height() < 800) { return void hide(); } show(); }); diff --git a/www/pad/inner.js b/www/pad/inner.js index 5d161142b..cf21d199c 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -282,7 +282,7 @@ define([ framework._.sfCommon.setAttribute(['pad', 'showToolbar'], visible); }; framework._.sfCommon.getAttribute(['pad', 'showToolbar'], function (err, data) { - if (typeof(data) === "undefined" || data) { $('.cke_toolbox_main').show(); } + if ($(window).height() >= 800 && (typeof(data) === "undefined" || data)) { $('.cke_toolbox_main').show(); } else { $('.cke_toolbox_main').hide(); } var $collapse = framework._.sfCommon.createButton('toggle', true, cfg, onClick); framework._.toolbar.$rightside.append($collapse);