annotate WebContent/jscripts/tiny_mce/plugins/fullscreen/fullscreen.htm @ 8:11baadcdd2c8

start of new Annotator API implementation.
author casties
date Mon, 19 Mar 2012 14:50:28 +0100
parents 0be9d53a6967
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1 <!DOCTYPE html>
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
2 <html xmlns="http://www.w3.org/1999/xhtml">
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
3 <head>
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
4 <title></title>
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
5 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
6 <script type="text/javascript" src="../../tiny_mce.js"></script>
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
7 <script type="text/javascript">
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
8 function patchCallback(settings, key) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
9 if (settings[key])
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
10 settings[key] = "window.opener." + settings[key];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
11 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
12
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
13 var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
14
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
15 // Clone array
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
16 for (var n in paSe)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
17 settings[n] = paSe[n];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
18
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
19 // Override options for fullscreen
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
20 for (var n in paSe.fullscreen_settings)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
21 settings[n] = paSe.fullscreen_settings[n];
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
22
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
23 // Patch callbacks, make them point to window.opener
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
24 patchCallback(settings, 'urlconverter_callback');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
25 patchCallback(settings, 'insertlink_callback');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
26 patchCallback(settings, 'insertimage_callback');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
27 patchCallback(settings, 'setupcontent_callback');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
28 patchCallback(settings, 'save_callback');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
29 patchCallback(settings, 'onchange_callback');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
30 patchCallback(settings, 'init_instance_callback');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
31 patchCallback(settings, 'file_browser_callback');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
32 patchCallback(settings, 'cleanup_callback');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
33 patchCallback(settings, 'execcommand_callback');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
34 patchCallback(settings, 'oninit');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
35
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
36 // Set options
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
37 delete settings.id;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
38 settings['mode'] = 'exact';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
39 settings['elements'] = 'fullscreenarea';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
40 settings['add_unload_trigger'] = false;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
41 settings['ask'] = false;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
42 settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
43 settings['fullscreen_is_enabled'] = true;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
44 settings['fullscreen_editor_id'] = oeID;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
45 settings['theme_advanced_resizing'] = false;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
46 settings['strict_loading_mode'] = true;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
47
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
48 settings.save_onsavecallback = function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
49 window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
50 window.opener.tinyMCE.get(oeID).execCommand('mceSave');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
51 window.close();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
52 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
53
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
54 function unloadHandler(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
55 moveContent();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
56 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
57
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
58 function moveContent() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
59 window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent());
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
60 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
61
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
62 function closeFullscreen() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
63 moveContent();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
64 window.close();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
65 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
66
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
67 function doParentSubmit() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
68 moveContent();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
69
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
70 if (window.opener.tinyMCE.selectedInstance.formElement.form)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
71 window.opener.tinyMCE.selectedInstance.formElement.form.submit();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
72
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
73 window.close();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
74
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
75 return false;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
76 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
77
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
78 function render() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
79 var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
80
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
81 e.value = window.opener.tinyMCE.get(oeID).getContent();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
82
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
83 vp = dom.getViewPort();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
84 settings.width = vp.w;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
85 settings.height = vp.h - 15;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
86
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
87 tinymce.dom.Event.add(window, 'resize', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
88 var vp = dom.getViewPort();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
89
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
90 tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
91 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
92
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
93 tinyMCE.init(settings);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
94 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
95
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
96 // Add onunload
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
97 tinymce.dom.Event.add(window, "beforeunload", unloadHandler);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
98 </script>
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
99 </head>
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
100 <body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
101 <form onsubmit="doParentSubmit();">
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
102 <textarea id="fullscreenarea" style="width:100%; height:100%"></textarea>
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
103 </form>
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
104
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
105 <script type="text/javascript">
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
106 render();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
107 </script>
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
108
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
109 </body>
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
110 </html>