百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

angular-editor

> 前端框架
开源

一个简单的原生 WYSIWYG 编辑器组件,适用于 Angular 6 -20+

721 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个简单的原生 WYSIWYG 编辑器组件,适用于 Angular 6 -20+

AngularEditor

A simple native WYSIWYG/Rich Text editor for Angular 22+

Demo

demo | See the code in StackBlitz.

Getting Started

Installation

Install via npm package manager

npm install @kolkov/angular-editor --save

Versions

3.1.0 and above - for Angular v22+ (CSS variables, Vitest testing)

3.0.0 and above - for Angular v20+ (CSS variables, modern Angular 20)

2.0.0 and above - for Angular v13-19

1.0.0 and above - for Angular v8-12

0.18.4 and above - for Angular v7.x.x

0.15.x - for Angular v6.x.x

Note: Version 3.1.0 requires:

  • Angular 22.0.0 or higher
  • RxJS 7.8.0 or higher
  • TypeScript 6.0 or higher

Attention! alpha and beta versions may contain breaking changes.

Usage

Import angular-editor module

import { HttpClientModule} from '@angular/common/http';
import { AngularEditorModule } from '@kolkov/angular-editor';

@NgModule({
  imports: [ HttpClientModule, AngularEditorModule ]
})

Then in HTML

or for usage with reactive forms

if you are using more than one editor on same page set id property

where

…

For ngModel to work, you must import FormsModule from @angular/forms, or for formControlName, you must import ReactiveFormsModule from @angular/forms

To serve the icons file, ensure that your angular.json contains the following asset configuration:

{
  "glob": "**/*",
  "input": "node_modules/@kolkov/angular-editor/assets/icons",
  "output": "assets/ae-icons/"
}

Styling

Connect default theme file to your angular.json or nx.json

"styles": [
     "projects/angular-editor-app/src/styles.scss",
     "node_modules/@kolkov/angular-editor/themes/default.scss"
],

or @include or @use in your project styles.scss file, and then override default theme variables like this:

…

Custom buttons

You can define your custom buttons with custom actions using executeCommandFn. It accepts commands from execCommand. The first argument of this method is aCommandName and the second argument is aValueArgument. Example shows a button that adds Angular editor logo into the editor.


  
    
      
        
          
          
          
            
              
              
              
            
          
        
      
    
  

API

Inputs

Input Type Default Required Description
id string - no Id property when multiple editor used on same page
[config] AngularEditorConfig default config no config for the editor
placeholder string - no Set custom placeholder for input area
tabIndex number - no Set Set tabindex on angular-editor

Outputs

Output Description
(html) Output html
(viewMode) Fired when switched visual and html source mode
(blur) Fired when editor blur
(focus) Fired when editor focus

Methods

Name Description
focus Focuses the editor element

Other

Name Type Description
AngularEditorConfig configuration Configuration for the AngularEditor component.

Configuration

Input Type Default Required Description
editable bolean true no Set editing enabled or not
spellcheck bolean true no Set spellchecking enabled or not
translate string yes no Set translating enabled or not
sanitize bolean true no Set DOM sanitizing enabled or not
height string auto no Set height of the editor
minHeight string 0 no Set minimum height of the editor
maxHeight string auto no Set maximum height of the editor
width string auto no Set width of the editor
minWidth string 0 no Set minimum width of the editor
enableToolbar bolean true no Set toolbar enabled or not
showToolbar bolean true no Set toolbar visible or not
toolbarPosition string top no Set toolbar position top or bottom
placeholder string - no Set placeholder text
defaultParagraphSeparator string - no Set default paragraph separator such as p
defaultFontName string - no Set default font such as Comic Sans MS
defaultFontSize string - no Set default font size such as 1 - 7
uploadUrl string - no Set image upload endpoint https://api.exapple.com/v1/image/upload and return response with imageUrl key. {"imageUrl" : }
upload function - no Set image upload function
uploadWithCredentials bolean false no Set passing or not credentials in the image upload call
fonts Font[] - no Set array of available fonts [{name, class},...]
customClasses CustomClass[] - no Set array of available fonts [{name, class, tag},...]
outline bolean true no Set outline of the editor if in focus
toolbarHiddenButtons string[][] - no Set of the array of button names or elements to hide
toolbarHiddenButtons: [
  [
    'undo',
    'redo',
    'bold',
    'italic',
    'underline',
    'strikeThrough',
    'subscript',
    'superscript',
    'justifyLeft',
    'justifyCenter',
    'justifyRight',
    'justifyFull',
    'indent',
    'outdent',
    'insertUnorderedList',
    'insertOrderedList',
    'heading',
    'fontName'
  ],
  [
    'fontSize',
    'textColor',
    'backgroundColor',
    'customClasses',
    'link',
    'unlink',
    'insertImage',
    'insertVideo',
    'insertHorizontalRule',
    'removeFormat',
    'toggleEditorMode'
  ]
]

What's included

Within the download you'll find the following directories and files. You'll see something like this:

angular-editor/
└── projects/
    ├── angular-editor/
    └── angular-editor-app/

angular-editor/ - library

angular-editor-app/ - demo application

Documentation

The documentation for the AngularEditor is hosted at our website AngularEditor

Icons from Ligature Symbols Icons Collection icons

Contributing

Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.

Editor preferences are available in the editor config for easy use in common text editors. Read more and download plugins at .

Versioning

For a transparency into our release cycle and in striving to maintain backward compatibility, AngularEditor is maintained under the Semantic Versioning guidelines.

See the Releases section of our project for changelogs for each release version.

Creators

Andrey Kolkov

Donate

If you like my work and I save your time you can buy me a :beer: or :pizza:

Star History

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptangularangular-editoreditorrich-text

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架