Comments component
The comments component renders a complete and functional user interface for comments.
Element: <wy-comments>
Class: WyComments
Usage
First import and configure Weavy
and the WyComments
component.
import { Weavy, WyComments } from "@weavy/uikit-web";
const weavy = new Weavy();
weavy.url = "https://myenvironment.weavy.io";
weavy.tokenFactory = async (refresh) => "token_from_server";
Then add the <wy-comments>
component to your HTML. Since it is a contextual app you must specify the uid
property.
The corresponding app will be created automatically on the server when a new uid
is defined.
You can also adjust permissions and details for the app using the Apps API.
<wy-comments uid="my-comments-1"></wy-comments>
Note: The unique ids (uid) used when creating apps, users etc. is something you decide what it should be. Since the apps are contextual, the
uid
is often related to the context it's in. For example "product-123-comments", "customer-2-files" etc.
Properties
Property | Type | Default | Description |
---|---|---|---|
uid |
string |
Unique identifier for the Comments app to load. | |
features |
FeaturesConfigType |
{} |
Overrides the default features available for the product. |
submodals |
boolean |
false |
Enables modal compatibility with other modals, backdrops and focus-traps. Note that it may have implications with layout (such as z-index effects) in your app. |
The available features are controlled by your product license. The features
config is opt-out, meaning you can disable available features,
but never enable features that are not included in your license.
Feature | Description |
---|---|
attachments |
Disable the possibility to upload local attachments. |
cloudFiles |
Disable the cloud file picker (Google Drive, Dropbox etc.). |
meetings |
Disable Zoom meetings. |
mentions |
Disable the possibility to mention other people in the directory. |
previews |
Disable previews of files. |
reactions |
Disable the possibility to add emoji reactions to a comment. |
Example: Render a comments component with the reactions feature disabled.
const comments = new WyComments();
comments.features = {
reactions: false,
};
document.body.append(comments);
Events
The WyComments
component emits the following events.
Event | Detail | Description |
---|---|---|
wy:comment_created |
{ comment: CommentType } |
New comment created. |
wy:reaction_added |
{ reaction: string, entity: EntityType } |
Comment reaction added. |
wy:reaction_removed |
{ reaction: string, entity: EntityType } |
Comment reaction removed. |