summaryrefslogtreecommitdiff
path: root/program/js/tiny_mce/plugins/fullscreen
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-01-20 18:46:28 +0100
committerAleksander Machniak <alec@alec.pl>2014-01-20 18:46:28 +0100
commit6fa5b437a48485927e5d90abe061ee723f3b45c2 (patch)
tree118a32ddde4af92c7def9838b10beddb9f0fe241 /program/js/tiny_mce/plugins/fullscreen
parentfac59dc441d25f7204fb6013bf88db90c01ae34b (diff)
Update to TinyMCE 4.x
Diffstat (limited to 'program/js/tiny_mce/plugins/fullscreen')
-rw-r--r--program/js/tiny_mce/plugins/fullscreen/editor_plugin.js1
-rw-r--r--program/js/tiny_mce/plugins/fullscreen/editor_plugin_src.js234
-rw-r--r--program/js/tiny_mce/plugins/fullscreen/fullscreen.htm117
3 files changed, 0 insertions, 352 deletions
diff --git a/program/js/tiny_mce/plugins/fullscreen/editor_plugin.js b/program/js/tiny_mce/plugins/fullscreen/editor_plugin.js
deleted file mode 100644
index 1aa8cc443..000000000
--- a/program/js/tiny_mce/plugins/fullscreen/editor_plugin.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(){var b=tinymce.DOM;var a=function(d,f,e){var c=function(g){var i=d.controlManager.get(g);var h=f.controlManager.get(g);if(i&&h){h.displayColor(i.value)}};c("forecolor");c("backcolor");f.setContent(d.getContent({format:"raw"}),{format:"raw"});f.selection.moveToBookmark(e);if(d.plugins.spellchecker&&f.plugins.spellchecker){f.plugins.spellchecker.setLanguage(d.plugins.spellchecker.selectedLang)}};tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(i,c){var l=this,m={},k=b.doc.documentElement,d,o,h,g,f,e,j;i.addCommand("mceFullScreen",function(){var q,r;if(i.getParam("fullscreen_is_enabled")){if(i.getParam("fullscreen_new_window")){closeFullscreen()}else{b.win.setTimeout(function(){var t=i;var s=tinyMCE.get(t.getParam("fullscreen_editor_id"));s.plugins.fullscreen.saveState(t);tinyMCE.remove(t)},10)}return}if(i.getParam("fullscreen_new_window")){l.fullscreenSettings={bookmark:i.selection.getBookmark()};q=b.win.open(c+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{q.resizeTo(screen.availWidth,screen.availHeight)}catch(p){}}else{o=b.getStyle(b.doc.body,"overflow",1)||"auto";h=b.getStyle(k,"overflow",1);d=b.getViewPort();g=d.x;f=d.y;if(tinymce.isOpera&&o=="visible"){o="auto"}if(tinymce.isIE&&o=="scroll"){o="auto"}if(tinymce.isIE&&(h=="visible"||h=="scroll")){h="auto"}if(o=="0px"){o=""}b.setStyle(b.doc.body,"overflow","hidden");k.style.overflow="hidden";d=b.getViewPort();b.win.scrollTo(0,0);if(tinymce.isIE){d.h-=1}if(tinymce.isIE6||document.compatMode=="BackCompat"){e="absolute;top:"+d.y}else{e="fixed;top:0"}n=b.add(b.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+e+";left:0;width:"+d.w+"px;height:"+d.h+"px;z-index:200000;"});b.add(n,"div",{id:"mce_fullscreen"});tinymce.each(i.settings,function(s,t){m[t]=s});m.id="mce_fullscreen";m.width=n.clientWidth;m.height=n.clientHeight-15;m.fullscreen_is_enabled=true;m.fullscreen_editor_id=i.id;m.theme_advanced_resizing=false;m.save_onsavecallback=function(){i.setContent(tinyMCE.get(m.id).getContent());i.execCommand("mceSave")};tinymce.each(i.getParam("fullscreen_settings"),function(t,s){m[s]=t});l.fullscreenSettings={bookmark:i.selection.getBookmark(),fullscreen_overflow:o,fullscreen_html_overflow:h,fullscreen_scrollx:g,fullscreen_scrolly:f};if(m.theme_advanced_toolbar_location==="external"){m.theme_advanced_toolbar_location="top"}tinyMCE.oldSettings=tinyMCE.settings;l.fullscreenEditor=new tinymce.Editor("mce_fullscreen",m);l.fullscreenEditor.onInit.add(function(){l.loadState(l.fullscreenEditor)});l.fullscreenEditor.render();l.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");l.fullscreenElement.update();l.resizeFunc=tinymce.dom.Event.add(b.win,"resize",function(){var v=tinymce.DOM.getViewPort(),t=l.fullscreenEditor,s,u;s=t.dom.getSize(t.getContainer().getElementsByTagName("table")[0]);u=t.dom.getSize(t.getContainer().getElementsByTagName("iframe")[0]);t.theme.resizeTo(v.w-s.w+u.w,v.h-s.h+u.h)})}});i.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});i.onNodeChange.add(function(q,p){p.setActive("fullscreen",q.getParam("fullscreen_is_enabled"))});l.loadState=function(p){if(!(p&&l.fullscreenSettings)){throw"No fullscreen editor to load to"}a(i,p,l.fullscreenSettings.bookmark);p.focus()};l.saveState=function(q){if(!(q&&l.fullscreenSettings)){throw"No fullscreen editor to restore from"}var p=l.fullscreenSettings;a(q,i,q.selection.getBookmark());if(!i.getParam("fullscreen_new_window")){tinymce.dom.Event.remove(b.win,"resize",l.resizeFunc);delete l.resizeFunc;b.remove("mce_fullscreen_container");b.doc.documentElement.style.overflow=p.fullscreen_html_overflow;b.setStyle(b.doc.body,"overflow",p.fullscreen_overflow);b.win.scrollTo(p.fullscreen_scrollx,p.fullscreen_scrolly)}tinyMCE.settings=tinyMCE.oldSettings;delete tinyMCE.oldSettings;delete l.fullscreenEditor;delete l.fullscreenElement;delete l.fullscreenSettings;b.win.setTimeout(function(){i.selection.moveToBookmark(j);i.focus()},10)}},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})(); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/fullscreen/editor_plugin_src.js b/program/js/tiny_mce/plugins/fullscreen/editor_plugin_src.js
deleted file mode 100644
index bec886f74..000000000
--- a/program/js/tiny_mce/plugins/fullscreen/editor_plugin_src.js
+++ /dev/null
@@ -1,234 +0,0 @@
-/**
- * editor_plugin_src.js
- *
- * Copyright 2009, Moxiecode Systems AB
- * Released under LGPL License.
- *
- * License: http://tinymce.moxiecode.com/license
- * Contributing: http://tinymce.moxiecode.com/contributing
- */
-
-(function() {
- var DOM = tinymce.DOM;
-
- // State Transfer function
- var transferState = function(oldEditor, newEditor, bookmark) {
- var transferColorButtonState = function(swapme) {
- var c = oldEditor.controlManager.get(swapme);
- var newC = newEditor.controlManager.get(swapme);
-
- if (c && newC) {
- newC.displayColor(c.value);
- }
-
- };
-
- transferColorButtonState('forecolor');
- transferColorButtonState('backcolor');
- newEditor.setContent(oldEditor.getContent({format : 'raw'}), {format : 'raw'});
- newEditor.selection.moveToBookmark(bookmark);
-
- if (oldEditor.plugins.spellchecker && newEditor.plugins.spellchecker) {
- newEditor.plugins.spellchecker.setLanguage(oldEditor.plugins.spellchecker.selectedLang);
- }
- };
-
- tinymce.create('tinymce.plugins.FullScreenPlugin', {
- init : function(ed, url) {
- var t = this, s = {}, de = DOM.doc.documentElement, vp, fullscreen_overflow, fullscreen_html_overflow, fullscreen_scrollx, fullscreen_scrolly, posCss, bookmark;
-
- // Register commands
- ed.addCommand('mceFullScreen', function() {
- var win, oed;
-
- if (ed.getParam('fullscreen_is_enabled')) {
- if (ed.getParam('fullscreen_new_window'))
- closeFullscreen(); // Call to close in fullscreen.htm
- else {
- DOM.win.setTimeout(function() {
- var fullscreenEditor = ed;
-
- // find the editor that opened this one, execute restore function there
- var originalEditor = tinyMCE.get(fullscreenEditor.getParam('fullscreen_editor_id'));
- originalEditor.plugins.fullscreen.saveState(fullscreenEditor);
-
- tinyMCE.remove(fullscreenEditor);
- }, 10);
- }
-
- return;
- }
-
- if (ed.getParam('fullscreen_new_window')) {
- t.fullscreenSettings = {
- bookmark: ed.selection.getBookmark()
- };
- win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
- try {
- win.resizeTo(screen.availWidth, screen.availHeight);
- } catch (e) {
- // Ignore
- }
- } else {
- fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
- fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
- vp = DOM.getViewPort();
- fullscreen_scrollx = vp.x;
- fullscreen_scrolly = vp.y;
-
- // Fixes an Opera bug where the scrollbars doesn't reappear
- if (tinymce.isOpera && fullscreen_overflow == 'visible')
- fullscreen_overflow = 'auto';
-
- // Fixes an IE bug where horizontal scrollbars would appear
- if (tinymce.isIE && fullscreen_overflow == 'scroll')
- fullscreen_overflow = 'auto';
-
- // Fixes an IE bug where the scrollbars doesn't reappear
- if (tinymce.isIE && (fullscreen_html_overflow == 'visible' || fullscreen_html_overflow == 'scroll'))
- fullscreen_html_overflow = 'auto';
-
- if (fullscreen_overflow == '0px')
- fullscreen_overflow = '';
-
- DOM.setStyle(DOM.doc.body, 'overflow', 'hidden');
- de.style.overflow = 'hidden'; //Fix for IE6/7
- vp = DOM.getViewPort();
- DOM.win.scrollTo(0, 0);
-
- if (tinymce.isIE)
- vp.h -= 1;
-
- // Use fixed position if it exists
- if (tinymce.isIE6 || document.compatMode == 'BackCompat')
- posCss = 'absolute;top:' + vp.y;
- else
- posCss = 'fixed;top:0';
-
- n = DOM.add(DOM.doc.body, 'div', {
- id : 'mce_fullscreen_container',
- style : 'position:' + posCss + ';left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});
- DOM.add(n, 'div', {id : 'mce_fullscreen'});
-
- tinymce.each(ed.settings, function(v, n) {
- s[n] = v;
- });
-
- s.id = 'mce_fullscreen';
- s.width = n.clientWidth;
- s.height = n.clientHeight - 15;
- s.fullscreen_is_enabled = true;
- s.fullscreen_editor_id = ed.id;
- s.theme_advanced_resizing = false;
- s.save_onsavecallback = function() {
- ed.setContent(tinyMCE.get(s.id).getContent());
- ed.execCommand('mceSave');
- };
-
- tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) {
- s[k] = v;
- });
-
- t.fullscreenSettings = {
- bookmark: ed.selection.getBookmark(),
- fullscreen_overflow: fullscreen_overflow,
- fullscreen_html_overflow: fullscreen_html_overflow,
- fullscreen_scrollx: fullscreen_scrollx,
- fullscreen_scrolly: fullscreen_scrolly
- };
-
- if (s.theme_advanced_toolbar_location === 'external')
- s.theme_advanced_toolbar_location = 'top';
-
- tinyMCE.oldSettings = tinyMCE.settings; // Store old settings, the Editor constructor overwrites them
- t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
- t.fullscreenEditor.onInit.add(function() {
- t.loadState(t.fullscreenEditor);
- });
-
- t.fullscreenEditor.render();
-
- t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container');
- t.fullscreenElement.update();
- //document.body.overflow = 'hidden';
-
- t.resizeFunc = tinymce.dom.Event.add(DOM.win, 'resize', function() {
- var vp = tinymce.DOM.getViewPort(), fed = t.fullscreenEditor, outerSize, innerSize;
-
- // Get outer/inner size to get a delta size that can be used to calc the new iframe size
- outerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('table')[0]);
- innerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('iframe')[0]);
-
- fed.theme.resizeTo(vp.w - outerSize.w + innerSize.w, vp.h - outerSize.h + innerSize.h);
- });
- }
- });
-
- // Register buttons
- ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'});
-
- ed.onNodeChange.add(function(ed, cm) {
- cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled'));
- });
-
- // fullscreenEditor is a param here because in window mode we don't create it
- t.loadState = function(fullscreenEditor) {
- if (!(fullscreenEditor && t.fullscreenSettings)) {
- throw "No fullscreen editor to load to";
- }
-
- transferState(ed, fullscreenEditor, t.fullscreenSettings.bookmark);
- fullscreenEditor.focus();
-
- };
-
- // fullscreenEditor is a param here because in window mode we don't create it
- t.saveState = function(fullscreenEditor) {
- if (!(fullscreenEditor && t.fullscreenSettings)) {
- throw "No fullscreen editor to restore from";
- }
- var settings = t.fullscreenSettings;
-
- transferState(fullscreenEditor, ed, fullscreenEditor.selection.getBookmark());
-
- // cleanup only required if window mode isn't used
- if (!ed.getParam('fullscreen_new_window')) {
- tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
- delete t.resizeFunc;
-
- DOM.remove('mce_fullscreen_container');
-
- DOM.doc.documentElement.style.overflow = settings.fullscreen_html_overflow;
- DOM.setStyle(DOM.doc.body, 'overflow', settings.fullscreen_overflow);
- DOM.win.scrollTo(settings.fullscreen_scrollx, settings.fullscreen_scrolly);
- }
- tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
-
- // clear variables
- delete tinyMCE.oldSettings;
- delete t.fullscreenEditor;
- delete t.fullscreenElement;
- delete t.fullscreenSettings;
-
- // allow the fullscreen editor to be removed before restoring focus and selection
- DOM.win.setTimeout(function() {
- ed.selection.moveToBookmark(bookmark);
- ed.focus();
- }, 10);
- };
- },
-
- getInfo : function() {
- return {
- longname : 'Fullscreen',
- author : 'Moxiecode Systems AB',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',
- version : tinymce.majorVersion + "." + tinymce.minorVersion
- };
- }
- });
-
- // Register plugin
- tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin);
-})();
diff --git a/program/js/tiny_mce/plugins/fullscreen/fullscreen.htm b/program/js/tiny_mce/plugins/fullscreen/fullscreen.htm
deleted file mode 100644
index baf028b79..000000000
--- a/program/js/tiny_mce/plugins/fullscreen/fullscreen.htm
+++ /dev/null
@@ -1,117 +0,0 @@
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title></title>
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
- <script type="text/javascript" src="../../tiny_mce.js"></script>
- <script type="text/javascript">
- function patchCallback(settings, key) {
- if (settings[key])
- settings[key] = "window.opener." + settings[key];
- }
-
- var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id;
-
- // Clone array
- for (var n in paSe)
- settings[n] = paSe[n];
-
- // Override options for fullscreen
- for (var n in paSe.fullscreen_settings)
- settings[n] = paSe.fullscreen_settings[n];
-
- // Patch callbacks, make them point to window.opener
- patchCallback(settings, 'urlconverter_callback');
- patchCallback(settings, 'insertlink_callback');
- patchCallback(settings, 'insertimage_callback');
- patchCallback(settings, 'setupcontent_callback');
- patchCallback(settings, 'save_callback');
- patchCallback(settings, 'onchange_callback');
- patchCallback(settings, 'init_instance_callback');
- patchCallback(settings, 'file_browser_callback');
- patchCallback(settings, 'cleanup_callback');
- patchCallback(settings, 'execcommand_callback');
- patchCallback(settings, 'oninit');
-
- // Set options
- delete settings.id;
- settings['mode'] = 'exact';
- settings['elements'] = 'fullscreenarea';
- settings['add_unload_trigger'] = false;
- settings['ask'] = false;
- settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
- settings['fullscreen_is_enabled'] = true;
- settings['fullscreen_editor_id'] = oeID;
- settings['theme_advanced_resizing'] = false;
- settings['strict_loading_mode'] = true;
-
- settings.save_onsavecallback = function() {
- moveContent();
- window.opener.tinyMCE.get(oeID).execCommand('mceSave');
- window.close();
- };
-
- function unloadHandler(e) {
- moveContent();
- }
-
- function moveContent() {
- // find the original editor, execute restore state in it's plugin instance
- window.opener.tinyMCE.get(oeID).plugins.fullscreen.saveState(tinyMCE.activeEditor);
-
- // prevent moveContent from being called twice - e.g. if the unloadHandler runs after moveContent()
- tinymce.dom.Event.remove(window, "beforeunload", unloadHandler);
- }
-
- function closeFullscreen() {
- // moveContent() will be called by the unload handler
- window.close();
- }
-
- function doParentSubmit() {
- moveContent();
-
- if (window.opener.tinyMCE.selectedInstance.formElement.form)
- window.opener.tinyMCE.selectedInstance.formElement.form.submit();
-
- window.close();
-
- return false;
- }
-
- function render() {
- var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
-
- vp = dom.getViewPort();
- settings.width = vp.w;
- settings.height = vp.h - 15;
-
- settings.oninit = function() {
- var ed = tinyMCE.activeEditor;
- window.opener.tinyMCE.get(oeID).plugins.fullscreen.loadState(ed);
-
- tinymce.dom.Event.add(window, 'resize', function() {
- var vp = dom.getViewPort();
-
- tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
- });
- }
-
- tinyMCE.init(settings);
- }
-
- // Add onunload
- tinymce.dom.Event.add(window, "beforeunload", unloadHandler);
- </script>
-</head>
-<body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">
-<form onsubmit="doParentSubmit();">
-<textarea id="fullscreenarea" style="width:100%; height:100%"></textarea>
-</form>
-
-<script type="text/javascript">
- render();
-</script>
-
-</body>
-</html>