ckeditor/samples/old/xhtmlstyle.html
author indvd00m (gotoindvdum[at]gmail[dot]com)
Thu, 15 Dec 2016 18:10:20 +0300
changeset 0 44d330dccc59
permissions -rw-r--r--
Init sample
indvd00m@0
     1
<!DOCTYPE html>
indvd00m@0
     2
<!--
indvd00m@0
     3
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
indvd00m@0
     4
For licensing, see LICENSE.md or http://ckeditor.com/license
indvd00m@0
     5
-->
indvd00m@0
     6
<html>
indvd00m@0
     7
<head>
indvd00m@0
     8
	<meta charset="utf-8">
indvd00m@0
     9
	<title>XHTML Compliant Output &mdash; CKEditor Sample</title>
indvd00m@0
    10
	<meta name="ckeditor-sample-required-plugins" content="sourcearea">
indvd00m@0
    11
	<script src="../../ckeditor.js"></script>
indvd00m@0
    12
	<script src="sample.js"></script>
indvd00m@0
    13
	<link href="sample.css" rel="stylesheet">
indvd00m@0
    14
</head>
indvd00m@0
    15
<body>
indvd00m@0
    16
	<h1 class="samples">
indvd00m@0
    17
		<a href="index.html">CKEditor Samples</a> &raquo; Producing XHTML Compliant Output
indvd00m@0
    18
	</h1>
indvd00m@0
    19
	<div class="warning deprecated">
indvd00m@0
    20
		This sample is not maintained anymore. Check out its <a href="http://sdk.ckeditor.com/samples/basicstyles.html">brand new version in CKEditor SDK</a>.
indvd00m@0
    21
	</div>
indvd00m@0
    22
	<div class="description">
indvd00m@0
    23
		<p>
indvd00m@0
    24
			This sample shows how to configure CKEditor to output valid
indvd00m@0
    25
			<a class="samples" href="http://www.w3.org/TR/xhtml11/">XHTML 1.1</a> code.
indvd00m@0
    26
			Deprecated elements (<code>&lt;font&gt;</code>, <code>&lt;u&gt;</code>) or attributes
indvd00m@0
    27
			(<code>size</code>, <code>face</code>) will be replaced with XHTML compliant code.
indvd00m@0
    28
		</p>
indvd00m@0
    29
		<p>
indvd00m@0
    30
			To add a CKEditor instance outputting valid XHTML code, load the editor using a standard
indvd00m@0
    31
			JavaScript call and define CKEditor features to use the XHTML compliant elements and styles.
indvd00m@0
    32
		</p>
indvd00m@0
    33
		<p>
indvd00m@0
    34
			A snippet of the configuration code can be seen below; check the source of this page for
indvd00m@0
    35
			full definition:
indvd00m@0
    36
		</p>
indvd00m@0
    37
<pre class="samples">
indvd00m@0
    38
CKEDITOR.replace( '<em>textarea_id</em>', {
indvd00m@0
    39
	contentsCss: 'assets/outputxhtml.css',
indvd00m@0
    40
indvd00m@0
    41
	coreStyles_bold: {
indvd00m@0
    42
		element: 'span',
indvd00m@0
    43
		attributes: { 'class': 'Bold' }
indvd00m@0
    44
	},
indvd00m@0
    45
	coreStyles_italic: {
indvd00m@0
    46
		element: 'span',
indvd00m@0
    47
		attributes: { 'class': 'Italic' }
indvd00m@0
    48
	},
indvd00m@0
    49
indvd00m@0
    50
	...
indvd00m@0
    51
});</pre>
indvd00m@0
    52
	</div>
indvd00m@0
    53
	<form action="sample_posteddata.php" method="post">
indvd00m@0
    54
		<p>
indvd00m@0
    55
			<label for="editor1">
indvd00m@0
    56
				Editor 1:
indvd00m@0
    57
			</label>
indvd00m@0
    58
			<textarea cols="80" id="editor1" name="editor1" rows="10">&lt;p&gt;This is some &lt;span class="Bold"&gt;sample text&lt;/span&gt;. You are using &lt;a href="http://ckeditor.com/"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
indvd00m@0
    59
			<script>
indvd00m@0
    60
