Highlight plugin calls

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Highlight plugin calls

Post by cmb » Thu Apr 06, 2017 10:30 am

Tata wrote: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.
Yes, I know. :) I've mentioned Calleditor only because it is similar to what you're looking for. It's probably not hard to adapt Calleditor to this requirement, but it might not be so easy to adapt it to TinyMCE 4. I'll have a look.
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Highlight plugin calls

Post by Tata » Thu Apr 06, 2017 10:47 am

Maybe I wrote it not fully understandible. The plugin is fine. It would help many beginners to insert plugin calls correctly. But this is not a problem. And OTOH, the plugin calls provide many specific adjustments (variables etc.), which the plugin very probably doesn't know. So inserting the plugins by hand seems to me to be more comfortable, better controlled. Now I tried only to use the same adjustments to adminsfuncs.php and tinyMCE inits. And here the result was "0". It would be sufficient either to use the "placeholder" feature direct in tinyMCE (as Holger suggested) or some other adminfuncs feature that would automatically evaluate the {{{...}}}/#cmsimpls...;# and add the styling independent to active editor. For, I think, only very few admins would be able to made the necessary adjustments. Also I think, this feature is more aimed to beginners than to advanced users, who know how to handle the plugins calls.
The idea came from my experience, when users called me to check their webpages, because they got destroyed after some unintentional manimulation with the plugin calls.
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.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Highlight plugin calls

Post by cmb » Thu Apr 06, 2017 11:01 am

I think I understand your idea quite well. So forget about the Calleditor plugin, because there's an even simpler solution for TinyMCE 3.
  1. edit the plugins/tinymce/inits/init_*.js and add noneditable to plugins, e.g.:

    Code: Select all

        plugins : "noneditable,advimage,advlink,autosave,contextmenu,emotions,fullscreen,insertdatetime,lists,media,paste,save,searchreplace,table,wordcount", 
  2. Add the following to the template's stylesheet:

    Code: Select all

    body.mceContentBody .mceNonEditable {
        color: black;
        background: yellow;
    } 
Then mark up all plugin calls in the following way:

Code: Select all

<div class="mceNonEditable">{{{plugincall}}}</div> 
After adding the class mceNonEditable, the plugin calls are highlighted, and can't be edited anymore in WYSIWYG mode.

Contrary to the placeholder plugin for CKEditor this requires manual preparation, but it seems that is acceptable.

If you don't want to prevent editing of the calls, you don't need the noneditable plugin. And you can use another class name. For highlighting, the important part is to prepend body.mceContentBody to the class selector. If there are multiple templates in use, you could also add the style rule to core.css.
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Highlight plugin calls

Post by Tata » Thu Apr 06, 2017 11:23 am

It is fine with your previous method in tinyMCE. I made it and tested with a couple of webpages. It works fine. The only that I have found later was, that the higlighting only occures after saving the page. This is not a big problem and it is logical.
It is not about blocking the calls editting. It is like "Don't touch if you are not sure what you are doing."
If a client demands to have some plugins installed, the designer writes the calls (I ususally make short manuals to each website with explanation how to adjust the plugin calls, if necessary). But the clients are always different. Some of them make the adjustments and the websites run smoothly. Some of them are affraid to make it. So I have to make it for them and here it may be very helpful to have the calls highlighted.
This is the reason why I think it may be very practical feature. I just have no clue hor to make it automatic and optional. I understand it must be set in each editor, or it would need some function able to modify the editor's setting.
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.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Highlight plugin calls

Post by cmb » Thu Apr 06, 2017 12:18 pm

Tata wrote:I just have no clue hor to make it automatic and optional. I understand it must be set in each editor, or it would need some function able to modify the editor's setting.
I also think that this functionality would have to be (optionally) implemented for each editor. I'll try to find a better solution for TinyMCE.
Christoph M. Becker – Plugins for CMSimple_XH

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Highlight plugin calls

Post by Tata » Thu Apr 06, 2017 12:23 pm

cmb wrote:I'll try to find a better solution for TinyMCE.
Maybe for TinyMCE4? For 3 it works already. It just needs adjusting deep saved files. Safer would be one external script able to handle these files.
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.

