Ticket #16780: example.html

File example.html, 1.2 KB (added by azotova, 7 years ago)

Html file to reproduce the issue

Line 
1<!DOCTYPE html>
2<html>
3    <head>
4        <meta charset="utf-8">
5        <title>A Simple Page with CKEditor</title>
6        <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.6.0/ckeditor.js"></script> -->
7        <script src="ckeditor.js"></script>
8    </head>
9    <body>
10        <p>
11           <input type="button" id="replace" value="Replace question" onclick="replaceQuestion();">
12        </p>
13        <div name="editor1" id="editor1">
14            <p> Some text...</p>
15            <question id="myQ">
16              <answer> More text...</answer>
17            </question>
18        </div>
19        <script>
20            var editorElement = CKEDITOR.document.getById( 'editor1' );
21            editorElement.setAttribute( 'contenteditable', 'true' );
22            editor = CKEDITOR.inline( 'editor1' );
23            editor.config.allowedContent = true
24            var replaceQuestion = function() {
25              var sel = editor.getSelection();
26              var questionElement = CKEDITOR.document.getById( 'myQ' );               
27              sel.selectElement(questionElement);
28              editor.extractSelectedHtml();
29              editor.insertHtml('<choice>Some other text</choice>');
30            }
31        </script>
32    </body>
33</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy