diff --git a/manifest.json b/manifest.json index b76aaa9..df08e79 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "1.6.5", + "version": "1.6.6", "minAppVersion": "0.12.16", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/package.json b/package.json index dbe88c0..c882eba 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "author": "", "license": "MIT", "dependencies": { - "@zsviczian/excalidraw": "0.10.0-obsidian-45", + "@zsviczian/excalidraw": "0.10.0-obsidian-47", "monkey-around": "^2.3.0", "react": "^17.0.2", "react-dom": "^17.0.2", diff --git a/src/ExcalidrawView.ts b/src/ExcalidrawView.ts index 71ff0f3..0c46774 100644 --- a/src/ExcalidrawView.ts +++ b/src/ExcalidrawView.ts @@ -732,7 +732,6 @@ export default class ExcalidrawView extends TextFileView { } this.excalidrawData.scene.appState.theme = this.excalidrawAPI.getAppState().theme; - //debug({where:"ExcalidrawView.reload",file:this.file.name,dataTheme:this.excalidrawData.scene.appState.theme,before:"loadDrawing(false)"}) await this.loadDrawing(false); this.dirty = null; } @@ -746,9 +745,6 @@ export default class ExcalidrawView extends TextFileView { this.activeLoader.terminate = true; } this.nextLoader = null; - /*ReactDOM.unmountComponentAtode(this.contentEl); - this.excalidrawRef = null; - this.excalidrawAPI = null;*/ this.excalidrawAPI.resetScene(); this.excalidrawAPI.history.clear(); } @@ -799,7 +795,6 @@ export default class ExcalidrawView extends TextFileView { return; } } - //debug({where:"ExcalidrawView.setViewData",file:this.file.name,dataTheme:this.excalidrawData.scene.appState.theme,before:"loadDrawing(true)"}) await this.loadDrawing(true); this.isLoaded = true; }); @@ -809,13 +804,10 @@ export default class ExcalidrawView extends TextFileView { private nextLoader: EmbeddedFilesLoader = null; public async loadSceneFiles() { const loader = new EmbeddedFilesLoader(this.plugin); - //debug({where:"ExcalidrawView.loadSceneFiles",status:"loader created",file:this.file.name,loader:loader.uid}); const runLoader = (l: EmbeddedFilesLoader) => { this.nextLoader = null; this.activeLoader = l; - //debug({where:"ExcalidrawView.loadSceneFiles",status:"loader initiated",file:this.file.name,loader:l.uid}); - //debug({where:"ExcalidrawView.loadSceneFiles",file:this.file.name,dataTheme:this.excalidrawData.scene.appState.theme,before:"loader.loadSceneFiles",isDark}) l.loadSceneFiles( this.excalidrawData, (files: FileData[], isDark: boolean) => { @@ -864,6 +856,7 @@ export default class ExcalidrawView extends TextFileView { appState: { zenModeEnabled, viewModeEnabled, + linkOpacity: this.plugin.settings.linkOpacity, ...excalidrawData.appState, }, files: excalidrawData.files, @@ -885,6 +878,7 @@ export default class ExcalidrawView extends TextFileView { appState: { zenModeEnabled: om.zenModeEnabled, viewModeEnabled: om.viewModeEnabled, + linkOpacity: this.plugin.settings.linkOpacity, ...excalidrawData.appState, }, files: excalidrawData.files, diff --git a/src/lang/locale/en.ts b/src/lang/locale/en.ts index 2616fec..769d852 100644 --- a/src/lang/locale/en.ts +++ b/src/lang/locale/en.ts @@ -174,6 +174,8 @@ export default { }${FRONTMATTER_KEY_CUSTOM_URL_PREFIX}: "🌐 " to the file's frontmatter.`, HOVERPREVIEW_NAME: "Hover preview without CTRL/CMD key", HOVERPREVIEW_DESC: "Toggle On: Hover preview for [[wiki links]] is shown immedately, without the need to hold the CTRL/CMD key.
Toggle Off: Hover preview is shown only when you hold the CTRL/CMD key while hovering the link.", + LINKOPACITY_NAME: "Opacity of link icon", + LINKOPACITY_DESC: "Opacity of the link indicator icon in the top right corner of an element. 1 is opaque, 0 is transparent.", LINK_CTRL_CLICK_NAME: "CTRL/CMD + CLICK on text with [[links]] or [](links) to open them", LINK_CTRL_CLICK_DESC: diff --git a/src/settings.ts b/src/settings.ts index 05d5556..5b46364 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -35,6 +35,7 @@ export interface ExcalidrawSettings { linkPrefix: string; urlPrefix: string; hoverPreviewWithoutCTRL: boolean; + linkOpacity: number; allowCtrlClick: boolean; //if disabled only the link button in the view header will open links forceWrap: boolean; pageTransclusionCharLimit: number; @@ -94,6 +95,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = { linkPrefix: "📍", urlPrefix: "🌐", hoverPreviewWithoutCTRL: false, + linkOpacity: 1, openInAdjacentPane: false, showLinkBrackets: true, allowCtrlClick: true, @@ -497,6 +499,27 @@ export class ExcalidrawSettingTab extends PluginSettingTab { this.applySettingsUpdate(true); }), ); + + let opacityText: HTMLDivElement; + new Setting(containerEl) + .setName(t("LINKOPACITY_NAME")) + .setDesc(fragWithHTML(t("LINKOPACITY_DESC"))) + .addSlider((slider) => + slider + .setLimits(0, 1, 0.05) + .setValue(this.plugin.settings.linkOpacity) + .onChange(async (value) => { + opacityText.innerText = ` ${value.toString()}`; + this.plugin.settings.linkOpacity = value; + this.applySettingsUpdate(true); + }), + ) + .settingEl.createDiv("", (el) => { + opacityText = el; + el.style.minWidth = "2.3em"; + el.style.textAlign = "right"; + el.innerText = ` ${this.plugin.settings.linkOpacity.toString()}`; + }); new Setting(containerEl) .setName(t("HOVERPREVIEW_NAME")) diff --git a/versions.json b/versions.json index 0bf9cf3..0e01c66 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,4 @@ { - "1.6.5": "0.12.16", + "1.6.6": "0.12.16", "1.4.2": "0.11.13" } diff --git a/yarn.lock b/yarn.lock index 253467f..f895180 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2127,10 +2127,10 @@ "resolved" "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz" "version" "4.2.2" -"@zsviczian/excalidraw@0.10.0-obsidian-45": - "integrity" "sha512-m0RaRTg1jgeDBZCGmYmvKo0GDvGioBZGI+HBamcFGs2ZqN8RYmnetuS6U2RZSqTmKlgr/++1VXqi5vrGkTSzQw==" - "resolved" "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.10.0-obsidian-45.tgz" - "version" "0.10.0-obsidian-45" +"@zsviczian/excalidraw@0.10.0-obsidian-47": + "integrity" "sha512-KdY9jcvhE6XfsPLFowoV/1Qdh9QEGcS4CVu6dBMIkCrNTvFhpHj8aZERtzloaze8XewnqpUZyPGDNIA2CRe8DA==" + "resolved" "https://registry.npmjs.org/@zsviczian/excalidraw/-/excalidraw-0.10.0-obsidian-47.tgz" + "version" "0.10.0-obsidian-47" dependencies: "dotenv" "10.0.0"