1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
<!DOCTYPE html>
<!--
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Replace Textarea by Code — CKEditor Sample</title>
<script src="../../../ckeditor.js"></script>
<link href="../../../samples/old/sample.css" rel="stylesheet">
</head>
<body>
<h1 class="samples">
<a href="../../../samples/old/index.html">CKEditor Samples</a> » Replace Textarea Elements Using JavaScript Code
</h1>
<form action="sample_posteddata.php" method="post">
<div class="description">
<p>
This editor is using an <code><iframe></code> element-based editing area, provided by the <strong>Wysiwygarea</strong> plugin.
</p>
<pre class="samples">
CKEDITOR.replace( '<em>textarea_id</em>' )
</pre>
</div>
<textarea cols="80" id="editor1" name="editor1" rows="10">
<p>Apollo 11</p>
<p>111 222 333 444 555 666 777</p>
</textarea>
<p>
<input type="submit" value="Submit">
</p>
</form>
<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright © 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
<div id="debugConsole">
<div>Snapshots: <strong id="debugSnapshotsCount">0</strong></div>
<div>Typing: <strong id="debugTypingVal">false</strong></div>
</div>
<div id="undoControls">
<a onclick="CKEDITOR.instances.editor1.execCommand('undo');" href="#">< Undo</a>
<a onclick="CKEDITOR.instances.editor1.execCommand('redo');" href="#">Redo ></a>
</div>
<script type="text/javascript">
var snapCount = document.getElementById( 'debugSnapshotsCount' ),
typingTracer = document.getElementById( 'debugTypingVal' ),
updateTypingTracer = function() {
typingTracer.innerHTML = String( CKEDITOR.instances.editor1.undoManager.typing );
},
updateSnapshotCounter = function() {
if ( !CKEDITOR && CKEDITOR.instances.editor1 )
return;
snapCount.innerHTML = CKEDITOR.instances.editor1.undoManager.snapshots.length;
updateTypingTracer();
};
CKEDITOR.replace( 'editor1', {
toolbar: [ [ 'Source', 'Bold', 'Italic' ] ,[ 'Undo' ], [ 'Redo' ] ],
on: {
instanceReady: function( evt ) {
CKEDITOR.instances.editor1.focus();
},
change: function( evt ) {
updateSnapshotCounter();
}
}
} );
window.setInterval( updateSnapshotCounter, 700 );
</script>
<style type="text/css">
#debugConsole { clear: both; }
#undoControls { clear: both; }
#undoControls a { padding: 25px 50px; font-size: 19px; margin-right: 15px; outline: 2px solid gray; display: block; float: left; text-decoration: none; }
</style>
</body>
</html>
|