Hi all, Using the CMS Forum 'MyBB' and a user who is working to implement the CKEditor to MyBB. But long ago I did some questions and I answered in your github profile. So I had to fix the to add a button to ckeditor.
Hi all,
Using the CMS Forum 'MyBB' and a user who is working to implement the CKEditor to MyBB. But long ago I did some questions and I answered in your github profile. So I had to fix the to add a button to ckeditor.
My problem is that I found it difficult to add a buton ckeditor
I do not know javascript, but I read the basic operation of JavaScript to be not so lost to learn the rules and restrictions and achieve add the button to ckeditor.
So far I'm doing well because it appears the button with the image, clicking insert html text, everything ok.
This is plugin.js of external ckeditor that accommodates thanks to a tutorial to add button to ckeditor vBulletin
(function() {
var o = { exec: function(p) {
url = baseUrl + "/GetSomeData";
$.post(url, function(response) {
alert(response)
});
}
};
CKEDITOR.plugins.add('ficha', {
init: function(editor) {
editor.addCommand('ficha',
{exec : function( editor ){
editor.insertHtml( '[ficha][/ficha]' );
}}
);
editor.ui.addButton('ficha', {
label: 'Ficha Code',
icon: this.path + 'ficha.gif',
command: 'ficha'
});
}
});
})();
When clicking the button inserted into the editor: [ficha] [/ficha] | but the cursor is at the last of the labels
My question is how I can do to make the click display [ficha] | [/ficha] but the cursor appears in the middle of the labels.
And when you select some text and then click, you wrap example
Text for example order in MyBB
By clicking the button with the text selected, i do not want you to replace:
Text for [ficha][/ficha] order in MyBB
I want the code to the selected text wrap, example:
Text to [ficha]example[/ficha] order in MyBB
PD: excuse me because I'm using Google Translator
Thanks for your answers
Nothing? Please
Nothing?
Please