fix: 空值异常
This commit is contained in:
@@ -73,9 +73,8 @@ export class ArticleComponent implements OnInit {
|
||||
after: () => {
|
||||
// 处理锚点
|
||||
const tocList: HTMLCollection = this.divElement.nativeElement
|
||||
.getElementsByClassName('vditor-toc')[0]
|
||||
.getElementsByTagName(`a`);
|
||||
for (let i = 0; i < tocList.length; i++) {
|
||||
.getElementsByClassName('vditor-toc')[0]?.getElementsByTagName(`a`);
|
||||
for (let i = 0; i < tocList?.length; i++) {
|
||||
const linkValue = tocList.item(i).getAttribute('href');
|
||||
tocList.item(i).setAttribute('href', window.location.pathname + linkValue);
|
||||
}
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
<button nz-button nzType="primary" id="submit" (click)="articleSubmit()">提交</button>
|
||||
</div>
|
||||
<div id="vditor"></div>
|
||||
|
||||
<!-- <div id="md" appEditorMd [editormdConfig]="conf" (editorChange)="syncModel($event)">-->
|
||||
<!-- <textarea style="display: block;" [(ngModel)]="article.mdContent"></textarea>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
|
||||
<nz-modal [(nzVisible)]="modalVisible" [nzTitle]="title" [nzContent]="content" [nzFooter]="null"
|
||||
|
||||
@@ -3,10 +3,11 @@ import {CommonModule} from '@angular/common';
|
||||
import {WriteComponent} from './write.component';
|
||||
import {Route, RouterModule} from '@angular/router';
|
||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import {EditorMdDirective} from './editor-md/editor-md.directive';
|
||||
import {PublishFormComponent} from './components/publish-form/publish-form.component';
|
||||
import {
|
||||
NzButtonModule, NzCardModule, NzDividerModule,
|
||||
NzButtonModule,
|
||||
NzCardModule,
|
||||
NzDividerModule,
|
||||
NzFormModule,
|
||||
NzIconModule,
|
||||
NzInputModule,
|
||||
@@ -23,7 +24,7 @@ const routes: Route[] = [
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [WriteComponent, EditorMdDirective, PublishFormComponent],
|
||||
declarations: [WriteComponent, PublishFormComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
RouterModule.forChild(routes),
|
||||
|
||||
Reference in New Issue
Block a user