display only style name in the editor tab title

"Edit Style" was redundant and made the title unreadable when many tabs were opened.
"Add Style" is still displayed for the new styles.
This commit is contained in:
tophf 2018-08-07 19:56:24 +03:00
parent 1b7c131c37
commit eff0a7030c
2 changed files with 3 additions and 4 deletions

View File

@ -406,11 +406,10 @@ function validate() {
} }
function updateTitle() { function updateTitle() {
const DIRTY_TITLE = '* $';
const name = $('#name').savedValue; const name = $('#name').savedValue;
const clean = isCleanGlobal(); const clean = isCleanGlobal();
const title = styleId === null ? t('addStyleTitle') : t('editStyleTitle', [name]); const title = styleId === null ? t('addStyleTitle') : name;
document.title = clean ? title : DIRTY_TITLE.replace('$', title); document.title = (clean ? '' : '* ') + title;
window.onbeforeunload = clean ? null : beforeUnload; window.onbeforeunload = clean ? null : beforeUnload;
$('#save-button').disabled = clean; $('#save-button').disabled = clean;
} }

View File

@ -149,7 +149,7 @@ function createSourceEditor(style) {
function updateTitle() { function updateTitle() {
const newTitle = (dirty.isDirty() ? '* ' : '') + const newTitle = (dirty.isDirty() ? '* ' : '') +
(style.id ? t('editStyleTitle', [style.name]) : t('addStyleTitle')); (style.id ? style.name : t('addStyleTitle'));
if (document.title !== newTitle) { if (document.title !== newTitle) {
document.title = newTitle; document.title = newTitle;
} }