2017-07-30 134 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'] 

希望這有助於誰來到這裏其他人。