【问题标题】:PrimeNG Quill editor custom toolbarPrimeNG Quill 编辑器自定义工具栏
【发布时间】:2018-02-05 20:53:17
【问题描述】:

我想用 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-listql-bullet 并未显示。

我能做什么?

【问题讨论】:

    标签: angular primeng quill


    【解决方案1】:

    注意这两个按钮的代码之间的区别:

     <button class="ql-list" title="List"></button>
     <button class="ql-bullet" title="Bullet"></button>
    

    以及编辑器呈现时的实际代码。您所要做的就是将标题属性替换为可以解决问题的值属性:

    <button class="ql-list" value="ordered"></button>
    <button class="ql-list" value="bullet"></button>
    

    我所做的只是返回primeng拥有的全功能工具栏并右键单击>检查未正确显示的按钮的html标签,然后我得到了正确的代码来显示它。

    【讨论】:

    • 非常感谢!我查看了完整的功能标签,但没有找到,或者我错过了:/
    • 我在寻找所有工具栏选项的列表时遇到了您的帖子(感谢您),当我注意到您缺少这些按钮时,我想通了 primeng 是如何呈现这些按钮的,我立即知道了不同的属性可以在呈现图标或将其留空之间产生差异。
    • @WilliamMatias 能否请您查看 issue stackoverflow.com/questions/61889006/…,如果您有任何线索,请告诉我
    猜你喜欢
    • 1970-01-01
    • 2021-06-24
    • 2018-06-25
    • 1970-01-01
    • 1970-01-01
    • 2020-03-15
    • 2019-08-23
    • 2021-01-24
    • 1970-01-01
    相关资源
    最近更新 更多