@airoom/nextmin-react 1.4.2 → 1.4.3
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.
|
@@ -287,7 +287,7 @@ export const TiptapEditor = ({ value, onChange, className, placeholder = 'Start
|
|
|
287
287
|
editor.chain().focus().insertContent(`<p class="text-red-500">Error loading data for ${selectedSchema.modelName}</p>`).run();
|
|
288
288
|
}
|
|
289
289
|
};
|
|
290
|
-
const handleDistrictGridInsert = async ({ districts, baseType, specialitySlug }) => {
|
|
290
|
+
const handleDistrictGridInsert = async ({ districts, baseType, specialitySlug, specialityName }) => {
|
|
291
291
|
if (!editor || districts.length === 0)
|
|
292
292
|
return;
|
|
293
293
|
try {
|
|
@@ -310,8 +310,11 @@ export const TiptapEditor = ({ value, onChange, className, placeholder = 'Start
|
|
|
310
310
|
urlParts.push(specialitySlug);
|
|
311
311
|
}
|
|
312
312
|
const url = urlParts.join('/');
|
|
313
|
-
|
|
314
|
-
|
|
313
|
+
// Format: "Speciality Name in District Name" or just "District Name" if no speciality
|
|
314
|
+
const displayText = specialityName
|
|
315
|
+
? `${specialityName} in ${district.name}`
|
|
316
|
+
: district.name;
|
|
317
|
+
html += `<div data-type="grid-item" href="${url}"><p>${displayText}</p></div>`;
|
|
315
318
|
});
|
|
316
319
|
html += `</div>`;
|
|
317
320
|
// Insert spacing first, then grid
|
|
@@ -11,6 +11,7 @@ export const DistrictGridModal = ({ isOpen, onClose, onInsert, currentSpeciality
|
|
|
11
11
|
const [selectedDistricts, setSelectedDistricts] = useState([]);
|
|
12
12
|
const [selectedSpecialityId, setSelectedSpecialityId] = useState('');
|
|
13
13
|
const [specialitySlug, setSpecialitySlug] = useState('');
|
|
14
|
+
const [specialityName, setSpecialityName] = useState('');
|
|
14
15
|
// Fetch speciality data when ID changes
|
|
15
16
|
useEffect(() => {
|
|
16
17
|
if (!selectedSpecialityId) {
|
|
@@ -22,10 +23,12 @@ export const DistrictGridModal = ({ isOpen, onClose, onInsert, currentSpeciality
|
|
|
22
23
|
const res = await api.get('Specialities', selectedSpecialityId);
|
|
23
24
|
const speciality = res.data || res;
|
|
24
25
|
setSpecialitySlug(speciality?.slug || '');
|
|
26
|
+
setSpecialityName(speciality?.name || '');
|
|
25
27
|
}
|
|
26
28
|
catch (err) {
|
|
27
29
|
console.error('Failed to fetch speciality:', err);
|
|
28
30
|
setSpecialitySlug('');
|
|
31
|
+
setSpecialityName('');
|
|
29
32
|
}
|
|
30
33
|
};
|
|
31
34
|
fetchSpeciality();
|
|
@@ -34,7 +37,8 @@ export const DistrictGridModal = ({ isOpen, onClose, onInsert, currentSpeciality
|
|
|
34
37
|
onInsert({
|
|
35
38
|
districts: selectedDistricts,
|
|
36
39
|
baseType,
|
|
37
|
-
specialitySlug: specialitySlug
|
|
40
|
+
specialitySlug: specialitySlug,
|
|
41
|
+
specialityName: specialityName
|
|
38
42
|
});
|
|
39
43
|
onClose();
|
|
40
44
|
// Reset state after a short delay
|
|
@@ -43,6 +47,7 @@ export const DistrictGridModal = ({ isOpen, onClose, onInsert, currentSpeciality
|
|
|
43
47
|
setSelectedDistricts([]);
|
|
44
48
|
setSelectedSpecialityId('');
|
|
45
49
|
setSpecialitySlug('');
|
|
50
|
+
setSpecialityName('');
|
|
46
51
|
}, 200);
|
|
47
52
|
};
|
|
48
53
|
const baseFrontendUrl = process.env.NEXT_PUBLIC_FRONTEND_URL || '';
|
|
@@ -5,11 +5,5 @@ import { cn } from '../../../lib/utils';
|
|
|
5
5
|
export const ImageBubbleMenu = ({ editor }) => {
|
|
6
6
|
if (!editor)
|
|
7
7
|
return null;
|
|
8
|
-
return (_jsxs(BubbleMenu, { editor: editor, pluginKey: "imageBubbleMenu", shouldShow: ({ editor }) => editor.isActive('image'),
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
tippyOptions: {
|
|
11
|
-
duration: 100,
|
|
12
|
-
zIndex: 99, // Ensure it sits above other elements
|
|
13
|
-
maxWidth: 'none',
|
|
14
|
-
}, className: "flex items-center gap-1 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-gray-700 shadow-lg p-1 rounded-lg z-50", children: [_jsx("button", { type: "button", onClick: () => editor.chain().focus().updateAttributes('image', { width: '100%', height: null }).run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200", editor.getAttributes('image').width === '100%' && "bg-gray-200 dark:bg-gray-600"), title: "Full Width", children: _jsx(StretchHorizontal, { size: 16 }) }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().updateAttributes('image', { width: null, height: null }).run(), className: "p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200", title: "Original Size", children: _jsx(Minimize, { size: 16 }) }), _jsx("div", { className: "w-[1px] h-4 bg-gray-300 dark:bg-gray-600 mx-1" }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().setTextAlign('left').run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200", editor.isActive({ textAlign: 'left' }) && "bg-gray-200 dark:bg-gray-600"), title: "Align Left", children: _jsx(AlignLeft, { size: 16 }) }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().setTextAlign('center').run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200", editor.isActive({ textAlign: 'center' }) && "bg-gray-200 dark:bg-gray-600"), title: "Align Center", children: _jsx(AlignCenter, { size: 16 }) }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().setTextAlign('right').run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200", editor.isActive({ textAlign: 'right' }) && "bg-gray-200 dark:bg-gray-600"), title: "Align Right", children: _jsx(AlignRight, { size: 16 }) }), _jsx("div", { className: "w-[1px] h-4 bg-gray-300 dark:bg-gray-600 mx-1" }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().updateAttributes('image', { objectFit: 'contain' }).run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200 text-xs font-medium", editor.getAttributes('image').objectFit === 'contain' && "bg-gray-200 dark:bg-gray-600"), title: "Contain", children: "Fit" }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().updateAttributes('image', { objectFit: 'cover' }).run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200 text-xs font-medium", editor.getAttributes('image').objectFit === 'cover' && "bg-gray-200 dark:bg-gray-600"), title: "Cover", children: "Cover" }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().updateAttributes('image', { objectFit: 'fill' }).run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200 text-xs font-medium", editor.getAttributes('image').objectFit === 'fill' && "bg-gray-200 dark:bg-gray-600"), title: "Fill", children: "Fill" })] }));
|
|
8
|
+
return (_jsxs(BubbleMenu, { editor: editor, pluginKey: "imageBubbleMenu", shouldShow: ({ editor }) => editor.isActive('image'), className: "flex items-center gap-1 bg-white dark:bg-zinc-800 border border-gray-200 dark:border-gray-700 shadow-lg p-1 rounded-lg z-50", children: [_jsx("button", { type: "button", onClick: () => editor.chain().focus().updateAttributes('image', { width: '100%', height: null }).run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200", editor.getAttributes('image').width === '100%' && "bg-gray-200 dark:bg-gray-600"), title: "Full Width", children: _jsx(StretchHorizontal, { size: 16 }) }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().updateAttributes('image', { width: null, height: null }).run(), className: "p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200", title: "Original Size", children: _jsx(Minimize, { size: 16 }) }), _jsx("div", { className: "w-[1px] h-4 bg-gray-300 dark:bg-gray-600 mx-1" }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().setTextAlign('left').run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200", editor.isActive({ textAlign: 'left' }) && "bg-gray-200 dark:bg-gray-600"), title: "Align Left", children: _jsx(AlignLeft, { size: 16 }) }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().setTextAlign('center').run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200", editor.isActive({ textAlign: 'center' }) && "bg-gray-200 dark:bg-gray-600"), title: "Align Center", children: _jsx(AlignCenter, { size: 16 }) }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().setTextAlign('right').run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200", editor.isActive({ textAlign: 'right' }) && "bg-gray-200 dark:bg-gray-600"), title: "Align Right", children: _jsx(AlignRight, { size: 16 }) }), _jsx("div", { className: "w-[1px] h-4 bg-gray-300 dark:bg-gray-600 mx-1" }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().updateAttributes('image', { objectFit: 'contain' }).run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200 text-xs font-medium", editor.getAttributes('image').objectFit === 'contain' && "bg-gray-200 dark:bg-gray-600"), title: "Contain", children: "Fit" }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().updateAttributes('image', { objectFit: 'cover' }).run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200 text-xs font-medium", editor.getAttributes('image').objectFit === 'cover' && "bg-gray-200 dark:bg-gray-600"), title: "Cover", children: "Cover" }), _jsx("button", { type: "button", onClick: () => editor.chain().focus().updateAttributes('image', { objectFit: 'fill' }).run(), className: cn("p-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200 text-xs font-medium", editor.getAttributes('image').objectFit === 'fill' && "bg-gray-200 dark:bg-gray-600"), title: "Fill", children: "Fill" })] }));
|
|
15
9
|
};
|