about summary refs log tree commit diff stats
path: root/app/assets/javascripts/ckeditor/plugins/lineutils/dev/magicfinger.html
blob: 7f2b6321dc433fa5f97113fb25d7dd04c69b0576 (plain) (blame)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String
<!DOCTYPE html>
<!--
Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
	<meta charset="utf-8">
	<title>Lineutils &mdash; 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> &raquo; Lineutils
	</h1>

	<h3>Classic (iframe-based) Editor</h3>

	<textarea id="editor1" cols="10" rows="10">
		<table border="0" cellpadding="1" cellspacing="1" style="width: 100%; ">
			<tbody>
				<tr>
					<td>This table</td>
					<td>is the</td>
					<td>very first</td>
					<td>element of the document.</td>
				</tr>
				<tr>
					<td>We are still</td>
					<td>able to acces</td>
					<td>the space before it.</td>
					<td style="padding: 25px">
					<table border="0" cellpadding="1" cellspacing="1" style="width: 100%; ">
						<tbody>
							<tr>
								<td>This table is inside of a cell of another table.</td>
							</tr>
							<tr>
								<td>We can type&nbsp;either before or after it though.</td>
							</tr>
						</tbody>
					</table>
					</td>
				</tr>
			</tbody>
		</table>

		<p>Two succesive horizontal lines (<tt>HR</tt> tags). We can access the space in between:</p>

		<hr />
		<hr />
		<ol style="width: 300px">
			<li>This numbered list...</li>
			<li>...is a neighbour of a horizontal line...</li>
			<li style="padding: 20px;">
				<ol>
					<li>Nested list!</li>
				</ol>
			</li>
		</ol>

		<ul style="width: 450px">
			<li>We can type between the lists...</li>
			<li>...thanks to <strong>Magicline</strong>.</li>
		</ul>

		<p>Lorem ipsum dolor sit amet dui. Morbi vel turpis. Nullam et leo. Etiam rutrum, urna tellus dui vel tincidunt mattis egestas, justo fringilla vel, massa. Phasellus.</p>

		<p>Quisque iaculis, dui lectus varius vitae, tortor. Proin lacus. Pellentesque ac lacus. Aenean nonummy commodo nec, pede. Etiam blandit risus elit.</p>

		<p>Ut pretium. Vestibulum rutrum in, adipiscing elit. Sed in quam in purus sem vitae pede. Pellentesque bibendum, urna sem vel risus. Vivamus posuere metus. Aliquam gravida iaculis nisl. Nam enim. Aliquam erat ac lacus tellus ac felis.</p>

		<div id="last" style="padding: 10px; text-align: center;">
		<p>This text is wrapped in a&nbsp;<tt>DIV</tt>&nbsp;element. We can type after this element though.</p>
		</div>
	</textarea>

	<h3>Inline Editor</h3>

	<div id="editor2" contenteditable="true" style="outline: 2px solid #ccc">
		<table border="0" cellpadding="1" cellspacing="1" style="width: 100%; ">
			<tbody>
				<tr>
					<td>This table</td>
					<td>is the</td>
					<td>very first</td>
					<td>element of the document.</td>
				</tr>
				<tr>
					<td>We are still</td>
					<td>able to acces</td>
					<td>the space before it.</td>
					<td style="padding: 25px">
					<table border="0" cellpadding="1" cellspacing="1" style="width: 100%; ">
						<tbody>
							<tr>
								<td>This table is inside of a cell of another table.</td>
							</tr>
							<tr>
								<td>We can type&nbsp;either before or after it though.</td>
							</tr>
						</tbody>
					</table>
					</td>
				</tr>
			</tbody>
		</table>

		<p>Two succesive horizontal lines (<tt>HR</tt> tags). We can access the space in between:</p>

		<hr />
		<hr />
		<ol style="width: 300px">
			<li>This numbered list...</li>
			<li>...is a neighbour of a horizontal line...</li>
			<li style="padding: 20px;">
				<ol>
					<li>Nested list!</li>
				</ol>
			</li>
		</ol>

		<ul style="width: 450px">
			<li>We can type between the lists...</li>
			<li>...thanks to <strong>Magicline</strong>.</li>
		</ul>

		<p>Lorem ipsum dolor sit amet dui. Morbi vel turpis. Nullam et leo. Etiam rutrum, urna tellus dui vel tincidunt mattis egestas, justo fringilla vel, massa. Phasellus.</p>

		<p>Quisque iaculis, dui lectus varius vitae, tortor. Proin lacus. Pellentesque ac lacus. Aenean nonummy commodo nec, pede. Etiam blandit risus elit.</p>

		<p>Ut pretium. Vestibulum rutrum in, adipiscing elit. Sed in quam in purus sem vitae pede. Pellentesque bibendum, urna sem vel risus. Vivamus posuere metus. Aliquam gravida iaculis nisl. Nam enim. Aliquam erat ac lacus tellus ac felis.</p>

		<div id="last" style="padding: 10px; text-align: center;">
			<p>This text is wrapped in a&nbsp;<tt>DIV</tt>&nbsp;element. We can type after this element though.</p>
		</div>
	</div>

	<h3>Extreme inline</h3>

	<div id="editor3" contenteditable="true" style="left: 123px; outline: 1px solid red; border: 15px solid green; position: relative; top: 30; left: 30px;">
		<div style="padding: 20px; background: gray; width: 300px" class="1">Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies. Curabitur et ligula. Ut molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet enim.</div>
		<div style="background: violet; padding: 30px;" class="static">
			Position static
			<div style="background: green; padding: 30px;  border: 14px solid orange">foo</div>
		</div>
		<dl class="2">
			<dt>Key</dt><dd>Value</dd>
		</dl>
		<div>Whatever</div>
		<hr id="hr">
		<p>Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies</p>
		<hr>
		<hr>
		<p>Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies</p>
		<div style="background: green; padding: 30px; width: 200px">foo</div>
	</div>

	<h3>Classic (iframe-based) Editor, H-scroll</h3>

	<textarea id="editor4" cols="10" rows="10">
		<hr />
		<hr />
		<ol style="width: 1500px">
			<li>This numbered list...</li>
			<li>...is a neighbour of a horizontal line...</li>
			<li style="padding: 20px;">
				<ol>
					<li>Nested list!</li>
				</ol>
			</li>
		</ol>

		<ul style="width: 450px">
			<li>We can type between the lists...</li>
			<li>...thanks to <strong>Magicline</strong>.</li>
		</ul>

		<p>Lorem ipsum dolor sit amet dui. Morbi vel turpis. Nullam et leo. Etiam rutrum, urna tellus dui vel tincidunt mattis egestas, justo fringilla vel, massa. Phasellus.</p>

		<p>Quisque iaculis, dui lectus varius vitae, tortor. Proin lacus. Pellentesque ac lacus. Aenean nonummy commodo nec, pede. Etiam blandit risus elit.</p>

		<p>Ut pretium. Vestibulum rutrum in, adipiscing elit. Sed in quam in purus sem vitae pede. Pellentesque bibendum, urna sem vel risus. Vivamus posuere metus. Aliquam gravida iaculis nisl. Nam enim. Aliquam erat ac lacus tellus ac felis.</p>

		<div id="last" style="padding: 10px; text-align: center;">
		<p>This text is wrapped in a&nbsp;<tt>DIV</tt>&nbsp;element. We can type after this element though.</p>
		</div>
	</textarea>

	<script>

		CKEDITOR.addCss(
			'.cke_editable * { outline: 1px solid #BCEBFF }'
		);

		function callback() {
			var helpers = CKEDITOR.plugins.lineutils;
			var liner = new helpers.liner( this );
			var locator = new helpers.locator( this );
			var finder = new helpers.finder( this, {
				lookups: {
					'is block and first child': function( el ) {
						if ( el.is( CKEDITOR.dtd.$listItem ) )
							return;

						if ( el.is( CKEDITOR.dtd.$block ) )
							return CKEDITOR.LINEUTILS_BEFORE | CKEDITOR.LINEUTILS_AFTER;
					}
				}
			} ).start( function( relations, x, y ) {
				locator.locate( relations );

				var locations = locator.locations,
					uid, type;

				liner.prepare( relations, locations );

				for ( uid in locations ) {
					for ( type in locations[ uid ] )
						liner.placeLine( { uid: uid, type: type } );
				}

				liner.cleanup();
			} );
		}

		CKEDITOR.disableAutoInline = true;

		CKEDITOR.replace( 'editor1', {
			extraPlugins: 'lineutils',
			height: 450,
			removePlugins: 'magicline',
			allowedContent: true,
			contentsCss: [ '../../../contents.css' ],
			on: {
				contentDom: callback
			}
		} );

		CKEDITOR.inline( 'editor2', {
			extraPlugins: 'lineutils',
			removePlugins: 'magicline',
			allowedContent: true,
			contentsCss: [ '../../../contents.css' ],
			on: {
				contentDom: callback
			}
		} );

		CKEDITOR.inline( 'editor3', {
			extraPlugins: 'lineutils',
			removePlugins: 'magicline',
			allowedContent: true,
			contentsCss: [ '../../../contents.css' ],
			on: {
				contentDom: callback
			}
		} );

		CKEDITOR.replace( 'editor4', {
			extraPlugins: 'lineutils',
			removePlugins: 'magicline',
			allowedContent: true,
			contentsCss: [ '../../../contents.css' ],
			on: {
				contentDom: callback
			}
		} );


	</script>

	<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 &copy; 2003-2017, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
			Knabben. All rights reserved.
		</p>
	</div>
</body>
</html>