English 中文(简体)
图一
原标题:Show a button next to an element inside TinyMCE

我想在丁瑞克语中每个具体要素(例如表格)的旁边打一个 but子(例如,米布顿),然后,当 but子被点击时,就把这个具体要素 s到html处理,并在编辑中加以更新。

我可以处理加工问题,但我可以指出,如何显示纽伦,并 gr碎具体要素——html。 例如,如果我这样做的话,就会增加时间的html。 我对锡里卡马埃语的我的回答是,如果这是正常内容,我不想:

jQuery( iframe#content ).contents().find( table ).append( <span class="mybutton">My button</span> );

我在此试图做的是:

function processElement( element, values ) {
      // do stuff to the table html (I don t need help with this part)
      return element;
}


function appendButtonToTinyMCEElement ( button, element ) {

     // put button next to all instances of the specified element in TinyMCE
     // (in this case, put span.mybutton at the corner of all tables)

}


$( .myhelperbutton ).click(function(){

      var element = ??? // get content of the element whose button was clicked
      var element = processElement( element );
      // send element back to TinyMCE (not sure how)

});

So, my two questions are: How can I display the button in the right place without affecting the html that gets saved in TinyMCE? And, when the button is clicked, how do I get/set just that element from TinyMCE?

问题回答

如果我能正确理解,你就希望 gr掉所有表层的OMS分子,把一个 but子放在后面,那就有些 st。

以下是我的第一个想法。 我将作出方便的假设,但让我知道,我是否做了一些错误的假设。 我也不知道你已经知道多少份 j/j,因此,让我知道我是否清楚解释一些。

jQuery( iframe#content ).contents().find( table ).each(function(index, element) {
    // create a new button.
    var $btn = $( <input type="button" class="mybutton"></input> );

    function action() {
        // This is using the `processElement` function you defined in your question,
        // I am applying it to the specific table just grabbed.
        processElement(element);
    }
    $btn.click(action);

    // This should append the button. See http://api.jquery.com/after/
    $(element).after($btn[0]);
});

让我知道,这是否有利于你。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签