Ticket #9982: fakesel.html

File fakesel.html, 6.4 KB (added by Piotrek Koszuliński, 6 years ago)
Line 
1<!DOCTYPE html>
2<!--
3Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
4For licensing, see LICENSE.html or http://ckeditor.com/license
5-->
6<html>
7<head>
8        <title>Fake selection sample &mdash; CKEditor Sample</title>
9        <meta charset="utf-8">
10        <script src="../ckeditor.js"></script>
11        <link href="sample.css" rel="stylesheet">
12</head>
13<body>
14        <h1 class="samples">
15                <a href="index.html">CKEditor Samples</a> &raquo; Replace Textarea Elements Using JavaScript Code
16        </h1>
17        <form action="sample_posteddata.php" method="post">
18                <textarea cols="80" id="editor1" name="editor1" rows="10">
19
20<h1><img alt="Saturn V carrying Apollo 11" class="right fakesel" contenteditable="false" src="assets/sample.jpg" /> Apollo 11</h1>
21
22<p><strong>Apollo 11</strong> was the spaceflight that landed the first humans, Americans <a href="http://en.wikipedia.org/wiki/Neil_Armstrong" title="Neil Armstrong">Neil Armstrong</a> and <a href="http://en.wikipedia.org/wiki/Buzz_Aldrin" title="Buzz Aldrin">Buzz Aldrin</a>, on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.</p>
23
24<p>Armstrong spent about <s>three and a half</s> two and a half hours outside the spacecraft, Aldrin slightly less; and together they collected 47.5 pounds (21.5&nbsp;kg) of lunar material for return to Earth. A third member of the mission, <a href="http://en.wikipedia.org/wiki/Michael_Collins_(astronaut)" title="Michael Collins (astronaut)">Michael Collins</a>, piloted the <a href="http://en.wikipedia.org/wiki/Apollo_Command/Service_Module" title="Apollo Command/Service Module">command</a> spacecraft alone in lunar orbit until Armstrong and Aldrin returned to it for the trip back to Earth.</p>
25
26<h2>Broadcasting and <em class="fakesel" contenteditable="false">quotes</em> <a id="quotes" name="quotes"></a></h2>
27
28<p>Broadcast on live TV to a world-wide audience, Armstrong stepped onto the lunar surface and described the event as:</p>
29
30<blockquote>
31<p>One small step for [a] man, one giant leap for mankind.</p>
32</blockquote>
33
34<p>Apollo 11 effectively ended the <a href="http://en.wikipedia.org/wiki/Space_Race" title="Space Race">Space Race</a> and fulfilled a national goal proposed in 1961 by the late U.S. President <a href="http://en.wikipedia.org/wiki/John_F._Kennedy" title="John F. Kennedy">John F. Kennedy</a> in a speech before the United States Congress:</p>
35
36<blockquote class="fakesel" contenteditable="false">
37<p>[...] before this decade is out, of landing a man on the Moon and returning him safely to the Earth.</p>
38</blockquote>
39
40<h2>Technical details <a id="tech-details" name="tech-details"></a></h2>
41
42<table align="right" border="1" bordercolor="#ccc" cellpadding="5" cellspacing="0" style="border-collapse:collapse; margin:10px 0 10px 15px">
43        <caption><strong>Mission crew</strong></caption>
44        <thead>
45                <tr>
46                        <th scope="col">Position</th>
47                        <th scope="col">Astronaut</th>
48                </tr>
49        </thead>
50        <tbody>
51                <tr>
52                        <td>Commander</td>
53                        <td>Neil A. Armstrong</td>
54                </tr>
55                <tr>
56                        <td>Command Module Pilot</td>
57                        <td>Michael Collins</td>
58                </tr>
59                <tr>
60                        <td>Lunar Module Pilot</td>
61                        <td>Edwin &quot;Buzz&quot; E. Aldrin, Jr.</td>
62                </tr>
63        </tbody>
64</table>
65
66<p>Launched by a <strong>Saturn V</strong> rocket from <a href="http://en.wikipedia.org/wiki/Kennedy_Space_Center" title="Kennedy Space Center">Kennedy Space Center</a> in Merritt Island, Florida on July 16, Apollo 11 was the fifth manned mission of <a href="http://en.wikipedia.org/wiki/NASA" title="NASA">NASA</a>&#39;s Apollo program. The Apollo spacecraft had three parts:</p>
67
68<ol>
69        <li><strong>Command Module</strong> with a cabin for the three astronauts which was the only part which landed back on Earth</li>
70        <li><strong>Service Module</strong> which supported the Command Module with propulsion, electrical power, oxygen and water</li>
71        <li><strong>Lunar Module</strong> for landing on the Moon.</li>
72</ol>
73
74<p>After being sent to the Moon by the Saturn V&#39;s upper stage, the astronauts separated the spacecraft from it and travelled for three days until they entered into lunar orbit. Armstrong and Aldrin then moved into the Lunar Module and landed in the <a href="http://en.wikipedia.org/wiki/Mare_Tranquillitatis" title="Mare Tranquillitatis">Sea of Tranquility</a>. They stayed a total of about 21 and a half hours on the lunar surface. After lifting off in the upper part of the Lunar Module and rejoining Collins in the Command Module, they returned to Earth and landed in the <a href="http://en.wikipedia.org/wiki/Pacific_Ocean" title="Pacific Ocean">Pacific Ocean</a> on July 24.</p>
75
76<hr />
77<p style="text-align:right"><small>Source: <a href="http://en.wikipedia.org/wiki/Apollo_11">Wikipedia.org</a></small></p>
78
79                </textarea>
80                <script>
81
82                        CKEDITOR.addCss( '.fakesel { outline: yellow solid 2px }' );
83
84                        CKEDITOR.replace( 'editor1', {
85                                extraAllowedContent: '*(fakesel)[contenteditable]',
86                                height: 400,
87                                on: {
88                                        selectionCheck: function( evt ) {
89                                                var realSel = evt.editor.getSelection( true ),
90                                                        editorSel = evt.editor.getSelection(),
91                                                        startEl = realSel.getStartElement(),
92                                                        el = editorSel.getSelectedElement();
93
94                                                console.log(
95                                                        'real.isHidden: ' + realSel.isHidden(),
96                                                        '\teditor.isFake: ' + !!editorSel.isFake,
97                                                        '\treal.startElement: ' + ( startEl && startEl.getOuterHtml().slice( 0, 100 ) ),
98                                                        '\teditor.selectedElement: ' + ( el && el.getOuterHtml().slice( 0, 20 ) )
99                                                );
100                                        },
101
102                                        contentDom: function( evt ) {
103                                                var editable = evt.editor.editable(),
104                                                        editor = evt.editor;
105
106                                                var fakeElements = editable.$.querySelectorAll( '.fakesel' );
107
108                                                for ( var i = 0; i < fakeElements.length; ++i )
109                                                        addMouseListener( evt.editor, editable, new CKEDITOR.dom.element( fakeElements[ i ] ) );
110                                        }
111                                }
112                        } );
113
114                        function addMouseListener( editor, editable, el ) {
115                                editable.attachListener( el, 'mousedown', function( evt ) {
116                                        editor.getSelection().fake( el );
117
118                                        evt.data.preventDefault();
119                                        evt.data.stopPropagation();
120                                        evt.cancel();
121                                }, null, null, -100 );
122                        }
123
124                </script>
125                <p>
126                        <input type="submit" value="Submit">
127                </p>
128        </form>
129        <div id="footer">
130                <hr>
131                <p>
132                        CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
133                </p>
134                <p id="copy">
135                        Copyright &copy; 2003-2013, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
136                        Knabben. All rights reserved.
137                </p>
138        </div>
139</body>
140</html>
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy