mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 07:08:08 +02:00
Add support for firefox integrated find.
This commit is contained in:
parent
ca666e9914
commit
95b1f74a30
3 changed files with 105 additions and 16 deletions
|
@ -117,11 +117,9 @@ limitations under the License.
|
|||
<span data-l10n-id="toggle_slider_label">Toggle Sidebar</span>
|
||||
</button>
|
||||
<div class="toolbarButtonSpacer"></div>
|
||||
<!--#if !MOZCENTRAL-->
|
||||
<button id="viewFind" class="toolbarButton group" title="Find in Document" tabindex="4" data-l10n-id="find">
|
||||
<span data-l10n-id="find_label">Find</span>
|
||||
</button>
|
||||
<!--#endif-->
|
||||
<div class="splitToolbarButton">
|
||||
<button class="toolbarButton pageUp" title="Previous Page" id="previous" tabindex="5" data-l10n-id="previous">
|
||||
<span data-l10n-id="previous_label">Previous</span>
|
||||
|
|
|
@ -466,7 +466,11 @@ var PDFFindController = {
|
|||
},
|
||||
|
||||
updateUIState: function(state, previous) {
|
||||
// TODO: Update the firefox find bar or update the html findbar.
|
||||
if (PDFView.supportsIntegratedFind) {
|
||||
FirefoxCom.request('updateFindControlState',
|
||||
{result: state, findPrevious: previous});
|
||||
return;
|
||||
}
|
||||
PDFFindBar.updateUIState(state, previous);
|
||||
}
|
||||
};
|
||||
|
@ -783,6 +787,19 @@ var PDFView = {
|
|||
return support;
|
||||
},
|
||||
|
||||
get supportsIntegratedFind() {
|
||||
var support = false;
|
||||
//#if !(FIREFOX || MOZCENTRAL)
|
||||
//#else
|
||||
// support = FirefoxCom.requestSync('supportsIntegratedFind');
|
||||
//#endif
|
||||
Object.defineProperty(this, 'supportsIntegratedFind', { value: support,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: false });
|
||||
return support;
|
||||
},
|
||||
|
||||
initPassiveLoading: function pdfViewInitPassiveLoading() {
|
||||
if (!PDFView.loadingBar) {
|
||||
PDFView.loadingBar = new ProgressBar('#loadingBar', {});
|
||||
|
@ -2508,13 +2525,6 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
|
|||
PDFBug.init();
|
||||
}
|
||||
|
||||
//#if !(FIREFOX || MOZCENTRAL)
|
||||
//#else
|
||||
//if (FirefoxCom.requestSync('findEnabled')) {
|
||||
// document.querySelector('#viewFind').classList.remove('hidden');
|
||||
//}
|
||||
//#endif
|
||||
|
||||
if (!PDFView.supportsPrinting) {
|
||||
document.getElementById('print').classList.add('hidden');
|
||||
}
|
||||
|
@ -2523,6 +2533,10 @@ document.addEventListener('DOMContentLoaded', function webViewerLoad(evt) {
|
|||
document.getElementById('fullscreen').classList.add('hidden');
|
||||
}
|
||||
|
||||
if (PDFView.supportsIntegratedFind) {
|
||||
document.querySelector('#viewFind').classList.add('hidden');
|
||||
}
|
||||
|
||||
// Listen for warnings to trigger the fallback UI. Errors should be caught
|
||||
// and call PDFView.error() so we don't need to listen for those.
|
||||
PDFJS.LogManager.addLogger({
|
||||
|
@ -2818,12 +2832,12 @@ window.addEventListener('keydown', function keydown(evt) {
|
|||
// control is selected or not.
|
||||
if (cmd == 1 || cmd == 8) { // either CTRL or META key.
|
||||
switch (evt.keyCode) {
|
||||
//#if !MOZCENTRAL
|
||||
case 70:
|
||||
PDFFindBar.toggle();
|
||||
handled = true;
|
||||
if (!PDFView.supportsIntegratedFind) {
|
||||
PDFFindBar.toggle();
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
//#endif
|
||||
case 61: // FF/Mac '='
|
||||
case 107: // FF '+' and '='
|
||||
case 187: // Chrome '+'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue