我想使用Froala编辑器并进行测试。通过以下设置,我可以看到插入视频按钮,并且我可以打开一个小窗口以添加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 :(得分:0)
我发现了答案。对于
htmlAllowedEmptyTags
它不应该是空的。最初,我想排除script
,但走得太远了。现在有了以下内容,我可以插入视频链接。
htmlAllowedEmptyTags: ['textarea', 'a', 'iframe', 'object', 'video', 'style','.fa']
希望这有助于其他来到这里的人。