ldb68 Posted September 2, 2016 Share Posted September 2, 2016 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> Link to comment Share on other sites More sharing options...
Sherzod Posted September 2, 2016 Share Posted September 2, 2016 Hi, Can you try this instead of "tinyMCE.get('edt1').getContent()" ?!: Ext.get("edt1").getValue() Best regards. Link to comment Share on other sites More sharing options...
ldb68 Posted September 2, 2016 Author Share Posted September 2, 2016 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());'); Link to comment Share on other sites More sharing options...
Sherzod Posted September 3, 2016 Share Posted September 3, 2016 Hi, Add this line in: UniServerModule->CustomFiles: http://cdn.tinymce.com/4/tinymce.min.js Best regards. Link to comment Share on other sites More sharing options...
ldb68 Posted September 3, 2016 Author Share Posted September 3, 2016 Hi, Add this line in: UniServerModule->CustomFiles: http://cdn.tinymce.com/4/tinymce.min.js Best regards. Same error Link to comment Share on other sites More sharing options...
Sherzod Posted September 3, 2016 Share Posted September 3, 2016 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" }); Link to comment Share on other sites More sharing options...
ldb68 Posted September 3, 2016 Author Share Posted September 3, 2016 UniHTMLFrame1.AfterScript: ??? I don't find this event ... And then I need always to call UniSession.AddJS('MainForm.UniMemo1.setValue(Ext.get("edt1").getValue());'); ? Link to comment Share on other sites More sharing options...
Sherzod Posted September 3, 2016 Share Posted September 3, 2016 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. Link to comment Share on other sites More sharing options...
ldb68 Posted September 3, 2016 Author Share Posted September 3, 2016 Sorry to bore but I dont see any AfterScript property on UniHTMLFrame. I'm using UNIGUI 0.99.96.1320. Link to comment Share on other sites More sharing options...
ldb68 Posted September 3, 2016 Author Share Posted September 3, 2016 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 .... Link to comment Share on other sites More sharing options...
ldb68 Posted September 3, 2016 Author Share Posted September 3, 2016 Thanks "Delphi Developer". It works. To write to htmlframe we can use: UniSession.AddJS('MainForm.UniMemo1.setValue(tinyMCE.get("edt1").setContent('+ StrToJS(UniMemo1.Text) +'))'); Link to comment Share on other sites More sharing options...
ldb68 Posted September 4, 2016 Author Share Posted September 4, 2016 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now