@jhits/plugin-content 0.0.15 → 0.0.18

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.
Files changed (45) hide show
  1. package/dist/api/files.d.ts +27 -0
  2. package/dist/api/files.d.ts.map +1 -0
  3. package/dist/api/files.js +159 -0
  4. package/dist/api/handler.d.ts +4 -0
  5. package/dist/api/handler.d.ts.map +1 -1
  6. package/dist/api/links.d.ts +23 -0
  7. package/dist/api/links.d.ts.map +1 -0
  8. package/dist/api/links.js +75 -0
  9. package/dist/api/router.d.ts +6 -0
  10. package/dist/api/router.d.ts.map +1 -1
  11. package/dist/api/router.js +32 -4
  12. package/dist/components/DynamicLink.d.ts +28 -0
  13. package/dist/components/DynamicLink.d.ts.map +1 -0
  14. package/dist/components/DynamicLink.js +62 -0
  15. package/dist/components/LinkSettingsModal.d.ts +22 -0
  16. package/dist/components/LinkSettingsModal.d.ts.map +1 -0
  17. package/dist/components/LinkSettingsModal.js +172 -0
  18. package/dist/components/TranslationEditor.d.ts +3 -1
  19. package/dist/components/TranslationEditor.d.ts.map +1 -1
  20. package/dist/components/TranslationEditor.js +11 -5
  21. package/dist/hooks/useLinks.d.ts +23 -0
  22. package/dist/hooks/useLinks.d.ts.map +1 -0
  23. package/dist/hooks/useLinks.js +56 -0
  24. package/dist/index.d.ts +7 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +10 -8
  27. package/dist/views/LinkManager/LinkManager.d.ts +9 -0
  28. package/dist/views/LinkManager/LinkManager.d.ts.map +1 -0
  29. package/dist/views/LinkManager/LinkManager.js +90 -0
  30. package/dist/views/MediaManager/MediaManager.d.ts +8 -0
  31. package/dist/views/MediaManager/MediaManager.d.ts.map +1 -0
  32. package/dist/views/MediaManager/MediaManager.js +93 -0
  33. package/dist/views/index.d.ts +10 -0
  34. package/dist/views/index.d.ts.map +1 -0
  35. package/dist/views/index.js +22 -0
  36. package/package.json +1 -1
  37. package/src/api/files.ts +192 -0
  38. package/src/api/handler.ts +2 -0
  39. package/src/api/links.ts +107 -0
  40. package/src/api/router.ts +37 -8
  41. package/src/components/DynamicLink.tsx +152 -0
  42. package/src/components/LinkSettingsModal.tsx +442 -0
  43. package/src/components/TranslationEditor.tsx +18 -7
  44. package/src/hooks/useLinks.ts +75 -0
  45. package/src/index.tsx +40 -9
package/src/index.tsx CHANGED
@@ -16,12 +16,31 @@ export interface ContentPluginProps {
16
16
  locale?: string;
17
17
  /** Messages object - can be passed explicitly or will be fetched from context */
18
18
  messages?: Record<string, any>;
19
+ /** API base URL for the dashboard */
20
+ apiBaseUrl?: string;
21
+ /** Site identifier for multi-tenant setups */
22
+ siteId?: string;
19
23
  }
20
24
 
