diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index b98c947f4..c03664036 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -706,7 +706,6 @@ define([ common.initialName = sessionStorage[newPadNameKey]; delete sessionStorage[newPadNameKey]; } - // Deprecated if (sessionStorage[newPadPathKey]) { common.initialPath = sessionStorage[newPadPathKey]; delete sessionStorage[newPadPathKey]; diff --git a/www/drive/main.js b/www/drive/main.js index 4c5e667bc..605eb82c8 100644 --- a/www/drive/main.js +++ b/www/drive/main.js @@ -958,16 +958,11 @@ define([ } AppConfig.availablePadTypes.forEach(function (type) { if (type === 'drive') { return; } - var path = filesOp.isPathInTrash(currentPath) ? '' : '/#?path=' + encodeURIComponent(currentPath); var attributes = { 'class': 'newdoc', - 'data-type': type + 'data-type': type, + 'href': '#' }; - // In root, do not redirect instantly, but ask for a name first. Cf handlers below - if (!isInRoot) { - attributes.href = '/' + type + path; - attributes.target = '_blank'; - } options.push({ tag: 'a', attributes: attributes, @@ -997,6 +992,12 @@ define([ var name = Cryptpad.getDefaultName({type: type}); filesOp.createNewFile(currentPath, name, type, onCreated); }); + } else { + $block.find('a.newdoc').click(function (e) { + var type = $(this).attr('data-type') || 'pad'; + sessionStorage[Cryptpad.newPadPathKey] = filesOp.isPathInTrash(currentPath) ? '' : currentPath; + window.open('/' + type + '/'); + }); } return $block;