(core) Populate doc title, description and thumbnail in app.html

Summary:
Fills in the title and description/thumbnail (for templates) in app.html if the
page being requested is for a document.

Test Plan: Tested manually.

Reviewers: paulfitz

Reviewed By: paulfitz

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3544
This commit is contained in:
George Gevoian
2022-07-27 13:20:14 -07:00
parent 7078922a65
commit c54dde3dba
6 changed files with 106 additions and 6 deletions

View File

@@ -128,6 +128,10 @@ function pagePanelsDoc(owner: IDisposableOwner, appModel: AppModel, appObj: App)
// Set document title to strings like "DocName - Grist"
owner.autoDispose(subscribe(pageModel.currentDocTitle, (use, docName) => {
// If the document hasn't loaded yet, don't update the title; since the HTML document already has
// a title element with the document's name, there's no need for further action.
if (!pageModel.currentDoc.get()) { return; }
document.title = `${docName}${getPageTitleSuffix(getGristConfig())}`;
}));