mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
feat(mermaid): disable line wrapping by default
This commit is contained in:
parent
acf6d9dc4f
commit
91dca2df35
34
src/public/app/types.d.ts
vendored
34
src/public/app/types.d.ts
vendored
@ -186,20 +186,28 @@ declare global {
|
|||||||
attach(editor: TextEditor);
|
attach(editor: TextEditor);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface CodeMirrorOpts {
|
||||||
|
value: string;
|
||||||
|
viewportMargin: number;
|
||||||
|
indentUnit: number;
|
||||||
|
matchBrackets: boolean;
|
||||||
|
matchTags: { bothTags: boolean };
|
||||||
|
highlightSelectionMatches: {
|
||||||
|
showToken: boolean;
|
||||||
|
annotateScrollbar: boolean;
|
||||||
|
};
|
||||||
|
lineNumbers: boolean;
|
||||||
|
lineWrapping: boolean;
|
||||||
|
keyMap: "vim" | "default";
|
||||||
|
lint: boolean;
|
||||||
|
gutters: string[];
|
||||||
|
tabindex: number;
|
||||||
|
dragDrop: boolean;
|
||||||
|
placeholder: string;
|
||||||
|
}
|
||||||
|
|
||||||
var CodeMirror: {
|
var CodeMirror: {
|
||||||
(el: HTMLElement, opts: {
|
(el: HTMLElement, opts: CodeMirrorOpts): CodeMirrorInstance;
|
||||||
value: string;
|
|
||||||
viewportMargin: number;
|
|
||||||
indentUnit: number;
|
|
||||||
matchBrackets: boolean;
|
|
||||||
matchTags: { bothTags: boolean };
|
|
||||||
highlightSelectionMatches: {
|
|
||||||
showToken: boolean;
|
|
||||||
annotateScrollbar: boolean;
|
|
||||||
};
|
|
||||||
lineNumbers: boolean;
|
|
||||||
lineWrapping: boolean;
|
|
||||||
}): CodeMirrorInstance;
|
|
||||||
keyMap: {
|
keyMap: {
|
||||||
default: Record<string, string>;
|
default: Record<string, string>;
|
||||||
};
|
};
|
||||||
|
@ -64,7 +64,7 @@ export default class AbstractCodeTypeWidget extends TypeWidget {
|
|||||||
*
|
*
|
||||||
* @returns the extra options to be passed to the CodeMirror constructor.
|
* @returns the extra options to be passed to the CodeMirror constructor.
|
||||||
*/
|
*/
|
||||||
getExtraOpts() {
|
getExtraOpts(): Partial<CodeMirrorOpts> {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,6 +92,7 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget {
|
|||||||
super();
|
super();
|
||||||
this.editorTypeWidget = new EditableCodeTypeWidget();
|
this.editorTypeWidget = new EditableCodeTypeWidget();
|
||||||
this.editorTypeWidget.isEnabled = () => true;
|
this.editorTypeWidget.isEnabled = () => true;
|
||||||
|
this.editorTypeWidget.getExtraOpts = this.buildEditorExtraOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
doRender(): void {
|
doRender(): void {
|
||||||
@ -139,13 +140,20 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Called upon when the split between the preview and content pane is initialized. Can be used to add additional listeners if needed.
|
* Called upon when the split between the preview and content pane is initialized. Can be used to add additional listeners if needed.
|
||||||
*
|
|
||||||
* @returns the additional split options.
|
|
||||||
*/
|
*/
|
||||||
buildSplitExtraOptions(): Split.Options {
|
buildSplitExtraOptions(): Split.Options {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called upon when the code editor is being initialized. Can be used to add additional options to the editor.
|
||||||
|
*/
|
||||||
|
buildEditorExtraOptions(): Partial<CodeMirrorOpts> {
|
||||||
|
return {
|
||||||
|
lineWrapping: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
setError(message: string | null | undefined) {
|
setError(message: string | null | undefined) {
|
||||||
this.$errorContainer.toggleClass("hidden-ext", !message);
|
this.$errorContainer.toggleClass("hidden-ext", !message);
|
||||||
this.$preview.toggleClass("on-error", !!message);
|
this.$preview.toggleClass("on-error", !!message);
|
||||||
|
@ -38,7 +38,7 @@ export default class EditableCodeTypeWidget extends AbstractCodeTypeWidget {
|
|||||||
super.doRender();
|
super.doRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
getExtraOpts() {
|
getExtraOpts(): Partial<CodeMirrorOpts> {
|
||||||
return {
|
return {
|
||||||
keyMap: options.is("vimKeymapEnabled") ? "vim" : "default",
|
keyMap: options.is("vimKeymapEnabled") ? "vim" : "default",
|
||||||
lint: true,
|
lint: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user