
Jezik 🇷🇸 Srpski (Latinica)
Dokumentacija
Početak rada
Korišćenje
Konfiguracija
Add Comments to Your SolidJS App
Ovo je zvanična SolidJS biblioteka za FastComments.
Ugradite widget-e za komentare uživo, chat i recenzije u vašu SolidJS aplikaciju.
Repozitorijum
Demo uživo 
Isprobajte svaki widget uživo na https://fastcomments.com/commenting-system-for-solidjs.
Korišćenje 
import { FastCommentsCommentWidget } from 'fastcomments-solidjs';
export default function App() {
return <FastCommentsCommentWidget tenantId="demo" urlId="some-page-id" />;
}
Reagovanje na promene konfiguracije (imperativni handle) 
Solid ne prati automatski duboke mutacije nad proizvoljnim objektima, tako da promene u config-u nakon prvog rendera moraju biti eksplicitno gurnute. Svaki widget prihvata apiRef koji vraća handle; pozovite handle.update(partial) iz createEffect da biste pokrenuli reaktivnost:
import { createEffect, createSignal } from 'solid-js';
import { FastCommentsCommentWidget, type FastCommentsCommentWidgetHandle } from 'fastcomments-solidjs';
export default function Paginated() {
const [page, setPage] = createSignal(0);
let handle: FastCommentsCommentWidgetHandle | undefined;
createEffect(() => handle?.update({ urlId: `product-${page()}` }));
return (
<>
<button onClick={() => setPage(page() + 1)}>next</button>
<FastCommentsCommentWidget
apiRef={(h) => (handle = h)}
tenantId="demo"
urlId={`product-${page()}`}
/>
</>
);
}
update() je bezbedno pozivati u bilo kom trenutku:
- Pre nego što se skript učita: partial se čuva i primenjuje pri init.
- Tokom asinhrone init faze (reviews-summary, user-activity-feed): partial se stavi u red i primeni kada se callback reši.
- Posle init-a: prosleđuje se direktno metodi
.update()živog widgeta.
Imperativni handle API
interface WidgetHandle<Config> {
getInstance: () => WidgetInstance | null; // najnovija aktivna instanca (ili null pre mount-a)
onInstance: (cb: (instance: WidgetInstance) => void) => void; // poziva se jednom kada je instanca spremna
update: (partial: Partial<Config>) => void; // spoji i pošalji konfiguraciju
}
Koristite getInstance() za imperativne akcije koje nisu obuhvaćene .update(), npr. openProfile:
const openProfile = () =>
(handle?.getInstance() as { openProfile?: (o: { userId: string }) => void } | null)
?.openProfile?.({ userId: 'demo' });
Komponente 
Svaki widget iz fastcomments-react dostupan je pod istim imenom:
| Komponenta | Tip handle-a | Učitani embed |
|---|---|---|
FastCommentsCommentWidget |
FastCommentsCommentWidgetHandle |
Vodeći widget za komentarisanje uživo |
FastCommentsCommentCountWidget |
FastCommentsCommentCountWidgetHandle |
Inline značka sa brojačem komentara |
FastCommentsLiveChatWidget |
FastCommentsLiveChatWidgetHandle |
Widget za streaming chat uživo |
FastCommentsCollabChatWidget |
FastCommentsCollabChatWidgetHandle |
Kolaborativni chat vezan za tekst |
FastCommentsImageChatWidget |
FastCommentsImageChatWidgetHandle |
Komentari na slici po regionima |
FastCommentsRecentCommentsWidget |
FastCommentsRecentCommentsWidgetHandle |
Feed najnovijih komentara |
FastCommentsRecentDiscussionsWidget |
FastCommentsRecentDiscussionsWidgetHandle |
Feed najnovijih diskusija |
FastCommentsReviewsSummaryWidget |
FastCommentsReviewsSummaryWidgetHandle |
Rezime ocena zvezdicama |
FastCommentsTopPagesWidget |
FastCommentsTopPagesWidgetHandle |
Lista najkomentaranijih stranica |
FastCommentsUserActivityFeedWidget |
FastCommentsUserActivityFeedWidgetHandle |
Vremenska linija aktivnosti po korisniku |
Widgeti koji se prikače na postojeći element
FastCommentsCollabChatWidget and FastCommentsImageChatWidget montiraju se u element koji pozivalac obezbedi.
Prosledite accessor targetRef koji vraća element nakon što je montiran:
import { FastCommentsImageChatWidget } from 'fastcomments-solidjs';
export default function ImageChat() {
let img: HTMLImageElement | undefined;
return (
<>
<img ref={img} src="/screenshot.png" alt="" />
<FastCommentsImageChatWidget
tenantId="demo"
urlId="my-image"
targetRef={() => img}
/>
</>
);
}
Regije
Prosledite region="eu" da usmerite saobraćaj widgeta kroz EU klaster.
Trebate pomoć?
Ako naiđete na bilo kakve probleme ili imate pitanja u vezi sa SolidJS Library, molimo vas:
Doprinos
Doprinosi su dobrodošli! Molimo posetite GitHub repozitorijum za smernice za doprinos.