切换markdown编辑器为vditor #27
@@ -8,6 +8,7 @@ import {Tag} from '../../class/Tag';
|
|||||||
import {Title} from '@angular/platform-browser';
|
import {Title} from '@angular/platform-browser';
|
||||||
import {GlobalUserService} from '../../services/global-user.service';
|
import {GlobalUserService} from '../../services/global-user.service';
|
||||||
import Vditor from 'vditor';
|
import Vditor from 'vditor';
|
||||||
|
import {environment} from "../../../environments/environment";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'view-write',
|
selector: 'view-write',
|
||||||
@@ -47,12 +48,37 @@ export class WriteComponent implements OnInit {
|
|||||||
height: (window.innerHeight - 120),
|
height: (window.innerHeight - 120),
|
||||||
placeholder: '欢迎来到小海的创作中心',
|
placeholder: '欢迎来到小海的创作中心',
|
||||||
mode: 'sv',
|
mode: 'sv',
|
||||||
|
outline: true,
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
pin: true,
|
pin: true,
|
||||||
},
|
},
|
||||||
|
preview: {
|
||||||
|
hljs: {
|
||||||
|
lineNumber: true
|
||||||
|
},
|
||||||
|
markdown: {
|
||||||
|
autoSpace: true,
|
||||||
|
fixTermTypo: true,
|
||||||
|
chinesePunct: true,
|
||||||
|
toc: false,
|
||||||
|
linkBase: ''
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
cache: {
|
cache: {
|
||||||
enable: false,
|
enable: false,
|
||||||
},
|
},
|
||||||
|
counter: {
|
||||||
|
enable: true
|
||||||
|
},
|
||||||
|
upload: {
|
||||||
|
url: environment.host + '/fileUpload',
|
||||||
|
format: (files: File[], responseText: string) => {
|
||||||
|
console.log(responseText)
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
after: () => {
|
after: () => {
|
||||||
// 判断是更新文章还是恢复文章
|
// 判断是更新文章还是恢复文章
|
||||||
this.articleId = this.activatedRoute.snapshot.queryParams.id;
|
this.articleId = this.activatedRoute.snapshot.queryParams.id;
|
||||||
@@ -105,7 +131,7 @@ export class WriteComponent implements OnInit {
|
|||||||
this.message.warning(this.article.title === '' ? '标题不能为空' : '文章不能为空');
|
this.message.warning(this.article.title === '' ? '标题不能为空' : '文章不能为空');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.article.mdContent = this.vditor.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user