Add the title in the toolbar

This commit is contained in:
Yann Flory
2016-10-21 18:16:27 +02:00
parent 5d9b81ab2f
commit 10bb5e1607
5 changed files with 131 additions and 41 deletions

View File

@@ -85,11 +85,12 @@ define([
});
editor.on('instanceReady', function (Ckeditor) {
var $bar = $('#pad-iframe')[0].contentWindow.$('#cke_1_toolbox');
if (readOnly) {
$('#pad-iframe')[0].contentWindow.$('#cke_1_toolbox > .cke_toolbar').hide();
}
/* add a class to the magicline plugin so we can pick it out more easily */
var ml = $('iframe')[0].contentWindow.CKEDITOR.instances.editor1.plugins.magicline
@@ -402,6 +403,7 @@ define([
document.title = oldTitle;
return;
}
$bar.find('.' + Toolbar.constants.title).find('span').text(newTitle);
});
};
@@ -512,13 +514,19 @@ define([
realtimeOptions.onLocal();
};
var renameCb = function (err, title) {
if (err) { return; }
document.title = title;
editor.fire('change');
};
var onInit = realtimeOptions.onInit = function (info) {
var $bar = $('#pad-iframe')[0].contentWindow.$('#cke_1_toolbox');
toolbarList = info.userList;
var config = {
userData: userList,
readOnly: readOnly,
ifrw: ifrw
ifrw: ifrw,
onRename: renameCb
};
if (readOnly) {delete config.changeNameID; }
toolbar = info.realtime.toolbar = Toolbar.create($bar, info.myID, info.realtime, info.getLag, info.userList, config);
@@ -554,11 +562,6 @@ define([
$rightside.append($import);
/* add a rename button */
var renameCb = function (err, title) {
if (err) { return; }
document.title = title;
editor.fire('change');
};
var $setTitle = Cryptpad.createButton('rename', true, {suggestName: suggestName}, renameCb);
$rightside.append($setTitle);
}
@@ -593,13 +596,8 @@ define([
console.log("Couldn't get pad title");
return;
}
updateTitle(title || info.channel.slice(0, 8));
document.title = title || info.channel.slice(0, 8);
Cryptpad.setPadTitle(title, function (err, data) {
if (err) {
console.log("Couldn't remember pad");
console.error(err);
}
});
});
};