English 中文(简体)
锡克教区:最后加入的法典
原标题:tinyMCE: Remove last inserted code
  • 时间:2011-09-30 10:29:51
  •  标签:
  • tinymce

此后: 编辑固定规模,没有剪辑机;

我怎么能去掉在廷斯马赛插入的最后一部法典?

setup : function(ed){
ed.onKeyDown.add(function (ed, evt) {
            var currentfr=document.getElementById(ed.id +  _ifr );
            if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) { //ns6 syntax
                currentfr.height = currentfr.contentDocument.body.offsetHeight + 26;
            }
            else if (currentfr.Document && currentfr.Document.body.scrollHeight) { //ie5+ syntax
                    currentfr.height = currentfr.Document.body.scrollHeight;
            }
            if( currentfr.height >= 156 ){
                // Remove last inserted code here
            }
});

},

因此,如果高点为156或以上,就应当删除你刚才所描述的(代码)。

如何做到这一点?

最佳回答

我进行了几次测试,这是我提出的:

setup : function(ed){

    ed.onKeyDown.add(function (ed, evt) {
        var currentfr=document.getElementById(ed.id +  _ifr );
        if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) { //ns6 syntax
            currentfr.height = currentfr.contentDocument.body.offsetHeight + 26;
        }
        else if (currentfr.Document && currentfr.Document.body.scrollHeight) { //ie5+ syntax
            currentfr.height = currentfr.Document.body.scrollHeight;
        }
        if (evt.keyCode != 8 && evt.keyCode != 46 && currentfr.height < 156){
          ed.bookmark = ed.selection.getBookmark(2,true);
          ed.latest_content = ed.getContent({format: raw });
        }
    });

    ed.onKeyUp.add(function (ed, evt) {
        var currentfr=document.getElementById(ed.id +  _ifr );
        if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) { //ns6 syntax
            currentfr.height = currentfr.contentDocument.body.offsetHeight + 26;
        }
        else if (currentfr.Document && currentfr.Document.body.scrollHeight) { //ie5+ syntax
            currentfr.height = currentfr.Document.body.scrollHeight;
        }
        if( currentfr.height >= 156 && evt.keyCode != 8 && evt.keyCode != 46){
            // Remove last inserted code here
            // save and reset the caret using a bookmark
            ed.setContent(ed.latest_content);
            ed.selection.moveToBookmark(ed.bookmark);
            ed.execCommand( mceCleanup );
        }
    });
},
问题回答

暂无回答




相关问题
Tinymce Model Binding with ASP.NET MVC

Does anyone know how to auto-populate the tinymce editor from the ASP.NET MVC model? In other words, what code do I need to use to set the contents of tinymce? EDITED: My problem is that tinyMCE is ...

How to dynamically load & unload a TinyMCE Plugin

Does anyone know if there is a way I can dynamically load and unload a TinyMCE plugin after TinyMCE has already been loaded? Specifically, I m thinking about asking the user whether or not they wish ...

tinyMCE problem with jQuery load

I have a DIV and a Load button on my page and when I click in Load button the jQuery loads a HTML from another file, this HTML file have texteareas and start tinymce. Ex: <script language="...

TinyMCE - adding an ON/OFF toggle switch

I m using TinyMCE on the text-areas in my Magento admin section. I have my TinyMCE editor visible form the start, but I want the option to disable/re-enable it. I m using the jQuery plugin version, ...

My admin panel and upload

I have written an admin panel for my site (im beginner in php). In content.php I have insert tinyMCE editor. I want to upload images from editor. What is the best way to do this. (not very familiar ...

How to click TinyMCE toolbar s button programmatically?

I want to make preview button as usual form button next to submit button(as it made in most cases of "Post new topic" forms). How can I programmatically simulate toolbar s preview button click ? I ...

热门标签