mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Update loading dictionaries
This commit is contained in:
@ -79,18 +79,19 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var src_size = 4 * src.length + 1;
|
||||
var dict = new Uint8ClampedArray(src);
|
||||
var dict_size = dict.length;
|
||||
var lang_size = 4 * lang.length + 1;
|
||||
|
||||
var _src = hyphenAllocateMemory(src_size);
|
||||
var _dict = hyphenAllocateMemory(dict_size);
|
||||
var _lang = hyphenAllocateMemory(lang_size);
|
||||
|
||||
Module.stringToUTF8(src, _src, src_size);
|
||||
hyphenSetMemory(dict, _dict);
|
||||
Module.stringToUTF8(lang, _lang, lang_size);
|
||||
|
||||
Module._hyphenLoadDictionary(app, _src, _lang);
|
||||
Module._hyphenLoadDictionary(app, _dict, _lang);
|
||||
|
||||
hyphenFreeMemory(_src);
|
||||
hyphenFreeMemory(_dict);
|
||||
hyphenFreeMemory(_lang);
|
||||
}
|
||||
|
||||
|
||||
@ -23,11 +23,19 @@
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
var path = '../../../../../../dictionaries/' + lang + '/' + 'hyph_' + lang + '.dic';
|
||||
|
||||
request.responseType = 'arraybuffer';
|
||||
|
||||
if (request.overrideMimeType) {
|
||||
request.overrideMimeType('text/plain; charset=x-user-defined');
|
||||
} else {
|
||||
request.setRequestHeader('Accept-Charset', 'x-user-defined');
|
||||
}
|
||||
request.open('GET', path, true);
|
||||
request.send(null);
|
||||
|
||||
request.onload = function () {
|
||||
var dict = request.responseText;
|
||||
var dict = request.response;
|
||||
window.hyphen.hyphenLoadDictionary(application, dict, lang);
|
||||
|
||||
for(var i = 0; i < text.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user