ckeditor/samples/old/ajax.html
changeset 0 44d330dccc59
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ckeditor/samples/old/ajax.html	Thu Dec 15 18:10:20 2016 +0300
     1.3 @@ -0,0 +1,85 @@
     1.4 +<!DOCTYPE html>
     1.5 +<!--
     1.6 +Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
     1.7 +For licensing, see LICENSE.md or http://ckeditor.com/license
     1.8 +-->
     1.9 +<html>
    1.10 +<head>
    1.11 +	<meta charset="utf-8">
    1.12 +	<title>Ajax &mdash; CKEditor Sample</title>
    1.13 +	<script src="../../ckeditor.js"></script>
    1.14 +	<link rel="stylesheet" href="sample.css">
    1.15 +	<script>
    1.16 +
    1.17 +		var editor, html = '';
    1.18 +
    1.19 +		function createEditor() {
    1.20 +			if ( editor )
    1.21 +				return;
    1.22 +
    1.23 +			// Create a new editor inside the <div id="editor">, setting its value to html
    1.24 +			var config = {};
    1.25 +			editor = CKEDITOR.appendTo( 'editor', config, html );
    1.26 +		}
    1.27 +
    1.28 +		function removeEditor() {
    1.29 +			if ( !editor )
    1.30 +				return;
    1.31 +
    1.32 +			// Retrieve the editor contents. In an Ajax application, this data would be
    1.33 +			// sent to the server or used in any other way.
    1.34 +			document.getElementById( 'editorcontents' ).innerHTML = html = editor.getData();
    1.35 +			document.getElementById( 'contents' ).style.display = '';
    1.36 +
    1.37 +			// Destroy the editor.
    1.38 +			editor.destroy();
    1.39 +			editor = null;
    1.40 +		}
    1.41 +
    1.42 +	</script>
    1.43 +</head>
    1.44 +<body>
    1.45 +	<h1 class="samples">
    1.46 +		<a href="index.html">CKEditor Samples</a> &raquo; Create and Destroy Editor Instances for Ajax Applications
    1.47 +	</h1>
    1.48 +	<div class="warning deprecated">
    1.49 +		This sample is not maintained anymore. Check out its <a href="http://sdk.ckeditor.com/samples/saveajax.html">brand new version in CKEditor SDK</a>.
    1.50 +	</div>
    1.51 +	<div class="description">
    1.52 +		<p>
    1.53 +			This sample shows how to create and destroy CKEditor instances on the fly. After the removal of CKEditor the content created inside the editing
    1.54 +			area will be displayed in a <code>&lt;div&gt;</code> element.
    1.55 +		</p>
    1.56 +		<p>
    1.57 +			For details of how to create this setup check the source code of this sample page
    1.58 +			for JavaScript code responsible for the creation and destruction of a CKEditor instance.
    1.59 +		</p>
    1.60 +	</div>
    1.61 +	<p>Click the buttons to create and remove a CKEditor instance.</p>
    1.62 +	<p>
    1.63 +		<input onclick="createEditor();" type="button" value="Create Editor">
    1.64 +		<input onclick="removeEditor();" type="button" value="Remove Editor">
    1.65 +	</p>
    1.66 +	<!-- This div will hold the editor. -->
    1.67 +	<div id="editor">
    1.68 +	</div>
    1.69 +	<div id="contents" style="display: none">
    1.70 +		<p>
    1.71 +			Edited Contents:
    1.72 +		</p>
    1.73 +		<!-- This div will be used to display the editor contents. -->
    1.74 +		<div id="editorcontents">
    1.75 +		</div>
    1.76 +	</div>
    1.77 +	<div id="footer">
    1.78 +		<hr>
    1.79 +		<p>
    1.80 +			CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
    1.81 +		</p>
    1.82 +		<p id="copy">
    1.83 +			Copyright &copy; 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
    1.84 +			Knabben. All rights reserved.
    1.85 +		</p>
    1.86 +	</div>
    1.87 +</body>
    1.88 +</html>