+++ /dev/null
-/**\r
- * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $\r
- *\r
- * @author Moxiecode\r
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.\r
- */\r
-\r
-/* Import plugin specific language pack */\r
-tinyMCE.importPluginLanguagePack('fullscreen');\r
-\r
-var TinyMCE_FullScreenPlugin = {\r
- getInfo : function() {\r
- return {\r
- longname : 'Fullscreen',\r
- author : 'Moxiecode Systems AB',\r
- authorurl : 'http://tinymce.moxiecode.com',\r
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',\r
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion\r
- };\r
- },\r
-\r
- initInstance : function(inst) {\r
- if (!tinyMCE.settings['fullscreen_skip_plugin_css'])\r
- tinyMCE.importCSS(inst.getContainerWin().document, tinyMCE.baseURL + "/plugins/fullscreen/css/page.css");\r
- },\r
-\r
- getControlHTML : function(cn) {\r
- switch (cn) {\r
- case "fullscreen":\r
- return tinyMCE.getButtonHTML(cn, 'lang_fullscreen_desc', '{$pluginurl}/images/fullscreen.gif', 'mceFullScreen');\r
- }\r
-\r
- return "";\r
- },\r
-\r
- execCommand : function(editor_id, element, command, user_interface, value) {\r
- var inst;\r
-\r
- // Handle commands\r
- switch (command) {\r
- case "mceFullScreen":\r
- inst = tinyMCE.getInstanceById(editor_id);\r
-\r
- if (tinyMCE.getParam('fullscreen_new_window'))\r
- this._toggleFullscreenWin(inst);\r
- else\r
- this._toggleFullscreen(inst);\r
-\r
- return true;\r
- }\r
-\r
- // Pass to next handler in chain\r
- return false;\r
- },\r
-\r
- _toggleFullscreenWin : function(inst) {\r
- if (tinyMCE.getParam('fullscreen_is_enabled')) {\r
- // In fullscreen mode\r
- window.opener.tinyMCE.execInstanceCommand(tinyMCE.getParam('fullscreen_editor_id'), 'mceSetContent', false, tinyMCE.getContent(inst.editorId));\r
- top.close();\r
- } else {\r
- tinyMCE.setWindowArg('editor_id', inst.editorId);\r
-\r
- var win = window.open(tinyMCE.baseURL + "/plugins/fullscreen/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);\r
- try { win.resizeTo(screen.availWidth, screen.availHeight); } catch (e) {}\r
- }\r
- },\r
-\r
- _toggleFullscreen : function(inst) {\r
- var ds = inst.getData('fullscreen'), editorContainer, tableElm, iframe, vp, cw, cd, re, w, h, si, blo, delta = 0, cell, row, fcml, bcml;\r
-\r
- cw = inst.getContainerWin();\r
- cd = cw.document;\r
- editorContainer = cd.getElementById(inst.editorId + '_parent');\r
- tableElm = editorContainer.firstChild;\r
- iframe = inst.iframeElement;\r
- re = cd.getElementById(inst.editorId + '_resize');\r
- blo = document.getElementById('mce_fullscreen_blocker');\r
- fcm = new TinyMCE_Layer(inst.editorId + '_fcMenu');\r
- fcml = new TinyMCE_Layer(inst.editorId + '_fcMenu');\r
- bcml = new TinyMCE_Layer(inst.editorId + '_bcMenu');\r
-\r
- if (fcml.exists() && fcml.isVisible()) {\r
- tinyMCE.switchClass(inst.editorId + '_forecolor', 'mceMenuButton');\r
- fcml.hide();\r
- }\r
-\r
- if (bcml.exists() && bcml.isVisible()) {\r
- tinyMCE.switchClass(inst.editorId + '_backcolor', 'mceMenuButton');\r
- bcml.hide();\r
- }\r
-\r
- if (!ds.enabled) {\r
- // Handle External Toolbar\r
- if (inst.toolbarElement) {\r
- delta += inst.toolbarElement.offsetHeight;\r
-\r
- cell = tableElm.tBodies[0].insertRow(0).insertCell(-1);\r
- cell.className = 'mceToolbarTop';\r
- cell.nowrap = true;\r
-\r
- ds.oldToolbarParent = inst.toolbarElement.parentNode;\r
- ds.toolbarHolder = document.createTextNode('...');\r
-\r
- cell.appendChild(ds.oldToolbarParent.replaceChild(ds.toolbarHolder, inst.toolbarElement));\r
- }\r
-\r
- ds.parents = [];\r
-\r
- vp = tinyMCE.getViewPort(cw);\r
- ds.scrollX = vp.left;\r
- ds.scrollY = vp.top;\r
-\r
- // Opera has a bug restoring scrollbars\r
- if (!tinyMCE.isOpera)\r
- tinyMCE.addCSSClass(cd.body, 'mceFullscreen');\r
-\r
- tinyMCE.getParentNode(tableElm.parentNode, function (n) {\r
- if (n.nodeName == 'BODY')\r
- return true;\r
-\r
- if (n.nodeType == 1)\r
- tinyMCE.addCSSClass(n, 'mceFullscreenPos');\r
-\r
- return false;\r
- });\r
-\r
- if (re)\r
- re.style.display = 'none';\r
-\r
- vp = tinyMCE.getViewPort(cw);\r
-\r
- ds.oldWidth = iframe.style.width ? iframe.style.width : iframe.offsetWidth;\r
- ds.oldHeight = iframe.style.height ? iframe.style.height : iframe.offsetHeight;\r
- ds.oldTWidth = tableElm.style.width ? tableElm.style.width : tableElm.offsetWidth;\r
- ds.oldTHeight = tableElm.style.height ? tableElm.style.height : tableElm.offsetHeight;\r
-\r
- // Handle % width\r
- if (ds.oldWidth && ds.oldWidth.indexOf)\r
- ds.oldTWidth = ds.oldWidth.indexOf('%') != -1 ? ds.oldWidth : ds.oldTWidth;\r
-\r
- if (!blo && tinyMCE.isRealIE) {\r
- blo = tinyMCE.createTag(document, 'iframe', {id : 'mce_fullscreen_blocker', src : 'about:blank', frameBorder : 0, width : vp.width, height : vp.height, style : 'display: block; position: absolute; left: 0; top: 0; z-index: 999; margin: 0; padding: 0;'});\r
- document.body.appendChild(blo);\r
- }\r
-\r
- tableElm.style.position = 'absolute';\r
- tableElm.style.zIndex = 1000;\r
- tableElm.style.left = tableElm.style.top = '0';\r
-\r
- tableElm.style.width = vp.width + 'px';\r
- tableElm.style.height = vp.height + 'px';\r
-\r
- if (tinyMCE.isRealIE) {\r
- iframe.style.width = vp.width + 'px';\r
- iframe.style.height = vp.height + 'px';\r
-\r
- // Calc new width/height based on overflow\r
- w = iframe.parentNode.clientWidth - (tableElm.offsetWidth - vp.width);\r
- h = iframe.parentNode.clientHeight - (tableElm.offsetHeight - vp.height);\r
- } else {\r
- w = iframe.parentNode.clientWidth;\r
- h = iframe.parentNode.clientHeight;\r
- }\r
-\r
- iframe.style.width = w + "px";\r
- iframe.style.height = (h+delta) + "px";\r
-\r
- tinyMCE.switchClass(inst.editorId + '_fullscreen', 'mceButtonSelected');\r
- ds.enabled = true;\r
-\r
- inst.useCSS = false;\r
- } else {\r
- // Handle External Toolbar\r
- if (inst.toolbarElement) {\r
- row = inst.toolbarElement.parentNode.parentNode;\r
-\r
- row.parentNode.removeChild(row);\r
-\r
- ds.oldToolbarParent.replaceChild(inst.toolbarElement, ds.toolbarHolder);\r
-\r
- ds.oldToolbarParent = null;\r
- ds.toolbarHolder = null;\r
- }\r
-\r
- if (blo)\r
- blo.parentNode.removeChild(blo);\r
-\r
- si = 0;\r
- tinyMCE.getParentNode(tableElm.parentNode, function (n) {\r
- if (n.nodeName == 'BODY')\r
- return true;\r
-\r
- if (n.nodeType == 1)\r
- tinyMCE.removeCSSClass(n, 'mceFullscreenPos');\r
- });\r
-\r
- if (re && tinyMCE.getParam("theme_advanced_resizing", false))\r
- re.style.display = 'block';\r
-\r
- tableElm.style.position = 'static';\r
- tableElm.style.zIndex = '';\r
- tableElm.style.width = '';\r
- tableElm.style.height = '';\r
-\r
- tableElm.style.width = ds.oldTWidth ? ds.oldTWidth : '';\r
- tableElm.style.height = ds.oldTHeight ? ds.oldTHeight : '';\r
-\r
- iframe.style.width = ds.oldWidth ? ds.oldWidth : '';\r
- iframe.style.height = ds.oldHeight ? ds.oldHeight : '';\r
-\r
- tinyMCE.switchClass(inst.editorId + '_fullscreen', 'mceButtonNormal');\r
- ds.enabled = false;\r
-\r
- tinyMCE.removeCSSClass(cd.body, 'mceFullscreen');\r
- cw.scrollTo(ds.scrollX, ds.scrollY);\r
-\r
- inst.useCSS = false;\r
- }\r
- },\r
-\r
- handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {\r
- if (tinyMCE.getParam('fullscreen_is_enabled'))\r
- tinyMCE.switchClass(editor_id + '_fullscreen', 'mceButtonSelected');\r
-\r
- return true;\r
- }\r
-};\r
-\r
-tinyMCE.addPlugin("fullscreen", TinyMCE_FullScreenPlugin);\r