Convert getDefaultOptions to a utility function (#1235)
This commit is contained in:
parent
c1e4741f22
commit
39741bf1d2
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
/* global
|
/* global
|
||||||
* HtmlTemplateCollection
|
* HtmlTemplateCollection
|
||||||
|
* OptionsUtil
|
||||||
* api
|
* api
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -124,6 +125,13 @@ class SettingsController extends EventDispatcher {
|
|||||||
return this._templates.instantiateFragment(name);
|
return this._templates.instantiateFragment(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getDefaultOptions() {
|
||||||
|
const optionsUtil = new OptionsUtil();
|
||||||
|
await optionsUtil.prepare();
|
||||||
|
const optionsFull = optionsUtil.getDefault();
|
||||||
|
return optionsFull;
|
||||||
|
}
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
|
|
||||||
_setProfileIndex(value) {
|
_setProfileIndex(value) {
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* global
|
|
||||||
* OptionsUtil
|
|
||||||
*/
|
|
||||||
|
|
||||||
class SentenceTerminationCharactersController {
|
class SentenceTerminationCharactersController {
|
||||||
constructor(settingsController) {
|
constructor(settingsController) {
|
||||||
this._settingsController = settingsController;
|
this._settingsController = settingsController;
|
||||||
@ -135,18 +131,11 @@ class SentenceTerminationCharactersController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _reset() {
|
async _reset() {
|
||||||
const defaultOptions = await this._getDefaultOptions();
|
const defaultOptions = await this._settingsController.getDefaultOptions();
|
||||||
const value = defaultOptions.profiles[0].options.sentenceParsing.terminationCharacters;
|
const value = defaultOptions.profiles[0].options.sentenceParsing.terminationCharacters;
|
||||||
await this._settingsController.setProfileSetting('sentenceParsing.terminationCharacters', value);
|
await this._settingsController.setProfileSetting('sentenceParsing.terminationCharacters', value);
|
||||||
await this._updateOptions();
|
await this._updateOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
async _getDefaultOptions() {
|
|
||||||
const optionsUtil = new OptionsUtil();
|
|
||||||
await optionsUtil.prepare();
|
|
||||||
const optionsFull = optionsUtil.getDefault();
|
|
||||||
return optionsFull;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SentenceTerminationCharacterEntry {
|
class SentenceTerminationCharacterEntry {
|
||||||
|
Loading…
Reference in New Issue
Block a user