Scriptcase und tinyMCE mit benutzerdefinierten init Parametern

Scriptcase und tinyMCE mit benutzerdefinierten init Parametern

tinyMCE in Scriptcase mit beliebigen init-Einstellungen aufrufen

tinyMCE ist ein HTML-Editor, der in eigene Programme eingebunden werden kann.

Scriptcase verwendet ihn standardmäßig zum Anzeigen und Editieren von Text/BLOB-Feldern mit HTML-Formatierung.
Dabei kann man zahlreiche Parameter einstellen, aber nicht alle und vor allem keine Plugins dazu laden.

Natürlich könnte man tinyMCE selbst nochmals einbinden und dabei die init-Prozedur variabel aufrufen.
Dann muss man auch beim Veröffentlichen (deploy) der Anwendung auf den Live-Server diese Installation manuell vornehmen.

Einfacher geht es, wenn man in der Scriptcase Form ein Text-Feld mit dem SQL-Feld verbindet.
Um dann aus dem Text-Feld einen tinyMCE-Editor zu machen, ermittelt man die interne ID des Text-Feldes im HTML (z.B. mit Chrome > untersuchen).

Anschließend bindet man im onLoad-Event der Form den folgenden Code ein:

In diesem Script muss jetzt noch der Name des Textfeldes ersetzt werden.
In unserem Beispiel-Code hieß das text-Feld: id_sc_field_text_1

Anschließend kann man auch zusätzliche Funktionen beim Aufruf mitgeben.

Hier zwei Beispiele (bitte den Code vor $msg.=’content_style… einfügen):

oder eigene Templates definieren:

 

 

Scriptcase and tinyMCE with userdefined init parameter

Scriptcase and tinyMCE with userdefined init parameter

Call tinyMCE in Scriptcase with your init-Settings

tinyMCE is a HTML editor plugin which can be used in own code.

Scriptcase already uses tinyMCE already to show and edit text/blob database fields with HTML formatting.
The developer can set several parameters for this, but not all, especially no plugins.

You could import another copy of tinyMCE and call the init for this.
Doing so, you’ll also have to take care of, when you deoply the application on a live server.

But there is an other way:
Use a standard text-field in Scriptcase, which is bound to a text(blob-field in the sql table.
Then convert this field into a tinyMCE-editor. For this we’ll need the id of the text field. You can get this for example in Chrome via the explore feature.

To do the conversion, add the following code into the onLoad event of the form:

Please replace the name of the text field in this code.
Our sample uses a text field named id_sc_field_text_1
Replace this name with the name of your text field.

Now you can add additional functions and plugin calling tinyMCE.

Here are two samples (please add the code before: $msg.=’content_style… einfügen)

or define own templates to be inserted at the cursor position in tinyMCE: