允许TinyMCE的所有属性

时间:2017-06-28 08:16:58

标签: javascript html tinymce

我正在构建一个javascript(Backbone with Coffeescript)应用程序,在这个应用程序中我正在使用TinyMCE。

我正在添加一个contenteditable设置为true的新标签,但TinyMCE忽略它。我该如何允许这个属性?

这是我的代码:

@App.module "Concerns", (Concerns, App, Backbone, Marionette, $, _) ->

  Concerns.FormWysiwyg = 

    onDomRefresh: ->
      tinymce.init
        selector: '.wysiwyg'
        height: 350
        menubar: false
        statusbar: false
        plugins: [
          'advlist autolink lists link image charmap print preview anchor'
          'searchreplace visualblocks code fullscreen'
          'insertdatetime media table contextmenu paste code'
        ]
        extended_valid_elements: 'span[class|contenteditable]'
        toolbar: 'bold italic | alignleft aligncenter alignright | bullist numlist outdent indent | link | editable'
        setup: (editor) ->
          editor.on 'change', ->
            editor.save()
          editor.addButton 'editable',
            text: 'Editable'
            icon: false
            onclick: ->
              ed = tinyMCE.activeEditor
              content = ed.selection.getContent({'format':'html'})
              new_selection_content = '<span class="editable yellow" contenteditable="true">' + content + '</span>'
              ed.execCommand('insertHTML', false, new_selection_content)

0 个答案:

没有答案