mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-21 14:30:57 -04:00
E-book viewer: Allow searching to work with hyphenation enabled, provided you are searching for whole words. Searching for partial words may still not work. For robust searching, turn off hyphenation in the viewer preferences.
29 lines
697 B
JavaScript
29 lines
697 B
JavaScript
/*
|
|
* Hyphenation
|
|
* Copyright 2008 Kovid Goyal
|
|
* License: GNU GPL v3
|
|
*/
|
|
|
|
function do_hyphenation(lang) {
|
|
Hyphenator.config(
|
|
{
|
|
'minwordlength' : 6,
|
|
// 'hyphenchar' : '|',
|
|
'displaytogglebox' : false,
|
|
'remoteloading' : false,
|
|
'doframes' : true,
|
|
'defaultlanguage' : 'en',
|
|
'storagetype' : 'session',
|
|
'onerrorhandler' : function (e) {
|
|
window.py_bridge.debug(e);
|
|
}
|
|
});
|
|
// console.log(lang);
|
|
Hyphenator.hyphenate(document.body, lang);
|
|
}
|
|
|
|
function hyphenate_text(text, lang) {
|
|
return Hyphenator.hyphenate(text, lang);
|
|
}
|
|
|