Merge branch 'pad2' of github.com:xwiki-labs/cryptpad into pad2

pull/1/head
Caleb James DeLisle 7 years ago
commit ec87f3f897

@ -102,6 +102,10 @@ define([], function () {
metadataLazyObj = JSON.parse(JSON.stringify(m));
change(false);
},
updateTitle: function (t) {
metadataObj.title = t;
change(true);
},
getMetadata: function () {
checkUpdate(false);
return Object.freeze(JSON.parse(JSON.stringify(metadataObj)));

@ -12,8 +12,8 @@ define(['jquery'], function ($) {
var getHeadingText = cfg.getHeadingText || function () { return; };
var updateLocalTitle = function (newTitle) {
console.log(newTitle);
/* var updateLocalTitle = function (newTitle) {
console.error(newTitle);
exp.title = newTitle;
onLocal();
if (typeof cfg.updateLocalTitle === "function") {
@ -21,7 +21,7 @@ define(['jquery'], function ($) {
} else {
document.title = newTitle;
}
};
};*/
var $title;
exp.setToolbar = function (toolbar) {
@ -39,11 +39,11 @@ define(['jquery'], function ($) {
}
};
var renameCb = function (err, newTitle) {
/*var renameCb = function (err, newTitle) {
if (err) { return; }
updateLocalTitle(newTitle);
onLocal();
};
//updateLocalTitle(newTitle);
};*/
// update title: href is optional; if not specified, we use window.location.href
exp.updateTitle = function (newTitle, cb) {
@ -58,11 +58,10 @@ define(['jquery'], function ($) {
updateLocalTitle(oldTitle);
return void cb(err);
}
updateLocalTitle(data);
metadataMgr.updateTitle(newTitle);
//onLocal();
cb(null, data);
if (!$title) { return; }
$title.find('span.title').text(data);
$title.find('input').val(data);
});
};
@ -75,12 +74,14 @@ define(['jquery'], function ($) {
metadataMgr.onChange(function () {
var md = metadataMgr.getMetadata();
exp.updateTitle(md.title || md.defaultTitle);
$title.find('span.title').text(md.title || md.defaultTitle);
$title.find('input').val(md.title || md.defaultTitle);
//exp.updateTitle(md.title || md.defaultTitle);
});
exp.getTitleConfig = function () {
return {
onRename: renameCb,
updateTitle: exp.updateTitle,
suggestName: suggestTitle,
defaultName: exp.defaultTitle
};

@ -515,7 +515,7 @@ define([
console.error("config.title", config);
throw new Error("config.title is not an object");
}
var callback = config.title.onRename;
var updateTitle = config.title.updateTitle;
var placeholder = config.title.defaultName;
var suggestName = config.title.suggestName;
@ -568,12 +568,9 @@ define([
if (name === "") {
name = $input.attr('placeholder');
}
console.log('here');
Common.setPadTitleInDrive(name, function (err, newtitle) {
console.log('here');
updateTitle(name, function (err, newtitle) {
if (err) { return console.error(err); }
$text.text(newtitle);
callback(null, newtitle);
//$text.text(newtitle);
$input.hide();
$text.show();
$pencilIcon.show();

@ -485,6 +485,8 @@ define([
toolbar = info.realtime.toolbar = Toolbar.create(configTb);
Title.setToolbar(toolbar);
var $rightside = toolbar.$rightside;
$bar.find('#cke_1_toolbar_collapser').hide();
if (!readOnly) {
// Expand / collapse the toolbar
@ -559,7 +561,7 @@ define([
//Title.setToolbar(toolbar);
var $rightside = toolbar.$rightside;
//var $rightside = toolbar.$rightside;
var $drawer = toolbar.$drawer;
var editHash;

Loading…
Cancel
Save