mirror of
https://github.com/emklasson/obsidian-save-modified-times.git
synced 2026-07-22 06:40:27 +00:00
feat: replace height property with class
This commit is contained in:
parent
e1640553ae
commit
6fca8bb834
3 changed files with 13 additions and 5 deletions
12
dialog.ts
12
dialog.ts
|
|
@ -4,11 +4,12 @@ import {
|
|||
} from "obsidian";
|
||||
|
||||
export interface DialogField {
|
||||
class?: string; // Custom CSS class to apply. Only for textArea types for now.
|
||||
close?: boolean;
|
||||
components?: BaseComponent[];
|
||||
cta?: boolean;
|
||||
desc?: string;
|
||||
height?: string;
|
||||
// height?: string;
|
||||
key?: string;
|
||||
onClick?: (result: DialogData, dialog: Dialog) => void | Promise<void>;
|
||||
sameLine?: boolean;
|
||||
|
|
@ -74,12 +75,15 @@ export class Dialog extends Modal {
|
|||
setting.controlEl.addClass("mklasson-text-control");
|
||||
setting.setName(field);
|
||||
setting.infoEl.addClass("mklasson-text-info");
|
||||
if (type == "textArea" || props?.height || value.contains("\n")) {
|
||||
if (type == "textArea" /*|| props?.height */|| value.contains("\n")) {
|
||||
setting.addTextArea(textInitialiser);
|
||||
setting.controlEl.querySelector("textarea")?.addClass("mklasson-textarea");
|
||||
if (props?.height) {
|
||||
setting.controlEl.querySelector("textarea")?.setCssProps({"height": props.height});
|
||||
if (props?.class) {
|
||||
setting.controlEl.querySelector("textarea")?.addClass(props.class);
|
||||
}
|
||||
// if (props?.height) {
|
||||
// setting.controlEl.querySelector("textarea")?.setCssProps({"height": props.height});
|
||||
// }
|
||||
} else {
|
||||
setting.addText(textInitialiser);
|
||||
setting.controlEl.querySelector("input")?.addClass("mklasson-text-wide");
|
||||
|
|
|
|||
2
main.ts
2
main.ts
|
|
@ -705,7 +705,7 @@ class SettingTab extends PluginSettingTab {
|
|||
} else {
|
||||
fields[`${matches.length} matches`] = {
|
||||
type: "textArea",
|
||||
height: "20em",
|
||||
class: "mklasson-setting-matches",
|
||||
text: matches.map(file => file.path).join('\n'),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@ textarea.mklasson-textarea {
|
|||
height: 5rem;
|
||||
}
|
||||
|
||||
textarea.mklasson-setting-matches {
|
||||
height: 16rem;
|
||||
}
|
||||
|
||||
.mklasson-setting-error {
|
||||
background-color: var(--background-modifier-error) !important;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue