Merge pull request #9 from tech-reclipped/export-option-channel-and-platform

add new setting to toggle create channel and platform folder and files
This commit is contained in:
ReClipped 2024-10-18 18:20:06 +05:30 committed by GitHub
commit 8078785d16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 28 additions and 13 deletions

View file

@ -1,10 +0,0 @@
# top-most EditorConfig file
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4
tab_width = 4

1
.gitignore vendored
View file

@ -15,6 +15,7 @@ package-lock.json
# JetBrains IDE
.idea/
.editorconfig
# Unit test reports
TEST*.xml

View file

@ -1,7 +1,7 @@
{
"id": "reclipped-official",
"name": "ReClipped Official",
"version": "1.0.3",
"version": "1.0.4",
"minAppVersion": "0.12.10",
"description": "Official ReClipped and Obsidian integration",
"author": "ReClipped",

View file

@ -1,6 +1,6 @@
{
"name": "reclipped-official",
"version": "1.0.0",
"version": "1.0.4",
"description": "Automatically syncs your ReClipped annotations with Obsidian.",
"main": "main.js",
"scripts": {

View file

@ -69,6 +69,7 @@ interface ReclippedPluginSettings {
isSyncing: boolean;
frequency: string;
triggerOnLoad: boolean;
createCPFolders: boolean;
lastSyncFailed: boolean;
lastSyncedTimeEpoch: number;
refreshVideos: boolean,
@ -90,6 +91,7 @@ const DEFAULT_SETTINGS: ReclippedPluginSettings = {
reclippedDir: "ReClipped",
frequency: "0", // manual by default
triggerOnLoad: true,
createCPFolders: true,
isSyncing: false,
lastSyncFailed: false,
lastSyncedTimeEpoch: 0,
@ -311,7 +313,9 @@ export default class ReclippedPlugin extends Plugin {
this.notice(`Saving file ${cleanedFileName}`, false, 30);
const processedFileName = normalizePath(this.settings.reclippedDir + '/' + cleanedFileName + '.md');
try {
await this.createChannelPlatformConnections(channelDict, platform, this.fs);
if (this.settings.createCPFolders) {
await this.createChannelPlatformConnections(channelDict, platform, this.fs);
}
// write the actual files
const contentToSave = json.annotations;
let originalName = processedFileName;
@ -812,9 +816,26 @@ class ReclippedSettingTab extends PluginSettingTab {
await this.plugin.saveSettings();
}));
new Setting(containerEl)
.setName("Create Platform and Channel folders")
.setDesc("If enabled, ReClipped will create Platform and Channel folders")
.addToggle((toggle) => {
toggle.setValue(this.plugin.settings.createCPFolders);
toggle.onChange((val) => {
this.plugin.settings.createCPFolders = val;
this.plugin.saveSettings();
if (val){
containerEl.getElementsByClassName("cp_folder")[0].removeAttribute("style");
} else {
containerEl.getElementsByClassName("cp_folder")[0].setAttribute("style", "display:none");
}
});
});
new Setting(containerEl)
.setName("Customize Channel and Platform folder")
.setDesc("Plugin will use /Channels, and /Platforms folder respectively by default ")
.setClass("cp_folder")
.addButton((button) => {
button.setButtonText("Customize").onClick(() => {
window.open(`${baseURL}/account/sync_obsidian`);
@ -899,6 +920,9 @@ class ReclippedSettingTab extends PluginSettingTab {
let el = containerEl.createEl("div", {cls: "rc-info-container"});
containerEl.find(".rc-setting-connect > .setting-item-control ").prepend(el);
}
if (!this.plugin.settings.createCPFolders){
containerEl.getElementsByClassName("cp_folder")[0].setAttribute("style", "display:none");
}
const help = containerEl.createEl('p', {text: "Question? Please see our "});
help.createEl('a', {text: "Documentation", href:"https://blog.reclipped.com/"});
help.createEl('span', {text:" or email us at "});