Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

653 B
Raw Blame
window.addEventListener("tinymce.options", function (e) { 
	let tinyMceOptions = e.detail;
	
	tinyMceOptions.quickbars_insert_toolbar += '| Embed';
	tinyMceOptions.toolbar += '| Embed';

	return tinyMceOptions;
});

window.addEventListener("tinymce.setup", function (e) { 
	let editor = e.detail;
	
	editor.ui.registry.addButton('Embed', {
		text: "Embed",
		icon: 'browse',
		tooltip: 'Insert oEmbed Url',
		//enabled: true,
		onAction: (_) => {
			
			const url = prompt('Enter embed URL');
			
			if (url) {
				getOembed(url).then(response => {
					 editor.insertContent(response.html);
				}).catch(error => console.log(error));
			}
		}
	});
});