indvd00m@0
    61
				CKEDITOR.replace( 'editor1', {
indvd00m@0
    62
					/*
indvd00m@0
    63
					 * Style sheet for the contents
indvd00m@0
    64
					 */
indvd00m@0
    65
					contentsCss: 'assets/outputxhtml/outputxhtml.css',
indvd00m@0
    66
indvd00m@0
    67
					/*
indvd00m@0
    68
					 * Special allowed content rules for spans used by
indvd00m@0
    69
					 * font face, size, and color buttons.
indvd00m@0
    70
					 *
indvd00m@0
    71
					 * Note: all rules have been written separately so
indvd00m@0
    72
					 * it was possible to specify required classes.
indvd00m@0
    73
					 */
indvd00m@0
    74
					extraAllowedContent: 'span(!FontColor1);span(!FontColor2);span(!FontColor3);' +
indvd00m@0
    75
						'span(!FontColor1BG);span(!FontColor2BG);span(!FontColor3BG);' +
indvd00m@0
    76
						'span(!FontComic);span(!FontCourier);span(!FontTimes);' +
indvd00m@0
    77
						'span(!FontSmaller);span(!FontLarger);span(!FontSmall);span(!FontBig);span(!FontDouble)',
indvd00m@0
    78
indvd00m@0
    79
					/*
indvd00m@0
    80
					 * Core styles.
indvd00m@0
    81
					 */
indvd00m@0
    82
					coreStyles_bold: {
indvd00m@0
    83
						element: 'span',
indvd00m@0
    84
						attributes: { 'class': 'Bold' }
indvd00m@0
    85
					},
indvd00m@0
    86
					coreStyles_italic: {
indvd00m@0
    87
						element: 'span',
indvd00m@0
    88
						attributes: { 'class': 'Italic' }
indvd00m@0
    89
					},
indvd00m@0
    90
					coreStyles_underline: {
indvd00m@0
    91
						element: 'span',
indvd00m@0
    92
						attributes: { 'class': 'Underline' }
indvd00m@0
    93
					},
indvd00m@0
    94
					coreStyles_strike: {
indvd00m@0
    95
						element: 'span',
indvd00m@0
    96
						attributes: { 'class': 'StrikeThrough' },
indvd00m@0
    97
						overrides: 'strike'
indvd00m@0
    98
					},
indvd00m@0
    99
					coreStyles_subscript: {
indvd00m@0
   100
						element: 'span',
indvd00m@0
   101
						attributes: { 'class': 'Subscript' },
indvd00m@0
   102
						overrides: 'sub'
indvd00m@0
   103
					},
indvd00m@0
   104
					coreStyles_superscript: {
indvd00m@0
   105
						element: 'span',
indvd00m@0
   106
						attributes: { 'class': 'Superscript' },
indvd00m@0
   107
						overrides: 'sup'
indvd00m@0
   108
					},
indvd00m@0
   109
indvd00m@0
   110
					/*
indvd00m@0
   111
					 * Font face.
indvd00m@0
   112
					 */
indvd00m@0
   113
indvd00m@0
   114
					// List of fonts available in the toolbar combo. Each font definition is
indvd00m@0
   115
					// separated by a semi-colon (;). We are using class names here, so each font
indvd00m@0
   116
					// is defined by {Combo Label}/{Class Name}.
indvd00m@0
   117
					font_names: 'Comic Sans MS/FontComic;Courier New/FontCourier;Times New Roman/FontTimes',
indvd00m@0
   118
indvd00m@0
   119
					// Define the way font elements will be applied to the document. The "span"
indvd00m@0
   120
					// element will be used. When a font is selected, the font name defined in the
indvd00m@0
   121
					// above list is passed to this definition with the name "Font", being it
indvd00m@0
   122
					// injected in the "class" attribute.
indvd00m@0
   123
					// We must also instruct the editor to replace span elements that are used to
indvd00m@0
   124
					// set the font (Overrides).
indvd00m@0
   125
					font_style: {
indvd00m@0
   126
						element: 'span',
indvd00m@0
   127
						attributes: { 'class': '#(family)' },
indvd00m@0
   128
						overrides: [
indvd00m@0
   129
							{
indvd00m@0
   130
								element: 'span',
indvd00m@0
   131
								attributes: {
indvd00m@0
   132
									'class': /^Font(?:Comic|Courier|Times)$/
indvd00m@0
   133
								}
indvd00m@0
   134
							}
indvd00m@0
   135
						]
indvd00m@0
   136
					},
indvd00m@0
   137
indvd00m@0
   138
					/*
indvd00m@0
   139
					 * Font sizes.
indvd00m@0
   140
					 */
indvd00m@0
   141
					fontSize_sizes: 'Smaller/FontSmaller;Larger/FontLarger;8pt/FontSmall;14pt/FontBig;Double Size/FontDouble',
indvd00m@0
   142
					fontSize_style: {
indvd00m@0
   143
						element: 'span',
indvd00m@0
   144
						attributes: { 'class': '#(size)' },
indvd00m@0
   145
						overrides: [
indvd00m@0
   146
							{
indvd00m@0
   147
								element: 'span',
indvd00m@0
   148
								attributes: {
indvd00m@0
   149
									'class': /^Font(?:Smaller|Larger|Small|Big|Double)$/
indvd00m@0
   150
								}
indvd00m@0
   151
							}
indvd00m@0
   152
						]
indvd00m@0
   153
					} ,
indvd00m@0
   154
indvd00m@0
   155
					/*
indvd00m@0
   156
					 * Font colors.
indvd00m@0
   157
					 */
indvd00m@0
   158
					colorButton_enableMore: false,
indvd00m@0
   159
indvd00m@0
   160
					colorButton_colors: 'FontColor1/FF9900,FontColor2/0066CC,FontColor3/F00',
indvd00m@0
   161
					colorButton_foreStyle: {
indvd00m@0
   162
						element: 'span',
indvd00m@0
   163
						attributes: { 'class': '#(color)' },
indvd00m@0
   164
						overrides: [
indvd00m@0
   165
							{
indvd00m@0
   166
								element: 'span',
indvd00m@0
   167
								attributes: {
indvd00m@0
   168
									'class': /^FontColor(?:1|2|3)$/
indvd00m@0
   169
								}
indvd00m@0
   170
							}
indvd00m@0
   171
						]
indvd00m@0
   172
					},
indvd00m@0
   173
indvd00m@0
   174
					colorButton_backStyle: {
indvd00m@0
   175
						element: 'span',
indvd00m@0
   176
						attributes: { 'class': '#(color)BG' },
indvd00m@0
   177
						overrides: [
indvd00m@0
   178
							{
indvd00m@0
   179
								element: 'span',
indvd00m@0
   180
								attributes: {
indvd00m@0
   181
									'class': /^FontColor(?:1|2|3)BG$/
indvd00m@0
   182
								}
indvd00m@0
   183
							}
indvd00m@0
   184
						]
indvd00m@0
   185
					},
indvd00m@0
   186
indvd00m@0
   187
					/*
indvd00m@0
   188
					 * Indentation.
indvd00m@0
   189
					 */
indvd00m@0
   190
					indentClasses: [ 'Indent1', 'Indent2', 'Indent3' ],
indvd00m@0
   191
indvd00m@0
   192
					/*
indvd00m@0
   193
					 * Paragraph justification.
indvd00m@0
   194
					 */
indvd00m@0
   195
					justifyClasses: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyFull' ],
indvd00m@0
   196
indvd00m@0
   197
					/*
indvd00m@0
   198
					 * Styles combo.
indvd00m@0
   199
					 */
indvd00m@0
   200
					stylesSet: [
indvd00m@0
   201
						{ name: 'Strong Emphasis', element: 'strong' },
indvd00m@0
   202
						{ name: 'Emphasis', element: 'em' },
indvd00m@0
   203
indvd00m@0
   204
						{ name: 'Computer Code', element: 'code' },
indvd00m@0
   205
						{ name: 'Keyboard Phrase', element: 'kbd' },
indvd00m@0
   206
						{ name: 'Sample Text', element: 'samp' },
indvd00m@0
   207
						{ name: 'Variable', element: 'var' },
indvd00m@0
   208
indvd00m@0
   209
						{ name: 'Deleted Text', element: 'del' },
indvd00m@0
   210
						{ name: 'Inserted Text', element: 'ins' },
indvd00m@0
   211
indvd00m@0
   212
						{ name: 'Cited Work', element: 'cite' },
indvd00m@0
   213
						{ name: 'Inline Quotation', element: 'q' }
indvd00m@0
   214
					]
indvd00m@0
   215
				});
indvd00m@0
   216
indvd00m@0
   217
			</script>
indvd00m@0
   218
		</p>
indvd00m@0
   219
		<p>
indvd00m@0
   220
			<input type="submit" value="Submit">
indvd00m@0
   221
		</p>
indvd00m@0
   222
	</form>
indvd00m@0
   223
	<div id="footer">
indvd00m@0
   224
		<hr>
indvd00m@0
   225
		<p>
indvd00m@0
   226
			CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
indvd00m@0
   227
		</p>
indvd00m@0
   228
		<p id="copy">
indvd00m@0
   229
			Copyright &copy; 2003-2016, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
indvd00m@0
   230
			Knabben. All rights reserved.
indvd00m@0
   231
		</p>
indvd00m@0
   232
	</div>
indvd00m@0
   233
</body>
indvd00m@0
   234
</html>