TinyMCE"添加课程"输入字段到链接对话框

时间:2017-03-23 16:53:31

标签: class tinymce tinymce-4

link_class_list插件允许创建添加链接时要选择的类列表。有没有办法添加开放输入而不是下拉列表,以便用户可以输入任何类?

这些是文档中的参数,但没有提及开放输入字段。

tinymce.init({
  selector: "textarea",  // change this value according to your HTML
  plugins: "link",
  menubar: "insert",
  toolbar: "link",
  link_class_list: [
    {title: 'None', value: ''},
    {title: 'Dog', value: 'dog'},
    {title: 'Cat', value: 'cat'}
  ]
});

1 个答案:

答案 0 :(得分:0)

<script>
tinymce.init({
	selector: 'textarea',
	menubar:false,
	plugins: [
		'advlist autolink link image lists charmap print preview hr anchor pagebreak',
		'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',
		'save table contextmenu directionality emoticons template paste textcolor code pageembed codesample advcode '
	],
	toolbar: 'bold italic | link image preview media fullpage pageembed | code codesample forecolor backcolor | emoticons styleselect alignleft aligncenter alignright alignjustify bullist numlist outdent indent |table tabledelete | tableprops tablerowprops tablecellprops | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol',
        default_link_target: '_blank',
        style_formats: [{title: 'Button (Default)', selector: 'a', classes: ''}, {title: 'Button (primary)', selector: 'a', classes: 'btn btn-primary'}, {title: 'Button (success)', selector: 'a', classes: 'btn btn-success'}],
        link_class_list: [{title:'Button (Default)', value:''}, {title:'Button (primary)', value:'btn btn-primary'}, {title:'Button (success)', value:'btn btn-success'}]

});
</script>

尝试一下。