0
我想知道如何創建一個ckeditor(v4.x)插件,其中包含兩個或多個命令。在ckeditor中有多個命令的插件
我能夠創建和使用一個命令執行的CKEditor,因爲代碼可以在下面看到:
CKEDITOR.plugins.add ('family',
{
init: function (editor)
{
editor.setKeystroke (CKEDITOR.CTRL + 65, 'parent'); // CTRL+A
editor.addCommand ('parent',
{
exec : function(editor)
{
var selection = editor.getSelection().getSelectedText();
editor.insertHtml ('<span data-role="parent">' + selection + '</span>');
}
});
}
});
我想達到的目標:
CKEDITOR.plugins.add ('family',
{
init: function (editor)
{
editor.setKeystroke (CKEDITOR.CTRL + 65, 'parent'); // CTRL+A
editor.addCommand ('parent',
{
exec : function(editor)
{
var selection = editor.getSelection().getSelectedText();
editor.insertHtml ('<span data-role="parent">' + selection + '</span>');
}
});
editor.setKeystroke (CKEDITOR.CTRL + 69, 'child'); // CTRL+E
editor.addCommand ('child',
{
exec : function (editor)
{
var selection = editor.getSelection().getSelectedText();
editor.insertHtml ('<span data-role="child">' + selection + '</span>');
}
});
}
});
建議?