Jump to content

Recommended Posts

Posted

Hi. I need help with tinyMCE.

Below html code works.

I try to embeed the code into a unihtmlframe.

The editor is shown correct inside unigui.

 

UniHTMLFrame1.HTML property:
 

<script src="http://cdn.tinymce.com/4/tinymce.min.js"></script>
<script>
tinyMCE.init({
  /*selector: '#edt1', */
  plugins: [
    'advlist autolink lists link image charmap print preview anchor',
    'searchreplace visualblocks code fullscreen',
    'insertdatetime media table contextmenu paste code'
  ],
  toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
  content_css: [
    '//fast.fonts.net/cssapi/e6dc9b99-64fe-4292-ad98-6974f93cd2a2.css',
    '//www.tinymce.com/css/codepen.min.css'
  ],
   mode: "exact",
   elements : "edt1"
});
</script>
<textarea  style="width: 100%; height: 100%;" id="edt1"></textarea>
 

 

I cannot get the editor content.

With

  UniSession.AddJS('MainForm.UniMemo1.setValue(tinyMCE.get("edt1").getContent());');

 

I get ERROR:
tinyMCE is not defined

MainForm.UniMemo1.setValue(tinyMCE.get("edt1").getContent());

 

thanks

 

 

Html file sample with js that get content:

 

<!DOCTYPE html>
<html>
<head>
<script src="http://cdn.tinymce.com/4/tinymce.min.js"></script>
<script>
tinyMCE.init({
  /*selector: '#edt1', */
  plugins: [
    'advlist autolink lists link image charmap print preview anchor',
    'searchreplace visualblocks code fullscreen',
    'insertdatetime media table contextmenu paste code'
  ],
  toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
  content_css: [
    '//fast.fonts.net/cssapi/e6dc9b99-64fe-4292-ad98-6974f93cd2a2.css',
    '//www.tinymce.com/css/codepen.min.css'
  ],
   mode: "exact",
   elements : "edt1"
});

</script>
</head>

<body>
  <button onclick="alert(tinyMCE.get('edt1').getContent());">Get</button><br>
 
  <textarea id="edt1"></textarea>
</body>

Posted

Hi,

 

Can you try this instead of "tinyMCE.get('edt1').getContent()" ?!:

Ext.get("edt1").getValue()

Best regards.

 

I get /ERROR:   Ext.get(...) is null ...

 

UniSession.AddJS('MainForm.UniMemo1.setValue(Ext.get("edt1").getValue());');

Posted

1. UniServerModule->CustomFiles:

http://cdn.tinymce.com/4/tinymce.min.js

2. UniHTMLFrame1.HTML:

<button onclick="alert(tinyMCE.get('edt1').getContent());">Get</button><br>
<textarea id="edt1"></textarea>

3. UniHTMLFrame1.AfterScript:

tinyMCE.init({
  /*selector: '#edt1', */
  plugins: [
    'advlist autolink lists link image charmap print preview anchor',
    'searchreplace visualblocks code fullscreen',
    'insertdatetime media table contextmenu paste code'
  ],
  toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
  content_css: [
    '//fast.fonts.net/cssapi/e6dc9b99-64fe-4292-ad98-6974f93cd2a2.css',
    '//www.tinymce.com/css/codepen.min.css'
  ],
   mode: "exact",
   elements : "edt1"
});
Posted

UniHTMLFrame1.AfterScript: ???

 

I don't find this event ...

 

And then I need always to call

UniSession.AddJS('MainForm.UniMemo1.setValue(Ext.get("edt1").getValue());'); ?

Posted

Hi,

 

 

UniHTMLFrame1.AfterScript: ??? I don't find this event ... And then I need always to call UniSession.AddJS('MainForm.UniMemo1.setValue(Ext.get("edt1").getValue());'); ?

 

it is not an event, it is a property

 

 

And then I need always to call UniSession.AddJS('MainForm.UniMemo1.setValue(Ext.get("edt1").getValue());'); ?

 

you can use this: UniSession.AddJS('MainForm.UniMemo1.setValue(tinyMCE.get("edt1").getContent());');

 

Best regards.

Posted

Sorry to bore but I dont see any  AfterScript property on UniHTMLFrame.

I'm using UNIGUI 0.99.96.1320.

 

Finded problem. Starting with unigui demo where a UniUrlFame is named UniHTMLFrame1 ....

Posted

Thanks "Delphi Developer".

It works.

 

To write to htmlframe we can use:

UniSession.AddJS('MainForm.UniMemo1.setValue(tinyMCE.get("edt1").setContent('+ StrToJS(UniMemo1.Text) +'))');

Posted

Hi.

 

There is a problem accessing the memo text after the JS call.

 

Showmessage(UniMemo1.Text);

 

return "UniMemo1.Text" and not the html content.

Seems that assign value to a memo1 at client side is not notifed to server side correctly.

Ho can resolve ... ?

 

thanks again

 

 


you can use this: UniSession.AddJS('MainForm.UniMemo1.setValue(tinyMCE.get("edt1").getContent());');

 

Best regards.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...