Page 1 of 1

Problem with my custom plugin

Posted: Wed Dec 11, 2013 3:09 pm
by tomgal001
Hi i wrote simple plugin with params containig javascript arrays in arguments. For example:
users="[['Adam'm 25], [John, 23]]" // this is string which plugin parse

I have problem with smarty and TinyMce editor when i put this args arrays in new lines tiny editor adds new lines in html:

{MyPlugin users="[<br/>['Adam'm 25],<br/> [John, 23]]"}

and smarty show me error page :(

I don't want to clean this html tags in html view.
I think that buttons in editor (clean formating, paste as raw text) do this job but they don't work in wersion 1.11.9

Please help me ...

Re: Problem with my custom plugin

Posted: Wed Dec 11, 2013 3:33 pm
by Jos
Is it an idea to just use comma separated parametervalues like
{MyPlugin users='Adam,John'}

And convert it to a javascript array in your script like this:

Code: Select all

$userarray = explode(',', $params['users']);
$javascriptarray = implode('],[', $userarray);
$javascriptarray = '[[' . $javascriptarray . ']]';
or simply

Code: Select all

$javascriptarray = '[[' . str_replace(',', '],[', $params['users']) . ']]';

Re: Problem with my custom plugin

Posted: Wed Dec 11, 2013 3:39 pm
by calguy1000
You CANNOT mix code like that in a WYSIWYG area.

i.e:

some marked up text with bold and stuff in it
{some_plugin foo='<br/>'}
some more marked up text.

TinyMCE and MicroTiny are not built for that. Period. I will not go into the how or why.
And it goes to the separation of concerns. Don't mix business logic with content or design.

You should disable the wysiwyg on the pages and/or content blocks using these business logic plugins. And don't allow your users to edit those pages or GCB's.

Re: Problem with my custom plugin

Posted: Wed Dec 11, 2013 4:00 pm
by tomgal001
Thanks for your responses.

On the other hand coud you tell my why icons to copy/paste/clean formatting not working in version 1.11.9 ?
If will by some solutions in higher releases ? :)