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() {
const DIRTY_TITLE = '* $';
const name = $('#name').savedValue;
const clean = isCleanGlobal();
const title = styleId === null ? t('addStyleTitle') : t('editStyleTitle', [name]);
document.title = clean ? title : DIRTY_TITLE.replace('$', title);
const title = styleId === null ? t('addStyleTitle') : name;
document.title = (clean ? '' : '* ') + title;
window.onbeforeunload = clean ? null : beforeUnload;
$('#save-button').disabled = clean;
}

View File

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