mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-07 01:08:49 +01:00
This commit is contained in:
parent
8c35440a77
commit
74b4a00a2f
42 changed files with 426 additions and 270 deletions
|
|
@ -5,6 +5,7 @@ import {confirmDialog} from "../dialog/confirmDialog";
|
|||
import {setPadding} from "../protyle/ui/initUI";
|
||||
import {reloadProtyle} from "../protyle/util/reload";
|
||||
import {updateHotkeyTip} from "../protyle/util/compatibility";
|
||||
import {App} from "../index";
|
||||
|
||||
export const editor = {
|
||||
element: undefined as Element,
|
||||
|
|
@ -257,7 +258,7 @@ export const editor = {
|
|||
</div>
|
||||
</label>`;
|
||||
},
|
||||
bindEvent: () => {
|
||||
bindEvent: (app: App) => {
|
||||
const fontFamilyElement = editor.element.querySelector("#fontFamily") as HTMLSelectElement;
|
||||
if (fontFamilyElement.tagName === "SELECT") {
|
||||
let fontFamilyHTML = `<option value="">${window.siyuan.languages.default}</option>`;
|
||||
|
|
@ -317,7 +318,7 @@ export const editor = {
|
|||
fontFamily: fontFamilyElement.value,
|
||||
emoji: window.siyuan.config.editor.emoji
|
||||
}, response => {
|
||||
editor.onSetEditor(response.data);
|
||||
editor.onSetEditor(response.data, app);
|
||||
});
|
||||
};
|
||||
editor.element.querySelectorAll("input.b3-switch, select.b3-select, input.b3-slider").forEach((item) => {
|
||||
|
|
@ -337,13 +338,13 @@ export const editor = {
|
|||
});
|
||||
});
|
||||
},
|
||||
onSetEditor: (editorData: IEditor) => {
|
||||
onSetEditor: (editorData: IEditor, app: App) => {
|
||||
if (editorData.readOnly !== window.siyuan.config.editor.readOnly) {
|
||||
editor.setReadonly(editorData.readOnly);
|
||||
}
|
||||
window.siyuan.config.editor = editorData;
|
||||
getAllModels().editor.forEach((item) => {
|
||||
reloadProtyle(item.editor.protyle, false);
|
||||
reloadProtyle(item.editor.protyle, app, false);
|
||||
setPadding(item.editor.protyle);
|
||||
if (window.siyuan.config.editor.fullWidth) {
|
||||
item.editor.protyle.contentElement.setAttribute("data-fullwidth", "true");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue