Highlight plugin calls
Highlight plugin calls
Little idea:
how would it be possible to have all calls styled by a pre-defined colour different from the pre9-defined webpage text color?
Or even with a tooltip with configurable hint, warning etc.
E.g.
Heading
{{{COMMENT: plugin-call();}}}
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat."
how would it be possible to have all calls styled by a pre-defined colour different from the pre9-defined webpage text color?
Or even with a tooltip with configurable hint, warning etc.
E.g.
Heading
{{{COMMENT: plugin-call();}}}
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat."
Last edited by cmb on Sat Dec 27, 2014 6:10 pm, edited 1 time in total.
Reason: moved to new topic
Reason: moved to new topic
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Highlight plugin calls
That would be nice. I have seen this several times done by users, not rarely causing the plugin call to fail due to markup inside the {{{ }}}.Tata wrote:how would it be possible to have all calls styled by a pre-defined colour different from the pre9-defined webpage text color?
However, this would have to be done for each editor individually to be working before the page is saved, and I'm not sure if it's feasible at all. If it would be okay to highlight the plugin call only after saving, we could do that similar to replacing a surrounding <p> with a <div>. In both cases adding an appropriate CSS class (which would have to be styled in the template's stylesheet) might be sufficient.
A quick draft: find the following in cmsimple/adminfuncs.php (line 922ff):
Code: Select all
$text = preg_replace(
'/<p>({{{.*?}}}|#CMSimple .*?#)<\/p>/isu', '<div>$1</div>', $text
);
Code: Select all
$text = preg_replace(
'/<(?:p|div)>({{{.*?}}}|#CMSimple .*?#)<\/(?:p|div)>/isu', '<div class="xh_plugin_call">$1</div>', $text
);
Christoph M. Becker – Plugins for CMSimple_XH
Re: Highlight plugin calls
Tested with 1.6.4 - works but only with the comment "PLUGIN:". With pure {{{plugincall();}}} it doesn't work at all.
However, the plugin output is then styled too. E.g. the call makes the Guestbook styled the same way as defined in xh_plugin_call.
However, the plugin output is then styled too. E.g. the call
Code: Select all
{{{twocents('guestbook');}}}
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Highlight plugin calls
I had tested with {{{slideshow('slides', 'order=fixed');}}}, and that worked. However, it won't work, if the plugin call is written inline or if it is put in an already styled element, for instance. There is room for improvement, even though we may not be able to catch all cases.Tata wrote:Tested with 1.6.4 - works but only with the comment "PLUGIN:". With pure {{{plugincall();}}} it doesn't work at all.
Yes, indeed. To avoid that, the styling of the plugin call must not be put into the template's stylesheet, but rather in a separate stylesheet, which has to be referenced in plugins/tinymce/inits/init_*.js. For instance,replace:Tata wrote:However, the plugin output is then styled too.
Code: Select all
content_css : "%STYLESHEET%",
Code: Select all
content_css : "%STYLESHEET%, ./plugins/tinymce/inits/editor.css",
Christoph M. Becker – Plugins for CMSimple_XH
Re: Highlight plugin calls
Works fine but still only with "PLUGIN: ". At least on my website.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Highlight plugin calls
Tested right now with v1.6.9.
Adjusted the above suggested code to
and saving editor.css in ./plugins/tinymce/initsI get
[ external image ]
As you see, it works without "PLUGIN" and it acts only while logged in. Normally the plugin call is executed.
However, it doesn't work if there are other plugins installed. Or it seems that the problem is somewhere in content.htm. With Original content file it works. When I add a content from another website, it doesn't work.
Adjusted the above suggested code to
Code: Select all
if(!$adm == "true"){
$text = preg_replace('/<(?:p|div)>({{{.*?}}}|#CMSimple .*?#)<\/(?:p|div)>/isu', '<div class="xh_plugin_call">$1</div>', $text);
}else{
$text = preg_replace('/<(?:p|div)>({{{.*?}}}|#CMSimple .*?#)<\/(?:p|div)>/isu', '<div>$1</div>', $text);
}
Code: Select all
.xh_plugin_call{display: inline-block; background: yellow; color: red; border: 1px solid red;}
.xh_plugin_call:before{content: "PLUGIN CALL: "; color: red; font-weight: bold;}
.xh_plugin_call:after{content: " DON'T TOUCH!!!"; color: red; font-weight: bold;}
[ external image ]
As you see, it works without "PLUGIN" and it acts only while logged in. Normally the plugin call is executed.
However, it doesn't work if there are other plugins installed. Or it seems that the problem is somewhere in content.htm. With Original content file it works. When I add a content from another website, it doesn't work.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Highlight plugin calls
Another idea:
what about something like this: http://sdk.ckeditor.com/samples/placeholder.html ?
Once you have entered a PluginCall it gets highlighted and you can only edit the contents with a double click.
what about something like this: http://sdk.ckeditor.com/samples/placeholder.html ?
Once you have entered a PluginCall it gets highlighted and you can only edit the contents with a double click.
Re: Highlight plugin calls
Well, this would be fine. But it would require to use CKRditor instead of tinyMCE, which is somehow more flexible to me.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
Re: Highlight plugin calls
Great! IMHO much better than just highlighting plugin calls. Thank!Holger wrote:what about something like this: http://sdk.ckeditor.com/samples/placeholder.html ?
There might be a similar solution readily available for TinyMCE (I couldn't find one, though), or we may write one ourselves (Calleditor_XH is actually somewhat similar). Note, however, that TinyMCE 3 (our default editor so far) is going to be replaced by TinyMCE 4 in XH 1.7, which is quite different to TinyMCE 3, it seems.Tata wrote:But it would require to use CKRditor instead of tinyMCE, which is somehow more flexible to me.
Christoph M. Becker – Plugins for CMSimple_XH
Re: Highlight plugin calls
This method seems not to work with v1.7.0. There are no warnings returned, but the styling is not adopted by the editor.
The Calleditor would be fine. But it didn't read all plugins installed, instead it offered some plugins I don't have installed at all. Also the problem is not in writing the plugin call. The purpose is in styling already inserted plugin call.
The Calleditor would be fine. But it didn't read all plugins installed, instead it offered some plugins I don't have installed at all. Also the problem is not in writing the plugin call. The purpose is in styling already inserted plugin call.
CMSimple.sk
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.
It's no shame to ask for an answer if all efforts failed.
But it's awful to ask without any effort to find the answer yourself.