best solution for creating formatted text in the client?

Questions, answers, tips and ideas on Servoy Client

Re: best solution for creating formatted text in the client?

Postby tgs » Wed Jul 16, 2014 9:39 am

tgs wrote:And in the tinymce documentation I cannot find the 'tinyMCE.activeEditor.getContent()'. There is only the 'tinymce.selection.activeEditor.getContent()' and '...setContent()'.

Sorry, the tinyMCE.activeEditor.getContent() function can be found in the TinyMCE API 3.x docu.
Thomas Schnaus
SAN Developer
yomotec GmbH
User avatar
tgs
 
Posts: 886
Joined: Wed Oct 04, 2006 12:05 pm
Location: Germany

Re: best solution for creating formatted text in the client?

Postby LXS » Wed Jul 16, 2014 2:32 pm

Hi Thomas,

my onLoad looks like this:

Code: Select all
fvWebView = new scopes.svyJFXWebView.WebViewPanel(elements.webView);
fvWebView.load(globals.mkor_getHtmlEditorUrl());
application.sleep(200);


My onShow loads the content to the editor:

Code: Select all
vHtml = globals.escapeJavaScript(vHtml);
var vScript = "tinyMCE.activeEditor.setContent( '" + vHtml + "' );"
fvWebView.executeScriptLater(vScript);


The timing is important here i think.
When you use fvWebView.load() and just after that fvWebView.executeScriptLater(vScript) it will not work, because the TinyMCE is not already loaded.
It works for me, if i wait 200ms. I think the time duration depends on the machine.

Alex

tgs wrote:Hi Alex,

your code examples are confusing me a bit.
I'm loading the TinyMCE by the onLoad function of the form where the tabless panel element is set.
function onLoad():
Code: Select all
var _textEditor = new scopes.svyJFXWebView.WebViewPanel(elements.tmceEditor);
   _textEditor.load("http://localhost:8080/tmce1.html");

To get the content of the TinyMCE I have to add:
LXS wrote:get the content:
Code: Select all
fvWebView.executeScriptAndWait("tinyMCE.activeEditor.getContent()");

as codeline in the onLoad function?
If yes, this is not working with a form variable like your 'fvWebView'.
And in the tinymce documentation I cannot find the 'tinyMCE.activeEditor.getContent()'. There is only the 'tinymce.selection.activeEditor.getContent()' and '...setContent()'.

As I understand, you will get and set the content to the form variable, or?
LXS wrote:set the content - here it is important to remove the line breaks and escape the html:
Code: Select all
vHtml = globals.escapeJavaScript(vHtml);
var vScript = "tinyMCE.activeEditor.setContent( '" + vHtml + "' );"
fvWebView.executeScriptLater(vScript);

But how is the getting of the tinymce content be executed?
Where are your codelines above are? Also in the 'onLoad' function?

It would be very kind of you to make this more clear.

Thomas
Alexander Stefan
Dr. Maison & Partner GmbH
www.servoy-plugins.de
www.maison-partner.de
LXS
 
Posts: 151
Joined: Thu Mar 01, 2007 12:00 am

Re: best solution for creating formatted text in the client?

Postby tgs » Thu Dec 11, 2014 8:34 pm

Hi Alex,

now I have a little bit more time to get the tinymce running in my solution.

You got me your tinymce.html code and most of them is working, but this
Code: Select all
...
setup: function (ed) {
        ed.on('init', function(args) {
            tinyMCE.execCommand('mceFullScreen', true, ed.id);
        });
   }
...

makes the editor unusable in my solution. If I remove this codelines, the tinymce editor is running as I set it up in the .html, but I don't know why?
I'm on Servoy 7.4.2 and Java 1.8.0_25. However, I can set the width and height in the html file.

Another question is:
Do you use the TinyMCE editor for print by a page setup like A4?
I couldn't find any solution for setting up the editor for the print page format.

Regards
Thomas Schnaus
SAN Developer
yomotec GmbH
User avatar
tgs
 
Posts: 886
Joined: Wed Oct 04, 2006 12:05 pm
Location: Germany

Previous

Return to Servoy Client

Who is online

Users browsing this forum: No registered users and 8 guests