21
- function ContentPluginWithIntl({ locale, messages }: { locale: string; messages: Record<string, any> }) {
25
+ function ContentPluginWithIntl({
26
+ locale,
27
+ messages,
28
+ apiBaseUrl,
29
+ siteId
30
+ }: {
31
+ locale: string;
32
+ messages: Record<string, any>;
33
+ apiBaseUrl?: string;
34
+ siteId?: string;
35
+ }) {
22
36
  return (
23
37
  <Suspense fallback={null}>
24
- <TranslationEditor messages={messages} locale={locale} />
38
+ <TranslationEditor
39
+ messages={messages}
40
+ locale={locale}
41
+ apiBaseUrl={apiBaseUrl}
42
+ siteId={siteId}
43
+ />
25
44
  </Suspense>
26
45
  );
27
46
  }
@@ -40,28 +59,34 @@ function ClientOnly({ children }: { children: React.ReactNode }) {
40
59
  * Content Plugin Component
41
60
  * Renders the translation editor for editing website content
42
61
  */
43
- export default function ContentPlugin({ enabled = true, locale, messages }: ContentPluginProps) {
62
+ export default function ContentPlugin(props: ContentPluginProps) {
63
+ const { enabled = true, locale, messages, apiBaseUrl, siteId = 'default' } = props;
64
+
44
65
  if (!enabled) return null;
45
66
 
46
67
  // If locale and messages are provided as props, use them directly
47
68
  if (locale && messages) {
48
69
  return (
49
70
  <ClientOnly>
50
- <ContentPluginWithIntl locale={locale} messages={messages} />
71
+ <ContentPluginWithIntl
72
+ locale={locale}
73
+ messages={messages}
74
+ apiBaseUrl={apiBaseUrl}
75
+ siteId={siteId}
76
+ />
51
77
  </ClientOnly>
52
78
  );
53
79
  }
54
80
 
55
81
  // Otherwise, try to use context (for backward compatibility)
56
- // This path might have issues with context not being found
57
82
  return (
58
83
  <ClientOnly>
59
- <ContentPluginWithIntlFallback />
84
+ <ContentPluginWithIntlFallback apiBaseUrl={apiBaseUrl} siteId={siteId} />
60
85
  </ClientOnly>
61
86
  );
62
87
  }
63
88
 
64
- function ContentPluginWithIntlFallback() {
89
+ function ContentPluginWithIntlFallback({ apiBaseUrl, siteId }: { apiBaseUrl?: string; siteId?: string }) {
65
90
  // Dynamic import to avoid SSR issues with next-intl hooks
66
91
  const { useMessages, useLocale, NextIntlClientProvider } = require('next-intl');
67
92
  const messages = useMessages();
@@ -70,7 +95,12 @@ function ContentPluginWithIntlFallback() {
70
95
  return (
71
96
  <NextIntlClientProvider locale={locale} messages={messages}>
72
97
  <Suspense fallback={null}>
73
- <TranslationEditor messages={messages} locale={locale} />
98
+ <TranslationEditor
99
+ messages={messages}
100
+ locale={locale}
101
+ apiBaseUrl={apiBaseUrl}
102
+ siteId={siteId}
103
+ />
74
104
  </Suspense>
75
105
  </NextIntlClientProvider>
76
106
  );
@@ -84,6 +114,7 @@ export { default as MultilineText } from './components/MultilineText';
84
114
  export type { MultilineTextProps } from './components/MultilineText';
85
115
  export { default as ParsedText } from './components/ParsedText';
86
116
  export type { ParsedTextProps } from './components/ParsedText';
117
+ export { DynamicLink } from './components/DynamicLink';
87
118
  export type { TranslationEditorProps } from './components/TranslationEditor';
88
119
 
89
120
  // Export context
@@ -93,6 +124,7 @@ export type { ParserConfigProviderProps } from './context/ParserConfigContext';
93
124
  // Export hooks
94
125
  export { useParse } from './hooks/useParse';
95
126
  export { useLocaleSync } from './hooks/useLocaleSync';
127
+ export { useLinks } from './hooks/useLinks';
96
128
 
97
129
  // Export utilities
98
130
  // Note: parse() is a client-only function. Use ParsedText component in server components.
@@ -104,4 +136,3 @@ export type { ParserConfig, FormatStyle } from './utils/parser-config';
104
136
 
105
137
  // Note: API handlers are server-only and exported from ./index.ts (server entry point)
106
138
  // They are NOT exported here to prevent client/server context mixing
107
-