17
17
<label for =" short" >Short Description</label >
18
18
<InputTextArea class =" form-control" id =" short" @bind-Value =" model.ShortDescription" rows =" 4"
19
19
@oninput =" args => model.ShortDescription = args.Value.ToString()" />
20
- <small id =" short" class =" form-text text-muted" >You can use markdown to style your component.</small >
20
+ <small for =" short" class =" form-text text-muted" >You can use markdown to style your component.</small >
21
21
</div >
22
22
<div class =" mb-3" >
23
23
<label for =" content" >Content</label >
24
24
<InputTextArea class =" form-control" id =" content" @bind-Value =" model.Content" @oninput =" args => model.Content = args.Value.ToString()" rows =" 10" />
25
- <small id =" content" class =" form-text text-muted" >You can use markdown to style your component. Additional features are listed <a @onclick =" @(() => FeatureDialog.Open())" >here</a ></small >
26
- @* <small id="content" class="form-text text-muted">Drag and drop images to upload and insert picture.</small> *@
25
+ <small for =" content" class =" form-text text-muted" >You can use markdown to style your component. Additional features are listed <a @onclick =" @(() => FeatureDialog.Open())" >here</a ></small >
26
+ <UploadFile OnFileUploaded =" SetContentFromFile" id =" content-upload" ></UploadFile >
27
+ <small for =" content-upload" class =" form-text text-muted" >Drag and drop markdown files to upload and
28
+ insert them</small >
27
29
</div >
28
30
<div class =" mb-3" >
29
31
<label for =" preview" >Preview-Url</label >
32
34
<div class =" form-check" >
33
35
<InputCheckbox class =" form-check-input" id =" published" @bind-Value =" model.IsPublished" />
34
36
<label class =" form-check-label" for =" published" >Publish</label ><br />
35
- <small id =" published" class =" form-text text-muted" >If this blog post is only draft uncheck the box</small >
37
+ <small for =" published" class =" form-text text-muted" >If this blog post is only draft uncheck the box</small >
36
38
</div >
37
39
<div class =" mb-3" >
38
40
<label for =" tags" >Tags</label >
43
45
<div class =" form-check" >
44
46
<InputCheckbox class =" form-check-input" id =" updatedate" @bind-Value =" model.ShouldUpdateDate" />
45
47
<label class =" form-check-label" for =" updatedate" >Update Publish Date ? </label ><br />
46
- <small id =" updatedate" class =" form-text text-muted" >If set the publish date is set to now , otherwise its original date </small >
48
+ <small for =" updatedate" class =" form-text text-muted" >If set the publish date is set to now ,
49
+ otherwise its original date </small >
47
50
</div >
48
51
}
49
52
<button class =" btn btn-primary" type =" submit" >Submit</button >
68
71
@code {
69
72
[Parameter ]
70
73
public BlogPost BlogPost { get ; set ; }
71
-
74
+
72
75
[Parameter ]
73
76
public string Title { get ; set ; }
74
-
77
+
75
78
[Parameter ]
76
79
public EventCallback <BlogPost > OnBlogPostCreated { get ; set ; }
77
80
97
100
await OnBlogPostCreated .InvokeAsync (model .ToBlogPost ());
98
101
ClearModel ();
99
102
}
100
-
103
+
101
104
private void ClearModel ()
102
105
{
103
106
if (ClearAfterCreated )
104
107
{
105
108
model = new CreateNewModel ();
106
109
}
107
110
}
111
+
112
+ private void SetContentFromFile (string content )
113
+ {
114
+ model .Content = content ;
115
+ }
108
116
}
0 commit comments