Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TinyMCE version 5 Developer Challenge #4767

Closed
androb opened this Issue Jan 18, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@androb
Copy link
Member

androb commented Jan 18, 2019

To get more feedback about the TinyMCE UI and Plugin APIs we are hosting a Developer Challenge.

Get involved! Full details on our blog:
https://go.tiny.cloud/blog/tinymce-5-developer-challenge/

@androb androb added the 5.x label Jan 18, 2019

@androb androb pinned this issue Jan 18, 2019

@cfconsultancy

This comment has been minimized.

Copy link

cfconsultancy commented Jan 29, 2019

Let me be the first with a very simple plugin. Clicking on the button inserts some Lorum ipsum text
The only thing I cannot get to work is a custom button :-)

tinymce.PluginManager.add('lorumipsum', function(editor, url) {
    // Add a button
    editor.ui.registry.addButton('lorumipsum', {
    text: 'lorem ipsum',
    tooltip: 'lorem ipsum text',
     onAction: function() {
		editor.insertContent('<h1>Tu enim ista lenius, hic Stoicorum more nos vexat.</h1><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nihilo magis. Primum quid tu dicis breve? <b>Maximus dolor, inquit, brevis est.</b>Quod quidem iam fit etiam in Academia.</mark><i>Que Manilium, ab iisque M.</i> Sed residamus, inquit, si placet. Duo Reges: constructio interrete. Sed tamen omne, quod de re bona dilucide dicitur, mihi praeclare dici videtur. Hunc vos beatum; Habes, inquam, Cato, formam eorum, de quibus loquor, <a href="#">philosophorum</a>.</p><h2>Quam ob rem tandem, inquit, non satisfacit?</h2><p>Nam memini etiam quae nolo, oblivisci non possum quae volo. Octavio fuit, cum illam severitatem in eo filio adhibuit, quem in adoptionem D. Est, ut dicis, inquam. </p><blockquote cite="http://loripsum.net">Epicurus autem cum in prima commendatione voluptatem dixisset, si eam, quam Aristippus, idem tenere debuit ultimum bonorum, quod ille;</blockquote><ol><li>Illud non continuo, ut aeque incontentae.</li><li>Vide, quantum, inquam, fallare, Torquate.</li><li>Laelius clamores sofòw ille so lebat Edere compellans gumias ex ordine nostros.</li></ol><p>Nam, ut sint illa vendibiliora, haec uberiora certe sunt. Dicam, inquam, et quidem discendi causa magis, quam quo te aut Epicurum reprehensum velim. Nam adhuc, meo fortasse vitio, quid ego quaeram non perspicis. Videsne quam sit magna dissensio? Sin dicit obscurari quaedam nec apparere, quia valde parva sint, nos quoque concedimus; Non dolere, inquam, istud quam vim habeat postea videro; Ut nemo dubitet, eorum omnia officia quo spectare, quid sequi, quid fugere debeant? Dulce amarum, leve asperum, prope longe, stare movere, quadratum rotundum. </p><p>Quamquam tu hanc copiosiorem etiam soles dicere. Si quidem, inquit, tollerem, sed relinquo. Mihi enim satis est, ipsis non satis. <b>Quod totum contra est.</b> Huic mori optimum esse propter desperationem sapientiae, illi propter spem vivere. Nunc ita separantur, ut disiuncta sint, quo nihil potest esse perversius. <i>Tum Triarius: Posthac quidem, inquit, audacius.</i> </p><h3>Quaerimus enim finem bonorum.</h3><p>Quae fere omnia appellantur uno ingenii nomine, easque virtutes qui habent, ingeniosi vocantur. <i>Hoc sic expositum dissimile est superiori.</i> Ratio enim nostra consentit, pugnat oratio. Obsecro, inquit, Torquate, haec dicit Epicurus? </p><ul><li>Sed finge non solum callidum eum, qui aliquid improbe faciat, verum etiam praepotentem, ut M.</li><li>Non pugnem cum homine, cur tantum habeat in natura boni;</li><li>Unum nescio, quo modo possit, si luxuriosus sit, finitas cupiditates habere.</li><li>Nunc de hominis summo bono quaeritur;</li></ul>');
        }
    });
});
@cfconsultancy

This comment has been minimized.

Copy link

cfconsultancy commented Jan 29, 2019

Also an example plugin here by martyf https://github.com/martyf/tinymce-5-plugin-with-dialog

A question, how to make it dynamic with php for example since an php include or iframe is not supported anymore ?

@cfconsultancy

This comment has been minimized.

Copy link

cfconsultancy commented Jan 29, 2019

Here an dynamic example of an album module in php and ubb code

// albums button
editor.ui.registry.addMenuButton('albums', {
//type: 'menubutton',
text: 'Albums',
fetch: function (callback) {
	var items = [
	<?php
	//albums
	if ($albumadmin = 1) {
	$albumdir = "../images/album/";
	 foreach(glob($albumdir.'*', GLOB_ONLYDIR) as $dir) {
		$dirname = basename($dir);
		echo "{type: 'menuitem', text: '" . str_replace("_", " ", $dirname) . "', onAction: function() {editor.insertContent('[MODULE:gallery:" . $dirname . "]');}},";
	 }
      }
      ?>
];
callback(items);
}
});

@TheSpyder TheSpyder unpinned this issue Mar 5, 2019

@TheSpyder

This comment has been minimized.

Copy link
Member

TheSpyder commented Mar 5, 2019

We'll tally the submitted issues and announce the winners soon :)

@TheSpyder TheSpyder closed this Mar 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.