Skip to content

Commit 2ab3a35

Browse files
committed
Changed to Quill.js for better editor support
1 parent e3a943e commit 2ab3a35

File tree

12 files changed

+201
-31
lines changed

12 files changed

+201
-31
lines changed

src/LetsDisc.Web.Host/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"App": {
66
"ServerRootAddress": "http://localhost:21021/",
77
"ClientRootAddress": "http://localhost:4200/",
8-
"CorsOrigins": "http://localhost:4200,http://localhost:8080,http://localhost:8081"
8+
"CorsOrigins": "http://localhost:4200,http://localhost:8080,http://localhost:8081,http://localhost:8085/"
99
},
1010
"Authentication": {
1111
"JwtBearer": {

src/LetsDisc.Web.Host/package-lock.json

Lines changed: 60 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/LetsDisc.Web.Host/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@
5858
"ngx-bootstrap": "^3.0.0",
5959
"ngx-chips": "^2.0.0-beta.0",
6060
"ngx-pagination": "^3.0.3",
61+
"ngx-quill": "^7.1.2",
6162
"node-waves": "^0.7.5",
6263
"push.js": "1.0.4",
64+
"quill": "^1.3.6",
6365
"raphael": "^2.2.7",
6466
"rxjs": "^6.0.0",
6567
"simple-line-icons": "^2.4.1",

src/LetsDisc.Web.Host/src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import { UserDetailComponent } from './users/user-detail/user-detail.component';
4444
import { PrivacyComponent } from './privacy/privacy.component';
4545
import { ContactComponent } from './contact/contact.component';
4646
import { SearchPostsComponent } from './search-posts/search-posts.component';
47+
import { QuillModule } from 'ngx-quill';
4748

4849
@NgModule({
4950
declarations: [
@@ -88,7 +89,8 @@ import { SearchPostsComponent } from './search-posts/search-posts.component';
8889
NgxPaginationModule,
8990
CKEditorModule,
9091
TagInputModule,
91-
SocialLoginModule
92+
SocialLoginModule,
93+
QuillModule.forRoot()
9294
],
9395
providers: [
9496
]

src/LetsDisc.Web.Host/src/app/posts/create-question/create-question.component.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
}
2424

2525
.invalid-feedback {
26+
display:block;
2627
color: red;
2728
padding: 5px;
2829
font-size: 12px;
@@ -34,4 +35,8 @@ input.ng-touched.ng-invalid {
3435

3536
.tag-input.ng-touched.ng-invalid {
3637
border: 1px solid red !important;
38+
}
39+
40+
.quill-body {
41+
height: 200px;
3742
}

src/LetsDisc.Web.Host/src/app/posts/create-question/create-question.component.html

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,35 @@ <h3>
2727
<div class="form-group">
2828
<div class="form-line">
2929
<label for="question-body">{{l('Body')}}</label>
30-
<ckeditor id="question-body" [(ngModel)]="question.body" [editor]="Editor" [config]="config" name="Body" data="<p></p>" class="body" #body="ngModel" required></ckeditor>
30+
<!--<ckeditor id="question-body" [(ngModel)]="question.body" [editor]="Editor" [config]="config" name="Body" data="<p></p>" class="body" #body="ngModel" required></ckeditor>-->
31+
<quill-editor id="question-body" [(ngModel)]="question.body" name="Body" class="body" #body="ngModel" [required]="true" [styles]="{height: '250px'}" placeholder="Type the content here!">
32+
<div quill-editor-toolbar>
33+
<span class="ql-formats">
34+
<button class="ql-bold" [title]="'Bold'"></button>
35+
<button class="ql-italic" [title]="'Italic'"></button>
36+
</span>
37+
<span class="ql-formats">
38+
<button class="ql-blockquote" [title]="'Block Quote'"></button>
39+
<button class="ql-code-block" [title]="'Code Block'"></button>
40+
</span>
41+
<span class="ql-formats">
42+
<button class="ql-list" value="ordered" [title]="'Ordered List'"></button>
43+
<button class="ql-list" value="bullet" [title]="'Ordered List'"></button>
44+
</span>
45+
<span class="ql-formats">
46+
<select class="ql-size" [title]="'Size'">
47+
<option selected></option>
48+
<option value="small"></option>
49+
<option value="large"></option>
50+
<option value="huge"></option>
51+
</select>
52+
</span>
53+
<span class="ql-formats">
54+
<button class="ql-link" [title]="'Insert Link'"></button>
55+
<button class="ql-image" [title]="'Image'"></button>
56+
</span>
57+
</div>
58+
</quill-editor>
3159
</div>
3260
<div *ngIf="body.invalid && (body.dirty || body.touched)" class="invalid-feedback">
3361
<div *ngIf="body.errors.required">
@@ -36,6 +64,11 @@ <h3>
3664
</div>
3765
</div>
3866

67+
<div class="form-group">
68+
<label for="question-body">Preview</label>
69+
<quill-view [content]="question.body" theme="snow"></quill-view>
70+
</div>
71+
3972
<div class="form-group">
4073
<label for="question-tags">{{l('Tags')}}</label>
4174
<tag-input [(ngModel)]="items"
@@ -56,7 +89,7 @@ <h3>
5689
</div>
5790
</div>
5891

59-
<button type="submit" [disabled]="!myform.form.valid || saving" class="btn btn-primary">Post Your Question</button>
92+
<button type="submit" [disabled]="!myform.form.valid || saving" class="btn btn-primary">Post Your Question</button>
6093
</form>
6194
</div>
6295
</div>

src/LetsDisc.Web.Host/src/app/posts/question-detail/question-detail.component.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@
2323
}
2424

2525
.question-body {
26-
margin-top: 10px;
27-
margin-left: 8%;
28-
min-height: 120px;
26+
margin-top:0px;
27+
min-height: 140px;
2928
}
3029

3130
.vote-layout {

0 commit comments

Comments
 (0)