簡體   English   中英

angular6 應用程序中的 tinyMCE 沒有使字體變粗

[英]tinyMCE in angular6 application not making font bold

我是 StackOverflow 的新手,如有錯別字請見諒。

好吧,我正在開發 angular 6 應用程序,我的 tinyMCE 版本 5 編輯器配置如下:

  tinymce.init({
      selector: '.TinyMCE',
      mode: 'exact',
      height: 150,
      menubar: false,
      theme: 'silver',
      statusbar: false,
      plugins: 'placeholder',
      content_style:
        '#tinymce-body { min-height: 0px; } .mce-content-body { color: rgba(101, 99, 93, 1); overflow-x: hidden !important; }',
      body_id: 'tinymce-body',
      toolbar: 'bold underline italic addAttachment',
      valid_elements: 'strong/b,i/italic,p,br',
      inline_styles: false,
      formats: {
        underline: { inline: 'u', exact: true },
        italic: { inline: 'i', exact: true },
        bold: { inline: 'b', exact: true }
        },
      elements: this.elementID,
      setup: this.tinyMCESetup.bind(this),
      //  setup: this.getSetup,
    });

在設置功能...

 tinyMCESetup(ed) {
    ed.on('keyup', this.tinyMCEOnKeyup.bind(this));
    this.editor = ed;
    //starts  here
    ed.ui.registry.addButton('Bold', {
      text: '',
      onAction: () => {
        ed.execCommand('Bold');
        return false;
      }
    });

  }

但是,當我將內容發送到在編輯器中選擇文本並使其加粗后不起作用時,我的意思是當我調試我的應用程序時,它只是將文本發送為。

<p>Hello</p>

但是我期待它有

<p><strong>Hello</strong></p>

附件是我的 tinyMCE 編輯器嵌入 angular 6 聊天應用程序的屏幕截圖。

tinyMCE 圖片

我通過更改tinymce的init屬性來解決它。

 schema:'html5',
formats: {

        underline: { inline: 'u', exact: true },
        italic: { inline: 'em', exact: true },
        bold: { inline: 'b', exact: true }
        }

這幫助我創建了粗體、斜體和下划線。

希望這對需要它的人有所幫助。

謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM