我想用PrimeNG制作羽毛笔编辑器的自定义工具栏。我正在使用Angular 2。
这是我在html代码中所做的:
<p-editor [(ngModel)]="message" [style]="{'height':'320px'}">
<p-header>
<span class="ql-formats">
<select class="ql-size">
<option value="small">Petit</option>
<option selected></option>
<option value="large">Sous-titre</option>
<option value="huge">Titre</option>
</select>
</span>
<span class="ql-formats">
<button class="ql-bold" aria-label="Bold"></button>
<button class="ql-italic" aria-label="Italic"></button>
<button class="ql-underline" aria-label="Underline"></button>
<button class="ql-strike" aria-label="Strike"></button>
</span>
<span class="ql-formats">
<select title="Text Color" class="ql-color" defaultValue="rgb(0, 0, 0)">
<option value="rgb(0, 0, 0)" label="rgb(0, 0, 0)"></option>
...
<option value="rgb(61, 20, 102)" label="rgb(61, 20, 102)"></option>
</select>
<span class="ql-format-separator"></span>
<select title="Background Color" class="ql-background" defaultValue="rgb(255, 255, 255)">
<option value="rgb(0, 0, 0)" label="rgb(0, 0, 0)"></option>
...
<option value="rgb(61, 20, 102)" label="rgb(61, 20, 102)"></option>
</select>
</span>
<span class="ql-formats">
<button class="ql-list" title="List"></button>
<button class="ql-bullet" title="Bullet"></button>
<select title="Text Alignment" class="ql-align" >
<option selected>Gauche</option>
<option value="center" label="Center"></option>
<option value="right" label="Right"></option>
<option value="justify" label="Justify"></option>
</select>
</span>
<span class="ql-formats">
<button aria-label="Link" class="ql-link"></button>
<button aria-label="Image" class="ql-image"></button>
</span>
</p-header>
</p-editor>
但是正如您所看到的ql-list
,ql-bullet
并且未显示。
我能做什么 ?
注意这两个按钮的代码之间的区别:
<button class="ql-list" title="List"></button>
<button class="ql-bullet" title="Bullet"></button>
以及编辑器渲染时的实际代码。您要做的就是将title属性替换为可以完成操作的value属性:
<button class="ql-list" value="ordered"></button>
<button class="ql-list" value="bullet"></button>
我要做的只是返回primeng拥有的功能齐全的工具栏,然后右键单击>检查未正确显示的按钮的html标签,然后得到正确的代码来显示它。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句