feat - added callout qoute collapsible setting;
Feat - added show full suggestion setting;
This commit is contained in:
@@ -81,6 +81,23 @@ export const SETTINGS_LABELS: SettingsLabels = {
|
||||
description:
|
||||
'Ob Sie den Verweis auf die Passage in Ihrer Tresorbibel verlinken möchten.',
|
||||
},
|
||||
collapsible: {
|
||||
name: 'Zusammenklappbar',
|
||||
description:
|
||||
'Ob der für die Passage zu verwendende Hinweis einklappbar ist.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
suggestionFormat: {
|
||||
name: 'Einstellungen für das Vorschlagsformat',
|
||||
description: 'Einstellungen für das Format des Hinweistextes.',
|
||||
controls: {
|
||||
full: {
|
||||
name: 'Vollständiger Vorschlag',
|
||||
description:
|
||||
'Ob der für die Passage vorgeschlagene Hinweis vollständig ist.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -79,6 +79,24 @@ export const SETTINGS_LABELS: SettingsLabels = {
|
||||
description:
|
||||
'Whether to link the reference to the passage in your vault Bible.',
|
||||
},
|
||||
collapsible: {
|
||||
name: 'Collapsible',
|
||||
description:
|
||||
'Whether the callout to use for the passage is collapsible.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
suggestionFormat: {
|
||||
name: 'Suggestion Format Settings',
|
||||
description: 'Settings for the callout suggestion passage format.',
|
||||
controls: {
|
||||
full: {
|
||||
name: 'Full Suggestion',
|
||||
description:
|
||||
'Whether the callout suggestion to use for the passage is full.',
|
||||
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -76,6 +76,23 @@ export const SETTINGS_LABELS: SettingsLabels = {
|
||||
name: '통로 바로가기',
|
||||
description: '보관된 성경의 해당 구절에 참조를 연결할지 여부.',
|
||||
},
|
||||
collapsible: {
|
||||
name: '접을 수 있는',
|
||||
description:
|
||||
'해당 구절에 사용할 콜아웃이 접을 수 있는지 여부.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
suggestionFormat: {
|
||||
name: '제안 형식 설정',
|
||||
description: '콜아웃 제안 문구 형식에 대한 설정입니다.',
|
||||
controls: {
|
||||
full: {
|
||||
name: '전체 제안',
|
||||
description:
|
||||
'본문에 사용할 콜아웃 제안이 완전한지 여부.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -57,6 +57,15 @@ export interface SettingsLabels {
|
||||
controls: {
|
||||
calloutType: Control;
|
||||
linkToPassage: Control;
|
||||
collapsible: Control;
|
||||
};
|
||||
};
|
||||
|
||||
suggestionFormat: {
|
||||
name: string;
|
||||
description: string;
|
||||
controls: {
|
||||
full: Control;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
|
||||
display(): void {
|
||||
const { containerEl } = this;
|
||||
const { required, optional, quoteFormat, calloutFormat, issues } =
|
||||
const { required, optional, quoteFormat, calloutFormat, suggestionFormat, issues } =
|
||||
this.settingsLabels;
|
||||
containerEl.empty();
|
||||
|
||||
@@ -210,6 +210,7 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
quoteRefLinkSetting.settingEl.addClass(this.hiddenClass);
|
||||
}
|
||||
|
||||
// callout format
|
||||
new Setting(containerEl)
|
||||
.setName(calloutFormat.name)
|
||||
.setDesc(calloutFormat.description)
|
||||
@@ -254,6 +255,36 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName(calloutFormat.controls.collapsible.name)
|
||||
.setDesc(calloutFormat.controls.collapsible.description)
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(this.plugin.settings.callout.collapsible)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.callout.collapsible = value;
|
||||
await this.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
|
||||
//suggestion format
|
||||
new Setting(containerEl)
|
||||
.setName(suggestionFormat.name)
|
||||
.setDesc(suggestionFormat.description)
|
||||
.setHeading();
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName(suggestionFormat.controls.full.name)
|
||||
.setDesc(suggestionFormat.controls.full.description)
|
||||
.addToggle((toggle) =>
|
||||
toggle
|
||||
.setValue(this.plugin.settings.fullSuggestion)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.fullSuggestion = value;
|
||||
await this.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
|
||||
const issuesLink = document.createElement('a');
|
||||
issuesLink.href = 'https://github.com/camelChief/local-bible-ref/issues';
|
||||
issuesLink.textContent = issues.link;
|
||||
|
||||
@@ -295,16 +295,26 @@ export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
|
||||
|
||||
/** Generates an excerpt for the suggestion. */
|
||||
private generateExcerpt(text: string): string {
|
||||
text = text.split(/<\/sup>/, 2)[1];
|
||||
text = text.replace(/<sup>\d+<\/sup>/g, '');
|
||||
text = text.replace(/^(?:> |- )/gm, '');
|
||||
if(this.settings.fullSuggestion){
|
||||
text = text.replace(/(?:<sup>)/g, "");
|
||||
text = text.replace(/(?:<\/sup>)/g, "");
|
||||
}
|
||||
else{
|
||||
text = text.split(/<\/sup>/, 2)[1];
|
||||
text = text.replace(/<sup>\d+<\/sup>/g, "");
|
||||
text = text.replace(/^(?:> |- )/gm, "");
|
||||
}
|
||||
|
||||
text = text.replace(
|
||||
/<span(?:\s+\w+=['"][^'"]+['"])*>([^<]+)<\/span>/g,
|
||||
'$1'
|
||||
"$1"
|
||||
);
|
||||
text = text.replace(/\n/g, ' ');
|
||||
text = text.replace(/ {2,}/g, ' ');
|
||||
return text.slice(0, 45) + '...';
|
||||
if(!this.settings.fullSuggestion)
|
||||
text = text.replace(/\n/g, ' ');
|
||||
text = text.replace(/ {2,}/g, " ");
|
||||
if (this.settings.fullSuggestion)
|
||||
return text;
|
||||
return text.slice(0, 45) + "...";
|
||||
}
|
||||
|
||||
/** Formats the final text for suggestion. */
|
||||
@@ -358,8 +368,9 @@ export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
|
||||
if (linkToPassage)
|
||||
stringRef = this.generatePassageLink(passageRef, context);
|
||||
else stringRef = passageRef.stringify();
|
||||
formatted = `> [!quote]${this.settings.callout.collapsible? '+' : ''} ${stringRef}\n`;
|
||||
|
||||
formatted = `> [!${type}] ${stringRef}\n`;
|
||||
formatted = `> [!${type}]${this.settings.callout.collapsible? '+' : ''} ${stringRef}\n`;
|
||||
formatted += texts.join('\n\n').trim();
|
||||
formatted = formatted.replace(/\n/gm, '\n> ');
|
||||
formatted += '\n\n';
|
||||
|
||||
@@ -14,7 +14,9 @@ export default interface LocalBibleRefSettings {
|
||||
callout: {
|
||||
type: CalloutType;
|
||||
linkToPassage: boolean;
|
||||
collapsible: boolean;
|
||||
};
|
||||
fullSuggestion: boolean;
|
||||
}
|
||||
|
||||
export enum QuoteReferencePosition {
|
||||
|
||||
Reference in New Issue
Block a user