MyBB Community Forums

Full Version: re-assign a button in the editor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello All,
Is it possible to re-assign a button in the below editor*, to say "Hello World"?


[Image: ed.png]

* Quick Advanced Editor Plus[url=https://github.com/martec/quickadveditorplus][/url]
Example js:
// Add SCEditor Command
$.sceditor.command.set('custom_insert_code', {
	exec: custom_insert_code_sce,
	txtExec: custom_insert_code_sce,
	tooltip: "Insert Code"
});

// SCEditor Driver
function custom_insert_code_sce() {
	var code = custom_insert_code();
	if (false !== code) {
		this.insert('[php]' + code + '[/php]');
	}
}

// Custom Function
function custom_insert_code() {
	return "console.log('Success!)";
}

Use CSS to insert the icon in the custom button.
(2024-05-18, 10:35 PM)effone Wrote: [ -> ]Example js:
// Add SCEditor Command
$.sceditor.command.set('custom_insert_code', {
	exec: custom_insert_code_sce,
	txtExec: custom_insert_code_sce,
	tooltip: "Insert Code"
});

// SCEditor Driver
function custom_insert_code_sce() {
	var code = custom_insert_code();
	if (false !== code) {
		this.insert('[php]' + code + '[/php]');
	}
}

// Custom Function
function custom_insert_code() {
	return "console.log('Success!)";
}

Use CSS to insert the icon in the custom button.

Thank you!