Initial commit

This commit is contained in:
Aleksandr Ebaklakov
2026-04-22 16:58:43 +03:00
commit 011626b8b7
366 changed files with 23244 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
{
"modifierKey": "ShiftLeft",
"stepSize": 25,
"initialSize": 500,
"resizeInCanvas": true
}

View File

@@ -0,0 +1,616 @@
/*
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());
});
}
/**
* ReplaceTerm enables us to store the parameters for a replacement to add a new size parameter.
*/
class ReplaceTerm {
constructor(replaceFrom, replaceWith) {
this.replaceFrom = replaceFrom;
this.replaceWith = replaceWith;
}
// Generate a string that can be used in a string.replace() call as the string to replace
getReplaceFromString(oldSize) {
return this.replaceFrom(oldSize);
}
// Generate a string that can be used in a string.replace() call as the replacement string
getReplaceWithString(newSize) {
return this.replaceWith(newSize);
}
}
class Util {
/**
* For a given file content decide if a string is inside a table
* @param searchString string
* @param fileValue file content
* @private
*/
static isInTable(searchString, fileValue) {
return fileValue.search(new RegExp(`^\\|.+${escapeRegex(searchString)}.+\\|$`, "m")) !== -1;
}
/**
* Get the image name from a given src uri of a local image
* (URI like app://local/C:/.../image.png?1677337704730)
* @param imageUri uri of the image
* @private
*/
static getLocalImageNameFromUri(imageUri) {
imageUri = decodeURI(imageUri);
const imageNameMatch = imageUri.match(/([^\/?\\]+)(\?.*?|)$/);
const imageName = imageNameMatch ? imageNameMatch[1] : "";
// Handle linux not correctly decoding the %2F before the Filename to a \
const hasLinuxDecodingIssue = imageName.startsWith("2F");
return hasLinuxDecodingIssue ? imageName.slice(2) : imageName;
}
/**
* Get the parameters needed to handle the zoom for a local image.
* Source can be either a obsidian link like [[image.png]] or a markdown link like [image.png](image.png)
* @param imageName Name of the image
* @param fileText content of the current file
* @returns parameters to handle the zoom
*/
static getLocalImageZoomParams(imageName, fileText) {
imageName = this.determineImageName(imageName, fileText);
// Get the folder name if the image is located in a folder
const folderName = this.getFolderNameIfExist(imageName, fileText);
imageName = `${folderName}${imageName}`;
const isInTable = Util.isInTable(imageName, fileText);
// Separator to use for the replacement
const sizeSeparator = isInTable ? "\\|" : "|";
// Separator to use for the regex: isInTable ? \\\| : \|
const regexSeparator = isInTable ? "\\\\\\|" : "\\|";
// check character before the imageName to check if markdown link or obsidian link
const imageNamePosition = fileText.indexOf(imageName);
const isObsidianLink = fileText.charAt(imageNamePosition - 1) === "[";
if (isObsidianLink) {
const imageAttributes = this.getImageAttributes(imageName, fileText);
imageName = `${imageName}${imageAttributes}`;
return Util.generateReplaceTermForObsidianSyntax(imageName, regexSeparator, sizeSeparator);
}
else {
return Util.generateReplaceTermForMarkdownSyntax(imageName, regexSeparator, sizeSeparator, fileText);
}
}
/**
* When using markdown link syntax the image name can be encoded. This function checks if the image name is encoded and if not encodes it.
*
* @param origImageName Image name
* @param fileText File content
* @returns image name with the correct encoding
*/
static determineImageName(origImageName, fileText) {
const encodedImageName = encodeURI(origImageName);
const spaceEncodedImageName = origImageName.replace(/ /g, "%20");
// Try matching original, full URI encoded, and space encoded
const imageNameVariants = [origImageName, encodedImageName, spaceEncodedImageName];
for (const variant of imageNameVariants) {
if (fileText.includes(variant)) {
return variant;
}
}
throw new Error("Image not found in file");
}
/**
* Extracts the folder name from the given image name by looking for the first "[" or "(" character
* that appears before the image name in the file text.
* @param imageName The name of the image.
* @param fileText The text of the file that contains the image.
* @returns The name of the folder that contains the image, or an empty string if no folder is found.
*/
static getFolderNameIfExist(imageName, fileText) {
const index = fileText.indexOf(imageName);
if (index === -1) {
throw new Error("Image not found in file");
}
const stringBeforeFileName = fileText.substring(0, index);
const lastOpeningBracket = stringBeforeFileName.lastIndexOf("["); // Obsidian link
const lastOpeningParenthesis = stringBeforeFileName.lastIndexOf("("); // Markdown link
const lastOpeningBracketOrParenthesis = Math.max(lastOpeningBracket, lastOpeningParenthesis);
const folderName = stringBeforeFileName.substring(lastOpeningBracketOrParenthesis + 1);
return folderName;
}
/**
* Extracts any image attributes like |ctr for ITS Theme that appear after the given image name in the file.
* @param imageName - The name of the image to search for.
* @param fileText - The content of the file to search in.
* @returns A string containing any image attributes that appear after the image name.
*/
static getImageAttributes(imageName, fileText) {
const index = fileText.indexOf(imageName);
const stringAfterFileName = fileText.substring(index + imageName.length);
const regExpMatchArray = stringAfterFileName.match(/([^\]]*?)\\?\|\d+]]|([^\]]*?)]]|/);
if (regExpMatchArray) {
if (!!regExpMatchArray[1]) {
return regExpMatchArray[1];
}
else if (!!regExpMatchArray[2]) {
return regExpMatchArray[2];
}
}
return "";
}
/**
* Get the parameters needed to handle the zoom for images in markdown format.
* Example: ![image.png](image.png)
* @param imageName Name of the image
* @param fileText content of the current file
* @returns parameters to handle the zoom
* @private
*
*/
static generateReplaceTermForMarkdownSyntax(imageName, regexSeparator, sizeSeparator, fileText) {
const sizeMatchRegExp = new RegExp(`${regexSeparator}(\\d+)]${escapeRegex("(" + imageName + ")")}`);
const replaceSizeExistFrom = (oldSize) => `${sizeSeparator}${oldSize}](${imageName})`;
const replaceSizeExistWith = (newSize) => `${sizeSeparator}${newSize}](${imageName})`;
const replaceSizeNotExistsFrom = (oldSize) => `](${imageName})`;
const replaceSizeNotExistsWith = (newSize) => `${sizeSeparator}${newSize}](${imageName})`;
const replaceSizeExist = new ReplaceTerm(replaceSizeExistFrom, replaceSizeExistWith);
const replaceSizeNotExist = new ReplaceTerm(replaceSizeNotExistsFrom, replaceSizeNotExistsWith);
return {
sizeMatchRegExp: sizeMatchRegExp,
replaceSizeExist: replaceSizeExist,
replaceSizeNotExist: replaceSizeNotExist,
};
}
/**
* Get the parameters needed to handle the zoom for images in markdown format.
* Example: ![[image.png]]
* @param imageName Name of the image
* @param fileText content of the current file
* @returns parameters to handle the zoom
* @private
*
*/
static generateReplaceTermForObsidianSyntax(imageName, regexSeparator, sizeSeparator) {
const sizeMatchRegExp = new RegExp(`${escapeRegex(imageName)}${regexSeparator}(\\d+)`);
const replaceSizeExistFrom = (oldSize) => `${imageName}${sizeSeparator}${oldSize}`;
const replaceSizeExistWith = (newSize) => `${imageName}${sizeSeparator}${newSize}`;
const replaceSizeNotExistsFrom = (oldSize) => `${imageName}`;
const replaceSizeNotExistsWith = (newSize) => `${imageName}${sizeSeparator}${newSize}`;
const replaceSizeExist = new ReplaceTerm(replaceSizeExistFrom, replaceSizeExistWith);
const replaceSizeNotExist = new ReplaceTerm(replaceSizeNotExistsFrom, replaceSizeNotExistsWith);
return {
sizeMatchRegExp: sizeMatchRegExp,
replaceSizeExist: replaceSizeExist,
replaceSizeNotExist: replaceSizeNotExist,
};
}
/**
* Get the parameters needed to handle the zoom for a remote image.
* Format: https://www.example.com/image.png
* @param imageUri URI of the image
* @param fileText content of the current file
* @returns parameters to handle the zoom
*/
static getRemoteImageZoomParams(imageUri, fileText) {
const isInTable = Util.isInTable(imageUri, fileText);
// Separator to use for the replacement
const sizeSeparator = isInTable ? "\\|" : "|";
// Separator to use for the regex: isInTable ? \\\| : \|
const regexSeparator = isInTable ? "\\\\\\|" : "\\|";
return Util.generateReplaceTermForMarkdownSyntax(imageUri, regexSeparator, sizeSeparator, fileText);
}
}
/**
* Function to escape a string into a valid searchable string for a regex
* @param string string to escape
* @returns escaped string
*/
function escapeRegex(string) {
return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
}
var ModifierKey;
(function (ModifierKey) {
ModifierKey["ALT"] = "AltLeft";
ModifierKey["CTRL"] = "ControlLeft";
ModifierKey["SHIFT"] = "ShiftLeft";
ModifierKey["ALT_RIGHT"] = "AltRight";
ModifierKey["CTRL_RIGHT"] = "ControlRight";
ModifierKey["SHIFT_RIGHT"] = "ShiftRight";
})(ModifierKey || (ModifierKey = {}));
const DEFAULT_SETTINGS = {
modifierKey: ModifierKey.ALT,
stepSize: 25,
initialSize: 500,
resizeInCanvas: true,
};
const CtrlCanvasConflictWarning = "Warning: Using Ctrl as the modifier key conflicts with default canvas zooming behavior when 'Resize in canvas' is enabled. Consider using another modifier key or disabling 'Resize in canvas'.";
class MouseWheelZoomPlugin extends obsidian.Plugin {
constructor() {
super(...arguments);
this.isKeyHeldDown = false;
this.wheelOpt = { passive: false, capture: true };
this.wheelEvent = 'wheel';
}
onload() {
return __awaiter(this, void 0, void 0, function* () {
yield this.loadSettings();
this.registerEvent(this.app.workspace.on("window-open", (newWindow) => this.registerEvents(newWindow.win)));
this.registerEvents(window);
this.addSettingTab(new MouseWheelZoomSettingsTab(this.app, this));
console.log("Loaded: Mousewheel image zoom");
this.checkExistingUserConflict();
});
}
checkExistingUserConflict() {
const noticeShownKey = 'mousewheel-zoom-ctrl-warning-shown'; // Key for localStorage flag
const isCtrl = this.settings.modifierKey === ModifierKey.CTRL || this.settings.modifierKey === ModifierKey.CTRL_RIGHT;
// Only show the notice if the conflict exists AND the user hasn't dismissed it before (using localStorage flag)
if (isCtrl && this.settings.resizeInCanvas && !localStorage.getItem(noticeShownKey)) {
const fragment = document.createDocumentFragment();
const titleEl = document.createElement('strong');
titleEl.textContent = "Mousewheel Image Zoom";
fragment.appendChild(titleEl);
fragment.appendChild(document.createElement('br'));
const messageEl = document.createElement('span');
messageEl.textContent = CtrlCanvasConflictWarning;
fragment.appendChild(messageEl);
fragment.appendChild(document.createElement('br'));
const settingsButton = document.createElement('button');
settingsButton.textContent = "Open Settings";
settingsButton.style.marginTop = "5px";
settingsButton.onclick = () => {
// settings is a private property of the app object, so we need to cast it to any to access it
// See https://forum.obsidian.md/t/open-settings-for-my-plugin-community-plugin-settings-deeplink/61563/4
const setting = this.app.setting;
setting.open();
setting.openTabById(this.manifest.id);
};
fragment.appendChild(settingsButton);
new obsidian.Notice(fragment, 0);
// Set the flag in localStorage so the notice doesn't appear again
// unless the user clears their localStorage or the key changes.
localStorage.setItem(noticeShownKey, 'true');
}
}
/**
* When the config key is released, we enable the scroll again and reset the key held down flag.
*/
onConfigKeyUp(currentWindow) {
this.isKeyHeldDown = false;
this.enableScroll(currentWindow);
}
onunload(currentWindow = window) {
// Re-enable the normal scrolling behavior when the plugin unloads
this.enableScroll(currentWindow);
}
/**
* Registers image resizing events for the specified window
* @param currentWindow window in which to register events
* @private
*/
registerEvents(currentWindow) {
const doc = currentWindow.document;
this.registerDomEvent(doc, "keydown", (evt) => {
var _a;
if (evt.code === this.settings.modifierKey.toString()) {
// When canvas mode is enabled we just ignore the keydown event if the canvas is active
const isActiveViewCanvas = ((_a = this.app.workspace.getActiveViewOfType(obsidian.View)) === null || _a === void 0 ? void 0 : _a.getViewType()) === "canvas";
if (isActiveViewCanvas && !this.settings.resizeInCanvas) {
return;
}
this.isKeyHeldDown = true;
if (this.settings.modifierKey !== ModifierKey.SHIFT && this.settings.modifierKey !== ModifierKey.SHIFT_RIGHT) { // Ignore shift to allow horizontal scrolling
// Disable the normal scrolling behavior when the key is held down
this.disableScroll(currentWindow);
}
}
});
this.registerDomEvent(doc, "keyup", (evt) => {
if (evt.code === this.settings.modifierKey.toString()) {
this.onConfigKeyUp(currentWindow);
}
});
this.registerDomEvent(doc, "wheel", (evt) => {
if (this.isKeyHeldDown) {
// When for example using Alt + Tab to switch between windows, the key is still recognized as held down.
// We check if the key is really held down by checking if the key is still pressed in the event when the
// wheel event is triggered.
if (!this.isConfiguredKeyDown(evt)) {
this.onConfigKeyUp(currentWindow);
return;
}
const eventTarget = evt.target;
const targetIsCanvas = eventTarget.hasClass("canvas-node-content-blocker");
const targetIsCanvasNode = eventTarget.closest(".canvas-node-content") !== null;
const targetIsImage = eventTarget.nodeName === "IMG";
if (targetIsCanvas || targetIsCanvasNode || targetIsImage) {
this.disableScroll(currentWindow);
}
if (targetIsCanvas && this.settings.resizeInCanvas) {
// seems we're trying to zoom on some canvas node.
this.handleZoomForCanvas(evt, eventTarget);
}
else if (targetIsCanvasNode) ;
else if (targetIsImage) {
// Handle the zooming of the image
this.handleZoom(evt, eventTarget);
}
}
});
this.registerDomEvent(currentWindow, "blur", () => {
// When the window loses focus, ensure scrolling is re-enabled for this window
// and reset the key held state defensively, although the keyup should ideally handle it.
this.isKeyHeldDown = false;
this.enableScroll(currentWindow);
});
}
/**
* Handles zooming with the mousewheel on canvas node
* @param evt wheel event
* @param eventTarget targeted canvas node element
* @private
*/
handleZoomForCanvas(evt, eventTarget) {
// get active canvas
const isCanvas = this.app.workspace.getActiveViewOfType(obsidian.View).getViewType() === "canvas";
if (!isCanvas) {
throw new Error("Can't find canvas");
}
// Unfortunately the current type definitions don't include any canvas functionality...
const canvas = this.app.workspace.getActiveViewOfType(obsidian.View).canvas;
// get triggered canvasNode
const canvasNode = Array.from(canvas.nodes.values())
.find(node => node.contentBlockerEl == eventTarget);
// Adjust delta based on the direction of the resize
let delta = evt.deltaY > 0 ? this.settings.stepSize : this.settings.stepSize * -1;
// Calculate new dimensions directly using the delta and aspectRatio
const aspectRatio = canvasNode.width / canvasNode.height;
const newWidth = canvasNode.width + delta;
const newHeight = newWidth / aspectRatio;
// Resize the canvas node using the new dimensions
canvasNode.resize({ width: newWidth, height: newHeight });
}
/**
* Handles zooming with the mousewheel on an image
* @param evt wheel event
* @param eventTarget targeted image element
* @private
*/
handleZoom(evt, eventTarget) {
return __awaiter(this, void 0, void 0, function* () {
const imageUri = eventTarget.attributes.getNamedItem("src").textContent;
const activeFile = yield this.getActivePaneWithImage(eventTarget);
yield this.app.vault.process(activeFile, (fileText) => {
let frontmatter = "";
let body = fileText;
const frontmatterRegex = /^---\s*([\s\S]*?)\s*---\n*/;
const match = fileText.match(frontmatterRegex);
if (match) {
frontmatter = match[0]; // Keep the full matched frontmatter block including delimiters and trailing newline
body = fileText.slice(frontmatter.length); // The rest is the body
}
const zoomParams = this.getZoomParams(imageUri, body, eventTarget);
// Perform replacements ONLY on the body
let modifiedBody = body;
const sizeMatches = body.match(zoomParams.sizeMatchRegExp);
// Element already has a size entry in the body
if (sizeMatches !== null) {
const oldSize = parseInt(sizeMatches[1]);
let newSize = oldSize;
if (evt.deltaY < 0) {
newSize += this.settings.stepSize;
}
else if (evt.deltaY > 0 && newSize > this.settings.stepSize) {
newSize -= this.settings.stepSize;
}
// Replace within the body
modifiedBody = body.replace(zoomParams.replaceSizeExist.getReplaceFromString(oldSize), zoomParams.replaceSizeExist.getReplaceWithString(newSize));
}
else { // Element has no size entry in the body -> give it an initial size
const initialSize = this.settings.initialSize;
const image = new Image();
image.src = imageUri;
const width = image.naturalWidth || initialSize;
const minWidth = Math.min(width, initialSize);
// Replace within the body
modifiedBody = body.replace(zoomParams.replaceSizeNotExist.getReplaceFromString(0), zoomParams.replaceSizeNotExist.getReplaceWithString(minWidth));
}
// Combine original frontmatter with the modified body
return frontmatter + modifiedBody;
});
});
}
/**
* Loop through all panes and get the pane that hosts a markdown file with the image to zoom
* @param imageElement The HTML Element of the image
* @private
*/
getActivePaneWithImage(imageElement) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise(((resolve, reject) => {
this.app.workspace.iterateAllLeaves(leaf => {
if (leaf.view.containerEl.contains(imageElement) && leaf.view instanceof obsidian.MarkdownView) {
resolve(leaf.view.file);
}
});
reject(new Error("No file belonging to the image found"));
}));
});
}
getZoomParams(imageUri, fileText, target) {
if (imageUri.contains("http")) {
return Util.getRemoteImageZoomParams(imageUri, fileText);
}
else if (target.classList.value.match("excalidraw-svg.*")) {
const src = target.attributes.getNamedItem("filesource").textContent;
// remove ".md" from the end of the src
const imageName = src.substring(0, src.length - 3);
// Only get text after "/"
const imageNameAfterSlash = imageName.substring(imageName.lastIndexOf("/") + 1);
return Util.getLocalImageZoomParams(imageNameAfterSlash, fileText);
}
else if (imageUri.contains("app://")) {
const imageName = Util.getLocalImageNameFromUri(imageUri);
return Util.getLocalImageZoomParams(imageName, fileText);
}
else if (imageUri.contains("data:image/")) { // for image generated by PDF++ extension
// example: data:image/png;base64,iVB...
const imageName = Util.getLocalImageNameFromUri(target.parentElement.getAttribute("src"));
return Util.getLocalImageZoomParams(imageName, fileText);
}
throw new Error("Image is not zoomable");
}
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);
});
}
// Utilities to disable and enable scrolling //
preventDefault(ev) {
ev.preventDefault();
}
/**
* Disables the normal scroll event
*/
disableScroll(currentWindow) {
currentWindow.addEventListener(this.wheelEvent, this.preventDefault, this.wheelOpt);
}
/**
* Enables the normal scroll event
*/
enableScroll(currentWindow) {
currentWindow.removeEventListener(this.wheelEvent, this.preventDefault, this.wheelOpt);
}
isConfiguredKeyDown(evt) {
switch (this.settings.modifierKey) {
case ModifierKey.ALT:
case ModifierKey.ALT_RIGHT:
return evt.altKey;
case ModifierKey.CTRL:
case ModifierKey.CTRL_RIGHT:
return evt.ctrlKey;
case ModifierKey.SHIFT:
case ModifierKey.SHIFT_RIGHT:
return evt.shiftKey;
}
}
}
class MouseWheelZoomSettingsTab extends obsidian.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
this.plugin = plugin;
}
// Helper function to update the warning message
updateWarningMessage(modifierKey, resizeInCanvas) {
if (!this.warningEl)
return;
const isCtrl = modifierKey === ModifierKey.CTRL || modifierKey === ModifierKey.CTRL_RIGHT;
const conflict = isCtrl && resizeInCanvas;
if (conflict) {
this.warningEl.setText(CtrlCanvasConflictWarning);
this.warningEl.style.display = 'block';
this.warningEl.style.color = 'var(--text-warning)';
this.warningEl.style.marginTop = '10px';
}
else {
this.warningEl.setText("");
this.warningEl.style.display = 'none';
}
}
display() {
let { containerEl } = this;
containerEl.empty();
containerEl.createEl('h2', { text: 'Settings for mousewheel zoom' });
new obsidian.Setting(containerEl)
.setName('Trigger Key')
.setDesc('Key that needs to be pressed down for mousewheel zoom to work.')
.addDropdown(dropdown => dropdown
.addOption(ModifierKey.CTRL, "Ctrl")
.addOption(ModifierKey.ALT, "Alt")
.addOption(ModifierKey.SHIFT, "Shift")
.addOption(ModifierKey.CTRL_RIGHT, "Right Ctrl")
.addOption(ModifierKey.ALT_RIGHT, "Right Alt")
.addOption(ModifierKey.SHIFT_RIGHT, "Right Shift")
.setValue(this.plugin.settings.modifierKey)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
this.plugin.settings.modifierKey = value;
this.updateWarningMessage(this.plugin.settings.modifierKey, this.plugin.settings.resizeInCanvas);
yield this.plugin.saveSettings();
})));
new obsidian.Setting(containerEl)
.setName('Step size')
.setDesc('Step value by which the size of the image should be increased/decreased')
.addSlider(slider => {
slider
.setValue(25)
.setLimits(0, 100, 1)
.setDynamicTooltip()
.setValue(this.plugin.settings.stepSize)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
this.plugin.settings.stepSize = value;
yield this.plugin.saveSettings();
}));
});
new obsidian.Setting(containerEl)
.setName('Initial Size')
.setDesc('Initial image size if no size was defined beforehand')
.addSlider(slider => {
slider
.setValue(500)
.setLimits(0, 1000, 25)
.setDynamicTooltip()
.setValue(this.plugin.settings.initialSize)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
this.plugin.settings.initialSize = value;
yield this.plugin.saveSettings();
}));
});
new obsidian.Setting(containerEl)
.setName('Resize in canvas')
.setDesc('When enabled, all nodes on the Obsidian canvas can also be resized using the Modifier key')
.addToggle((toggle) => {
toggle.setValue(this.plugin.settings.resizeInCanvas)
.onChange((value) => __awaiter(this, void 0, void 0, function* () {
this.plugin.settings.resizeInCanvas = value;
this.updateWarningMessage(this.plugin.settings.modifierKey, value);
yield this.plugin.saveSettings();
}));
});
this.warningEl = containerEl.createDiv({ cls: 'mousewheel-zoom-warning' });
this.warningEl.style.display = 'none';
this.updateWarningMessage(this.plugin.settings.modifierKey, this.plugin.settings.resizeInCanvas);
}
}
module.exports = MouseWheelZoomPlugin;
/* nosourcemap */

