INNER CODE UNIT · JavaScript
defaults
obgnail/typora_plugin · plugin/abc/index.js:9
const defaults = (prop, fallback) => Object.hasOwn(this.config.RENDER_OPTIONS, prop) ? this.config.RENDER_OPTIONS[prop] : fallback
const parser = this.utils.thirdPartyDiagramParser
parser.register({
lang: this.config.LANGUAGE,
mappingLang: "javascript",
destroyWhenUpdate: false,
interactiveMode: this.config.INTERACTIVE_MODE,
metaConfigSchema: {
...parser.helpers.styleMetaConfigSchema.wrapDefaultStyle({
height: this.config.DEFAULT_FENCE_HEIGHT,
backgroundColor: this.config.DEFAULT_FENCE_BACKGROUND_COLOR,
}),
scale: { type: "number", default: defaults("scale", 1.0) },
staffwidth: { type: "number", default: defaults("staffwidth", 400) },
responsive: { type: "string", default: defaults("responsive", "resize") },
selectionColor: { type: "string", default: defaults("selectionColor", "#FF0000") },
},
checkSelector: ".plugin-notation-content",