如何通过Jquery在Tiny Mce编辑器中设置行间距? [英] How Do I Set Line Space In Tiny Mce Editor By Jquery ?

查看:71
本文介绍了如何通过Jquery在Tiny Mce编辑器中设置行间距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在微小的mce编辑器中设置行空间?选择行空间中的列表框并应用于小型mce编辑器中的所有文档。

how do i set Line space in tiny mce editor ? List box in select Line space and apply on all document in tiny mce editor.

推荐答案

我从
获得了解决方案




i got a solution from


tinymce.create('tinymce.plugins.LineSpacePlugin', {
     createControl: function (n, cm) {
         switch (n) {
             case 'listbox':
                 var mlb = cm.createListBox('listbox', {
                     title: 'Line Space',
                     onselect: function (v) {
                         mlb.focus();
                         var sel = tinymce.activeEditor.selection;
                         var node = tinymce.activeEditor.selection.getNode();
                         if (node.nodeName == 'BODY') {
                             if (v == "") {
                                 var val = '<p>';
                                 var Content = tinyMCE.activeEditor.selection.getContent({ format: 'html' }).replace(/<p(\s*\w*\s*style(\W*line)).*?>/g, val);
                                 Content = Content.replace(/<ul(\s*\w*\s*style(\W*line)).*?>/g, val);
                                 Content = Content.replace(/<li(\s*\w*\s*style(\W*line)).*?>/g, val);
                                 tinyMCE.execCommand('insertHTML', 0, Content);
                             }
                             else {
                                 var val = '<p style="line-height:' + v + 'pt;">';
                                 var Content = tinyMCE.activeEditor.selection.getContent({ format: 'html' }).replace(/<p>/g, val);
                                 Content = Content.replace(/<p(\s*\w*\s*style(\W*line)).*?>/g, val);
                                 Content = Content.replace(/<ul>/g, val);
                                 Content = Content.replace(/<ul(\s*\w*\s*style(\W*line)).*?>/g, val);
                                 Content = Content.replace(/<li>/g, val);
                                 Content = Content.replace(/<li(\s*\w*\s*style(\W*line)).*?>/g, val);
                                 //tinyMCE.activeEditor.selection.setContent(Content);
                                 //tinyMCE.execCommand('mceInsertContent', false, Content);
                                 tinyMCE.execCommand('insertHTML', false, Content);
                                 //tinyMCE.activeEditor.dom.addClass(tinyMCE.activeEditor.dom.select('p'), 'line-height:' + v + 'pt;');
                             }
                         }
                         else if (node.nodeName == "SPAN") {
                             if (v == "") {
                                 if (


(node).parents('LI'))
(node).parents('LI'))


(node).parent()。css(line-height,);
else
(node).parent().css("line-height", ""); else


这篇关于如何通过Jquery在Tiny Mce编辑器中设置行间距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