Skip to content

Commit 740795f

Browse files
committed
fixed bug
1 parent 50b181d commit 740795f

File tree

6 files changed

+80
-13
lines changed

6 files changed

+80
-13
lines changed

package-lock.json

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

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@
1616
"@angular/compiler": "^17.2.0",
1717
"@angular/core": "^17.2.0",
1818
"@angular/forms": "^17.2.0",
19-
"angular-oauth2-oidc": "^17.0.1",
2019
"@angular/platform-browser": "^17.2.0",
2120
"@angular/platform-browser-dynamic": "^17.2.0",
2221
"@angular/router": "^17.2.0",
2322
"@angular/service-worker": "^17.2.0",
24-
"codex-notifier": "^1.1.2",
25-
"codex-tooltip": "^1.0.5",
2623
"@editorjs/delimiter": "^1.4.0",
2724
"@editorjs/editorjs": "^2.29.0",
2825
"@editorjs/header": "^2.8.1",
2926
"@editorjs/inline-code": "^1.5.0",
3027
"@editorjs/nested-list": "^1.4.2",
3128
"@editorjs/table": "^2.3.0",
32-
"monaco-editor": "^0.46.0",
3329
"@monaco-editor/loader": "^1.4.0",
3430
"@ngx-loading-bar/core": "^6.0.2",
31+
"angular-oauth2-oidc": "^17.0.1",
32+
"codex-notifier": "^1.1.2",
33+
"codex-tooltip": "^1.0.5",
34+
"monaco-editor": "^0.46.0",
3535
"rxjs": "~7.8.0",
3636
"socket.io-client": "^4.7.4",
3737
"tslib": "^2.3.0",
@@ -43,6 +43,7 @@
4343
"@angular-devkit/build-angular": "^17.2.2",
4444
"@angular/cli": "^17.2.2",
4545
"@angular/compiler-cli": "^17.2.0",
46+
"@tailwindcss/typography": "^0.5.10",
4647
"@types/jasmine": "~5.1.0",
4748
"autoprefixer": "^10.4.18",
4849
"jasmine-core": "~5.1.0",
@@ -55,4 +56,4 @@
5556
"tailwindcss": "^3.4.1",
5657
"typescript": "~5.3.2"
5758
}
58-
}
59+
}

src/app/features/write/pages/add-article-page/add-article-page.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export class AddArticlePageComponent implements OnInit {
3333

3434
postAndAuthor!: PostAndAuthor;
3535

36+
isPublished = false;
37+
3638
ngOnInit(): void {
3739
this.postAndAuthor = {
3840
post: {
@@ -73,6 +75,7 @@ export class AddArticlePageComponent implements OnInit {
7375
switchMap(() => this.postService.addPost(postRequest))
7476
)
7577
.subscribe(() => {
78+
this.isPublished = true;
7679
this.lazyPost.disposeMap();
7780
this.toastService.push({
7881
title: 'เพิ่มโพสต์สำเร็จ',
@@ -87,6 +90,7 @@ export class AddArticlePageComponent implements OnInit {
8790
});
8891
} else {
8992
this.postService.addPost(postRequest).subscribe(() => {
93+
this.isPublished = true;
9094
this.lazyPost.disposeMap();
9195
this.toastService.push({
9296
title: 'เพิ่มโพสต์สำเร็จ',
@@ -123,6 +127,9 @@ export class AddArticlePageComponent implements OnInit {
123127
}
124128

125129
canDeactivate() {
130+
if (this.isPublished) {
131+
return true;
132+
}
126133
return confirm('คุณกำลังจะออกจากหน้านี้ ข้อมูลที่แก้ไขจะไม่ถูกบันทึก');
127134
}
128135
}

src/app/features/write/pages/edit-article-page/edit-article-page.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ export class EditArticlePageComponent implements OnInit {
3131

3232
postAndAuthor!: PostAndAuthor;
3333

34+
isPublished = false;
35+
3436
ngOnInit(): void {
3537
this.route.paramMap
3638
.pipe(
@@ -71,6 +73,7 @@ export class EditArticlePageComponent implements OnInit {
7173
)
7274
.subscribe(() => {
7375
this.lazyPost.disposeMap();
76+
this.isPublished = true;
7477
this.toastService.push({
7578
title: 'อัปเดตโพสต์สำเร็จ',
7679
type: 'success',
@@ -89,6 +92,7 @@ export class EditArticlePageComponent implements OnInit {
8992
this.postService
9093
.updatePost(this.postAndAuthor.post.id, postRequest)
9194
.subscribe(() => {
95+
this.isPublished = true;
9296
this.lazyPost.disposeMap();
9397
this.toastService.push({
9498
title: 'อัปเดตโพสต์สำเร็จ',
@@ -125,6 +129,9 @@ export class EditArticlePageComponent implements OnInit {
125129
}
126130

127131
canDeactivate() {
132+
if (this.isPublished) {
133+
return true;
134+
}
128135
return confirm('คุณกำลังจะออกจากหน้านี้ ข้อมูลที่แก้ไขจะไม่ถูกบันทึก');
129136
}
130137
}

src/app/shared/components/post/post-content/post-content.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
isSaving ? "กำลังบันทึก..." : "บันทึกแล้ว"
33
}}</span>
44
<div class="prose prose-zinc">
5-
<div id="editorjs"></div>
5+
<div id="editorjs" class=""></div>
66
</div>
77

88
<ng-container *ngIf="isShowCodePage && currentCode">

tailwind.config.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
/** @type {import('tailwindcss').Config} */
22
module.exports = {
3-
content: [
4-
"./src/**/*.{html,ts}",
5-
],
3+
content: ["./src/**/*.{html,ts}"],
64
theme: {
7-
extend: {},
5+
extend: {
6+
typography: {
7+
DEFAULT: {
8+
css: {
9+
maxWidth: '100%',
10+
}
11+
}
12+
}
13+
},
814
},
9-
plugins: [],
10-
}
11-
15+
plugins: [require("@tailwindcss/typography")],
16+
};

0 commit comments

Comments
 (0)