Set the correct document title when opening a new file in the GENERIC
default viewer
This commit is contained in:
parent
84920f39b2
commit
3e4a159a45
11
web/app.js
11
web/app.js
@ -615,7 +615,7 @@ let PDFViewerApplication = {
|
||||
});
|
||||
},
|
||||
|
||||
setTitleUsingUrl(url) {
|
||||
setTitleUsingUrl(url = '') {
|
||||
this.url = url;
|
||||
this.baseUrl = url.split('#')[0];
|
||||
let title = getPDFFileNameFromURL(url, '');
|
||||
@ -1928,8 +1928,13 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {
|
||||
let file = evt.fileInput.files[0];
|
||||
|
||||
if (URL.createObjectURL && !AppOptions.get('disableCreateObjectURL')) {
|
||||
PDFViewerApplication.open(URL.createObjectURL(file));
|
||||
let url = URL.createObjectURL(file);
|
||||
if (file.name) {
|
||||
url = { url, originalUrl: file.name, };
|
||||
}
|
||||
PDFViewerApplication.open(url);
|
||||
} else {
|
||||
PDFViewerApplication.setTitleUsingUrl(file.name);
|
||||
// Read the local file into a Uint8Array.
|
||||
let fileReader = new FileReader();
|
||||
fileReader.onload = function webViewerChangeFileReaderOnload(evt) {
|
||||
@ -1939,8 +1944,6 @@ if (typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) {
|
||||
fileReader.readAsArrayBuffer(file);
|
||||
}
|
||||
|
||||
PDFViewerApplication.setTitleUsingUrl(file.name);
|
||||
|
||||
// URL does not reflect proper document location - hiding some icons.
|
||||
let appConfig = PDFViewerApplication.appConfig;
|
||||
appConfig.toolbar.viewBookmark.setAttribute('hidden', 'true');
|
||||
|
Loading…
x
Reference in New Issue
Block a user