Tata
Posts: 3586
Joined: Tue May 20, 2008 5:34 am
Location: Slovakia
Contact:

Re: Highlight plugin calls

Post by Tata » Sun Sep 16, 2018 7:33 pm

Again the same situation. On a webpage with a lot of subpages with a plugin call or a function almost on each one, the owner unintentionally deleted something in one of the hundreds calls and the webpage was gone. It was not a big problem for me to find the point. But it took some time, anyway.
So I thought again of the polugin/function call highlighting and if possible making it "blocked from any simple editing" but except of in the code view (where the enduser very seldom enter).
The webpage is upgradet to 1.7.2 and the methods mentioned above do not work (because of TinyMCE4(?)).
Nice would be have all codes inserted on pages automatically in styled. E.g.:
highlight_call_1.jpg
An optional usable function (configurable - bool) and a styling in core.css (stylable - hell/dark) with hooks for at least CKEditor and TinyMCE4 would be great.
You do not have the required permissions to view the files attached to this post.
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.

frase
Posts: 5085
Joined: Thu Apr 21, 2016 6:32 am
Location: Saxony
Contact:

Re: Highlight plugin calls

Post by frase » Mon Sep 17, 2018 5:21 pm

Ich habe mir mal die Tiny-Doku durchgelesen und dann einen Schnellentwurf für ein Tiny-Plugin "xhplugincall" gemacht.

- entsprechend der Struktur kopieren
- in der Tinymce4–Konfiguration -> Init: "init_fontawesome-XH-plugincall" wählen

Es erscheint ein neuer Button in der Buttonleiste {} an letzter Stelle.
Nach Klick darauf, kann man seinen Plugin-Aufruf hineinkopieren.
Der ist im Editor dann farblich hervorgehoben (PostIt-Gelb) und kann in der Normalansicht nicht editiert werden.

Wahrscheinlich könnte man das noch komfortabler machen mit Parametern usw.
Kann ich aber nicht ;-)

tinymce4-plus-plugincall.zip
Jetzt habe ich keine Zeit mehr - es ist TBBT-Montag ;-)
You do not have the required permissions to view the files attached to this post.

manu
Posts: 1086
Joined: Wed Jun 04, 2008 12:05 pm
Location: St. Gallen - Schweiz
Contact:

Re: Highlight plugin calls

Post by manu » Wed Sep 19, 2018 9:46 am

Super @frase! Ich habe Deine Lösung (mit I18n de) in den neuesten Release gepackt. Wer es mag, kann es auf GitHub abholen.
---
Amazing @frase! I just packed your solution (with I18n de) into the latest release. For anybody who likes it, its available on GitHub.

Regards manu

frase
Posts: 5085
Joined: Thu Apr 21, 2016 6:32 am
Location: Saxony
Contact:

Re: Highlight plugin calls

Post by frase » Wed Sep 19, 2018 10:51 am

manu wrote:
Wed Sep 19, 2018 9:46 am
Super @frase! Ich habe Deine Lösung (mit I18n de) in den neuesten Release gepackt. Wer es mag, kann es auf GitHub abholen.
Menno, da warst du aber schnell.
Die Idee stammt ja von Tata!
Und wir hatten intern auch noch weiter probiert.
Dabei haben wir auch festgestellt, dass es eine Lokalisation geben muss ;-)
Vor allem das Button-Bild {} fanden wir nicht optimal.
Deshalb im Anhang zwei alternative SVG-Vorschläge mit Icons - generiert aus FontAwesome.
Du müsstest nur in der "plugin.min.js" xhplugincall.png ändern zu xhplugincall.svg

Ganz echt richtig wäre es eigentlich, den Tiny-IcoMoon-Font mithilfe der IcoMoon-App um genau ein Icon zu erweitern und dann dieses zu verwenden.

Ich frage mich auch, ob es nicht besser wäre, im Hover-Text statt "Plugin einfügen" -> "XH-Plugin einfügen" zu schreiben - damit keine Irrtümer aufkommen.
You do not have the required permissions to view the files attached to this post.

Post Reply