View File

@@ -0,0 +1,10 @@
{
"id": "mousewheel-image-zoom",
"name": "Mousewheel Image zoom",
"version": "1.0.24",
"minAppVersion": "0.9.12",
"description": "This plugin enables you to increase/decrease the size of an image by scrolling",
"author": "Nico Jeske",
"authorUrl": "https://github.com/nicojeske/mousewheel-image-zoom",
"isDesktopOnly": true
}

View File

@@ -0,0 +1,68 @@
{
"commitMessage": "vault backup: {{date}}",
"autoCommitMessage": "vault backup: {{date}}",
"commitMessageScript": "",
"commitDateFormat": "YYYY-MM-DD HH:mm:ss",
"autoSaveInterval": 0,
"autoPushInterval": 0,
"autoPullInterval": 0,
"autoPullOnBoot": false,
"autoCommitOnlyStaged": false,
"disablePush": false,
"pullBeforePush": true,
"disablePopups": false,
"showErrorNotices": true,
"disablePopupsForNoChanges": false,
"listChangedFilesInMessageBody": false,
"showStatusBar": true,
"updateSubmodules": false,
"syncMethod": "merge",
"mergeStrategy": "none",
"customMessageOnAutoBackup": false,
"autoBackupAfterFileChange": false,
"treeStructure": false,
"refreshSourceControl": false,
"basePath": "",
"differentIntervalCommitAndPush": false,
"changedFilesInStatusBar": false,
"showedMobileNotice": true,
"refreshSourceControlTimer": 300000,
"showBranchStatusBar": true,
"setLastSaveToLastCommit": false,
"submoduleRecurseCheckout": false,
"gitDir": "",
"showFileMenu": true,
"authorInHistoryView": "hide",
"dateInHistoryView": false,
"diffStyle": "split",
"hunks": {
"showSigns": false,
"hunkCommands": false,
"statusBar": "disabled"
},
"lineAuthor": {
"show": false,
"followMovement": "inactive",
"authorDisplay": "initials",
"showCommitHash": false,
"dateTimeFormatOptions": "date",
"dateTimeFormatCustomString": "YYYY-MM-DD HH:mm",
"dateTimeTimezone": "viewer-local",
"coloringMaxAge": "1y",
"colorNew": {
"r": 255,
"g": 150,
"b": 150
},
"colorOld": {
"r": 120,
"g": 160,
"b": 255
},
"textColorCss": "var(--text-muted)",
"ignoreWhitespace": false,
"gutterSpacingFallbackLength": 5,
"lastShownAuthorDisplay": "initials",
"lastShownDateTimeFormatOptions": "date"
}
}

