2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
|
var R=Object.create;var C=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var E=s=>C(s,"__esModule",{value:!0});var V=(s,t)=>{E(s);for(var e in t)C(s,e,{get:t[e],enumerable:!0})},O=(s,t,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of I(t))!N.call(s,i)&&i!=="default"&&C(s,i,{get:()=>t[i],enumerable:!(e=P(t,i))||e.enumerable});return s},x=s=>O(E(C(s!=null?R(B(s)):{},"default",s&&s.__esModule&&"default"in s?{get:()=>s.default,enumerable:!0}:{value:s,enumerable:!0})),s);var l=(s,t,e)=>new Promise((i,r)=>{var n=c=>{try{o(e.next(c))}catch(m){r(m)}},a=c=>{try{o(e.throw(c))}catch(m){r(m)}},o=c=>c.done?i(c.value):Promise.resolve(c.value).then(n,a);o((e=e.apply(s,t)).next())});V(exports,{default:()=>v});var u=x(require("obsidian"));var g=x(require("obsidian")),L=class extends g.PluginSettingTab{constructor(t,e){super(t,e);this.plugin=e}display(){let{containerEl:t}=this;t.empty(),t.createEl("h2",{text:"General Settings"}),new g.Setting(t).setName("Trim on Manual Save").setDesc("Trim the document during manual save (CTRL / CMD + S).").addToggle(e=>{e.setValue(this.plugin.settings.TrimOnSave).onChange(i=>l(this,null,function*(){this.plugin.settings.TrimOnSave=i,yield this.plugin.saveSettings(),this.plugin._toggleListenerEvent(i)}))}),new g.Setting(t).setName("Auto-Trim").setDesc("Automatically trim document when modified, according to the settings below.").addToggle(e=>{e.setValue(this.plugin.settings.AutoTrimDocument).onChange(i=>l(this,null,function*(){this.plugin.settings.AutoTrimDocument=i,yield this.plugin.saveSettings(),this.plugin._toggleListenerEvent(i)}))}),new g.Setting(t).setName("Auto-Trim Delay (seconds)").setDesc("Seconds to wait before auto-trimming.").addText(e=>{e.setValue(this.plugin.settings.AutoTrimTimeout.toString()).onChange(i=>l(this,null,function*(){let r=parseFloat(i);if(isNaN(r)){new g.Notice("Trim Whitespace: Enter a valid number!");return}this.plugin.settings.AutoTrimTimeout=r,yield this.plugin.saveSettings(),this.plugin._toggleListenerEvent(!1),this.plugin._initializeDebouncer(r),this.plugin._toggleListenerEvent(!0)}))}),new g.Setting(t).setName("Preserve Code Blocks").setDesc("Whether to preserve whitespace within code blocks.").addToggle(e=>{e.setValue(this.plugin.settings.PreserveCodeBlocks).onChange(i=>l(this,null,function*(){this.plugin.settings.PreserveCodeBlocks=i,yield this.plugin.saveSettings()}))}),t.createEl("h2",{text:"Trimming Rules"}),t.createEl("h3",{text:"Trailing Characters"}),new g.Setting(t).setName("Trim Trailing Spaces").setDesc("Trim spaces at the end of each line.").addToggle(e=>{e.setValue(this.plugin.settings.TrimTrailingSpaces).onChange(i=>l(this,null,function*(){this.plugin.settings.TrimTrailingSpaces=i,yield this.plugin.saveSettings()}))}),new g.Setting(t).setName("Trim Trailing Tabs").setDesc("Trim tabs at the end of each line.").addToggle(e=>{e.setValue(this.plugin.settings.TrimTrailingTabs).onChange(i=>l(this,null,function*(){this.plugin.settings.TrimTrailingTabs=i,yield this.plugin.saveSettings()}))}),new g.Setting(t).setName("Trim Trailing Lines").setDesc("Trim empty lines at the end of the document.").addToggle(e=>{e.setValue(this.plugin.settings.TrimTrailingLines).onChange(i=>l(this,null,function*(){this.plugin.settings.TrimTrailingLines=i,yield this.plugin.saveSettings()}))}),t.createEl("h3",{text:"Leading Characters"}),new g.Setting(t).setName("Preserve Indented Lists").setDesc("Preserve leading characters if they're used for list indentation.").addToggle(e=>{e.setValue(this.plugin.settings.PreserveIndentedLists).onChange(i=>l(this,null,function*(){this.plugin.settings.PreserveIndentedLists=i,yield this.plugin.saveSettings()}))}),new g.Setting(t).setName("Trim Leading Spaces").setDesc("Trim spaces at the start of each line.").addToggle(e=>{e.setValue(this.plugin.settings.TrimLeadingSpaces).onChange(i=>l(this,null,function*(){this.plugin.settings.TrimLeadingSpaces=i,yield this.plugin.saveSettings()}))}),new g.Setting(t).setName("Trim Leading Tabs"
|