ng-quill is an Angular.js component for Quill rich text editor.
If you like my work, feel free to support it. Donations to the project are always welcomed :)
PayPal: PayPal.Me/bengtler
BTC Wallet Address:3QVyr2tpRLBCw1kBQ59sTDraV6DTswq8Li
ETH Wallet Address:0x394d44f3b6e3a4f7b4d44991e7654b0cab4af68f
LTC Wallet Address:MFif769WSZ1g7ReAzzDE7TJVqtkFpmoTyT
npm install ng-quill
npm install angular angular-sanitize quill
The new version is complete rewritten and is using QuillJS 1.x.For the latest old version (0.20.1) checkout the special branch for it.
var myAppModule = angular.module('quillTest', ['ngQuill']);
<ng-quill-editor ng-model="message"></ng-quill-editor>
[ng-quill-editor] { display: block; }
ng-quill-toolbar
- it uses transclusion to add toolbar, avoids flickering and sets the modules toolbar config to the custom toolbar automatically:<ng-quill-editor ng-model="title">
<ng-quill-toolbar>
<div>
<span class="ql-formats">
<button class="ql-bold" ng-attr-title="{{'Bold'}}"></button>
</span>
<span class="ql-formats">
<select class="ql-align" ng-attr-title="{{'Aligment'}}">
<option selected></option>
<option value="center"></option>
<option value="right"></option>
<option value="justify"></option>
</select>
<select class="ql-align">
<option selected></option>
<option value="center"></option>
<option value="right"></option>
<option value="justify"></option>
</select>
</span>
</div>
</ng-quill-toolbar>
</ng-quill-editor>
top
, possible values top
, bottom
let app = angular.module('app', [ 'ngQuill' ])
app.constant('NG_QUILL_CONFIG', {
/*
* @NOTE: this config/output is not localizable.
*/
modules: {
toolbar: [
['bold', 'italic', 'underline', 'strike'], // toggled buttons
['blockquote', 'code-block'],
[{ 'header': 1 }, { 'header': 2 }], // custom button values
[{ 'list': 'ordered' }, { 'list': 'bullet' }],
[{ 'script': 'sub' }, { 'script': 'super' }], // superscript/subscript
[{ 'indent': '-1' }, { 'indent': '+1' }], // outdent/indent
[{ 'direction': 'rtl' }], // text direction
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
[{ 'font': [] }],
[{ 'align': [] }],
['clean'], // remove formatting button
['link', 'image', 'video'] // link and image, video
]
},
theme: 'snow',
debug: 'warn',
placeholder: '',
readOnly: false,
bounds: document.body,
scrollContainer: null
})
app.config([
'ngQuillConfigProvider',
'NG_QUILL_CONFIG',
function (ngQuillConfigProvider, NG_QUILL_CONFIG) {
ngQuillConfigProvider.set(NG_QUILL_CONFIG)
}
])
*see: ./src/ng-quill/app.provider('ngQuillConfig').config
ngQuillConfigProvider.set({modules: { ... }, theme: 'snow', placeholder: 'placeholder', formats: { ... }, bounds: document.body, readyOnly: false) to config toolbar module, other modules, default theme, allowed formats, ...
theme="snow"
(default: 'snow')read-only=""
(default: false) - requires true or falsemodules="modulesConfig"
placeholder="'Inser your text here'"
or placeholder="''"
for empty stringbounds="..."
, change the default boundary element of the editor (document.body
) - set it to 'self' and the editor element is usedformats="formatsArray"
, per default all quill formats are allowedmax-length="5"
, adds validation for maxlength (sets model state to invalid
and adds ng-invalid-maxlength
class)min-length="5"
, adds validation for minlength (sets model state to invalid
and adds ng-invalid-minlength
class), only works for values > 1, if you only want to check if there is a value --> use required/ng-requiredtrue
)styles="{ backgroundColor: 'red' }"
html
(default: false
)'error', 'warn', 'log', true, false
(default: 'warn'
)user
(quill source user) or all
change should be trigger model update, default user
. Using all
is not recommended, it cause some unexpected sideeffects. But useful for 3rd Party modules and blots to keep your model up to dateon-editor-created="myCallback(editor)"
on-content-changed="myCallback(editor, html, text, content, delta, oldDelta, source)"
on-selection-changed="myCallback(editor, range, oldRange, source)"
- content = quill editor content object, text = content as plain text, html = content as html stringon-focus="myCallback(editor, source)"
on-blur="myCallback(editor, source)"
Angular templates provide some assurance against XSS in the form of client side sanitizing of all inputs.
Ng-quill provides the config paramter sanitize to sanitize html-strings passed as ngModel to the component.
It is deactivated per default to avoid stripping content or styling, which is not expected.
But it is recommended to activate this option, if you are working with html strings as model values.
After editor creation you can use everything from the ordinary quill editor -> listen to editorCreated and work with the editor instance in your controller like you want ;).Add modules, use the quill API or listen to Events. Keep in mind to use $timeout if you are listening / working with quill-Events and updating some $scope stuff to notify angular about it ;).Quill Documentation
1、安装 npm install ng2-quill-editor --save 2、主模块中引入 import { QuillEditorModule } from 'ng2-quill-editor'; @NgModule({ // ... imports: [ QuillEditorModule ], // ... }) export class AppModule
1. npm install --save-dev @types/quill 安装types 2.npm install ng2-quill-editor --save 安装quill 3.配置tsconfig.app.json "compilerOptions": { "types": ["node", "jasmine"] } 转载于:https://www.cnblogs.com/
今天在运行build ng程序的时候,遇见了下面的错误: ERROR in : 'quill-editor' is not a known element: 1. If 'quill-editor' is an Angular component, then verify that it is part of this module. 2. If 'quill-editor' is a Web C
问题内容: 我试图了解和/ 之间的区别,但对我来说它们看起来相同。 我应该记住使用一个或另一个来区别吗? 问题答案: ngIf 该指令根据表达式 删除或重新创建 DOM树的一部分。如果赋值为的表达式的计算结果为假值,则将元素从DOM中删除,否则将元素的克隆重新插入DOM中。 删除元素时,使用它的作用域将被销毁,并在恢复该元素时创建一个新的作用域。在内部创建的作用域使用原型继承从其父作用域继承。 如
问题内容: 任何人都可以为该JSFiddle提供正确的方法: JsFiddle链接 我正在尝试通过.class&#ID更改元素的类。 提前致谢 感谢tymeJV,新的JSFiddle: 解 问题答案: 正确的方法是根据切换变量使用,请考虑: CSS: JS: HTML: 通过根据变量(“ toggle”)是否为或分配引用的类(在上面为“红色”)来工作。
问题内容: 我了解这一点,并会影响在元素上设置的类,并控制是否将元素呈现为DOM的一部分。 有没有对选择的准则在/ 或反之亦然? 问题答案: 取决于您的用例,但总结不同之处: 将从DOM中删除元素。这意味着您所有的处理程序或所有附加到这些元素的内容都将丢失。例如,如果将单击处理程序绑定到子元素之一,则将其评估为false时,将从DOM中删除该元素,并且即使稍后将其评估为true并显示该元素,您的单
NG Bootstrap 是基于 Angular(非 Angular.js)开发的 Bootstrap CSS 框架的指令集。 原生开发 专为Bootstrap 4 开发的Angular组件,开发了符合Angular生态系统的API,没有使用任何第三方Javascript库来实现,全都是纯粹的原生Javascript。 Boostrap的JS插件 支持全部Boostrap自带的Javascript
Mogwai ERDesigner NG是一个实体关系建模工具类似于ERWin。它设计成让数据库建模变得尽可能简易并为整个开发过程提供支持,从数据库设计到模式 (schema)和代码生成。此外ERDesigner还提供一个灵活的插件体系,从而可以通过安装新的插件来扩展该工具的功能。ERDesigner提 供的功能包括: *.能够使用一个强大和易于使用的图形编辑来设计数据库模型。 *.能够依据ER图
ng-inspector 是Chrome和Safari的浏览器扩展程序,它显示一个检查器面板,该面板实时显示当前页面中的AngularJS作用域层次结构,以及哪些控制器或指令与哪个作用域相关联。 将鼠标悬停在检查器中的范围上将突出显示该范围附加到的DOM元素。单击模型将console.log该模型的内容。 该扩展程序在带有AngularJS徽标的地址栏旁边添加了一个按钮,用于打开和关闭窗格。
netsniff-ng 是一个高性能的Linux下基于命令行的网络包分析工具,与 tcpdump 和其他基于 libpcap 的包分析器不同的是,netsniff-ng 直接将输入的帧循环映射到接收缓冲区中,这样就可以直接在用户空间中进行方法,而无须在地址空间中复制。可用来调试本地网、测量性能和吞吐量,并生成相应的数据统计报表。
Highcharts-ng 是一个 AngularJS 的指令扩展,实现了在 AngularJS 应用中集成 Highcharts 图表库的功能。 演示地址:http://jsfiddle.net/pablojim/46rhz/ 使用方法: var myapp = angular.module('myapp', ["highcharts-ng"]); HTML: <highchart id="ch