Froala 所见即所得编辑器:为什么我无法在编辑区插入 Youtube 视频 link 或嵌入代码?
Froala WYSIWYG editor: why am I not able to insert Youtube video link or embed code into the editing area?
我想使用 Froala 编辑器并正在测试它。通过以下设置,我可以看到插入视频按钮,并且可以打开一个小 window 以添加 Youtube link 或嵌入代码。但是,当输入 link 或嵌入代码并单击插入按钮时,编辑区域中没有显示任何内容。怎么了?
$('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']
})
});
我找到答案了。对于
htmlAllowedEmptyTags
不能为空。最初,我想排除 script
,但太过分了。现在有了以下内容,我可以插入视频 link.
htmlAllowedEmptyTags: ['textarea', 'a', 'iframe', 'object', 'video', 'style','.fa']
希望这对来到这里的其他人有所帮助。
我想使用 Froala 编辑器并正在测试它。通过以下设置,我可以看到插入视频按钮,并且可以打开一个小 window 以添加 Youtube link 或嵌入代码。但是,当输入 link 或嵌入代码并单击插入按钮时,编辑区域中没有显示任何内容。怎么了?
$('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']
})
});
我找到答案了。对于
htmlAllowedEmptyTags
不能为空。最初,我想排除 script
,但太过分了。现在有了以下内容,我可以插入视频 link.
htmlAllowedEmptyTags: ['textarea', 'a', 'iframe', 'object', 'video', 'style','.fa']
希望这对来到这里的其他人有所帮助。