ckeditor - onshow overiding custom definition

时间:2015-08-17 20:17:45

标签: javascript ckeditor

使用ckeditor链接对话框时,我有一些额外选项的自定义代码。我还想抓住所选的文本 - 所以我打电话给:

selectedContents = CKEDITOR.instances['my_editor'].getSelection().getSelectedText();

我想在加载对话框时发生这种情况。所以我写了一个“onShow()”处理函数......但这会弄乱我对对话框所做的自定义。我猜我的onShow正在抓住该事件的正常过程 - 我怎样才能继续正常处理呢?

dialogDefinition.onShow = function(evt) 
{
  contents = CKEDITOR.instances['my_editor'].getSelection().getSelectedText();

  // now here, continue as you were...

}

3 个答案:

答案 0 :(得分:3)

好的,我还有一些问题,但这个问题的答案是在覆盖它之前抓住现有的“onShow”处理程序。使用全局,然后可以在新处理程序中调用它:

with open("your_file") as f:
    r = csv.reader(f)
    for player, level, score in r:
        if player_search == player:
            level_1_score = score
            if level == "2":
                level_2_score = score
            elif level == "3":
                level_3_score = score
            elif level == "4":
                level_4_score = score
            else: # if there can only be five levels we can use else
                level_5_score = score
          # break # again uncomment if there can only be one name == to player_search

答案 1 :(得分:3)

取决于Andy Wallace代码:

var oldOnShow = dialogDefinition.onShow;
var newOnShow = function () { 
//your code 
}

然后:

dialogDefinition.onShow = function(){

                    oldOnShow.call(this, arguments);
                    newOnShow.call(this, arguments);

                }

它帮助我!

答案 2 :(得分:1)

正确的语法是:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        SomeClassWithEvent scwe = new SomeClassWithEvent(20);
        scwe.ErrorMessage +=(s, e) => { MessageBox.Show("Bravo!!!"); };            
    }
    private void button1_Click(object sender, EventArgs e)
    {
        int myData = Int32.Parse(textBox1.Text);
        SomeClassWithEvent scwe1 = new SomeClassWithEvent(myData);            
        textBox1.Text = scwe1.TransformData(myData);
    }        
}