2017-07-30 357 views
0

我想使用Froala编辑器并正在测试它。通过以下设置,我可以看到插入视频按钮,并且我可以打开一个小窗口以添加Youtube链接或嵌入代码。但是,当输入链接或嵌入代码并单击插入按钮时,编辑区域中不显示任何内容。哪里不对?Froala WYSIWYG编辑器:为什么我无法插入Youtube视频链接或嵌入代码到编辑区域?

 $('textarea').froalaEditor({ 
      charCounterCount: true, 
      codeMirror: false, 
      charCounterMax: 1000, 
      direction: 'ltr', 
      disableRightClick: false, 
      editorClass: 'froala-editor', 
      htmlAllowComments: false, 
      htmlAllowedEmptyTags: [], 
      htmlExecuteScripts: false, 
      htmlRemoveTags: ['script', 'style', 'base'], 
      placeholderText: '', 
      pluginsEnabled: ['align','codeView','colors','draggable','emoticons','entities','fontFamily','fontSize','fullscreen','image','lineBreaker','link','lists','paragraphFormat','quote','video'], 
      shortcutsEnabled: ['show', 'bold', 'italic', 'underline', 'strikeThrough', 'indent', 'outdent', 'undo', 'redo', 'insertImage', 'createLink'], 
      spellcheck: false, 
      toolbarButtons: ['fullscreen', 'bold', 'italic', 'underline', '|', 'fontFamily', 'fontSize', 'color', 'inlineStyle', 'paragraphStyle', '|', 'paragraphFormat', 'align', 'formatOL', 'formatUL', 'outdent', 'indent', 'quote', '|', 'insertLink', 'insertImage', 'insertVideo', '|', 'emoticons', 'specialCharacters', 'insertHR', 'selectAll', 'clearFormatting', '|', 'print', 'help', 'html', '|', 'undo', 'redo'], 
      toolbarButtonsSM: null, 
      toolbarButtonsXS: null, 
      toolbarSticky: false, 
      toolbarVisibleWithoutSelection: true, 
      imageAllowedTypes: ['jpeg', 'jpg', 'png','gif'], 
      imageEditButtons: ['imageReplace', 'imageAlign', 'imageRemove', '|', 'imageLink', 'linkOpen', 'linkEdit', 'linkRemove', '-', 'imageDisplay', 'imageAlt', 'imageSize'], 
      imageMaxSize: 1024 * 1024 * 1, 
      linkInsertButtons: ['linkBack'], 
      paragraphFormat: { 
       N: 'Normal', 
       H1: 'Heading 1', 
       H2: 'Heading 2', 
       H3: 'Heading 3', 
      }, 
      videoAllowedProviders: ['youtube', 'vimeo'], 
      videoInsertButtons: ['videoBack', '|', 'videoByURL', 'videoEmbed'] 
     }) 
    }); 
+0

你试图插入什么URL? – st3fan

+0

这只是一个例子。我打开它,并从浏览器地址栏复制它的网址:https://www.youtube.com/watch?v=yoPq-s7-_qM&t=152s – curious1

+0

斯蒂芬,你介意看这个问题吗?谢谢! https://stackoverflow.com/questions/45396636/froala-wysiwyg-editor-how-to-do-background-color – curious1

回答

0

我发现答案。对于

htmlAllowedEmptyTags 

它不应该是空的。最初,我想排除script,但是太过分了。现在,我可以插入视频链接。

htmlAllowedEmptyTags: ['textarea', 'a', 'iframe', 'object', 'video', 'style','.fa'] 

希望这有助于谁来到这里其他人。