You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
34 KiB

/*
THIS IS A GENERATED/BUNDLED FILE BY ROLLUP
if you want to view the source visit the plugins github repository
*/
'use strict';
var obsidian = require('obsidian');
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
const DEFAULT_SETTINGS = {
findText: '',
findRegexp: '',
regexpFlags: '',
replace: ''
};
class FindAndReplaceInSelection extends obsidian.Plugin {
onload() {
return __awaiter(this, void 0, void 0, function* () {
yield this.loadSettings();
this.addCommand({
id: 'find-and-replace-in-selection',
name: 'Find and replace in selection',
callback: () => this.findAndReplace()
});
this.addSettingTab(new SettingTab(this.app, this));
});
}
findAndReplace() {
let editor = this.getEditor();
if (editor) {
let selectedText = this.getSelectedText(editor);
if (this.settings.findText && this.settings.findText != "") {
selectedText = selectedText.split(this.settings.findText).join(this.settings.replace);
}
if (this.settings.findRegexp && this.settings.findRegexp != "") {
var re = new RegExp(this.settings.findRegexp, this.settings.regexpFlags);
selectedText = selectedText.replace(re, this.settings.replace);
}
editor.replaceSelection(selectedText);
}
}
getEditor() {
var _a;
return (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.sourceMode.cmEditor;
}
getSelectedText(editor) {
if (!editor.somethingSelected())
this.selectLineUnderCursor(editor);
return editor.getSelection();
}
selectLineUnderCursor(editor) {
let selection = this.getLineUnderCursor(editor);
editor.getDoc().setSelection(selection.start, selection.end);
}
getLineUnderCursor(editor) {
let fromCh, toCh;
let cursor = editor.getCursor();
fromCh = 0;
toCh = editor.getLine(cursor.line).length;
return {
start: { line: cursor.line, ch: fromCh },
end: { line: cursor.line, ch: toCh },
};
}
loadSettings() {
return __awaiter(this, void 0, void 0, function* () {
this.settings = Object.assign({}, DEFAULT_SETTINGS, yield this.loadData());
});
}
saveSettings() {
return __awaiter(this, void 0, void 0, function* () {
yield this.saveData(this.settings);
});
}
}
class SettingTab extends obsidian.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
display() {
let { containerEl } = this;
containerEl.empty();
containerEl.createEl('h2', { text: 'Find and replace in selection - Settings' });
new obsidian.Setting(containerEl)
.setName('Text to find')
.setDesc('Leave empty to ignore')
.addText(text => text
.setPlaceholder('')
.setValue(this.plugin.settings.findText)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
this.plugin.settings.findText = value;
yield this.plugin.saveSettings();
})));
new obsidian.Setting(containerEl)
.setName('RegExp to find')
.setDesc('Leave empty to ignore')
.addText(text => text
.setPlaceholder('Example: (\w+)\s(\w+)')
.setValue(this.plugin.settings.findRegexp)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
this.plugin.settings.findRegexp = value;
yield this.plugin.saveSettings();
})));
new obsidian.Setting(containerEl)
.setName('RegExp flags')
.setDesc('Type "gmi" for global, multiline, insensitive')
.addText(text => text
.setPlaceholder('Example: gmi')
.setValue(this.plugin.settings.regexpFlags)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
this.plugin.settings.regexpFlags = value;
yield this.plugin.saveSettings();
})));
new obsidian.Setting(containerEl)
.setName('Replace by')
.setDesc('Text to be inserted')
.addText(text => text
.setPlaceholder('Example: $2, $1')
.setValue(this.plugin.settings.replace)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
this.plugin.settings.replace = value;
yield this.plugin.saveSettings();
})));
}
}
module.exports = FindAndReplaceInSelection;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZXMiOlsibm9kZV9tb2R1bGVzL3RzbGliL3RzbGliLmVzNi5qcyIsIm1haW4udHMiXSwic291cmNlc0NvbnRlbnQiOlsiLyohICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXHJcbkNvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLlxyXG5cclxuUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55XHJcbnB1cnBvc2Ugd2l0aCBvciB3aXRob3V0IGZlZSBpcyBoZXJlYnkgZ3JhbnRlZC5cclxuXHJcblRIRSBTT0ZUV0FSRSBJUyBQUk9WSURFRCBcIkFTIElTXCIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEhcclxuUkVHQVJEIFRPIFRISVMgU09GVFdBUkUgSU5DTFVESU5HIEFMTCBJTVBMSUVEIFdBUlJBTlRJRVMgT0YgTUVSQ0hBTlRBQklMSVRZXHJcbkFORCBGSVRORVNTLiBJ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gW10sIGU7XHJcbiAgICB0cnkge1xyXG4gICAgICAgIHdoaWxlICgobiA9PT0gdm9pZCAwIHx8IG4tLSA+IDApICYmICEociA9IGkubmV4dCgpKS5kb25lKSBhci5wdXNoKHIudmFsdWUpO1xyXG4gICAgfVxyXG4gICAgY2F0Y2ggKGVycm9yKSB7IGUgPSB7IGVycm9yOiBlcnJvciB9OyB9XHJcbiAgICBmaW5hbGx5IHtcclxuICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICBpZiAociAmJiAhci5kb25lICYmIChtID0gaVtcInJldHVyblwiXSkpIG0uY2FsbChpKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgZmluYWxseSB7IGlmIChlKSB0aHJvdyBlLmVycm9yOyB9XHJcbiAgICB9XHJcbiAgICByZXR1cm4gYXI7XHJcbn1cclxuXHJcbi8qKiBAZGVwcmVjYXRlZCAqL1xyXG5leHBvcnQgZnVuY3Rpb24gX19zcHJlYWQoKSB7XHJcbiAgICBmb3IgKHZhciBhciA9IFtdLCBpID0gMDsgaSA8IGFyZ3VtZW50cy5sZW5ndGg7IGkrKylcclxuICAgICAgICBhciA9IGFyLmNvbmNhdChfX3JlYWQoYXJndW1lbnRzW2ldKSk7XHJcbiAgICByZXR1cm4gYXI7XHJcbn1cclxuXHJcbi8qKiBAZGVwcmVjYXRlZCAqL1xyXG5leHBvcnQgZnVuY3Rpb24gX19zcHJlYWRBcnJheXMoKSB7XHJcbiAgICBmb3IgKHZhciBzID0gMCwgaSA9IDAsIGlsID0gYXJndW1lbnRzLmxlbmd0aDsgaSA8IGlsOyBpKyspIHMgKz0gYXJndW1lbnRzW2ldLmxlbmd0aDtcclxuICAgIGZvciAodmFyIHIgPSBBcnJheShzKSwgayA9IDAsIGkgPSAwOyBpIDwgaWw7IGkrKylcclxuICAgICAgICBmb3IgKHZhciBhID0gYXJndW1lbnRzW2ldLCBqID0gMCwgamwgPSBhLmxlbmd0aDsgaiA8IGpsOyBqKyssIGsrKylcclxuICAgICAgICAg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