<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          AngularEditor適用于 Angular 的富文本編輯器

          聯(lián)合創(chuàng)作 · 2023-09-30 15:57

          AngularEditor 是一個(gè)簡單的原生 WYSIWYG/Rich Text 編輯器,適用于 Angular 6 至 12+。

          安裝

          通過 npm 包管理器安裝

          npm install @kolkov/angular-editor --save
          

          版本

          1.0.0 及更高版本 —— 適用于 Angular v8.xx 及更高版本

          0.18.4 及更高版本 —— 適用于 Angular v7.xx

          0.15.x —— 適用于 Angular v6.xx

          用法

          導(dǎo)入angular-editor模塊

          import { HttpClientModule} from '@angular/common/http';
          import { AngularEditorModule } from '@kolkov/angular-editor';
          
          @NgModule({
            imports: [ HttpClientModule, AngularEditorModule ]
          })
          

          然后在 HTML 中

          <angular-editor [placeholder]="'Enter text here...'" [(ngModel)]="htmlContent"></angular-editor>
          

          如果您在同一頁面設(shè)置id屬性上使用多個(gè)編輯器

          <angular-editor id="editor1" formControlName="htmlContent1" [config]="editorConfig"></angular-editor>
          <angular-editor id="editor2" formControlName="htmlContent2" [config]="editorConfig"></angular-editor>
          
          import { AngularEditorConfig } from '@kolkov/angular-editor';
          
          
          editorConfig: AngularEditorConfig = {
              editable: true,
                spellcheck: true,
                height: 'auto',
                minHeight: '0',
                maxHeight: 'auto',
                width: 'auto',
                minWidth: '0',
                translate: 'yes',
                enableToolbar: true,
                showToolbar: true,
                placeholder: 'Enter text here...',
                defaultParagraphSeparator: '',
                defaultFontName: '',
                defaultFontSize: '',
                fonts: [
                  {class: 'arial', name: 'Arial'},
                  {class: 'times-new-roman', name: 'Times New Roman'},
                  {class: 'calibri', name: 'Calibri'},
                  {class: 'comic-sans-ms', name: 'Comic Sans MS'}
                ],
                customClasses: [
                {
                  name: 'quote',
                  class: 'quote',
                },
                {
                  name: 'redText',
                  class: 'redText'
                },
                {
                  name: 'titleText',
                  class: 'titleText',
                  tag: 'h1',
                },
              ],
              uploadUrl: 'v1/image',
              upload: (file: File) => { ... }
              uploadWithCredentials: false,
              sanitize: true,
              toolbarPosition: 'top',
              toolbarHiddenButtons: [
                ['bold', 'italic'],
                ['fontSize']
              ]
          };
          

          為了讓 ngModel 正常使用,必須從 @angular/forms 導(dǎo)入 FormsModule,或者對于 formControlName,必須從 @angular/forms 導(dǎo)入 ReactiveFormsModule。

           

           

           

           

          瀏覽 33
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  国产乱视频 | wwwaaa | 一起操在线 | 青草资源网 | A片国产免费 |