452
.obsidian/plugins/obsidian-git/main.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
{
"author": "Vinzent",
"authorUrl": "https://github.com/Vinzent03",
"id": "obsidian-git",
"name": "Git",
"description": "Integrate Git version control with automatic backup and other advanced features.",
"isDesktopOnly": false,
"fundingUrl": "https://ko-fi.com/vinzent",
"version": "2.38.2"
}

View File

@@ -0,0 +1,23 @@
#!/bin/sh
PROMPT="$1"
TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT"
cleanup() {
rm -f "$TEMP_FILE" "$TEMP_FILE.response"
}
trap cleanup EXIT
echo "$PROMPT" > "$TEMP_FILE"
while [ ! -e "$TEMP_FILE.response" ]; do
if [ ! -e "$TEMP_FILE" ]; then
echo "Trigger file got removed: Abort" >&2
exit 1
fi
sleep 0.1
done
RESPONSE=$(cat "$TEMP_FILE.response")
echo "$RESPONSE"

View File

@@ -0,0 +1,710 @@
@keyframes loading {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.git-signs-gutter {
.cm-gutterElement {
/* Needed to align the sign properly for different line heigts. Such as
* when having a heading or list item.
*/
padding-top: 0 !important;
}
}
.workspace-leaf-content[data-type="git-view"] .button-border {
border: 2px solid var(--interactive-accent);
border-radius: var(--radius-s);
}
.workspace-leaf-content[data-type="git-view"] .view-content {
padding-left: 0;
padding-top: 0;
padding-right: 0;
}
.workspace-leaf-content[data-type="git-history-view"] .view-content {
padding-left: 0;
padding-top: 0;
padding-right: 0;
}
.loading {
overflow: hidden;
}
.loading > svg {
animation: 2s linear infinite loading;
transform-origin: 50% 50%;
display: inline-block;
}
.obsidian-git-center {
margin: auto;
text-align: center;
width: 50%;
}
.obsidian-git-textarea {
display: block;
margin-left: auto;
margin-right: auto;
}
.obsidian-git-disabled {
opacity: 0.5;
}
.obsidian-git-center-button {
display: block;
margin: 20px auto;
}
.tooltip.mod-left {
overflow-wrap: break-word;
}
.tooltip.mod-right {
overflow-wrap: break-word;
}
/* Limits the scrollbar to the view body */
.git-view {
display: flex;
flex-direction: column;
position: relative;
height: 100%;
}
/* Re-enable wrapping of nav buttns to prevent overflow on smaller screens #*/
.workspace-drawer .git-view .nav-buttons-container {
flex-wrap: wrap;
}
.git-tools {
display: flex;
margin-left: auto;
}
.git-tools .type {
padding-left: var(--size-2-1);
display: flex;
align-items: center;
justify-content: center;
width: 11px;
}
.git-tools .type[data-type="M"] {
color: orange;
}
.git-tools .type[data-type="D"] {
color: red;
}
.git-tools .buttons {
display: flex;
}
.git-tools .buttons > * {
padding: 0 0;
height: auto;
}
.workspace-leaf-content[data-type="git-view"] .tree-item-self,
.workspace-leaf-content[data-type="git-history-view"] .tree-item-self {
align-items: center;
}
.workspace-leaf-content[data-type="git-view"]
.tree-item-self:hover
.clickable-icon,
.workspace-leaf-content[data-type="git-history-view"]
.tree-item-self:hover
.clickable-icon {
color: var(--icon-color-hover);
}
/* Highlight an item as active if it's diff is currently opened */
.is-active .git-tools .buttons > * {
color: var(--nav-item-color-active);
}
.git-author {
color: var(--text-accent);
}
.git-date {
color: var(--text-accent);
}
.git-ref {
color: var(--text-accent);
}
/* ====== diff2html ======
The following styles are adapted from the obsidian-version-history plugin by
@kometenstaub https://github.com/kometenstaub/obsidian-version-history-diff/blob/main/src/styles.scss
which itself is adapted from the diff2html library with the following original license:
https://github.com/rtfpessoa/diff2html/blob/master/LICENSE.md
Copyright 2014-2016 Rodrigo Fernandes https://rtfpessoa.github.io/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
.theme-dark,
.theme-light {
--git-delete-bg: #ff475040;
--git-delete-hl: #96050a75;
--git-insert-bg: #68d36840;
--git-insert-hl: #23c02350;
--git-change-bg: #ffd55840;
--git-selected: #3572b0;
--git-delete: #c33;
--git-insert: #399839;
--git-change: #d0b44c;
--git-move: #3572b0;
}
.git-diff {
.d2h-d-none {
display: none;
}
.d2h-wrapper {
text-align: left;
border-radius: 0.25em;
overflow: auto;
}
.d2h-file-header.d2h-file-header {
background-color: var(--background-secondary);
border-bottom: 1px solid var(--background-modifier-border);
font-family:
Source Sans Pro,
Helvetica Neue,
Helvetica,
Arial,
sans-serif;
height: 35px;
padding: 5px 10px;
}
.d2h-file-header,
.d2h-file-stats {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.d2h-file-header {
display: none;
}
.d2h-file-stats {
font-size: 14px;
margin-left: auto;
}
.d2h-lines-added {
border: 1px solid var(--color-green);
border-radius: 5px 0 0 5px;
color: var(--color-green);
padding: 2px;
text-align: right;
vertical-align: middle;
}
.d2h-lines-deleted {
border: 1px solid var(--color-red);
border-radius: 0 5px 5px 0;
color: var(--color-red);
margin-left: 1px;
padding: 2px;
text-align: left;
vertical-align: middle;
}
.d2h-file-name-wrapper {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 15px;
width: 100%;
}
.d2h-file-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--text-normal);
font-size: var(--h5-size);
}
.d2h-file-wrapper {
border: 1px solid var(--background-secondary-alt);
border-radius: 3px;
margin-bottom: 1em;
max-height: 100%;
}
.d2h-file-collapse {
-webkit-box-pack: end;
-ms-flex-pack: end;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
border: 1px solid var(--background-secondary-alt);
border-radius: 3px;
cursor: pointer;
display: none;
font-size: 12px;
justify-content: flex-end;
padding: 4px 8px;
}
.d2h-file-collapse.d2h-selected {
background-color: var(--git-selected);
}
.d2h-file-collapse-input {
margin: 0 4px 0 0;
}
.d2h-diff-table {
border-collapse: collapse;
font-family: var(--font-monospace);
font-size: var(--code-size);
width: 100%;
}
.d2h-files-diff {
width: 100%;
}
.d2h-file-diff {
/*
overflow-y: scroll;
*/
border-radius: 5px;
font-size: var(--font-text-size);
line-height: var(--line-height-normal);
}
.d2h-file-side-diff {
display: inline-block;
margin-bottom: -8px;
margin-right: -4px;
overflow-x: scroll;
overflow-y: hidden;
width: 50%;
}
.d2h-code-line {
padding-left: 6em;
padding-right: 1.5em;
}
.d2h-code-line,
.d2h-code-side-line {
display: inline-block;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 100%;
}
.d2h-code-side-line {
/* needed to be changed */
padding-left: 0.5em;
padding-right: 0.5em;
}
.d2h-code-line-ctn {
word-wrap: normal;
background: none;
display: inline-block;
padding: 0;
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
vertical-align: middle;
width: 100%;
/* only works for line-by-line */
white-space: pre-wrap;
}
.d2h-code-line del,
.d2h-code-side-line del {
background-color: var(--git-delete-hl);
color: var(--text-normal);
}
.d2h-code-line del,
.d2h-code-line ins,
.d2h-code-side-line del,
.d2h-code-side-line ins {
border-radius: 0.2em;
display: inline-block;
margin-top: -1px;
text-decoration: none;
vertical-align: middle;
}
.d2h-code-line ins,
.d2h-code-side-line ins {
background-color: var(--git-insert-hl);
text-align: left;
}
.d2h-code-line-prefix {
word-wrap: normal;
background: none;
display: inline;
padding: 0;
white-space: pre;
}
.line-num1 {
float: left;
}
.line-num1,
.line-num2 {
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
/*
padding: 0 0.5em;
*/
text-overflow: ellipsis;
width: 2.5em;
padding-left: 0;
}
.line-num2 {
float: right;
}
.d2h-code-linenumber {
background-color: var(--background-primary);
border: solid var(--background-modifier-border);
border-width: 0 1px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: var(--text-faint);
cursor: pointer;
display: inline-block;
position: absolute;
text-align: right;
width: 5.5em;
}
.d2h-code-linenumber:after {
content: "\200b";
}
.d2h-code-side-linenumber {
background-color: var(--background-primary);
border: solid var(--background-modifier-border);
border-width: 0 1px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: var(--text-faint);
cursor: pointer;
overflow: hidden;
padding: 0 0.5em;
text-align: right;
text-overflow: ellipsis;
width: 4em;
/* needed to be changed */
display: table-cell;
position: relative;
}
.d2h-code-side-linenumber:after {
content: "\200b";
}
.d2h-code-side-emptyplaceholder,
.d2h-emptyplaceholder {
background-color: var(--background-primary);
border-color: var(--background-modifier-border);
}
.d2h-code-line-prefix,
.d2h-code-linenumber,
.d2h-code-side-linenumber,
.d2h-emptyplaceholder {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.d2h-code-linenumber,
.d2h-code-side-linenumber {
direction: rtl;
}
.d2h-del {
background-color: var(--git-delete-bg);
border-color: var(--git-delete-hl);
}
.d2h-ins {
background-color: var(--git-insert-bg);
border-color: var(--git-insert-hl);
}
.d2h-info {
background-color: var(--background-primary);
border-color: var(--background-modifier-border);
color: var(--text-faint);
}
.d2h-del,
.d2h-ins,
.d2h-file-diff .d2h-change {
color: var(--text-normal);
}
.d2h-file-diff .d2h-del.d2h-change {
background-color: var(--git-change-bg);
}
.d2h-file-diff .d2h-ins.d2h-change {
background-color: var(--git-insert-bg);
}
.d2h-file-list-wrapper {
a {
text-decoration: none;
cursor: default;
-webkit-user-drag: none;
}
svg {
display: none;
}
}
.d2h-file-list-header {
text-align: left;
}
.d2h-file-list-title {
display: none;
}
.d2h-file-list-line {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
text-align: left;
}
.d2h-file-list {
}
.d2h-file-list > li {
border-bottom: 1px solid var(--background-modifier-border);
margin: 0;
padding: 5px 10px;
}
.d2h-file-list > li:last-child {
border-bottom: none;
}
.d2h-file-switch {
cursor: pointer;
display: none;
font-size: 10px;
}
.d2h-icon {
fill: currentColor;
margin-right: 10px;
vertical-align: middle;
}
.d2h-deleted {
color: var(--git-delete);
}
.d2h-added {
color: var(--git-insert);
}
.d2h-changed {
color: var(--git-change);
}
.d2h-moved {
color: var(--git-move);
}
.d2h-tag {
background-color: var(--background-secondary);
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 10px;
margin-left: 5px;
padding: 0 2px;
}
.d2h-deleted-tag {
border: 1px solid var(--git-delete);
}
.d2h-added-tag {
border: 1px solid var(--git-insert);
}
.d2h-changed-tag {
border: 1px solid var(--git-change);
}
.d2h-moved-tag {
border: 1px solid var(--git-move);
}
/* needed for line-by-line*/
.d2h-diff-tbody {
position: relative;
}
}
/* ====================== Line Authoring Information ====================== */
.cm-gutterElement.obs-git-blame-gutter {
/* Add background color to spacing inbetween and around the gutter for better aesthetics */
border-width: 0px 2px 0.2px 2px;
border-style: solid;
border-color: var(--background-secondary);
background-color: var(--background-secondary);
}
.cm-gutterElement.obs-git-blame-gutter > div,
.line-author-settings-preview {
/* delegate text color to settings */
color: var(--obs-git-gutter-text);
font-family: monospace;
height: 100%; /* ensure, that age-based background color occupies entire parent */
text-align: right;
padding: 0px 6px 0px 6px;
white-space: pre; /* Keep spaces and do not collapse them. */
}
@media (max-width: 800px) {
/* hide git blame gutter not to superpose text */
.cm-gutterElement.obs-git-blame-gutter {
display: none;
}
}
.git-unified-diff-view,
.git-split-diff-view .cm-deletedLine .cm-changedText {
background-color: #ee443330;
}
.git-unified-diff-view,
.git-split-diff-view .cm-insertedLine .cm-changedText {
background-color: #22bb2230;
}
.git-obscure-prompt[git-is-obscured="true"] #git-show-password:after {
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-eye"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></svg>');
}
.git-obscure-prompt[git-is-obscured="false"] #git-show-password:after {
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-eye-off"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"></path><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"></path><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"></path><path d="m2 2 20 20"></path></svg>');
}
/* Override styling of Codemirror merge view "collapsed lines" indicator */
.git-split-diff-view .ͼ2 .cm-collapsedLines {
background: var(--interactive-normal);
border-radius: var(--radius-m);
color: var(--text-accent);
font-size: var(--font-small);
padding: var(--size-4-1) var(--size-4-1);
}
.git-split-diff-view .ͼ2 .cm-collapsedLines:hover {
background: var(--interactive-hover);
color: var(--text-accent-hover);
}
.git-signs-gutter {
.cm-gutterElement {
display: grid;
}
}
.git-gutter-marker:hover {
border-radius: 2px;
}
.git-gutter-marker.git-add {
background-color: var(--color-green);
justify-self: center;
height: inherit;
width: 0.2rem;
}
.git-gutter-marker.git-change {
background-color: var(--color-yellow);
justify-self: center;
height: inherit;
width: 0.2rem;
}
.git-gutter-marker.git-changedelete {
color: var(--color-yellow);
font-weight: var(--font-bold);
font-size: 1rem;
justify-self: center;
height: inherit;
}
.git-gutter-marker.git-delete {
background-color: var(--color-red);
height: 0.2rem;
width: 0.8rem;
align-self: end;
}
.git-gutter-marker.git-topdelete {
background-color: var(--color-red);
height: 0.2rem;
width: 0.8rem;
align-self: start;
}
div:hover > .git-gutter-marker.git-change {
width: 0.6rem;
}
div:hover > .git-gutter-marker.git-add {
width: 0.6rem;
}
div:hover > .git-gutter-marker.git-delete {
height: 0.6rem;
}
div:hover > .git-gutter-marker.git-topdelete {
height: 0.6rem;
}
div:hover > .git-gutter-marker.git-changedelete {
font-weight: var(--font-bold);
}
.git-gutter-marker.staged {
opacity: 0.5;
}
.git-diff {
.cm-merge-revert {
width: 4em;
}
/* Ensure that merge revert markers are positioned correctly */
.cm-merge-revert > * {
position: absolute;
background-color: var(--background-secondary);
display: flex;
}
}
/* Prevent shifting of the editor when git signs gutter is the only gutter present */
.cm-gutters.cm-gutters-before:has(> .git-signs-gutter:only-child) {
margin-inline-end: 0;
.git-signs-gutter {
margin-inline-start: -1rem;
}
}
.git-changes-status-bar-colored {
.git-add {
color: var(--color-green);
}
.git-change {
color: var(--color-yellow);
}
.git-delete {
color: var(--color-red);
}
}
.git-changes-status-bar .git-add {
margin-right: 0.3em;
}
.git-changes-status-bar .git-change {
margin-right: 0.3em;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
{
"id": "obsidian-outliner",
"name": "Outliner",
"version": "4.9.0",
"minAppVersion": "1.8.7",
"description": "Work with your lists like in Workflowy or RoamResearch.",
"author": "Viacheslav Slinko",
"authorUrl": "https://github.com/vslinko",
"isDesktopOnly": false
}

View File

@@ -0,0 +1,105 @@
/* lists and bullets */
.outliner-plugin-better-lists .cm-s-obsidian .HyperMD-list-line {
/* padding-top: 0.4em; */
}
.outliner-plugin-better-lists .cm-formatting-list-ul {
margin-right: 0.3em;
}
.outliner-plugin-better-lists .list-bullet::after {
width: 0.4em;
height: 0.4em;
background-color: var(--text-muted);
}
/* lines */
.outliner-plugin-list-lines-scroller {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
padding: var(--file-margins);
padding-left: 0;
pointer-events: none;
overflow: hidden;
}
.outliner-plugin-list-lines-content-container {
position: relative;
}
.outliner-plugin-list-line {
pointer-events: auto;
position: absolute;
width: 5px;
margin-left: 0.5ch;
margin-top: 1em;
z-index: 1;
cursor: pointer;
background: transparent;
background-image: linear-gradient(
to right,
var(--text-faint) 1px,
transparent 1px
);
background-position-x: 2px;
background-repeat: no-repeat;
}
.outliner-plugin-better-bullets .outliner-plugin-list-line {
margin-top: 1.4em;
}
.markdown-source-view.mod-cm6.is-readable-line-width
.outliner-plugin-list-lines-content-container {
max-width: 700px;
margin: auto;
}
.outliner-plugin-list-line:hover {
background: var(--text-faint);
}
.outliner-plugin-vertical-lines
.markdown-source-view.mod-cm6
.cm-hmd-list-indent
.cm-indent::before {
content: none;
}
/* drag-n-drop */
.outliner-plugin-dropping-line {
background-color: hsla(var(--interactive-accent-hsl), 0.4);
}
.outliner-plugin-dragging-line {
opacity: 0.5;
background-color: hsla(var(--interactive-accent-hsl), 0.2);
}
.outliner-plugin-drop-zone {
width: 300px;
height: 4px;
background: var(--color-accent);
z-index: 999;
position: absolute;
pointer-events: none;
}
.outliner-plugin-drop-zone-padding {
position: absolute;
height: 4px;
}
body.outliner-plugin-dnd:not(.outliner-plugin-dragging) .cm-formatting-list,
body.outliner-plugin-dnd:not(.outliner-plugin-dragging)
.cm-fold-indicator
.collapse-indicator {
cursor: grab !important;
}
html body.outliner-plugin-dnd.outliner-plugin-dragging {
cursor: grabbing !important;
}

View File

@@ -0,0 +1,18 @@
{
"curlyQuotes": true,
"emDash": true,
"ellipsis": true,
"arrows": true,
"comparisons": true,
"fractions": true,
"guillemets": false,
"skipEnDash": false,
"openSingle": "",
"closeSingle": "",
"openDouble": "«",
"closeDouble": "»",
"openGuillemet": "«",
"closeGuillemet": "»",
"leftArrow": "←",
"rightArrow": "→"
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
{
"id": "obsidian-smart-typography",
"name": "Smart Typography",
"version": "1.0.18",
"minAppVersion": "0.15.0",
"description": "Converts quotes to curly quotes, dashes to em dashes, and periods to ellipses",
"author": "mgmeyers",
"authorUrl": "https://github.com/mgmeyers/obsidian-smart-typography",
"isDesktopOnly": false
}

View File

@@ -0,0 +1,12 @@
{
"typomagical-title@@font-title": "Bitter",
"typomagical-colour@@background-color-enable": true,
"typomagical-colour@@ss-background-color": "#24201D",
"typomagical-colour@@theme-variant": "obsidian",
"typomagical-text@@ordered-lists": "circled-ol",
"typomagical-text@@line-height-body": 1.45,
"typomagical-text@@body-weight": 400,
"typomagical-text@@bold-weight": 600,
"typomagical-text@@ss-hide-external-link-icon": false,
"typomagical-text@@ss-revert-highlight": true
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
{
"id": "obsidian-style-settings",
"name": "Style Settings",
"version": "1.0.9",
"minAppVersion": "0.11.5",
"description": "Offers controls for adjusting theme, plugin, and snippet CSS variables.",
"author": "mgmeyers",
"authorUrl": "https://github.com/mgmeyers/obsidian-style-settings",
"isDesktopOnly": false
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,32 @@
{
"showGettingStartedBanner": true,
"hasMigratedDailyNoteSettings": true,
"hasMigratedWeeklyNoteSettings": false,
"daily": {
"format": "LL",
"folder": "daily",
"template": "templates/daily notes template",
"enabled": true
},
"weekly": {
"format": "",
"template": "",
"folder": "",
"enabled": false
},
"monthly": {
"format": "",
"template": "",
"folder": ""
},
"quarterly": {
"format": "",
"template": "",
"folder": ""
},
"yearly": {
"format": "",
"template": "",
"folder": ""
}
}

5561
.obsidian/plugins/periodic-notes/main.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
{
"id": "periodic-notes",
"name": "Periodic Notes",
"description": "Create/manage your daily, weekly, and monthly notes",
"version": "0.0.17",
"author": "Liam Cain",
"authorUrl": "https://github.com/liamcain/",
"isDesktopOnly": false,
"minAppVersion": "0.10.11"
}

View File

@@ -0,0 +1,30 @@
.periodic-modal {
min-width: 40vw;
}
.settings-banner {
background-color: var(--background-primary-alt);
border-radius: 8px;
border: 1px solid var(--background-modifier-border);
margin-bottom: 1em;
margin-top: 1em;
padding: 1.5em;
text-align: left;
}
.settings-banner h3 {
margin-top: 0;
}
.settings-banner h4 {
margin-bottom: 0.25em;
}
.has-error {
color: var(--text-error);
}
input.has-error {
color: var(--text-error);
border-color: var(--text-error);
}

View File

@@ -0,0 +1,765 @@
'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.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
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());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
var shortcutsExtender = /** @class */ (function (_super) {
__extends(shortcutsExtender, _super);
function shortcutsExtender() {
return _super !== null && _super.apply(this, arguments) || this;
}
shortcutsExtender.prototype.onload = function () {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
console.log(this.app);
this.addCommand({
id: "shortcut-exclamation-mark",
name: "Shortcut for ! symbol",
callback: function () { return _this.shortcutExclamationMark(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "1",
},
],
});
this.addCommand({
id: "shortcut-At",
name: "Shortcut for @ symbol",
callback: function () { return _this.shortcutAt(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "2",
},
],
});
this.addCommand({
id: "shortcut-hash",
name: "Shortcut for # symbol",
callback: function () { return _this.shortcutHash(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "3",
},
],
});
this.addCommand({
id: "shortcut-dollar",
name: "Shortcut for $ symbol",
callback: function () { return _this.shortcutDollar(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "4",
},
],
});
this.addCommand({
id: "shortcut-percent",
name: "Shortcut for % symbol",
callback: function () { return _this.shortcutPercent(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "5",
},
],
});
this.addCommand({
id: "shortcut-circumflex",
name: "Shortcut for ^ symbol",
callback: function () { return _this.shortcutCircumflex(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "6",
},
],
});
this.addCommand({
id: "shortcut-ampersand",
name: "Shortcut for & symbol",
callback: function () { return _this.shortcutAmpersand(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "7",
},
],
});
this.addCommand({
id: "shortcut-less-than",
name: "Shortcut for < symbol",
callback: function () { return _this.shortcutLessThan(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "б",
},
{
modifiers: ["Alt"],
key: ",",
},
],
});
this.addCommand({
id: "shortcut-greater-than",
name: "Shortcut for > symbol",
callback: function () { return _this.shortcutGreaterThan(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "ю",
},
{
modifiers: ["Alt"],
key: ".",
},
],
});
this.addCommand({
id: "shortcut-left-square-bracket",
name: "Shortcut for [ symbol",
callback: function () { return _this.shortcutLeftSquareBracket(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "х",
},
{
modifiers: ["Alt"],
key: "[",
},
],
});
this.addCommand({
id: "shortcut-right-square-bracket",
name: "Shortcut for ] symbol",
callback: function () { return _this.shortcutRightSquareBracket(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "ъ",
},
{
modifiers: ["Alt"],
key: "]",
},
],
});
this.addCommand({
id: "shortcut-python-code",
name: "Shortcut for .py code fences",
callback: function () { return _this.shortcutPyCode(); },
hotkeys: [
{
modifiers: ["Alt", "Shift"],
key: "ё",
},
{
modifiers: ["Alt", "Shift"],
key: "~",
},
],
});
this.addCommand({
id: "shortcut-code",
name: "Shortcut for code fences (`)",
callback: function () { return _this.shortcutCodeFences(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "ё",
},
{
modifiers: ["Alt"],
key: "`",
},
],
});
this.addCommand({
id: "shortcut-code-block",
name: "Shortcut for toggling a code block",
callback: function () { return _this.shortcutToggleCodeBlock(); },
hotkeys: [
{
modifiers: ["Ctrl"],
key: "`",
},
],
});
this.addCommand({
id: "shortcut-left-curly-bracket",
name: "Shortcut for { symbol",
callback: function () { return _this.shortcutLeftCurlyBracket(); },
hotkeys: [
{
modifiers: ["Alt", "Shift"],
key: "х",
},
{
modifiers: ["Alt", "Shift"],
key: "{",
},
],
});
this.addCommand({
id: "shortcut-right-curly-bracket",
name: "Shortcut for } symbol",
callback: function () { return _this.shortcutRightCurlyBracket(); },
hotkeys: [
{
modifiers: ["Alt", "Shift"],
key: "ъ",
},
{
modifiers: ["Alt", "Shift"],
key: "}",
},
],
});
this.addCommand({
id: "shortcut-Vertical-Line",
name: "Shortcut for | symbol",
callback: function () { return _this.shortcutVerticalLine(); },
hotkeys: [
{
modifiers: ["Alt", "Shift"],
key: "|",
},
{
modifiers: ["Alt", "Shift"],
key: "\/",
},
],
});
this.addCommand({
id: "shortcut-list-items",
name: "Creating list item from text",
callback: function () { return _this.shortcutListItems(); },
hotkeys: [
{
modifiers: ["Alt"],
key: "-",
},
],
});
this.addCommand({
id: "heading-1",
name: "line into level 1 heading",
callback: function () { return _this.shortcutHeaderN(1); },
hotkeys: [
{
modifiers: ["Ctrl"],
key: "1",
},
],
});
this.addCommand({
id: "heading-2",
name: "line into level 2 heading",
callback: function () { return _this.shortcutHeaderN(2); },
hotkeys: [
{
modifiers: ["Ctrl"],
key: "2",
},
],
});
this.addCommand({
id: "heading-3",
name: "line into level 3 heading",
callback: function () { return _this.shortcutHeaderN(3); },
hotkeys: [
{
modifiers: ["Ctrl"],
key: "3",
},
],
});
this.addCommand({
id: "heading-4",
name: "line into level 4 heading",
callback: function () { return _this.shortcutHeaderN(4); },
hotkeys: [
{
modifiers: ["Ctrl"],
key: "4",
},
],
});
this.addCommand({
id: "heading-5",
name: "line into level 5 heading",
callback: function () { return _this.shortcutHeaderN(5); },
hotkeys: [
{
modifiers: ["Ctrl"],
key: "5",
},
],
});
this.addCommand({
id: "heading-6",
name: "line into level 6 heading",
callback: function () { return _this.shortcutHeaderN(6); },
hotkeys: [
{
modifiers: ["Ctrl"],
key: "6",
},
],
});
this.addCommand({
id: "heading-0",
name: "clearing of text formatting",
callback: function () { return _this.shortcutHeaderN(0); },
hotkeys: [
{
modifiers: ["Ctrl"],
key: "0",
},
],
});
return [2 /*return*/];
});
});
};
shortcutsExtender.prototype.getSelectedText = function (editor) {
//thanks to user "Argentina Ortega Sáinz" from the Obsidian community for this feature
//For a long time I tried to do without such an approach, which resulted in several bugs and the impossibility of fixing them with non-crutches
if (editor.somethingSelected()) {
var cursorStart = editor.getCursor('from');
var cursorEnd = editor.getCursor('to');
var content = editor.getRange({ line: cursorStart.line, ch: 0 }, { line: cursorEnd.line, ch: editor.getLine(cursorEnd.line).length });
return {
start: { line: cursorStart.line, ch: 0 },
end: {
line: cursorEnd.line,
ch: editor.getLine(cursorEnd.line).length,
},
content: content,
};
}
else {
// Toggle the todo in the line
var lineNr = editor.getCursor().line;
var contents = editor.getDoc().getLine(lineNr);
var cursorStart = {
line: lineNr,
ch: 0,
};
var cursorEnd = {
line: lineNr,
ch: contents.length,
};
var content = editor.getRange(cursorStart, cursorEnd);
return { start: cursorStart, end: cursorEnd, content: content };
}
};
shortcutsExtender.prototype.shortcutExclamationMark = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
editor.somethingSelected()
? editor.getSelection()
: false;
editor.replaceSelection("!");
};
shortcutsExtender.prototype.shortcutAt = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
editor.somethingSelected()
? editor.getSelection()
: false;
editor.replaceSelection("@");
};
shortcutsExtender.prototype.shortcutHash = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
editor.somethingSelected()
? editor.getSelection()
: false;
editor.replaceSelection("#");
};
shortcutsExtender.prototype.shortcutDollar = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
editor.somethingSelected()
? editor.getSelection()
: false;
editor.replaceSelection("$");
};
shortcutsExtender.prototype.shortcutPercent = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
editor.somethingSelected()
? editor.getSelection()
: false;
editor.replaceSelection("%");
};
shortcutsExtender.prototype.shortcutCircumflex = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
editor.somethingSelected()
? editor.getSelection()
: false;
editor.replaceSelection("^");
};
shortcutsExtender.prototype.shortcutAmpersand = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
editor.somethingSelected()
? editor.getSelection()
: false;
editor.replaceSelection("&");
};
shortcutsExtender.prototype.shortcutLessThan = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
var selectedText = editor.somethingSelected()
? editor.getSelection()
: false;
if (selectedText) {
editor.replaceSelection("<".concat(selectedText, ">"));
}
else
editor.replaceSelection("<");
};
shortcutsExtender.prototype.shortcutGreaterThan = function () {
var activeLeaf = this.app.workspace.activeLeaf;
var editor = activeLeaf.view.sourceMode.cmEditor;
var selectedText = this.getSelectedText(editor);
var resultText = "> " + selectedText.content.split('\n').join("\n> ");
editor.replaceRange(resultText, selectedText.start, selectedText.end);
};
shortcutsExtender.prototype.shortcutLeftSquareBracket = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
var selectedText = editor.somethingSelected()
? editor.getSelection()
: false;
if (selectedText) {
editor.replaceSelection("[[".concat(selectedText, "]]"));
}
else
editor.replaceSelection("[");
};
shortcutsExtender.prototype.shortcutRightSquareBracket = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
editor.somethingSelected()
? editor.getSelection()
: false;
editor.replaceSelection("]");
};
shortcutsExtender.prototype.shortcutPyCode = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
var selectedText = editor.somethingSelected()
? editor.getSelection()
: false;
if (selectedText) {
editor.replaceSelection("```py\n".concat(selectedText, "\n```"));
}
else
editor.replaceSelection("`");
};
shortcutsExtender.prototype.shortcutCodeFences = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
var selectedText = editor.somethingSelected()
? editor.getSelection()
: false;
if (selectedText) {
editor.replaceSelection("`".concat(selectedText, "`"));
}
else
editor.replaceSelection("`");
};
shortcutsExtender.prototype.shortcutToggleCodeBlock = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
var selectedText = editor.somethingSelected() ? editor.getSelection() : "";
var startCursor = editor.getCursor('from');
var firstLine = editor.getLine(startCursor.line);
var endCursor = editor.getCursor('to');
var lastLine = editor.getLine(endCursor.line);
// If the selections starts with ```, then we should remove the code block.
var isCodeBlock = firstLine.startsWith("```") && lastLine.endsWith("```")
&& selectedText.length >= 6;
if (isCodeBlock) {
// Position of first non-whitespace
var textStartPos = selectedText.search("\\s\\S") + 1;
if (textStartPos < 0) {
textStartPos = 3;
}
// Remove the code block formatting.
var endPos = selectedText.length - 3;
var innerText = selectedText.substring(textStartPos, endPos);
editor.replaceSelection(innerText);
}
else {
editor.replaceSelection("```\n".concat(selectedText, "\n```"));
startCursor.ch = 3; // Move cursor after ```
editor.setCursor(startCursor);
}
};
shortcutsExtender.prototype.shortcutRightCurlyBracket = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
editor.somethingSelected()
? editor.getSelection()
: false;
editor.replaceSelection("}");
};
shortcutsExtender.prototype.shortcutLeftCurlyBracket = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
var selectedText = editor.somethingSelected()
? editor.getSelection()
: false;
if (selectedText) {
editor.replaceSelection("{".concat(selectedText, "}"));
}
else
editor.replaceSelection("{");
};
shortcutsExtender.prototype.shortcutVerticalLine = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
editor.somethingSelected()
? editor.getSelection()
: false;
editor.replaceSelection("|");
};
shortcutsExtender.prototype.shortcutListItems = function () {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
var selectedText = this.getSelectedText(editor);
var resultText = "- " + selectedText.content.split('\n').join("\n- ");
var resultTextCheck = resultText;
while (resultTextCheck.search("- - ") >= 0) {
resultTextCheck = resultTextCheck.replace("- - ", " - ");
}
while (resultTextCheck.search("- ") >= 0) {
resultTextCheck = resultTextCheck.replace("- ", " - ");
}
while (resultTextCheck.search("- - ") >= 0) {
resultTextCheck = resultTextCheck.replace("- - ", " - ");
}
editor.replaceRange(resultTextCheck, selectedText.start, selectedText.end);
};
shortcutsExtender.prototype.removeFormatSymbolsFromStr = function (line) {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
// Remove symbols we don't want at the beginning of the line.
while (line.substring(0, 2) == "##") {
line = line.replace("##", "#");
}
while (line.substring(0, 2) == "# ") {
line = line.substr(2);
}
while (line.substring(0, 2) == "> ") {
line = line.substr(2);
}
while (line.substring(0, 2) == " ") {
line = line.replace(" ", " ");
}
while (line.substring(0, 3) == " - ") {
line = line.substr(3);
}
while (line.substring(0, 2) == "- ") {
line = line.substr(2);
}
var re_digits = /^\d\.\s/;
line = line.replace(re_digits, "");
return line;
};
shortcutsExtender.prototype.addHeadingToStr = function (line, headingLevel) {
var space = " ";
if (headingLevel == 0) {
space = "";
}
return "#".repeat(headingLevel) + space + line;
};
shortcutsExtender.prototype.shortcutHeaderN = function (headingLevel) {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
// Apply heading level to each line.
var selections = editor.listSelections();
for (var i = 0; i < selections.length; i++) {
this.shortcutHeaderNSingleSelection(headingLevel, selections[i]);
}
// setSelections is called to preserve the location of each cursor relative
// to the end of the line.
editor.setSelections(selections);
};
// shortcutHeaderNSingleSelection sets all lines in the selection to the
// desired heading level. selection is also updated to maintain the cursor
// position relative to the end of the line.
shortcutsExtender.prototype.shortcutHeaderNSingleSelection = function (headingLevel, selection) {
var _a;
var editor = (_a = this.app.workspace.getActiveViewOfType(obsidian.MarkdownView)) === null || _a === void 0 ? void 0 : _a.editor;
if (editor == null) {
return;
}
// Save anchor/head distance from end.
var anchorDistFromEnd = editor.getLine(selection.anchor.line).length - selection.anchor.ch;
var headDistFromEnd = editor.getLine(selection.head.line).length - selection.head.ch;
// Get from and to line numbers.
var fromLine = selection.anchor.line;
var toLine = selection.head.line;
var increment = fromLine <= toLine ? 1 : -1;
// For each line in the selection, set the heading level.
var lineNum = fromLine;
while (true) {
// Update the current line.
var line = editor.getLine(lineNum);
line = this.removeFormatSymbolsFromStr(line);
line = this.addHeadingToStr(line, headingLevel);
editor.setLine(lineNum, line);
// Move to next line if not done.
if (lineNum == toLine) {
break;
}
lineNum += increment;
}
// Preserve anchor/head locations relative to line end.
selection.anchor.ch = editor.getLine(selection.anchor.line).length - anchorDistFromEnd;
selection.head.ch = editor.getLine(selection.head.line).length - headDistFromEnd;
};
return shortcutsExtender;
}(obsidian.Plugin));
module.exports = shortcutsExtender;
/* nosourcemap */

