Fix wrong pad title in drive

pull/1/head
yflory 7 years ago
parent 1775638d00
commit 921e6eb3c3

@ -64,7 +64,9 @@ define(['json.sortify'], function (Sortify) {
if (metadataObj.title !== rememberedTitle) { if (metadataObj.title !== rememberedTitle) {
rememberedTitle = metadataObj.title; rememberedTitle = metadataObj.title;
titleChangeHandlers.forEach(function (f) { f(metadataObj.title); }); titleChangeHandlers.forEach(function (f) {
f(metadataObj.title, metadataObj.defaultTitle);
});
} }
changeHandlers.forEach(function (f) { f(); }); changeHandlers.forEach(function (f) { f(); });

@ -312,7 +312,8 @@ define([
var title = currentTabTitle.replace(/\{title\}/g, currentTitle || 'CryptPad'); var title = currentTabTitle.replace(/\{title\}/g, currentTitle || 'CryptPad');
document.title = title; document.title = title;
}; };
sframeChan.on('Q_SET_PAD_TITLE_IN_DRIVE', function (newTitle, cb) { sframeChan.on('Q_SET_PAD_TITLE_IN_DRIVE', function (newData, cb) {
var newTitle = newData.title || newData.defaultTitle;
currentTitle = newTitle; currentTitle = newTitle;
setDocumentTitle(); setDocumentTitle();
var data = { var data = {

@ -59,8 +59,11 @@ define([
exp.defaultTitle = md.defaultTitle; exp.defaultTitle = md.defaultTitle;
exp.title = md.title; exp.title = md.title;
}); });
metadataMgr.onTitleChange(function (title) { metadataMgr.onTitleChange(function (title, defaultTitle) {
sframeChan.query('Q_SET_PAD_TITLE_IN_DRIVE', title, function (err) { sframeChan.query('Q_SET_PAD_TITLE_IN_DRIVE', {
title: title,
defaultTitle: defaultTitle
}, function (err) {
if (err === 'E_OVER_LIMIT') { if (err === 'E_OVER_LIMIT') {
return void UI.alert(Messages.pinLimitNotPinned, null, true); return void UI.alert(Messages.pinLimitNotPinned, null, true);
} else if (err) { return; } } else if (err) { return; }

Loading…
Cancel
Save