diff --git a/customize.dist/src/toolbar.less b/customize.dist/src/toolbar.less index 17e25c232..9832fc0a9 100644 --- a/customize.dist/src/toolbar.less +++ b/customize.dist/src/toolbar.less @@ -105,6 +105,34 @@ } } +.cryptpad-toolbar-top { + display: block; + text-align: center; + .cryptpad-title { + text-align: center; + input { + border: 1px solid black; + background: #fff; + cursor: auto; + width: 300px; + padding: 5px; + -webkit-touch-callout: text; + -webkit-user-select: text; + -khtml-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + &:focus { + -webkit-touch-callout: text; + -webkit-user-select: text; + -khtml-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + } + } + } +} .cryptpad-toolbar-leftside { float: left; margin-bottom: -1px; diff --git a/customize.dist/toolbar.css b/customize.dist/toolbar.css index 930a17eaf..9cbde4f5d 100644 --- a/customize.dist/toolbar.css +++ b/customize.dist/toolbar.css @@ -101,6 +101,34 @@ border: 1px solid #A6A6A6; border-bottom-color: #979797; } +.cryptpad-toolbar-top { + display: block; + text-align: center; +} +.cryptpad-toolbar-top .cryptpad-title { + text-align: center; +} +.cryptpad-toolbar-top .cryptpad-title input { + border: 1px solid black; + background: #fff; + cursor: auto; + width: 300px; + padding: 5px; + -webkit-touch-callout: text; + -webkit-user-select: text; + -khtml-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} +.cryptpad-toolbar-top .cryptpad-title input:focus { + -webkit-touch-callout: text; + -webkit-user-select: text; + -khtml-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} .cryptpad-toolbar-leftside { float: left; margin-bottom: -1px; diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index b512ab54b..b6d5f1588 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -619,6 +619,32 @@ define([ /* * Buttons */ + var renamePad = common.renamePad = function (title, callback) { + if (title === null) { return; } + + common.causesNamingConflict(title, function (err, conflicts) { + if (err) { + console.log("Unable to determine if name caused a conflict"); + console.error(err); + callback(err, title); + return; + } + + if (conflicts) { + common.alert(Messages.renameConflict); + return; + } + + common.setPadTitle(title, function (err, data) { + if (err) { + console.log("unable to set pad title"); + console.log(err); + return; + } + callback(null, title); + }); + }); + }; var createButton = common.createButton = function (type, rightside, data, callback) { var button; var size = "17px"; @@ -657,33 +683,9 @@ define([ button.click(function() { var suggestion = suggestName(); - common.prompt(Messages.renamePrompt, - suggestion, function (title, ev) { - if (title === null) { return; } - - common.causesNamingConflict(title, function (err, conflicts) { - if (err) { - console.log("Unable to determine if name caused a conflict"); - console.error(err); - callback(err, title); - return; - } - - if (conflicts) { - common.alert(Messages.renameConflict); - return; - } - - common.setPadTitle(title, function (err, data) { - if (err) { - console.log("unable to set pad title"); - console.log(err); - return; - } - callback(null, title); - }); - }); - }); + common.prompt(Messages.renamePrompt, suggestion, function (title, ev) { + renamePad(title, callback); + }); }); } break; diff --git a/www/common/toolbar.js b/www/common/toolbar.js index 943e27df5..bd58f324a 100644 --- a/www/common/toolbar.js +++ b/www/common/toolbar.js @@ -17,6 +17,7 @@ define([ /** The toolbar class which contains the user list, debug link and lag. */ var TOOLBAR_CLS = Bar.constants.toolbar = 'cryptpad-toolbar'; + var TOP_CLS = Bar.constants.top = 'cryptpad-toolbar-top'; var LEFTSIDE_CLS = Bar.constants.leftside = 'cryptpad-toolbar-leftside'; var RIGHTSIDE_CLS = Bar.constants.rightside = 'cryptpad-toolbar-rightside'; @@ -34,6 +35,7 @@ define([ var VIEWSHARE_CLS = Bar.constants.viewShare = "cryptpad-dropdown-viewShare"; var DROPDOWN_CONTAINER_CLS = Bar.constants.dropdownContainer = "cryptpad-dropdown-container"; var DROPDOWN_CLS = Bar.constants.dropdown = "cryptpad-dropdown"; + var TITLE_CLS = Bar.constants.title = "cryptpad-title"; /** Key in the localStore which indicates realtime activity should be disallowed. */ // TODO remove? will never be used in cryptpad @@ -67,6 +69,7 @@ define([ 'class': TOOLBAR_CLS, id: uid(), }) + .append($('