notes-to-strapi-export-article-ai 3.0.171 → 3.0.172
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/src/main.ts +2 -1
- package/src/services/frontmatter.ts +10 -5
- package/src/settings/UnifiedSettingsTab.ts +2 -3
- package/src/utils/preview-modal.ts +11 -3
package/manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "notes-to-strapi-export-article-ai",
|
|
3
3
|
"name": "Strapi Exporter AI",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.172",
|
|
5
5
|
"minAppVersion": "1.7.0",
|
|
6
6
|
"description": "Effortlessly export your notes to Strapi CMS with AI-powered handling and SEO optimization.",
|
|
7
7
|
"author": "Cinquin Andy",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "notes-to-strapi-export-article-ai",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.172",
|
|
4
4
|
"description": "Effortlessly export your Obsidian notes to Strapi CMS with AI-powered image handling and SEO optimization. Replace all the images in your notes by uploaded images in Strapi, and add SEO metadata to uploaded images.",
|
|
5
5
|
"main": "main.js",
|
|
6
6
|
"scripts": {
|
package/src/main.ts
CHANGED
|
@@ -38,13 +38,16 @@ interface GeneratedConfig {
|
|
|
38
38
|
export class FrontmatterGenerator {
|
|
39
39
|
private model
|
|
40
40
|
private plugin: StrapiExporterPlugin
|
|
41
|
+
private routeId: string
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
|
-
* Initialize the generator with the plugin instance
|
|
44
|
+
* Initialize the generator with the plugin instance and specific route
|
|
44
45
|
* @param plugin - The Strapi Exporter plugin instance
|
|
46
|
+
* @param routeId - The ID of the route to use for generation
|
|
45
47
|
*/
|
|
46
|
-
constructor(plugin: StrapiExporterPlugin) {
|
|
48
|
+
constructor(plugin: StrapiExporterPlugin, routeId: string) {
|
|
47
49
|
this.plugin = plugin
|
|
50
|
+
this.routeId = routeId
|
|
48
51
|
const openai = createOpenAI({
|
|
49
52
|
apiKey: this.plugin.settings.openaiApiKey,
|
|
50
53
|
})
|
|
@@ -285,11 +288,13 @@ Return complete YAML frontmatter with opening and closing "---" markers.`
|
|
|
285
288
|
}
|
|
286
289
|
|
|
287
290
|
/**
|
|
288
|
-
* Gets the
|
|
289
|
-
*
|
|
291
|
+
* Gets the route for this generator instance
|
|
292
|
+
* Uses the routeId passed in constructor
|
|
293
|
+
* @returns The route configuration or undefined
|
|
290
294
|
*/
|
|
291
295
|
private getCurrentRoute(): RouteConfig | undefined {
|
|
292
|
-
|
|
296
|
+
// Use the route ID passed to this generator
|
|
297
|
+
return this.plugin.settings.routes.find(route => route.id === this.routeId)
|
|
293
298
|
}
|
|
294
299
|
|
|
295
300
|
/**
|
|
@@ -162,9 +162,8 @@ export class UnifiedSettingsTab extends PluginSettingTab {
|
|
|
162
162
|
this.contentContainer.empty()
|
|
163
163
|
const currentTab = this.plugin.settings.currentTab
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
165
|
+
// Always reinitialize component to ensure fresh container reference
|
|
166
|
+
this.initializeComponent(currentTab)
|
|
168
167
|
|
|
169
168
|
this.components[currentTab]?.display()
|
|
170
169
|
} catch (error) {
|
|
@@ -6,6 +6,7 @@ import StrapiExporterPlugin from '../main'
|
|
|
6
6
|
export class PreviewModal extends Modal {
|
|
7
7
|
private content: AnalyzedContent
|
|
8
8
|
private plugin: StrapiExporterPlugin
|
|
9
|
+
private routeId: string
|
|
9
10
|
private onConfirm: () => void
|
|
10
11
|
private onCancel: () => void
|
|
11
12
|
private frontmatterGenerator: FrontmatterGenerator
|
|
@@ -14,17 +15,22 @@ export class PreviewModal extends Modal {
|
|
|
14
15
|
app: App,
|
|
15
16
|
content: AnalyzedContent,
|
|
16
17
|
plugin: StrapiExporterPlugin,
|
|
18
|
+
routeId: string,
|
|
17
19
|
onConfirm: () => void,
|
|
18
20
|
onCancel?: () => void
|
|
19
21
|
) {
|
|
20
22
|
super(app)
|
|
21
23
|
this.plugin = plugin
|
|
22
24
|
this.content = content
|
|
25
|
+
this.routeId = routeId
|
|
23
26
|
this.onConfirm = onConfirm
|
|
24
27
|
this.onCancel = onCancel || (() => {})
|
|
25
28
|
|
|
26
|
-
// Initialize with plugin instance
|
|
27
|
-
this.frontmatterGenerator = new FrontmatterGenerator(
|
|
29
|
+
// Initialize with plugin instance and route ID
|
|
30
|
+
this.frontmatterGenerator = new FrontmatterGenerator(
|
|
31
|
+
this.plugin,
|
|
32
|
+
this.routeId
|
|
33
|
+
)
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
onOpen() {
|
|
@@ -247,13 +253,15 @@ export class PreviewModal extends Modal {
|
|
|
247
253
|
export function showPreviewToUser(
|
|
248
254
|
app: App,
|
|
249
255
|
content: AnalyzedContent,
|
|
250
|
-
plugin: StrapiExporterPlugin
|
|
256
|
+
plugin: StrapiExporterPlugin,
|
|
257
|
+
routeId: string
|
|
251
258
|
): Promise<boolean> {
|
|
252
259
|
return new Promise(resolve => {
|
|
253
260
|
new PreviewModal(
|
|
254
261
|
app,
|
|
255
262
|
content,
|
|
256
263
|
plugin,
|
|
264
|
+
routeId,
|
|
257
265
|
() => {
|
|
258
266
|
resolve(true)
|
|
259
267
|
},
|