View File

@@ -0,0 +1,8 @@
{
"id": "shortcuts-extender",
"name": "Shortcuts extender",
"description": "Use shortcuts for text formatting or input special symbols without language switching",
"isDesktopOnly": false,
"js": "main.js",
"version": "2.2.0"
}

View File

@@ -0,0 +1,42 @@
{
"command_timeout": 5,
"templates_folder": "templates/templater",
"templates_pairs": [
[
"",
""
]
],
"trigger_on_file_creation": true,
"auto_jump_to_cursor": true,
"enable_system_commands": false,
"shell_path": "",
"user_scripts_folder": "",
"enable_folder_templates": false,
"folder_templates": [
{
"folder": "",
"template": ""
}
],
"enable_file_templates": true,
"file_templates": [
{
"regex": "^Манифест\\.\\s.+$",
"template": "templates/templater/Манифест template.md"
},
{
"regex": "^.+\\.\\sЛабораторная\\sработа.+$",
"template": "templates/templater/Лабораторная работа template.md"
}
],
"syntax_highlighting": true,
"syntax_highlighting_mobile": false,
"enabled_templates_hotkeys": [
""
],
"startup_templates": [
""
],
"intellisense_render": 1
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,11 @@
{
"id": "templater-obsidian",
"name": "Templater",
"version": "2.16.2",
"description": "Create and use templates",
"minAppVersion": "1.5.0",
"author": "SilentVoid",
"authorUrl": "https://github.com/SilentVoid13",
"helpUrl": "https://silentvoid13.github.io/Templater/",
"isDesktopOnly": false
}

View File

@@ -0,0 +1,226 @@
.templater_search {
width: calc(100% - 20px);
}
.templater_div {
border-top: 1px solid var(--background-modifier-border);
}
.templater_div > .setting-item {
border-top: none !important;
align-self: center;
}
.templater_div > .setting-item > .setting-item-control {
justify-content: space-around;
padding: 0;
width: 100%;
}
.templater_div
> .setting-item
> .setting-item-control
> .setting-editor-extra-setting-button {
align-self: center;
}
.templater_donating {
margin: 10px;
}
.templater_title {
margin: 0;
padding: 0;
margin-top: 5px;
text-align: center;
}
.templater_template {
align-self: center;
margin-left: 5px;
margin-right: 5px;
width: 70%;
}
.templater_cmd {
margin-left: 5px;
margin-right: 5px;
font-size: 14px;
width: 100%;
}
.templater_div2 > .setting-item {
align-content: center;
justify-content: center;
}
.templater-prompt-div,
.templater-multisuggester-div {
display: flex;
}
.templater-prompt-form {
display: flex;
flex-grow: 1;
}
.templater-prompt-input,
.templater-multisuggester-input {
flex-grow: 1;
}
.templater-button-div {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 1rem;
}
textarea.templater-prompt-input {
height: 10rem;
}
textarea.templater-prompt-input:focus {
border-color: var(--interactive-accent);
}
.templater-multisuggester-list {
margin: 1.5em 0;
}
.cm-s-obsidian .templater-command-bg {
left: 0px;
right: 0px;
background-color: var(--background-primary-alt);
}
.cm-s-obsidian .cm-templater-command {
font-size: 0.85em;
font-family: var(--font-monospace);
line-height: 1.3;
}
.cm-s-obsidian .templater-inline .cm-templater-command {
background-color: var(--background-primary-alt);
}
.cm-s-obsidian .cm-templater-command.cm-templater-opening-tag {
font-weight: bold;
}
.cm-s-obsidian .cm-templater-command.cm-templater-closing-tag {
font-weight: bold;
}
.cm-s-obsidian .cm-templater-command.cm-templater-interpolation-tag {
color: var(--code-property, #008bff);
}
.cm-s-obsidian .cm-templater-command.cm-templater-execution-tag {
color: var(--code-function, #c0d700);
}
.cm-s-obsidian .cm-templater-command.cm-keyword {
color: var(--code-keyword, #00a7aa);
font-weight: normal;
}
.cm-s-obsidian .cm-templater-command.cm-atom {
color: var(--code-normal, #f39b35);
}
.cm-s-obsidian .cm-templater-command.cm-value,
.cm-s-obsidian .cm-templater-command.cm-number,
.cm-s-obsidian .cm-templater-command.cm-type {
color: var(--code-value, #a06fca);
}
.cm-s-obsidian .cm-templater-command.cm-def,
.cm-s-obsidian .cm-templater-command.cm-type.cm-def {
color: var(--code-normal, var(--text-normal));
}
.cm-s-obsidian .cm-templater-command.cm-property,
.cm-s-obsidian .cm-templater-command.cm-property.cm-def,
.cm-s-obsidian .cm-templater-command.cm-attribute {
color: var(--code-function, #98e342);
}
.cm-s-obsidian .cm-templater-command.cm-variable,
.cm-s-obsidian .cm-templater-command.cm-variable-2,
.cm-s-obsidian .cm-templater-command.cm-variable-3,
.cm-s-obsidian .cm-templater-command.cm-meta {
color: var(--code-property, #d4d4d4);
}
.cm-s-obsidian .cm-templater-command.cm-callee,
.cm-s-obsidian .cm-templater-command.cm-operator,
.cm-s-obsidian .cm-templater-command.cm-qualifier,
.cm-s-obsidian .cm-templater-command.cm-builtin {
color: var(--code-operator, #fc4384);
}
.cm-s-obsidian .cm-templater-command.cm-tag {
color: var(--code-tag, #fc4384);
}
.cm-s-obsidian .cm-templater-command.cm-comment,
.cm-s-obsidian .cm-templater-command.cm-comment.cm-tag,
.cm-s-obsidian .cm-templater-command.cm-comment.cm-attribute {
color: var(--code-comment, #696d70);
}
.cm-s-obsidian .cm-templater-command.cm-string,
.cm-s-obsidian .cm-templater-command.cm-string-2 {
color: var(--code-string, #e6db74);
}
.cm-s-obsidian .cm-templater-command.cm-header,
.cm-s-obsidian .cm-templater-command.cm-hr {
color: var(--code-keyword, #da7dae);
}
.cm-s-obsidian .cm-templater-command.cm-link {
color: var(--code-normal, #696d70);
}
.cm-s-obsidian .cm-templater-command.cm-error {
border-bottom: 1px solid #c42412;
}
.CodeMirror-hints {
position: absolute;
z-index: 10;
overflow: hidden;
list-style: none;
margin: 0;
padding: 2px;
-webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2);
box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2);
border-radius: 3px;
border: 1px solid silver;
background: white;
font-size: 90%;
font-family: monospace;
max-height: 20em;
overflow-y: auto;
}
.CodeMirror-hint {
margin: 0;
padding: 0 4px;
border-radius: 2px;
white-space: pre;
color: black;
cursor: pointer;
}
li.CodeMirror-hint-active {
background: #08f;
color: white;
}