From 5c676f06d8d78129444bfb86d36f0eb5f88bbd43 Mon Sep 17 00:00:00 2001 From: FelisDiligens <47528453+FelisDiligens@users.noreply.github.com> Date: Tue, 2 May 2023 09:46:08 +0200 Subject: [PATCH 1/2] Remove iframe border --- src/iframe.css | 8 ++++++++ src/index.ts | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 src/iframe.css diff --git a/src/iframe.css b/src/iframe.css new file mode 100644 index 0000000..bf515db --- /dev/null +++ b/src/iframe.css @@ -0,0 +1,8 @@ +/* + Remove the bottom border for plugin iframes, + such that the tabs can "connect" to the rest of Joplin's UI. +*/ + +iframe { + border-bottom: none !important; +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index d6a94a2..752326b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,6 +23,11 @@ joplin.plugins.register({ // panel const panel = new Panel(tabs, settings); await panel.register(); + // custom CSS (to disable iframe border) + // source: https://github.com/andrejilderda/joplin-macos-native-theme/blob/main/src/index.ts#LL22C5-L22C5 + const installDir = await joplin.plugins.installationDir(); + const cssFilePath = installDir + '/iframe.css'; + await (joplin as any).window.loadChromeCssFile(cssFilePath); //#region HELPERS From 28166a294ceb14b5721c5af3ef44793da2579a81 Mon Sep 17 00:00:00 2001 From: FelisDiligens <47528453+FelisDiligens@users.noreply.github.com> Date: Tue, 2 May 2023 09:48:55 +0200 Subject: [PATCH 2/2] Style tabs to resemble Chrome's --- src/panel.ts | 39 ++++++++++++++++- src/settings.ts | 10 +++-- src/webview.css | 70 +++++++++++++++++++++++++++---- src/webview_auto.css | 8 ++++ src/webview_horizontal_bottom.css | 33 +++++++++++++++ src/webview_vertical.css | 8 ++++ 6 files changed, 153 insertions(+), 15 deletions(-) create mode 100644 src/webview_horizontal_bottom.css diff --git a/src/panel.ts b/src/panel.ts index 648e650..3fc78de 100644 --- a/src/panel.ts +++ b/src/panel.ts @@ -46,6 +46,9 @@ export class Panel { if (this.sets.hasLayoutMode(LayoutMode.Vertical)) { await joplin.views.panels.addScript(this._panel, './webview_vertical.css'); } + if (this.sets.hasLayoutMode(LayoutMode.HorizontalBottom)) { + await joplin.views.panels.addScript(this._panel, './webview_horizontal_bottom.css'); + } await joplin.views.panels.addScript(this._panel, './webview.js'); // message handler @@ -172,6 +175,15 @@ export class Panel { const iconTitle: string = (NoteTabs.isPinned(noteTab)) ? 'Unpin' : 'Pin'; const textDecoration: string = (note.is_todo && note.todo_completed) ? 'line-through' : ''; + // prepare tab style CSS + const tabStyle = ` + height: ${this.sets.tabHeight}px; + min-width: ${this.sets.minTabWidth}px; + max-width: ${this.sets.maxTabWidth}px; + border-color: ${this.sets.dividerColor}; + background: ${bg}; + `.replace(/[\n\s]+/g, ""); // remove whitespace + // prepare checkbox for todo let checkboxHtml: string = ''; if (this.sets.showTodoCheckboxes && note.is_todo) { @@ -182,7 +194,7 @@ export class Panel {