Skip to content

Commit 657b81a

Browse files
committed
Fixes for PR:
- adds relationship lines toggle - removes default css artifacts from template - Change slider title to Folder from Checkbox
1 parent 5234f0f commit 657b81a

File tree

4 files changed

+42
-59
lines changed

4 files changed

+42
-59
lines changed

src/@types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export interface FolderSnippetConfig extends SnippetConfig {
101101
hideScrollbar: boolean;
102102
hideTypes: boolean;
103103
hoverDecoration: boolean;
104+
relationshipLines: boolean;
104105
}
105106

106107
declare module "obsidian" {

src/snippetor-CreateFoldersModal.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,14 @@ class CreateFolderModal extends Modal {
161161
this.showFolders(folderEl);
162162
});
163163
});
164+
new Setting(content)
165+
.setName("Show relationship lines")
166+
.addToggle((t) => {
167+
t.setValue(this.cfg.relationshipLines).onChange((v) => {
168+
this.cfg.relationshipLines = v;
169+
this.showFolders(folderEl);
170+
});
171+
});
164172
new Setting(content)
165173
.setName("Show folder icon")
166174
.setDesc("A folder icon will be shown before folder names")
@@ -206,6 +214,7 @@ class CreateFolderModal extends Modal {
206214
Reflect.deleteProperty(this.cfg.default, "cache");
207215
}
208216
this.cfg.folders.forEach((ts) => Reflect.deleteProperty(ts, "cache"));
217+
this.cfg.folders = this.cfg.folders.filter(f => f.target && f.target.length);
209218
// make sure a name is set
210219
this.snippetor.initCommonConfig(this.cfg);
211220
}
@@ -239,7 +248,7 @@ class CreateFolderModal extends Modal {
239248
this.showFolders(folderEl);
240249
}
241250
});
242-
roundness.sliderEl.title = "Checkbox roundness";
251+
roundness.sliderEl.title = "Folder roundness";
243252
roundness.sliderEl.name = "snippetor-border-radius";
244253

245254
this.helper.createThemeToggleComponent(settingActions, () =>

src/snippetor-Defaults.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const DEFAULT_FOLDER_SNIPPET_SETTINGS: Partial<FolderSnippetConfig> = {
3030
hideCollapse: false,
3131
hideScrollbar: true,
3232
hideTypes: true,
33+
relationshipLines: true,
3334
default: {
3435
cache: {
3536
folderEl: null,

src/templates/COLORED_FOLDER.eta

Lines changed: 30 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ function defineColors(i, folder) {
3434
function folderSettings(i, folder) {
3535
%>
3636

37-
.nav-folder.mod-root {
38-
--<%~ root %>-border-radius: <%= it.cfg.borderRadius %>px;
39-
}
40-
4137
/** Folder
4238
The Folder Name is stored in the data-path attribute.
4339
[data-path^="<%~ folder.target %>"] targets a path that *begins with* the content.
@@ -201,78 +197,54 @@ body:not(.is-grabbing) .workspace-leaf-content[data-type="file-explorer"] .nav-f
201197
min-width: unset; /* Blue Topaz */
202198
}
203199

204-
<%
205-
} //end folderSettings
206-
%>
207-
208-
<% if (it.cfg.hideScrollbar) { %>
209-
210-
/** Scrollbars eliminated */
211-
.workspace-leaf-content[data-type="file-explorer"] ::-webkit-scrollbar {
212-
width: 0px;
213-
height: 0px;
214-
}
215-
216-
<% } %>
217-
218-
219-
220-
/** Grid */
221-
.workspace-leaf-content[data-type="file-explorer"] .nav-folder.mod-root > .nav-folder-children {
222-
display: grid;
223-
gap: 7px;
224-
grid-auto-rows: max-content;
225-
grid-auto-columns: 100%;
200+
/** Hide Overflowing Text */
201+
.workspace-leaf-content[data-type="file-explorer"]
202+
.nav-folder-title[data-path^="<%~ folder.target %>"]
203+
.nav-folder-title-content,
204+
.workspace-leaf-content[data-type="file-explorer"]
205+
.nav-folder-title[data-path^="<%~ folder.target %>"] + .nav-folder-children .nav-file-title,
206+
.workspace-leaf-content[data-type="file-explorer"]
207+
.nav-folder-title[data-path^="<%~ folder.target %>"] + .nav-folder-children .nav-file-title-content {
208+
overflow-x: hidden;
209+
overflow-y: hidden;
210+
text-overflow: ellipsis;
211+
white-space: nowrap;
212+
word-wrap: break-word;
213+
width: 100%;
226214
}
227215

228-
.workspace-leaf-content[data-type="file-explorer"] .nav-folder.mod-root
229-
> .nav-folder-children
230-
> .nav-folder
231-
> .nav-folder-title
232-
+ .nav-folder-children
233-
> .nav-file:last-child {
234-
border-right: 1px solid var(--<%~ root %>-folder-background);
235-
border-left: 1px solid var(--<%~ root %>-folder-background);
236-
border-bottom: 1px solid var(--<%~ root %>-folder-background);
237-
border-bottom-left-radius: var(--<%~ root %>-border-radius);
238-
border-bottom-right-radius: var(--<%~ root %>-border-radius);
239-
padding-bottom: 1px;
240-
}
216+
<% if (it.cfg.relationshipLines) { %>
241217

242218
/** Relationship lines */
243-
.workspace-leaf-content[data-type="file-explorer"] .nav-folder.mod-root
244-
> .nav-folder-children
219+
.workspace-leaf-content[data-type="file-explorer"] .nav-folder-title[data-path^="<%~ folder.target %>"] + .nav-folder-children
245220
> .nav-folder
246221
> .nav-folder-children
247-
.nav-folder
248222
.nav-file {
249223
border-left: 2px solid white;
250224
}
251-
.workspace-leaf-content[data-type="file-explorer"] .nav-folder.mod-root
252-
> .nav-folder-children
225+
.workspace-leaf-content[data-type="file-explorer"] .nav-folder-title[data-path^="<%~ folder.target %>"] + .nav-folder-children
253226
> .nav-folder
254227
> .nav-folder-children
255-
.nav-folder
256228
.nav-folder {
257229
border-left: 2px solid white;
258230
}
259231

260-
/** Animations */
261-
.workspace-leaf-content[data-type="file-explorer"] .nav-folder-title {
262-
font-weight: bold;
263-
}
232+
<% } %>
264233

265-
/** Set Active File to Permanent */
266-
.workspace-leaf-content[data-type="file-explorer"] .nav-file.is-active > .nav-file-title,
267-
.workspace-leaf-content[data-type="file-explorer"] .nav-file.is-active > .nav-file-title:hover {
268-
background-color: var(--background-primary);
269-
font-weight: bold;
270-
border-left: 2px solid var(--text-accent);
271-
transition-duration: 0.25s;
272-
transition-timing-function: ease;
273-
transition-property: background-color, color;
234+
<%
235+
} //end folderSettings
236+
%>
237+
238+
<% if (it.cfg.hideScrollbar) { %>
239+
240+
/** Scrollbars eliminated */
241+
.workspace-leaf-content[data-type="file-explorer"] ::-webkit-scrollbar {
242+
width: 0px;
243+
height: 0px;
274244
}
275245

246+
<% } %>
247+
276248
<%
277249

278250
for (let i = 0; i<it.cfg.folders.length; i++) {

0 commit comments

Comments
 (0)