function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
manu123manu123 

integrate CKEditor for a rich text in custom popup

I have integrate CKEditor for a richtext. Richtext is within a custom popup. Custom popup shows up with a click of a command button. On the custom popup, RichText is shown as a regular textbox and CKEditor is missing.
NagendraNagendra (Salesforce Developers) 
Hi Manu123,

Please find the below code:

VisualForce Page:
<apex:page controller="CKEditController" showHeader="false" id="thepageid">
   <apex:form id="theformid">
  <apex:includescript value="{!URLFOR($Resource.CkEditor, 'ckeditor/ckeditor.js')}" />
  
  <apex:inputtextarea id="editor1" value="{!Parameter}" styleClass="ckeditor" richtext="false"/>
 
  <apex:commandButton value="save" onclick="abc()"/>
  </apex:form>
<apex:form >
  <script type="text/javascript">
window.onload = function()
{
   CKEDITOR.replace('thepageid:theformid:editor1'); 
}

function abc()
{
var element = CKEDITOR.instances['editor1'].getData();
alert(element);
}
</script>
</apex:form>
</apex:page>

Apex Controller:
public class CKEditController
{
    public string Parameter{get; set;}
    public CKEditController()
    {
        Parameter = ApexPages.currentPage().getParameters().get('p7');
        system.debug(Parameter);
       
    //    return null;
    }
}

I hope this information has been helpful in resolving your issue.   Please be sure to mark a post that has been most helpful as “Best Answer” to help others in the community with similar questions.

Best Regards,
Nagendra.P
John Henry 31John Henry 31
I trust this data has been useful in settling your issue. Kindly make certain to check a post that has been generally useful as "Most intelligent Answer" to help other people locally with comparative inquiries. https://homecomfort.ae/
Debaranjan GhoshDebaranjan Ghosh
I implemented this by using Static Resource with uploaded file from https://cdn.ckeditor.com/ckeditor5/29.2.0/classic/ckeditor.js
and Got the below output is this what should it show 


User-added image
for Controller :
Parameter = ApexPages.currentPage().getParameters().get('p7');
system.debug(Parameter);

Debug Logs shows :
16:51:33:009 VARIABLE_ASSIGNMENT [EXTERNAL]|this.Parameter|"This is a Rich Text \r\n"|0x21d10d23

How ever I dont see any Alert when I click on save button
Can you please clarify.

Debaranjan Ghosh
 
Dylan Hughes 12Dylan Hughes 12
To use TinyMCE for displaying large text field in a custom content form and have image and link functionality similar to a standard form, add these external plugins with some additional configuration. The plug-ins are compatible with TinyMCE version 6.3.1.  https://www.myccpay.me/