Debian Codegraph @

dijit/tests/editor/test_ViewSource.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta http-equiv="Content-type" content="text/html; charset=utf-8">
5 <title>Editor Test: ViewSource Plugin</title>
6
7 <script type="text/javascript" src="../boilerplate.js"></script>
8
9 <script type="text/javascript">
10 require([
11 "dojo/parser",
12 "dijit/registry",
13 "dijit/Editor",
14 "dijit/_editor/plugins/ViewSource",
15 "dijit/_editor/plugins/FullScreen",
16 "dojo/domReady!"
17 ], function(parser, registry){
18 parser.parse();
19
20 var editor = registry.byId("editor7");
21 editor.set("value", "<h1>ViewSource Plugin with onmouseover in content set via setValue.</h1>" +
22 "<p onmouseover=\"alert('Mouse over foobar');\">foobar</p>" +
23 "<h2>Things to test:</h2>\n" +
24 "<ol>" +
25 "<li>Move mouse over \"foobar\" and make sure alert is not displayed.</li>" +
26 "</ol>");
27 });
28 </script>
29 </head>
30 <body class="claro" role="main">
31 <br>
32 <br>
33 <div>Content before the editors.</div>
34 <br>
35 <br>
36 <div>
37 <div id="editor0" data-dojo-type="dijit/Editor"
38 data-dojo-props='"aria-label":"editor0",extraPlugins:["viewSource"], style:"background-color: white; width: 800px;", height:"400px" '>
39 <h1>ViewSource Plugin details</h1>
40 <ol>
41 <li>The ViewSource plugin provides an extra button on the toolbar to allow switching the
42 editor from WSYIWYG editing to into HTML source mode editing in the browser.
43 This plugin is particularly useful when needing to tweak generated HTML source.</li>
44 <li>The mode can also be toggled by entering the key command: CTRL-SHIFT-F12
45 in the editor pane.</li>
46 <li>When it toggled it makes the edit area either a textarea if editing is enabled, or a readonly TEXTAREA node
47 if it is not editable.</li>
48 <li>The plugin is aware of the FullScreen plugin, and when present will make sure that FullScreen knows which
49 node to make 'full'.</li>
50 <li>The View Source adds in basic comment and script tag stripping by default (to help avoid XSS) attacks in code.
51 These can be disabled, but it is not recommended.</li>
52 <li>While in view source mode, all other menu bar plugins are disabled.</li>
53 </ol>
54
55 <h2>Things to test:</h2>
56 <ol>
57 <li>Verify that clicking the View Source icon highlights the button appropriately and toggles the view source mode on.</li>
58 <li>Verify that clicking the View Source icon again dehighlites the button and toggles the view source mode off.</li>
59 <li>Click in the editing pane and verify that CTRL-SHIFT-F12 toggles the view source mode on and off.</li>
60 <li>Verify that when in View Source mode and comment and script tag stripping is enabled, that both inputs are removed when
61 toggled off.</li>
62 </ol>
63 </div>
64 </div>
65 <br>
66 <br>
67 <div>
68 <div id="editor1" data-dojo-type="dijit/Editor"
69 data-dojo-props='"aria-label":"editor1",extraPlugins:["fullScreen","viewSource"], style:"background-color: white; width: 800px;", height:"300px" '>
70 <h1>ViewSource Plugin with FullScreen Plugin details</h1>
71 <ol>
72 <li>The ViewSource plugin is FullScreen aware. It will should work appropriately when in full screen mode.</li>
73 </ol>
74
75 <h2>Things to test:</h2>
76 <ol>
77 <li>Verify that while in Full Screen mode clicking the View Source icon highlights the button appropriately and toggles the
78 view source mode on and scales appropriately.</li>
79 </ol>
80 </div>
81 </div>
82 <br>
83 <br>
84 <div>
85 <div id="editor2" data-dojo-type="dijit/Editor"
86 data-dojo-props='"aria-label":"editor2",extraPlugins:["fullScreen",{name: "viewSource", readOnly: true}], style:"background-color: white; width: 800px;", height:"300px" '>
87 <h1>ViewSource Plugin with readOnly enabled details</h1>
88 <ol>
89 <li>The ViewSource plugin supports a readonly mode. This should display the content but not allow any edits..</li>
90 </ol>
91
92 <h2>Things to test:</h2>
93 <ol>
94 <li>Verify that while in View Source mode, the source cannot be edited.</li>
95 </ol>
96 </div>
97 </div>
98 <br>
99 <br>
100 <div>
101 <div id="editor3" data-dojo-type="dijit/Editor"
102 data-dojo-props='"aria-label":"editor3",extraPlugins:["fullScreen",{name: "viewSource", stripScripts: false, stripComments: false, stripIFrames: false}],
103 style:"background-color: white; width: 800px;", height:"300px" '>
104 <h1>ViewSource Plugin with script* disabled</h1>
105 <ol>
106 <li>The ViewSource plugin supports disabling the script stripping, comment stripping, etc. This can be dangerous, but sometimes it is desirable.</li>
107 </ol>
108
109 <h2>Things to test:</h2>
110 <ol>
111 <li>Verify that typed in script tags, comments, and iframes are left in the content when view switched.</li>
112 </ol>
113 </div>
114 </div>
115 <br>
116 <br>
117 <div>
118 <div id="editor4" data-dojo-type="dijit/Editor"
119 data-dojo-props='"aria-label":"editor3",extraPlugins:["fullScreen", "viewSource"],
120 style:"background-color: white; width: 800px;", height:"300px" '>
121 <h1>ViewSource Plugin with stripEventHandlers enabled</h1>
122 <img ondrag="alert('Bug dragged!')" src="./bug.png" onclick="alert('Bug clicked!');">
123 <button
124 onclick="alert('Button clicked!')"
125 id="button1"
126 ondblclick="alert('Button double clicked!')">
127 onclick button
128 </button>
129 <button name="button" id="button2">Just a button</button>
130 <h2>Things to test:</h2>
131 <ol>
132 <li>Click the view source button and verify that all on* attributes have been removed.</li>
133 </ol>
134 </div>
135 </div>
136 <br>
137 <br>
138 <div>
139 <div id="editor5" data-dojo-type="dijit/Editor"
140 data-dojo-props='"aria-label":"editor3",extraPlugins:["fullScreen", {name: "viewSource", stripEventHandlers: false}],
141 style:"background-color: white; width: 800px;", height:"300px" '>
142 <h1>ViewSource Plugin with stripEventHandlers disabled</h1>
143 <img ondrag="alert('Bug dragged!')" src="./bug.png" onclick="alert('Bug clicked!');">
144 <button
145 onclick="alert('Button clicked!')"
146 id="button3"
147 ondblclick="alert('Button double clicked!')">
148 onclick button
149 </button>
150 <button name="button" id="button4">Just a button</button>
151 <h2>Things to test:</h2>
152 <ol>
153 <li>Click the view source button and verify that all on* attributes have NOT been removed.</li>
154 </ol>
155 </div>
156 </div>
157 <br>
158 <br>
159 <div>
160 <div id="editor6" data-dojo-type="dijit/Editor"
161 data-dojo-props='"aria-label":"editor3",extraPlugins:["fullScreen", "viewSource"],
162 style:"background-color: white; width: 800px;", height:"300px" '>
163 <h1>ViewSource Plugin with onmouseover in content.</h1>
164 <p onmouseover="alert('Mouse over foobar');">foobar</p>
165
166 <h2>Things to test:</h2>
167 <ol>
168 <li>Move mouse over "foobar" and make sure alert is not displayed.</li>
169 </ol>
170 </div>
171 </div>
172 <br>
173 <br>
174 <div>
175 <div id="editor7" data-dojo-type="dijit/Editor"
176 data-dojo-props='"aria-label":"editor3",extraPlugins:["fullScreen", "viewSource"],
177 style:"background-color: white; width: 800px;", height:"300px" '>
178 </div>
179 </div>
180 <br>
181 <br>
182 <div>Content after the editors.</div>
183 </body>
184 </html>