ldb68 Posted September 2, 2016 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> Quote
Sherzod Posted September 2, 2016 Posted September 2, 2016 Hi, Can you try this instead of "tinyMCE.get('edt1').getContent()" ?!: Ext.get("edt1").getValue() Best regards. Quote
ldb68 Posted September 2, 2016 Author 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());'); Quote
Sherzod Posted September 3, 2016 Posted September 3, 2016 Hi, Add this line in: UniServerModule->CustomFiles: http://cdn.tinymce.com/4/tinymce.min.js Best regards. Quote
ldb68 Posted September 3, 2016 Author Posted September 3, 2016 Hi, Add this line in: UniServerModule->CustomFiles: http://cdn.tinymce.com/4/tinymce.min.js Best regards. Same error Quote
Sherzod Posted September 3, 2016 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" }); Quote
ldb68 Posted September 3, 2016 Author 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());'); ? Quote
Sherzod Posted September 3, 2016 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. Quote
ldb68 Posted September 3, 2016 Author Posted September 3, 2016 Sorry to bore but I dont see any AfterScript property on UniHTMLFrame. I'm using UNIGUI 0.99.96.1320. Quote
ldb68 Posted September 3, 2016 Author 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 .... Quote
ldb68 Posted September 3, 2016 Author 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) +'))'); Quote
ldb68 Posted September 4, 2016 Author 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.