Skip to content

Commit cab75dd

Browse files
committed
merge
2 parents e9b92a9 + dda1605 commit cab75dd

File tree

1 file changed

+186
-5
lines changed

1 file changed

+186
-5
lines changed

README.md

+186-5
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,194 @@
33
Bootstrap Text-Input with Smiley- and File-Support for Blazor.
44
![Regular Input](https://github.com/wsdt/Blazor_EmojiFilePicker/blob/master/docs/img/InputView.PNG "Regular Input")
55

6-
## Usage
7-
NuGet-Url: [Nuget.org/packages/Blazor_EmojiFilePicker](https://www.nuget.org/packages/Blazor_EmojiFilePicker)
6+
## Example projects
7+
* [WSDT/RealtimeChat_WebAssembly](https://github.com/wsdt/RealtimeChat_WebAssembly)
88

9-
`Install-Package Blazor_EmojiFilePicker`
9+
## Usage ![Nuget](https://img.shields.io/nuget/v/wsdt.blazor.emojifileinput?style=plastic)
10+
NuGet-Url: [Nuget.org/packages/WSDT.Blazor.EmojiFileInput](https://www.nuget.org/packages/wsdt.blazor.emojifileinput/)
11+
12+
1. `Install-Package WSDT.Blazor.EmojiFileInput`
13+
14+
2. And add to your **Startup.cs**-file:
15+
```csharp
16+
using EmojiPicker;
17+
services.AddEmojiPicker();
18+
```
19+
20+
3. Add the component to your **.razor-View**:
21+
```cshtml
22+
@using WSDT.EmojiFilePicker
23+
<EmojiInput />
24+
```
25+
26+
4. Add parameters and have fun :-)
27+
28+
<table>
29+
<thead>
30+
<tr>
31+
<th>Attribute</th>
32+
<th>Type</th>
33+
<th>Example</th>
34+
<th>Usage</th>
35+
</tr>
36+
</thead>
37+
<tbody>
38+
<tr>
39+
<td>@bind-Message</td>
40+
<td>string</td>
41+
<td>
42+
43+
```csharp
44+
ChatMsg
45+
```
46+
</td>
47+
<td>Binds value of input-field to your outer model for validation, form-submission, ...</td>
48+
</tr>
49+
<tr>
50+
<td>MessageChanged</td>
51+
<td>EventCallback<string></td>
52+
<td>
53+
54+
```csharp
55+
null
56+
```
57+
</td>
58+
<td>Overwrite default onMessageChanged-Callback. Basically just needed for binding.</td>
59+
</tr>
60+
<tr>
61+
<td>AddFiles</td>
62+
<td>Action<List<string>></td>
63+
<td>
64+
65+
```csharp
66+
public void AddFiles(List<string> imgUris)
67+
{
68+
foreach (string imgUri in imgUris) {
69+
AddToMsg($"<img src='{imgUri}' />");
70+
}
71+
72+
ChatService.Send();
73+
StateHasChanged();
74+
}
75+
```
76+
</td>
77+
<td>Receive the links to uploaded files as List. Files are uploaded to the provided FileUploadRoute. In case you expect images to be uploaded you could e.g. add them to your view.
78+
</td>
79+
</tr>
80+
<tr>
81+
<td>FileUploadRoute</td>
82+
<td>string</td>
83+
<td>
84+
85+
```csharp
86+
"/api/v1/file_upload"
87+
```
88+
</td>
89+
<td>Defines the local route to save uploaded files.</td>
90+
</tr>
91+
<tr>
92+
<td>Placeholder</td>
93+
<td>string</td>
94+
<td>
95+
96+
```csharp
97+
"Message"
98+
```
99+
</td>
100+
<td>Defines the placeholder for your text-input.</td>
101+
</tr>
102+
<tr>
103+
<td>AddonPrepend</td>
104+
<td>string</td>
105+
<td>
106+
107+
```csharp
108+
EmojiList.Envelope
109+
```
110+
or
111+
```csharp
112+
""
113+
```
114+
</td>
115+
<td>Defines the Prepend-Addon for the bootstrap input.</td>
116+
</tr>
117+
<tr>
118+
<td>ShowFilePicker</td>
119+
<td>bool</td>
120+
<td>
121+
122+
```csharp
123+
true
124+
```
125+
</td>
126+
<td>Should file-picker-Button and Dropzone be enabled?</td>
127+
</tr>
128+
<tr>
129+
<td>ShowSubmit</td>
130+
<td>bool</td>
131+
<td>
132+
133+
```csharp
134+
true
135+
```
136+
</td>
137+
<td>Displays a regular submit-Btn. No callback is required as this component is not nested by a form.</td>
138+
</tr>
139+
<tr>
140+
<td>IsSubmitDisabled</td>
141+
<td>bool</td>
142+
<td>
143+
144+
```cshtml
145+
@(!ChatService.IsConnected())
146+
```
147+
</td>
148+
<td>If Submit-Btn is shown, then this property en- or disables the button.</td>
149+
</tr>
150+
<tr>
151+
<td>SubmitBtnLbl</td>
152+
<td>string</td>
153+
<td>
154+
155+
```csharp
156+
"Send"
157+
```
158+
</td>
159+
<td>Sets the Submit-Label, if the button is shown.</td>
160+
</tr>
161+
<tr>
162+
<td>SmileyBtnIcon</td>
163+
<td>string</td>
164+
<td>
165+
166+
```csharp
167+
EmojiList.Smiley
168+
```
169+
or
170+
```csharp
171+
"😁"
172+
```
173+
</td>
174+
<td>Defines the smiley-button icon.</td>
175+
</tr>
176+
<tr>
177+
<td>FileBtnIcon</td>
178+
<td>string</td>
179+
<td>
180+
181+
```csharp
182+
EmojiList.Open_File_Folder
183+
```
184+
or
185+
```csharp
186+
"📎"
187+
```
188+
</td>
189+
<td>Defines the file-button icon.</td>
190+
</tr>
191+
</tbody>
192+
</table>
10193

11-
And add to your Startup.cs-file:
12-
`services.AddEmojiPicker();`
13194

14195
## Features
15196
* Configurable (e.g. submit-btn, file-picker, ... can be deactivated)

0 commit comments

Comments
 (0)