简体   繁体   中英

Adding Custom button to tinymce editor

当我们给文本提供超链接时, <a>标签会自动分配给文本。就像我如何给文本赋予自己的标签一样,所以我需要一个按钮工具栏,当我选择该按钮时,会自动添加一个自定义标签到选定的文本。

theme_advanced_buttons1 : "Tittle,phpimage,bold,italic,underline",    
setup : function(ed) {
            // Add a custom button
            ed.addButton('Tittle', {
                title : 'Tittle',
                image : './images/copy.jpg',
                onclick : function() {
                    // Add you own code to execute something on click
                    ed.focus();
                    ed.selection.setContent('<tittle>' + ed.selection.getContent() + '</tittle>');
                }
            });
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM