Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

replace selected content in rich text editor?

User_7U9LXNov 14 2016 — edited Nov 14 2016

Dear APEX Master,

Oracle Apex uses ckedtior to realize rich text editor. I want to replace the selected content in the rich text editor with the selected value in a select list. Currently, I am able to realize this function by using CKEDITOR official API. However, I can't get the instance of CKEDITOR in the ORACLE APEX. So, does anyone know how to get the instance of CKEDITOR in the ORACLE APEX? Thanks in advance.

<!DOCTYPE html>

<html>

<head><meta charset="utf-8">

<title>CKEditor Sample</title>

  <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>

  <script src="http://cdn.ckeditor.com/4.5.11/standard/ckeditor.js "></script>

  <script>

       $( document ).ready( function() {

            // I want to get instance of CKEDITOR by using some APEX JAVASCRIPT API

            var editor = CKEDITOR.replace( 'editor1' );

            var sel, range,

            replacementText="";

            $('#test').on('click',function(){

                 replacementText=$("#val1").val();

                 sel = editor.getSelection();

                 range = sel.getRanges()[0];

                 range.deleteContents(true);

                 range.insertNode(new CKEDITOR.dom.text(replacementText));

            });

});

</script></head>

<body>

  <h1 class="samples">Create Editors with jQuery</h1>

  <textarea id="editor1" name="editor1" cols="80" rows="10">

  <pre>Hello <strong>CKEditor</strong>

  test

  test

  test

  test

  test

  </pre>

  </textarea>

  <input id="val1"  type="text" value="replace it!" size="30">

  <input id="test" type="button" value="Set value">

</body></html>

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 12 2016
Added on Nov 14 2016
0 comments
766 views