forked from Acode-Foundation/Acode
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathapplySettings.js
More file actions
42 lines (37 loc) · 1.12 KB
/
applySettings.js
File metadata and controls
42 lines (37 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import actions from "../handlers/quickTools";
import appSettings from "../lib/settings";
import themes from "../theme/list";
import constants from "./constants";
import fonts from "./fonts";
export default {
beforeRender() {
//animation
appSettings.applyAnimationSetting();
//full-screen
if (appSettings.value.fullscreen) {
acode.exec("enable-fullscreen");
}
//setup vibration
app.addEventListener("click", function (e) {
const $target = e.target;
if ($target.hasAttribute("vibrate") && appSettings.value.vibrateOnTap) {
navigator.vibrate(constants.VIBRATION_TIME);
}
});
system.setInputType(appSettings.value.keyboardMode);
// Keep native context menu enabled globally; editor manager scopes disabling to CodeMirror focus.
system.setNativeContextMenuDisabled(false);
},
afterRender() {
const { value: settings } = appSettings;
if (!settings.floatingButton) {
root.classList.add("hide-floating-button");
}
actions("set-height", settings.quickTools);
fonts.setAppFont(settings.appFont);
fonts.setEditorFont(settings.editorFont);
if (!themes.applied) {
themes.apply("dark");
}
},
};