From d975bb9cc00543229515e58bfc87b9862775dc47 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 28 Feb 2018 13:16:30 +0100 Subject: [PATCH 01/11] Fix focus after pad creation screen --- www/code/inner.js | 2 ++ www/pad/inner.js | 22 +++++++++++++++++----- www/slide/inner.js | 2 ++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/www/code/inner.js b/www/code/inner.js index 091baa0e8..d7a9b25e4 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -327,6 +327,8 @@ define([ framework.setTitleRecommender(CodeMirror.getHeadingText); framework.onReady(function (newPad) { + editor.focus(); + if (newPad && !CodeMirror.highlightMode) { CodeMirror.setMode('gfm', evModeChange.fire); //console.log("%s => %s", CodeMirror.highlightMode, CodeMirror.$language.val()); diff --git a/www/pad/inner.js b/www/pad/inner.js index c1a2adbf2..5ca7c24f6 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -437,6 +437,8 @@ define([ } framework.onReady(function (newPad) { + editor.focus(); + if (!module.isMaximized) { module.isMaximized = true; $('iframe.cke_wysiwyg_frame').css('width', ''); @@ -444,7 +446,6 @@ define([ } $('body').addClass('app-pad'); - editor.focus(); if (newPad) { cursor.setToEnd(); } else if (framework.isReadOnly()) { @@ -474,9 +475,18 @@ define([ $iframe.find('html').addClass('cke_body_width'); } }); + /*setTimeout(function () { + $('iframe.cke_wysiwyg_frame').focus(); + editor.focus(); + console.log(editor); + console.log(editor.focusManager); + $(window).trigger('resize'); + });*/ }); - framework.onDefaultContentNeeded(function () { }); + framework.onDefaultContentNeeded(function () { + inner.innerHTML = '

'; + }); var importMediaTags = function (dom, cb) { var $dom = $(dom); @@ -616,9 +626,11 @@ define([ var backColor = AppConfig.appBackgroundColor; var newCss = '.cke_body_width { background: '+ backColor +'; height: 100%; }' + '.cke_body_width body {' + - 'max-width: 50em; padding: 10px 30px; margin: 0 auto; min-height: 100%;'+ - 'box-sizing: border-box;'+ - '}'; + 'max-width: 50em; padding: 20px 30px; margin: 0 auto; min-height: 100%;'+ + 'box-sizing: border-box; overflow: auto;'+ + '}' + + 'html.cke_body_width { overflow: hidden; }' + + '.cke_body_width body > *:first-child { margin-top: 0; }'; Ckeditor.addCss(newCss); Ckeditor.plugins.addExternal('mediatag','/pad/', 'mediatag-plugin.js'); module.ckeditor = editor = Ckeditor.replace('editor1', { diff --git a/www/slide/inner.js b/www/slide/inner.js index b41496024..6ef545dff 100644 --- a/www/slide/inner.js +++ b/www/slide/inner.js @@ -502,6 +502,8 @@ define([ }); framework.onReady(function (/*newPad*/) { + editor.focus(); + CodeMirror.setMode('markdown', function () { }); Slide.onChange(function (o, n, l) { var slideNumber = ''; From dbe8ab014d7c7b6f9f48246f8fc2cde24cb0fe8e Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 28 Feb 2018 16:34:55 +0100 Subject: [PATCH 02/11] Select all in drive --- www/drive/inner.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/www/drive/inner.js b/www/drive/inner.js index cbeb0b08f..26f504797 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -548,6 +548,13 @@ define([ return; } + // Ctrl+A select all + if (e.which === 65 && e.ctrlKey) { + $content.find('.cp-app-drive-element:not(.cp-app-drive-element-selected)') + .addClass('cp-app-drive-element-selected'); + return; + } + // [Left, Up, Right, Down] if ([37, 38, 39, 40].indexOf(e.which) === -1) { return; } e.preventDefault(); @@ -2908,6 +2915,7 @@ define([ } // else move to trash moveElements(paths, [TRASH], false, refresh); + return; } }); var isCharacterKey = function (e) { From a4a6385e86e97ada55ffb7983c7eef419258ccbd Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 28 Feb 2018 16:38:28 +0100 Subject: [PATCH 03/11] Add keyboard shortcuts for the Ctrl+E or Cmd+E modal --- customize.dist/src/less2/include/icons.less | 4 ++ customize.dist/src/less2/include/toolbar.less | 1 + customize.dist/translations/messages.fr.js | 3 +- customize.dist/translations/messages.js | 3 +- www/common/common-ui-elements.js | 51 ++++++++++++++++--- www/common/toolbar3.js | 28 +++++----- 6 files changed, 66 insertions(+), 24 deletions(-) diff --git a/customize.dist/src/less2/include/icons.less b/customize.dist/src/less2/include/icons.less index a79bc25f5..03a6af5ab 100644 --- a/customize.dist/src/less2/include/icons.less +++ b/customize.dist/src/less2/include/icons.less @@ -25,6 +25,10 @@ text-overflow: ellipsis; word-wrap: break-word; } + &.cp-icons-element-selected { + background-color: white; + color: #666; + } .fa { display: block; font-size: 64px; diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index a070c8af6..6f49250f4 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -208,6 +208,7 @@ width: auto; margin: 0; padding: 0; + outline: none; } label[for="cp-app-toolbar-creation-advanced"] { margin: 0; diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 08b974821..1a22c70ab 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -864,7 +864,8 @@ define(function () { out.creation_expiration = "Date d'expiration"; out.creation_propertiesTitle = "Disponibilité"; out.creation_appMenuName = "Mode avancé (Ctrl + E)"; - out.creation_newPadModalDescription = "Cliquez sur un type de pad pour le créer. Vous pouvez cocher la case pour afficher l'écran de création de pads"; + out.creation_newPadModalDescription = "Cliquez sur un type de pad pour le créer. Vous pouvez aussi appuyer sur Tab pour sélectionner un type et appuyer sur Entrée pour valider."; + out.creation_newPadModalDescriptionAdvanced = "Cochez la case si vous souhaitez voir l'écran de création de pads (pour les pads possédés ou à date d'expiration). Vous pouvez appuyer sur Espace pour changer sa valeur."; out.creation_newPadModalAdvanced = "Afficher l'écran de création de pads"; // New share modal diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 1e15eac1c..da9cad5e7 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -902,7 +902,8 @@ define(function () { out.creation_expiration = "Expiration time"; out.creation_propertiesTitle = "Availability"; out.creation_appMenuName = "Advanced mode (Ctrl + E)"; - out.creation_newPadModalDescription = "Click on a pad type to create it. You can check the box if you want to display the pad creation screen (for owned pads, expiring pads, etc.)."; + out.creation_newPadModalDescription = "Click on a pad type to create it. You can also press Tab to select the type and press Enter to confirm."; + out.creation_newPadModalDescriptionAdvanced = "You can check the box (or press Space to change its value) if you want to display the pad creation screen (for owned pads, expiring pads, etc.)."; out.creation_newPadModalAdvanced = "Display the pad creation screen"; // New share modal diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 502f18bea..5c0d3a2c0 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1528,6 +1528,7 @@ define([ if (!$blockContainer.length) { $blockContainer = $('
', { 'class': 'cp-modal-container', + tabindex: 1, 'id': cfg.id }); } @@ -1559,14 +1560,16 @@ define([ $body: $('body') }); var $title = $('

').text(Messages.fm_newFile); - var $description = $('

').text(Messages.creation_newPadModalDescription); + var $description = $('

').html(Messages.creation_newPadModalDescription); $modal.find('.cp-modal').append($title); $modal.find('.cp-modal').append($description); var $advanced; var $advancedContainer = $('

'); - if (common.isLoggedIn()) { + var priv = common.getMetadataMgr().getPrivateData(); + var c = (priv.settings.general && priv.settings.general.creation) || {}; + if (AppConfig.displayCreationScreen && common.isLoggedIn() && c.skip) { $advanced = $('', { type: 'checkbox', checked: 'checked', @@ -1575,9 +1578,12 @@ define([ $('