first commit
@ -0,0 +1 @@
|
||||
(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(b,c){var d=this;d.editor=b;function a(e){var h=b.dom,g,f=b.selection.getSelectedBlocks();if(f.length){g=h.getAttrib(f[0],"dir");tinymce.each(f,function(i){if(!h.getParent(i.parentNode,"*[dir='"+e+"']",h.getRoot())){if(g!=e){h.setAttrib(i,"dir",e)}else{h.setAttrib(i,"dir",null)}}});b.nodeChanged()}}b.addCommand("mceDirectionLTR",function(){a("ltr")});b.addCommand("mceDirectionRTL",function(){a("rtl")});b.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});b.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});b.onNodeChange.add(d._nodeChange,d)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(b,a,e){var d=b.dom,c;e=d.getParent(e,d.isBlock);if(!e){a.setDisabled("ltr",1);a.setDisabled("rtl",1);return}c=d.getAttrib(e,"dir");a.setActive("ltr",c=="ltr");a.setDisabled("ltr",0);a.setActive("rtl",c=="rtl");a.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})();
|
@ -0,0 +1,85 @@
|
||||
/**
|
||||
* 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() {
|
||||
tinymce.create('tinymce.plugins.Directionality', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
function setDir(dir) {
|
||||
var dom = ed.dom, curDir, blocks = ed.selection.getSelectedBlocks();
|
||||
|
||||
if (blocks.length) {
|
||||
curDir = dom.getAttrib(blocks[0], "dir");
|
||||
|
||||
tinymce.each(blocks, function(block) {
|
||||
// Add dir to block if the parent block doesn't already have that dir
|
||||
if (!dom.getParent(block.parentNode, "*[dir='" + dir + "']", dom.getRoot())) {
|
||||
if (curDir != dir) {
|
||||
dom.setAttrib(block, "dir", dir);
|
||||
} else {
|
||||
dom.setAttrib(block, "dir", null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ed.nodeChanged();
|
||||
}
|
||||
}
|
||||
|
||||
ed.addCommand('mceDirectionLTR', function() {
|
||||
setDir("ltr");
|
||||
});
|
||||
|
||||
ed.addCommand('mceDirectionRTL', function() {
|
||||
setDir("rtl");
|
||||
});
|
||||
|
||||
ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
|
||||
ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'});
|
||||
|
||||
ed.onNodeChange.add(t._nodeChange, t);
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Directionality',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
// Private methods
|
||||
|
||||
_nodeChange : function(ed, cm, n) {
|
||||
var dom = ed.dom, dir;
|
||||
|
||||
n = dom.getParent(n, dom.isBlock);
|
||||
if (!n) {
|
||||
cm.setDisabled('ltr', 1);
|
||||
cm.setDisabled('rtl', 1);
|
||||
return;
|
||||
}
|
||||
|
||||
dir = dom.getAttrib(n, 'dir');
|
||||
cm.setActive('ltr', dir == "ltr");
|
||||
cm.setDisabled('ltr', 0);
|
||||
cm.setActive('rtl', dir == "rtl");
|
||||
cm.setDisabled('rtl', 0);
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality);
|
||||
})();
|
@ -0,0 +1 @@
|
||||
(function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(d,e){var f=this,g={},c,b;f.editor=d;d.addCommand("mceFullScreen",function(){var i,j=a.doc.documentElement;if(d.getParam("fullscreen_is_enabled")){if(d.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",f.resizeFunc);tinyMCE.get(d.getParam("fullscreen_editor_id")).setContent(d.getContent());tinyMCE.remove(d);a.remove("mce_fullscreen_container");j.style.overflow=d.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",d.getParam("fullscreen_overflow"));a.win.scrollTo(d.getParam("fullscreen_scrollx"),d.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(d.getParam("fullscreen_new_window")){i=a.win.open(e+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{i.resizeTo(screen.availWidth,screen.availHeight)}catch(h){}}else{tinyMCE.oldSettings=tinyMCE.settings;g.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";g.fullscreen_html_overflow=a.getStyle(j,"overflow",1);c=a.getViewPort();g.fullscreen_scrollx=c.x;g.fullscreen_scrolly=c.y;if(tinymce.isOpera&&g.fullscreen_overflow=="visible"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&g.fullscreen_overflow=="scroll"){g.fullscreen_overflow="auto"}if(tinymce.isIE&&(g.fullscreen_html_overflow=="visible"||g.fullscreen_html_overflow=="scroll")){g.fullscreen_html_overflow="auto"}if(g.fullscreen_overflow=="0px"){g.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");j.style.overflow="hidden";c=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){c.h-=1}if(tinymce.isIE6||document.compatMode=="BackCompat"){b="absolute;top:"+c.y}else{b="fixed;top:0"}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+b+";left:0;width:"+c.w+"px;height:"+c.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(d.settings,function(k,l){g[l]=k});g.id="mce_fullscreen";g.width=n.clientWidth;g.height=n.clientHeight-15;g.fullscreen_is_enabled=true;g.fullscreen_editor_id=d.id;g.theme_advanced_resizing=false;g.save_onsavecallback=function(){d.setContent(tinyMCE.get(g.id).getContent());d.execCommand("mceSave")};tinymce.each(d.getParam("fullscreen_settings"),function(m,l){g[l]=m});if(g.theme_advanced_toolbar_location==="external"){g.theme_advanced_toolbar_location="top"}f.fullscreenEditor=new tinymce.Editor("mce_fullscreen",g);f.fullscreenEditor.onInit.add(function(){f.fullscreenEditor.setContent(d.getContent());f.fullscreenEditor.focus()});f.fullscreenEditor.render();f.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");f.fullscreenElement.update();f.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var o=tinymce.DOM.getViewPort(),l=f.fullscreenEditor,k,m;k=l.dom.getSize(l.getContainer().getElementsByTagName("table")[0]);m=l.dom.getSize(l.getContainer().getElementsByTagName("iframe")[0]);l.theme.resizeTo(o.w-k.w+m.w,o.h-k.h+m.h)})}});d.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});d.onNodeChange.add(function(i,h){h.setActive("fullscreen",i.getParam("fullscreen_is_enabled"))})},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)})();
|
159
wp-includes/js/tinymce/plugins/fullscreen/editor_plugin_src.js
Normal file
@ -0,0 +1,159 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
tinymce.create('tinymce.plugins.FullScreenPlugin', {
|
||||
init : function(ed, url) {
|
||||
var t = this, s = {}, vp, posCss;
|
||||
|
||||
t.editor = ed;
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceFullScreen', function() {
|
||||
var win, de = DOM.doc.documentElement;
|
||||
|
||||
if (ed.getParam('fullscreen_is_enabled')) {
|
||||
if (ed.getParam('fullscreen_new_window'))
|
||||
closeFullscreen(); // Call to close in new window
|
||||
else {
|
||||
DOM.win.setTimeout(function() {
|
||||
tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
|
||||
tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent());
|
||||
tinyMCE.remove(ed);
|
||||
DOM.remove('mce_fullscreen_container');
|
||||
de.style.overflow = ed.getParam('fullscreen_html_overflow');
|
||||
DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow'));
|
||||
DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly'));
|
||||
tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
|
||||
}, 10);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ed.getParam('fullscreen_new_window')) {
|
||||
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 {
|
||||
tinyMCE.oldSettings = tinyMCE.settings; // Store old settings
|
||||
s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
|
||||
s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
|
||||
vp = DOM.getViewPort();
|
||||
s.fullscreen_scrollx = vp.x;
|
||||
s.fullscreen_scrolly = vp.y;
|
||||
|
||||
// Fixes an Opera bug where the scrollbars doesn't reappear
|
||||
if (tinymce.isOpera && s.fullscreen_overflow == 'visible')
|
||||
s.fullscreen_overflow = 'auto';
|
||||
|
||||
// Fixes an IE bug where horizontal scrollbars would appear
|
||||
if (tinymce.isIE && s.fullscreen_overflow == 'scroll')
|
||||
s.fullscreen_overflow = 'auto';
|
||||
|
||||
// Fixes an IE bug where the scrollbars doesn't reappear
|
||||
if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll'))
|
||||
s.fullscreen_html_overflow = 'auto';
|
||||
|
||||
if (s.fullscreen_overflow == '0px')
|
||||
s.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;
|
||||
});
|
||||
|
||||
if (s.theme_advanced_toolbar_location === 'external')
|
||||
s.theme_advanced_toolbar_location = 'top';
|
||||
|
||||
t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
|
||||
t.fullscreenEditor.onInit.add(function() {
|
||||
t.fullscreenEditor.setContent(ed.getContent());
|
||||
t.fullscreenEditor.focus();
|
||||
});
|
||||
|
||||
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'));
|
||||
});
|
||||
},
|
||||
|
||||
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);
|
||||
})();
|
110
wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm
Normal file
@ -0,0 +1,110 @@
|
||||
<!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?ver=358-20121205"></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() {
|
||||
window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
|
||||
window.opener.tinyMCE.get(oeID).execCommand('mceSave');
|
||||
window.close();
|
||||
};
|
||||
|
||||
function unloadHandler(e) {
|
||||
moveContent();
|
||||
}
|
||||
|
||||
function moveContent() {
|
||||
window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent());
|
||||
}
|
||||
|
||||
function closeFullscreen() {
|
||||
moveContent();
|
||||
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;
|
||||
|
||||
e.value = window.opener.tinyMCE.get(oeID).getContent();
|
||||
|
||||
vp = dom.getViewPort();
|
||||
settings.width = vp.w;
|
||||
settings.height = vp.h - 15;
|
||||
|
||||
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>
|
699
wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js
Normal file
@ -0,0 +1,699 @@
|
||||
/**
|
||||
* 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, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is;
|
||||
|
||||
tinymce.create('tinymce.plugins.InlinePopups', {
|
||||
init : function(ed, url) {
|
||||
// Replace window manager
|
||||
ed.onBeforeRenderUI.add(function() {
|
||||
ed.windowManager = new tinymce.InlineWindowManager(ed);
|
||||
DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css");
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'InlinePopups',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', {
|
||||
InlineWindowManager : function(ed) {
|
||||
var t = this;
|
||||
|
||||
t.parent(ed);
|
||||
t.zIndex = 300000;
|
||||
t.count = 0;
|
||||
t.windows = {};
|
||||
},
|
||||
|
||||
open : function(f, p) {
|
||||
var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u, parentWindow;
|
||||
|
||||
f = f || {};
|
||||
p = p || {};
|
||||
|
||||
// Run native windows
|
||||
if (!f.inline)
|
||||
return t.parent(f, p);
|
||||
|
||||
parentWindow = t._frontWindow();
|
||||
if (parentWindow && DOM.get(parentWindow.id + '_ifr')) {
|
||||
parentWindow.focussedElement = DOM.get(parentWindow.id + '_ifr').contentWindow.document.activeElement;
|
||||
}
|
||||
|
||||
// Only store selection if the type is a normal window
|
||||
if (!f.type)
|
||||
t.bookmark = ed.selection.getBookmark(1);
|
||||
|
||||
id = DOM.uniqueId();
|
||||
vp = DOM.getViewPort();
|
||||
f.width = parseInt(f.width || 320);
|
||||
f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0);
|
||||
f.min_width = parseInt(f.min_width || 150);
|
||||
f.min_height = parseInt(f.min_height || 100);
|
||||
f.max_width = parseInt(f.max_width || 2000);
|
||||
f.max_height = parseInt(f.max_height || 2000);
|
||||
f.left = f.left || Math.round(Math.max(vp.x, vp.x + (vp.w / 2.0) - (f.width / 2.0)));
|
||||
f.top = f.top || Math.round(Math.max(vp.y, vp.y + (vp.h / 2.0) - (f.height / 2.0)));
|
||||
f.movable = f.resizable = true;
|
||||
p.mce_width = f.width;
|
||||
p.mce_height = f.height;
|
||||
p.mce_inline = true;
|
||||
p.mce_window_id = id;
|
||||
p.mce_auto_focus = f.auto_focus;
|
||||
|
||||
// Transpose
|
||||
// po = DOM.getPos(ed.getContainer());
|
||||
// f.left -= po.x;
|
||||
// f.top -= po.y;
|
||||
|
||||
t.features = f;
|
||||
t.params = p;
|
||||
t.onOpen.dispatch(t, f, p);
|
||||
|
||||
if (f.type) {
|
||||
opt += ' mceModal';
|
||||
|
||||
if (f.type)
|
||||
opt += ' mce' + f.type.substring(0, 1).toUpperCase() + f.type.substring(1);
|
||||
|
||||
f.resizable = false;
|
||||
}
|
||||
|
||||
if (f.statusbar)
|
||||
opt += ' mceStatusbar';
|
||||
|
||||
if (f.resizable)
|
||||
opt += ' mceResizable';
|
||||
|
||||
if (f.minimizable)
|
||||
opt += ' mceMinimizable';
|
||||
|
||||
if (f.maximizable)
|
||||
opt += ' mceMaximizable';
|
||||
|
||||
if (f.movable)
|
||||
opt += ' mceMovable';
|
||||
|
||||
// Create DOM objects
|
||||
t._addAll(DOM.doc.body,
|
||||
['div', {id : id, role : 'dialog', 'aria-labelledby': f.type ? id + '_content' : id + '_title', 'class' : (ed.settings.inlinepopups_skin || 'clearlooks2') + (tinymce.isIE && window.getSelection ? ' ie9' : ''), style : 'width:100px;height:100px'},
|
||||
['div', {id : id + '_wrapper', 'class' : 'mceWrapper' + opt},
|
||||
['div', {id : id + '_top', 'class' : 'mceTop'},
|
||||
['div', {'class' : 'mceLeft'}],
|
||||
['div', {'class' : 'mceCenter'}],
|
||||
['div', {'class' : 'mceRight'}],
|
||||
['span', {id : id + '_title'}, f.title || '']
|
||||
],
|
||||
|
||||
['div', {id : id + '_middle', 'class' : 'mceMiddle'},
|
||||
['div', {id : id + '_left', 'class' : 'mceLeft', tabindex : '0'}],
|
||||
['span', {id : id + '_content'}],
|
||||
['div', {id : id + '_right', 'class' : 'mceRight', tabindex : '0'}]
|
||||
],
|
||||
|
||||
['div', {id : id + '_bottom', 'class' : 'mceBottom'},
|
||||
['div', {'class' : 'mceLeft'}],
|
||||
['div', {'class' : 'mceCenter'}],
|
||||
['div', {'class' : 'mceRight'}],
|
||||
['span', {id : id + '_status'}, 'Content']
|
||||
],
|
||||
|
||||
['a', {'class' : 'mceMove', tabindex : '-1', href : 'javascript:;'}],
|
||||
['a', {'class' : 'mceMin', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
|
||||
['a', {'class' : 'mceMax', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
|
||||
['a', {'class' : 'mceMed', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
|
||||
['a', {'class' : 'mceClose', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
|
||||
['a', {id : id + '_resize_n', 'class' : 'mceResize mceResizeN', tabindex : '-1', href : 'javascript:;'}],
|
||||
['a', {id : id + '_resize_s', 'class' : 'mceResize mceResizeS', tabindex : '-1', href : 'javascript:;'}],
|
||||
['a', {id : id + '_resize_w', 'class' : 'mceResize mceResizeW', tabindex : '-1', href : 'javascript:;'}],
|
||||
['a', {id : id + '_resize_e', 'class' : 'mceResize mceResizeE', tabindex : '-1', href : 'javascript:;'}],
|
||||
['a', {id : id + '_resize_nw', 'class' : 'mceResize mceResizeNW', tabindex : '-1', href : 'javascript:;'}],
|
||||
['a', {id : id + '_resize_ne', 'class' : 'mceResize mceResizeNE', tabindex : '-1', href : 'javascript:;'}],
|
||||
['a', {id : id + '_resize_sw', 'class' : 'mceResize mceResizeSW', tabindex : '-1', href : 'javascript:;'}],
|
||||
['a', {id : id + '_resize_se', 'class' : 'mceResize mceResizeSE', tabindex : '-1', href : 'javascript:;'}]
|
||||
]
|
||||
]
|
||||
);
|
||||
|
||||
DOM.setStyles(id, {top : -10000, left : -10000});
|
||||
|
||||
// Fix gecko rendering bug, where the editors iframe messed with window contents
|
||||
if (tinymce.isGecko)
|
||||
DOM.setStyle(id, 'overflow', 'auto');
|
||||
|
||||
// Measure borders
|
||||
if (!f.type) {
|
||||
dw += DOM.get(id + '_left').clientWidth;
|
||||
dw += DOM.get(id + '_right').clientWidth;
|
||||
dh += DOM.get(id + '_top').clientHeight;
|
||||
dh += DOM.get(id + '_bottom').clientHeight;
|
||||
}
|
||||
|
||||
// Resize window
|
||||
DOM.setStyles(id, {top : f.top, left : f.left, width : f.width + dw, height : f.height + dh});
|
||||
|
||||
u = f.url || f.file;
|
||||
if (u) {
|
||||
if (tinymce.relaxedDomain)
|
||||
u += (u.indexOf('?') == -1 ? '?' : '&') + 'mce_rdomain=' + tinymce.relaxedDomain;
|
||||
|
||||
u = tinymce._addVer(u);
|
||||
}
|
||||
|
||||
if (!f.type) {
|
||||
DOM.add(id + '_content', 'iframe', {id : id + '_ifr', src : 'javascript:""', frameBorder : 0, style : 'border:0;width:10px;height:10px'});
|
||||
DOM.setStyles(id + '_ifr', {width : f.width, height : f.height});
|
||||
DOM.setAttrib(id + '_ifr', 'src', u);
|
||||
} else {
|
||||
DOM.add(id + '_wrapper', 'a', {id : id + '_ok', 'class' : 'mceButton mceOk', href : 'javascript:;', onmousedown : 'return false;'}, 'Ok');
|
||||
|
||||
if (f.type == 'confirm')
|
||||
DOM.add(id + '_wrapper', 'a', {'class' : 'mceButton mceCancel', href : 'javascript:;', onmousedown : 'return false;'}, 'Cancel');
|
||||
|
||||
DOM.add(id + '_middle', 'div', {'class' : 'mceIcon'});
|
||||
DOM.setHTML(id + '_content', f.content.replace('\n', '<br />'));
|
||||
|
||||
Event.add(id, 'keyup', function(evt) {
|
||||
var VK_ESCAPE = 27;
|
||||
if (evt.keyCode === VK_ESCAPE) {
|
||||
f.button_func(false);
|
||||
return Event.cancel(evt);
|
||||
}
|
||||
});
|
||||
|
||||
Event.add(id, 'keydown', function(evt) {
|
||||
var cancelButton, VK_TAB = 9;
|
||||
if (evt.keyCode === VK_TAB) {
|
||||
cancelButton = DOM.select('a.mceCancel', id + '_wrapper')[0];
|
||||
if (cancelButton && cancelButton !== evt.target) {
|
||||
cancelButton.focus();
|
||||
} else {
|
||||
DOM.get(id + '_ok').focus();
|
||||
}
|
||||
return Event.cancel(evt);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Register events
|
||||
mdf = Event.add(id, 'mousedown', function(e) {
|
||||
var n = e.target, w, vp;
|
||||
|
||||
w = t.windows[id];
|
||||
t.focus(id);
|
||||
|
||||
if (n.nodeName == 'A' || n.nodeName == 'a') {
|
||||
if (n.className == 'mceClose') {
|
||||
t.close(null, id);
|
||||
return Event.cancel(e);
|
||||
} else if (n.className == 'mceMax') {
|
||||
w.oldPos = w.element.getXY();
|
||||
w.oldSize = w.element.getSize();
|
||||
|
||||
vp = DOM.getViewPort();
|
||||
|
||||
// Reduce viewport size to avoid scrollbars
|
||||
vp.w -= 2;
|
||||
vp.h -= 2;
|
||||
|
||||
w.element.moveTo(vp.x, vp.y);
|
||||
w.element.resizeTo(vp.w, vp.h);
|
||||
DOM.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight});
|
||||
DOM.addClass(id + '_wrapper', 'mceMaximized');
|
||||
} else if (n.className == 'mceMed') {
|
||||
// Reset to old size
|
||||
w.element.moveTo(w.oldPos.x, w.oldPos.y);
|
||||
w.element.resizeTo(w.oldSize.w, w.oldSize.h);
|
||||
w.iframeElement.resizeTo(w.oldSize.w - w.deltaWidth, w.oldSize.h - w.deltaHeight);
|
||||
|
||||
DOM.removeClass(id + '_wrapper', 'mceMaximized');
|
||||
} else if (n.className == 'mceMove')
|
||||
return t._startDrag(id, e, n.className);
|
||||
else if (DOM.hasClass(n, 'mceResize'))
|
||||
return t._startDrag(id, e, n.className.substring(13));
|
||||
}
|
||||
});
|
||||
|
||||
clf = Event.add(id, 'click', function(e) {
|
||||
var n = e.target;
|
||||
|
||||
t.focus(id);
|
||||
|
||||
if (n.nodeName == 'A' || n.nodeName == 'a') {
|
||||
switch (n.className) {
|
||||
case 'mceClose':
|
||||
t.close(null, id);
|
||||
return Event.cancel(e);
|
||||
|
||||
case 'mceButton mceOk':
|
||||
case 'mceButton mceCancel':
|
||||
f.button_func(n.className == 'mceButton mceOk');
|
||||
return Event.cancel(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Make sure the tab order loops within the dialog.
|
||||
Event.add([id + '_left', id + '_right'], 'focus', function(evt) {
|
||||
var iframe = DOM.get(id + '_ifr');
|
||||
if (iframe) {
|
||||
var body = iframe.contentWindow.document.body;
|
||||
var focusable = DOM.select(':input:enabled,*[tabindex=0]', body);
|
||||
if (evt.target.id === (id + '_left')) {
|
||||
focusable[focusable.length - 1].focus();
|
||||
} else {
|
||||
focusable[0].focus();
|
||||
}
|
||||
} else {
|
||||
DOM.get(id + '_ok').focus();
|
||||
}
|
||||
});
|
||||
|
||||
// Add window
|
||||
w = t.windows[id] = {
|
||||
id : id,
|
||||
mousedown_func : mdf,
|
||||
click_func : clf,
|
||||
element : new Element(id, {blocker : 1, container : ed.getContainer()}),
|
||||
iframeElement : new Element(id + '_ifr'),
|
||||
features : f,
|
||||
deltaWidth : dw,
|
||||
deltaHeight : dh
|
||||
};
|
||||
|
||||
w.iframeElement.on('focus', function() {
|
||||
t.focus(id);
|
||||
});
|
||||
|
||||
// Setup blocker
|
||||
if (t.count == 0 && t.editor.getParam('dialog_type', 'modal') == 'modal') {
|
||||
DOM.add(DOM.doc.body, 'div', {
|
||||
id : 'mceModalBlocker',
|
||||
'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker',
|
||||
style : {zIndex : t.zIndex - 1}
|
||||
});
|
||||
|
||||
DOM.show('mceModalBlocker'); // Reduces flicker in IE
|
||||
DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'true');
|
||||
} else
|
||||
DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1);
|
||||
|
||||
if (tinymce.isIE6 || /Firefox\/2\./.test(navigator.userAgent) || (tinymce.isIE && !DOM.boxModel))
|
||||
DOM.setStyles('mceModalBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});
|
||||
|
||||
DOM.setAttrib(id, 'aria-hidden', 'false');
|
||||
t.focus(id);
|
||||
t._fixIELayout(id, 1);
|
||||
|
||||
// Focus ok button
|
||||
if (DOM.get(id + '_ok'))
|
||||
DOM.get(id + '_ok').focus();
|
||||
t.count++;
|
||||
|
||||
return w;
|
||||
},
|
||||
|
||||
focus : function(id) {
|
||||
var t = this, w;
|
||||
|
||||
if (w = t.windows[id]) {
|
||||
w.zIndex = this.zIndex++;
|
||||
w.element.setStyle('zIndex', w.zIndex);
|
||||
w.element.update();
|
||||
|
||||
id = id + '_wrapper';
|
||||
DOM.removeClass(t.lastId, 'mceFocus');
|
||||
DOM.addClass(id, 'mceFocus');
|
||||
t.lastId = id;
|
||||
|
||||
if (w.focussedElement) {
|
||||
w.focussedElement.focus();
|
||||
} else if (DOM.get(id + '_ok')) {
|
||||
DOM.get(w.id + '_ok').focus();
|
||||
} else if (DOM.get(w.id + '_ifr')) {
|
||||
DOM.get(w.id + '_ifr').focus();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_addAll : function(te, ne) {
|
||||
var i, n, t = this, dom = tinymce.DOM;
|
||||
|
||||
if (is(ne, 'string'))
|
||||
te.appendChild(dom.doc.createTextNode(ne));
|
||||
else if (ne.length) {
|
||||
te = te.appendChild(dom.create(ne[0], ne[1]));
|
||||
|
||||
for (i=2; i<ne.length; i++)
|
||||
t._addAll(te, ne[i]);
|
||||
}
|
||||
},
|
||||
|
||||
_startDrag : function(id, se, ac) {
|
||||
var t = this, mu, mm, d = DOM.doc, eb, w = t.windows[id], we = w.element, sp = we.getXY(), p, sz, ph, cp, vp, sx, sy, sex, sey, dx, dy, dw, dh;
|
||||
|
||||
// Get positons and sizes
|
||||
// cp = DOM.getPos(t.editor.getContainer());
|
||||
cp = {x : 0, y : 0};
|
||||
vp = DOM.getViewPort();
|
||||
|
||||
// Reduce viewport size to avoid scrollbars while dragging
|
||||
vp.w -= 2;
|
||||
vp.h -= 2;
|
||||
|
||||
sex = se.screenX;
|
||||
sey = se.screenY;
|
||||
dx = dy = dw = dh = 0;
|
||||
|
||||
// Handle mouse up
|
||||
mu = Event.add(d, 'mouseup', function(e) {
|
||||
Event.remove(d, 'mouseup', mu);
|
||||
Event.remove(d, 'mousemove', mm);
|
||||
|
||||
if (eb)
|
||||
eb.remove();
|
||||
|
||||
we.moveBy(dx, dy);
|
||||
we.resizeBy(dw, dh);
|
||||
sz = we.getSize();
|
||||
DOM.setStyles(id + '_ifr', {width : sz.w - w.deltaWidth, height : sz.h - w.deltaHeight});
|
||||
t._fixIELayout(id, 1);
|
||||
|
||||
return Event.cancel(e);
|
||||
});
|
||||
|
||||
if (ac != 'Move')
|
||||
startMove();
|
||||
|
||||
function startMove() {
|
||||
if (eb)
|
||||
return;
|
||||
|
||||
t._fixIELayout(id, 0);
|
||||
|
||||
// Setup event blocker
|
||||
DOM.add(d.body, 'div', {
|
||||
id : 'mceEventBlocker',
|
||||
'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'),
|
||||
style : {zIndex : t.zIndex + 1}
|
||||
});
|
||||
|
||||
if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel))
|
||||
DOM.setStyles('mceEventBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});
|
||||
|
||||
eb = new Element('mceEventBlocker');
|
||||
eb.update();
|
||||
|
||||
// Setup placeholder
|
||||
p = we.getXY();
|
||||
sz = we.getSize();
|
||||
sx = cp.x + p.x - vp.x;
|
||||
sy = cp.y + p.y - vp.y;
|
||||
DOM.add(eb.get(), 'div', {id : 'mcePlaceHolder', 'class' : 'mcePlaceHolder', style : {left : sx, top : sy, width : sz.w, height : sz.h}});
|
||||
ph = new Element('mcePlaceHolder');
|
||||
};
|
||||
|
||||
// Handle mouse move/drag
|
||||
mm = Event.add(d, 'mousemove', function(e) {
|
||||
var x, y, v;
|
||||
|
||||
startMove();
|
||||
|
||||
x = e.screenX - sex;
|
||||
y = e.screenY - sey;
|
||||
|
||||
switch (ac) {
|
||||
case 'ResizeW':
|
||||
dx = x;
|
||||
dw = 0 - x;
|
||||
break;
|
||||
|
||||
case 'ResizeE':
|
||||
dw = x;
|
||||
break;
|
||||
|
||||
case 'ResizeN':
|
||||
case 'ResizeNW':
|
||||
case 'ResizeNE':
|
||||
if (ac == "ResizeNW") {
|
||||
dx = x;
|
||||
dw = 0 - x;
|
||||
} else if (ac == "ResizeNE")
|
||||
dw = x;
|
||||
|
||||
dy = y;
|
||||
dh = 0 - y;
|
||||
break;
|
||||
|
||||
case 'ResizeS':
|
||||
case 'ResizeSW':
|
||||
case 'ResizeSE':
|
||||
if (ac == "ResizeSW") {
|
||||
dx = x;
|
||||
dw = 0 - x;
|
||||
} else if (ac == "ResizeSE")
|
||||
dw = x;
|
||||
|
||||
dh = y;
|
||||
break;
|
||||
|
||||
case 'mceMove':
|
||||
dx = x;
|
||||
dy = y;
|
||||
break;
|
||||
}
|
||||
|
||||
// Boundary check
|
||||
if (dw < (v = w.features.min_width - sz.w)) {
|
||||
if (dx !== 0)
|
||||
dx += dw - v;
|
||||
|
||||
dw = v;
|
||||
}
|
||||
|
||||
if (dh < (v = w.features.min_height - sz.h)) {
|
||||
if (dy !== 0)
|
||||
dy += dh - v;
|
||||
|
||||
dh = v;
|
||||
}
|
||||
|
||||
dw = Math.min(dw, w.features.max_width - sz.w);
|
||||
dh = Math.min(dh, w.features.max_height - sz.h);
|
||||
dx = Math.max(dx, vp.x - (sx + vp.x));
|
||||
dy = Math.max(dy, vp.y - (sy + vp.y));
|
||||
dx = Math.min(dx, (vp.w + vp.x) - (sx + sz.w + vp.x));
|
||||
dy = Math.min(dy, (vp.h + vp.y) - (sy + sz.h + vp.y));
|
||||
|
||||
// Move if needed
|
||||
if (dx + dy !== 0) {
|
||||
if (sx + dx < 0)
|
||||
dx = 0;
|
||||
|
||||
if (sy + dy < 0)
|
||||
dy = 0;
|
||||
|
||||
ph.moveTo(sx + dx, sy + dy);
|
||||
}
|
||||
|
||||
// Resize if needed
|
||||
if (dw + dh !== 0)
|
||||
ph.resizeTo(sz.w + dw, sz.h + dh);
|
||||
|
||||
return Event.cancel(e);
|
||||
});
|
||||
|
||||
return Event.cancel(se);
|
||||
},
|
||||
|
||||
resizeBy : function(dw, dh, id) {
|
||||
var w = this.windows[id];
|
||||
|
||||
if (w) {
|
||||
w.element.resizeBy(dw, dh);
|
||||
w.iframeElement.resizeBy(dw, dh);
|
||||
}
|
||||
},
|
||||
|
||||
close : function(win, id) {
|
||||
var t = this, w, d = DOM.doc, fw, id;
|
||||
|
||||
id = t._findId(id || win);
|
||||
|
||||
// Probably not inline
|
||||
if (!t.windows[id]) {
|
||||
t.parent(win);
|
||||
return;
|
||||
}
|
||||
|
||||
t.count--;
|
||||
|
||||
if (t.count == 0) {
|
||||
DOM.remove('mceModalBlocker');
|
||||
DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'false');
|
||||
t.editor.focus();
|
||||
}
|
||||
|
||||
if (w = t.windows[id]) {
|
||||
t.onClose.dispatch(t);
|
||||
Event.remove(d, 'mousedown', w.mousedownFunc);
|
||||
Event.remove(d, 'click', w.clickFunc);
|
||||
Event.clear(id);
|
||||
Event.clear(id + '_ifr');
|
||||
|
||||
DOM.setAttrib(id + '_ifr', 'src', 'javascript:""'); // Prevent leak
|
||||
w.element.remove();
|
||||
delete t.windows[id];
|
||||
|
||||
fw = t._frontWindow();
|
||||
|
||||
if (fw)
|
||||
t.focus(fw.id);
|
||||
}
|
||||
},
|
||||
|
||||
// Find front most window
|
||||
_frontWindow : function() {
|
||||
var fw, ix = 0;
|
||||
// Find front most window and focus that
|
||||
each (this.windows, function(w) {
|
||||
if (w.zIndex > ix) {
|
||||
fw = w;
|
||||
ix = w.zIndex;
|
||||
}
|
||||
});
|
||||
return fw;
|
||||
},
|
||||
|
||||
setTitle : function(w, ti) {
|
||||
var e;
|
||||
|
||||
w = this._findId(w);
|
||||
|
||||
if (e = DOM.get(w + '_title'))
|
||||
e.innerHTML = DOM.encode(ti);
|
||||
},
|
||||
|
||||
alert : function(txt, cb, s) {
|
||||
var t = this, w;
|
||||
|
||||
w = t.open({
|
||||
title : t,
|
||||
type : 'alert',
|
||||
button_func : function(s) {
|
||||
if (cb)
|
||||
cb.call(s || t, s);
|
||||
|
||||
t.close(null, w.id);
|
||||
},
|
||||
content : DOM.encode(t.editor.getLang(txt, txt)),
|
||||
inline : 1,
|
||||
width : 400,
|
||||
height : 130
|
||||
});
|
||||
},
|
||||
|
||||
confirm : function(txt, cb, s) {
|
||||
var t = this, w;
|
||||
|
||||
w = t.open({
|
||||
title : t,
|
||||
type : 'confirm',
|
||||
button_func : function(s) {
|
||||
if (cb)
|
||||
cb.call(s || t, s);
|
||||
|
||||
t.close(null, w.id);
|
||||
},
|
||||
content : DOM.encode(t.editor.getLang(txt, txt)),
|
||||
inline : 1,
|
||||
width : 400,
|
||||
height : 130
|
||||
});
|
||||
},
|
||||
|
||||
// Internal functions
|
||||
|
||||
_findId : function(w) {
|
||||
var t = this;
|
||||
|
||||
if (typeof(w) == 'string')
|
||||
return w;
|
||||
|
||||
each(t.windows, function(wo) {
|
||||
var ifr = DOM.get(wo.id + '_ifr');
|
||||
|
||||
if (ifr && w == ifr.contentWindow) {
|
||||
w = wo.id;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
return w;
|
||||
},
|
||||
|
||||
_fixIELayout : function(id, s) {
|
||||
var w, img;
|
||||
|
||||
if (!tinymce.isIE6)
|
||||
return;
|
||||
|
||||
// Fixes the bug where hover flickers and does odd things in IE6
|
||||
each(['n','s','w','e','nw','ne','sw','se'], function(v) {
|
||||
var e = DOM.get(id + '_resize_' + v);
|
||||
|
||||
DOM.setStyles(e, {
|
||||
width : s ? e.clientWidth : '',
|
||||
height : s ? e.clientHeight : '',
|
||||
cursor : DOM.getStyle(e, 'cursor', 1)
|
||||
});
|
||||
|
||||
DOM.setStyle(id + "_bottom", 'bottom', '-1px');
|
||||
|
||||
e = 0;
|
||||
});
|
||||
|
||||
// Fixes graphics glitch
|
||||
if (w = this.windows[id]) {
|
||||
// Fixes rendering bug after resize
|
||||
w.element.hide();
|
||||
w.element.show();
|
||||
|
||||
// Forced a repaint of the window
|
||||
//DOM.get(id).style.filter = '';
|
||||
|
||||
// IE has a bug where images used in CSS won't get loaded
|
||||
// sometimes when the cache in the browser is disabled
|
||||
// This fix tries to solve it by loading the images using the image object
|
||||
each(DOM.select('div,a', id), function(e, i) {
|
||||
if (e.currentStyle.backgroundImage != 'none') {
|
||||
img = new Image();
|
||||
img.src = e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/, '$1');
|
||||
}
|
||||
});
|
||||
|
||||
DOM.get(id).style.filter = '';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('inlinepopups', tinymce.plugins.InlinePopups);
|
||||
})();
|
||||
|
After Width: | Height: | Size: 810 B |
After Width: | Height: | Size: 272 B |
After Width: | Height: | Size: 989 B |
After Width: | Height: | Size: 907 B |
After Width: | Height: | Size: 909 B |
After Width: | Height: | Size: 51 B |
After Width: | Height: | Size: 769 B |
After Width: | Height: | Size: 84 B |
@ -0,0 +1,126 @@
|
||||
/* Clearlooks 2 */
|
||||
|
||||
/* Reset */
|
||||
.clearlooks2, .clearlooks2 div, .clearlooks2 span, .clearlooks2 a {vertical-align:baseline; text-align:left; position:absolute; border:0; padding:0; margin:0; background:transparent; font-family:Arial,Verdana; font-size:11px; color:#000; text-decoration:none; font-weight:normal; width:auto; height:auto; overflow:hidden; display:block}
|
||||
|
||||
/* General */
|
||||
.clearlooks2 {position:absolute; direction:ltr}
|
||||
.clearlooks2 .mceWrapper {position:static}
|
||||
.mceEventBlocker {position:fixed; left:0; top:0; background:url(img/horizontal.gif) no-repeat 0 -75px; width:100%; height:100%}
|
||||
.clearlooks2 .mcePlaceHolder {border:1px solid #000; background:#888; top:0; left:0; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50)}
|
||||
.clearlooks2_modalBlocker {position:fixed; left:0; top:0; width:100%; height:100%; background:#FFF; opacity:0.6; -ms-filter:'alpha(opacity=60)'; filter:alpha(opacity=60); display:none}
|
||||
|
||||
/* Top */
|
||||
.clearlooks2 .mceTop,
|
||||
.clearlooks2 .mceTop div {
|
||||
top:0;
|
||||
width:100%;
|
||||
height:23px
|
||||
}
|
||||
.clearlooks2 .mceTop .mceLeft {
|
||||
width:55%;
|
||||
background-image: none;
|
||||
border-style: solid none none solid;
|
||||
border-width: 1px;
|
||||
}
|
||||
.clearlooks2 .mceTop .mceCenter {
|
||||
}
|
||||
.clearlooks2 .mceTop .mceRight {
|
||||
right:0;
|
||||
width:55%;
|
||||
height:23px;
|
||||
background-image: none;
|
||||
border-style: solid solid none none;
|
||||
border-width: 1px;
|
||||
}
|
||||
.clearlooks2 .mceTop span {
|
||||
width:100%;
|
||||
font: 12px/20px bold "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif;
|
||||
text-align:center;
|
||||
vertical-align:middle;
|
||||
line-height:23px;
|
||||
font-weight:bold;
|
||||
}
|
||||
.clearlooks2 .mceFocus .mceTop .mceLeft {
|
||||
background-image: none;
|
||||
border-style: solid none none solid;
|
||||
border-width: 1px;
|
||||
}
|
||||
.clearlooks2 .mceFocus .mceTop .mceCenter {
|
||||
}
|
||||
.clearlooks2 .mceFocus .mceTop .mceRight {
|
||||
background-image: none;
|
||||
border-style: solid solid none none;
|
||||
border-width: 1px;
|
||||
}
|
||||
.clearlooks2 .mceFocus .mceTop span {
|
||||
color:#FFF
|
||||
}
|
||||
|
||||
/* Middle */
|
||||
.clearlooks2 .mceMiddle, .clearlooks2 .mceMiddle div {top:0}
|
||||
.clearlooks2 .mceMiddle {width:100%; height:100%; clip:rect(23px auto auto auto)}
|
||||
.clearlooks2 .mceMiddle .mceLeft {left:0; width:5px; height:100%; background:#E4F2FD;border-left:1px solid #c6d9e9}
|
||||
.clearlooks2 .mceMiddle span {top:23px; left:5px; width:100%; height:100%; background:#FFF}
|
||||
.clearlooks2 .mceMiddle .mceRight {right:0; width:5px; height:100%; background:#E4F2FD;border-right:1px solid #c6d9e9}
|
||||
|
||||
/* Bottom */
|
||||
.clearlooks2 .mceBottom, .clearlooks2 .mceBottom div {height:6px}
|
||||
.clearlooks2 .mceBottom {left:0; bottom:0; width:100%;background:#E4F2FD;border-bottom:1px solid #c6d9e9}
|
||||
.clearlooks2 .mceBottom div {top:0}
|
||||
.clearlooks2 .mceBottom .mceLeft {left:0; width:5px; background:#E4F2FD ;border-left:1px solid #c6d9e9}
|
||||
.clearlooks2 .mceBottom .mceCenter {left:5px; width:100%}
|
||||
.clearlooks2 .mceBottom .mceRight {right:0; width:6px; background:#E4F2FD url(img/drag.gif) no-repeat;border-right:1px solid #c6d9e9}
|
||||
.clearlooks2 .mceBottom span {display:none}
|
||||
.clearlooks2 .mceStatusbar .mceBottom, .clearlooks2 .mceStatusbar .mceBottom div {height:23px}
|
||||
.clearlooks2 .mceStatusbar .mceBottom .mceLeft {background:url(img/corners.gif) -29px 0}
|
||||
.clearlooks2 .mceStatusbar .mceBottom .mceCenter {background:url(img/horizontal.gif) 0 -52px}
|
||||
.clearlooks2 .mceStatusbar .mceBottom .mceRight {background:url(img/corners.gif) -24px 0}
|
||||
.clearlooks2 .mceStatusbar .mceBottom span {display:block; left:7px; font-family:Arial, Verdana; font-size:11px; line-height:23px}
|
||||
|
||||
/* Actions */
|
||||
.clearlooks2 a {width:29px; height:16px; top:3px;}
|
||||
.clearlooks2 .mceClose {right:6px; background:url(img/buttons.gif) -87px 0}
|
||||
.clearlooks2 .mceMin {display:none; right:68px; background:url(img/buttons.gif) 0 0}
|
||||
.clearlooks2 .mceMed {display:none; right:37px; background:url(img/buttons.gif) -29px 0}
|
||||
.clearlooks2 .mceMax {display:none; right:37px; background:url(img/buttons.gif) -58px 0}
|
||||
.clearlooks2 .mceMove {display:none;width:100%;cursor:move;background:url(img/corners.gif) no-repeat -100px -100px}
|
||||
.clearlooks2 .mceMovable .mceMove {display:block}
|
||||
.clearlooks2 .mceFocus .mceClose {right:6px; background:url(img/buttons.gif) -87px -16px}
|
||||
.clearlooks2 .mceFocus .mceMin {right:68px; background:url(img/buttons.gif) 0 -16px}
|
||||
.clearlooks2 .mceFocus .mceMed {right:37px; background:url(img/buttons.gif) -29px -16px}
|
||||
.clearlooks2 .mceFocus .mceMax {right:37px; background:url(img/buttons.gif) -58px -16px}
|
||||
.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px}
|
||||
.clearlooks2 .mceFocus .mceClose:hover {right:6px; background:url(img/buttons.gif) -87px -32px}
|
||||
.clearlooks2 .mceFocus .mceMin:hover {right:68px; background:url(img/buttons.gif) 0 -32px}
|
||||
.clearlooks2 .mceFocus .mceMed:hover {right:37px; background:url(img/buttons.gif) -29px -32px}
|
||||
.clearlooks2 .mceFocus .mceMax:hover {right:37px; background:url(img/buttons.gif) -58px -32px}
|
||||
|
||||
/* Resize */
|
||||
.clearlooks2 .mceResize {top:auto; left:auto; display:none; width:5px; height:5px; background:url(img/horizontal.gif) no-repeat 0 -75px}
|
||||
.clearlooks2 .mceResizable .mceResize {display:block}
|
||||
.clearlooks2 .mceResizable .mceMin, .clearlooks2 .mceMax {display:none}
|
||||
.clearlooks2 .mceMinimizable .mceMin {display:block}
|
||||
.clearlooks2 .mceMaximizable .mceMax {display:block}
|
||||
.clearlooks2 .mceMaximized .mceMed {display:block}
|
||||
.clearlooks2 .mceMaximized .mceMax {display:none}
|
||||
.clearlooks2 a.mceResizeN {top:0; left:0; width:100%; cursor:n-resize}
|
||||
.clearlooks2 a.mceResizeNW {top:0; left:0; cursor:nw-resize}
|
||||
.clearlooks2 a.mceResizeNE {top:0; right:0; cursor:ne-resize}
|
||||
.clearlooks2 a.mceResizeW {top:0; left:0; height:100%; cursor:w-resize;}
|
||||
.clearlooks2 a.mceResizeE {top:0; right:0; height:100%; cursor:e-resize}
|
||||
.clearlooks2 a.mceResizeS {bottom:0; left:0; width:100%; cursor:s-resize}
|
||||
.clearlooks2 a.mceResizeSW {bottom:0; left:0; cursor:sw-resize}
|
||||
.clearlooks2 a.mceResizeSE {bottom:0; right:0; cursor:se-resize}
|
||||
|
||||
/* Alert/Confirm */
|
||||
.clearlooks2 .mceButton {font-weight:bold; bottom:10px; width:80px; height:30px; background:url(img/button.gif); line-height:30px; vertical-align:middle; text-align:center; outline:0}
|
||||
.clearlooks2 .mceMiddle .mceIcon {left:15px; top:35px; width:32px; height:32px}
|
||||
.clearlooks2 .mceAlert .mceMiddle span, .clearlooks2 .mceConfirm .mceMiddle span {background:transparent;left:60px; top:35px; width:320px; height:50px; font-weight:bold; overflow:auto; white-space:normal}
|
||||
.clearlooks2 a:hover {font-weight:bold;}
|
||||
.clearlooks2 .mceAlert .mceMiddle, .clearlooks2 .mceConfirm .mceMiddle {background:#F9F9F9}
|
||||
.clearlooks2 .mceAlert .mceOk {left:50%; top:auto; margin-left: -40px}
|
||||
.clearlooks2 .mceAlert .mceIcon {background:url(img/alert.gif)}
|
||||
.clearlooks2 .mceConfirm .mceOk {left:50%; top:auto; margin-left: -90px}
|
||||
.clearlooks2 .mceConfirm .mceCancel {left:50%; top:auto}
|
||||
.clearlooks2 .mceConfirm .mceIcon {background:url(img/confirm.gif)}
|
387
wp-includes/js/tinymce/plugins/inlinepopups/template.htm
Normal file
@ -0,0 +1,387 @@
|
||||
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Template for dialogs</title>
|
||||
<link rel="stylesheet" type="text/css" href="skins/clearlooks2/window.css?ver=358-20121205" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="mceEditor">
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:10px;">
|
||||
<div class="mceWrapper">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Blured</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:420px;">
|
||||
<div class="mceWrapper mceMovable mceFocus">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Focused</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:10px; top:120px;">
|
||||
<div class="mceWrapper mceMovable mceFocus mceStatusbar">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:420px; top:120px;">
|
||||
<div class="mceWrapper mceMovable mceFocus mceStatusbar mceResizable">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar, Resizable</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:10px; top:230px;">
|
||||
<div class="mceWrapper mceMovable mceFocus mceResizable mceMaximizable">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Resizable, Maximizable</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:420px; top:230px;">
|
||||
<div class="mceWrapper mceMovable mceStatusbar mceResizable mceMaximizable">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Blurred, Maximizable, Statusbar, Resizable</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:10px; top:340px;">
|
||||
<div class="mceWrapper mceMovable mceFocus mceResizable mceMaximized mceMinimizable mceMaximizable">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Maximized, Maximizable, Minimizable</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:100px; left:420px; top:340px;">
|
||||
<div class="mceWrapper mceMovable mceStatusbar mceResizable mceMaximized mceMinimizable mceMaximizable">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Blured</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>Content</span>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Statusbar text.</span>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceMin" href="#"></a>
|
||||
<a class="mceMax" href="#"></a>
|
||||
<a class="mceMed" href="#"></a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
<a class="mceResize mceResizeN" href="#"></a>
|
||||
<a class="mceResize mceResizeS" href="#"></a>
|
||||
<a class="mceResize mceResizeW" href="#"></a>
|
||||
<a class="mceResize mceResizeE" href="#"></a>
|
||||
<a class="mceResize mceResizeNW" href="#"></a>
|
||||
<a class="mceResize mceResizeNE" href="#"></a>
|
||||
<a class="mceResize mceResizeSW" href="#"></a>
|
||||
<a class="mceResize mceResizeSE" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:130px; left:10px; top:450px;">
|
||||
<div class="mceWrapper mceMovable mceFocus mceModal mceAlert">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Alert</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
</span>
|
||||
<div class="mceRight"></div>
|
||||
<div class="mceIcon"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceButton mceOk" href="#">Ok</a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearlooks2" style="width:400px; height:130px; left:420px; top:450px;">
|
||||
<div class="mceWrapper mceMovable mceFocus mceModal mceConfirm">
|
||||
<div class="mceTop">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
<span>Confirm</span>
|
||||
</div>
|
||||
|
||||
<div class="mceMiddle">
|
||||
<div class="mceLeft"></div>
|
||||
<span>
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
This is a very long error message. This is a very long error message.
|
||||
</span>
|
||||
<div class="mceRight"></div>
|
||||
<div class="mceIcon"></div>
|
||||
</div>
|
||||
|
||||
<div class="mceBottom">
|
||||
<div class="mceLeft"></div>
|
||||
<div class="mceCenter"></div>
|
||||
<div class="mceRight"></div>
|
||||
</div>
|
||||
|
||||
<a class="mceMove" href="#"></a>
|
||||
<a class="mceButton mceOk" href="#">Ok</a>
|
||||
<a class="mceButton mceCancel" href="#">Cancel</a>
|
||||
<a class="mceClose" href="#"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
17
wp-includes/js/tinymce/plugins/media/css/media.css
Normal file
@ -0,0 +1,17 @@
|
||||
#id, #name, #hspace, #vspace, #class_name, #align { width: 100px }
|
||||
#hspace, #vspace { width: 50px }
|
||||
#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { width: 100px }
|
||||
#flash_base, #flash_flashvars, #html5_altsource1, #html5_altsource2, #html5_poster { width: 240px }
|
||||
#width, #height { width: 40px }
|
||||
#src, #media_type { width: 250px }
|
||||
#class { width: 120px }
|
||||
#prev { margin: 0; border: 1px solid black; width: 380px; height: 260px; overflow: auto }
|
||||
.panel_wrapper div.current { height: 420px; overflow: auto }
|
||||
#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { display: none }
|
||||
.mceAddSelectValue { background-color: #DDDDDD }
|
||||
#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { width: 70px }
|
||||
#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { width: 70px }
|
||||
#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { width: 70px }
|
||||
#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { width: 90px }
|
||||
#qt_qtsrc { width: 200px }
|
||||
iframe {border: 1px solid gray}
|
1
wp-includes/js/tinymce/plugins/media/editor_plugin.js
Normal file
898
wp-includes/js/tinymce/plugins/media/editor_plugin_src.js
Normal file
@ -0,0 +1,898 @@
|
||||
/**
|
||||
* 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 rootAttributes = tinymce.explode('id,name,width,height,style,align,class,hspace,vspace,bgcolor,type'), excludedAttrs = tinymce.makeMap(rootAttributes.join(',')), Node = tinymce.html.Node,
|
||||
mediaTypes, scriptRegExp, JSON = tinymce.util.JSON, mimeTypes;
|
||||
|
||||
// Media types supported by this plugin
|
||||
mediaTypes = [
|
||||
// Type, clsid:s, mime types, codebase
|
||||
["Flash", "d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],
|
||||
["ShockWave", "166b1bca-3f9c-11cf-8075-444553540000", "application/x-director", "http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],
|
||||
["WindowsMedia", "6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a", "application/x-mplayer2", "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],
|
||||
["QuickTime", "02bf25d5-8c17-4b23-bc80-d3488abddc6b", "video/quicktime", "http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],
|
||||
["RealMedia", "cfcdaa03-8be4-11cf-b84b-0020afbbccfa", "audio/x-pn-realaudio-plugin", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],
|
||||
["Java", "8ad9c840-044e-11d1-b3e9-00805f499d93", "application/x-java-applet", "http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],
|
||||
["Silverlight", "dfeaf541-f3e1-4c24-acac-99c30715084a", "application/x-silverlight-2"],
|
||||
["Iframe"],
|
||||
["Video"],
|
||||
["EmbeddedAudio"],
|
||||
["Audio"]
|
||||
];
|
||||
|
||||
function normalizeSize(size) {
|
||||
return typeof(size) == "string" ? size.replace(/[^0-9%]/g, '') : size;
|
||||
}
|
||||
|
||||
function toArray(obj) {
|
||||
var undef, out, i;
|
||||
|
||||
if (obj && !obj.splice) {
|
||||
out = [];
|
||||
|
||||
for (i = 0; true; i++) {
|
||||
if (obj[i])
|
||||
out[i] = obj[i];
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
tinymce.create('tinymce.plugins.MediaPlugin', {
|
||||
init : function(ed, url) {
|
||||
var self = this, lookup = {}, i, y, item, name;
|
||||
|
||||
function isMediaImg(node) {
|
||||
return node && node.nodeName === 'IMG' && ed.dom.hasClass(node, 'mceItemMedia');
|
||||
};
|
||||
|
||||
self.editor = ed;
|
||||
self.url = url;
|
||||
|
||||
// Parse media types into a lookup table
|
||||
scriptRegExp = '';
|
||||
for (i = 0; i < mediaTypes.length; i++) {
|
||||
name = mediaTypes[i][0];
|
||||
|
||||
item = {
|
||||
name : name,
|
||||
clsids : tinymce.explode(mediaTypes[i][1] || ''),
|
||||
mimes : tinymce.explode(mediaTypes[i][2] || ''),
|
||||
codebase : mediaTypes[i][3]
|
||||
};
|
||||
|
||||
for (y = 0; y < item.clsids.length; y++)
|
||||
lookup['clsid:' + item.clsids[y]] = item;
|
||||
|
||||
for (y = 0; y < item.mimes.length; y++)
|
||||
lookup[item.mimes[y]] = item;
|
||||
|
||||
lookup['mceItem' + name] = item;
|
||||
lookup[name.toLowerCase()] = item;
|
||||
|
||||
scriptRegExp += (scriptRegExp ? '|' : '') + name;
|
||||
}
|
||||
|
||||
// Handle the media_types setting
|
||||
tinymce.each(ed.getParam("media_types",
|
||||
"video=mp4,m4v,ogv,webm;" +
|
||||
"silverlight=xap;" +
|
||||
"flash=swf,flv;" +
|
||||
"shockwave=dcr;" +
|
||||
"quicktime=mov,qt,mpg,mpeg;" +
|
||||
"shockwave=dcr;" +
|
||||
"windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;" +
|
||||
"realmedia=rm,ra,ram;" +
|
||||
"java=jar;" +
|
||||
"audio=mp3,ogg"
|
||||
).split(';'), function(item) {
|
||||
var i, extensions, type;
|
||||
|
||||
item = item.split(/=/);
|
||||
extensions = tinymce.explode(item[1].toLowerCase());
|
||||
for (i = 0; i < extensions.length; i++) {
|
||||
type = lookup[item[0].toLowerCase()];
|
||||
|
||||
if (type)
|
||||
lookup[extensions[i]] = type;
|
||||
}
|
||||
});
|
||||
|
||||
scriptRegExp = new RegExp('write(' + scriptRegExp + ')\\(([^)]+)\\)');
|
||||
self.lookup = lookup;
|
||||
|
||||
ed.onPreInit.add(function() {
|
||||
// Allow video elements
|
||||
ed.schema.addValidElements('object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]');
|
||||
|
||||
// Convert video elements to image placeholder
|
||||
ed.parser.addNodeFilter('object,embed,video,audio,script,iframe', function(nodes) {
|
||||
var i = nodes.length;
|
||||
|
||||
while (i--)
|
||||
self.objectToImg(nodes[i]);
|
||||
});
|
||||
|
||||
// Convert image placeholders to video elements
|
||||
ed.serializer.addNodeFilter('img', function(nodes, name, args) {
|
||||
var i = nodes.length, node;
|
||||
|
||||
while (i--) {
|
||||
node = nodes[i];
|
||||
if ((node.attr('class') || '').indexOf('mceItemMedia') !== -1)
|
||||
self.imgToObject(node, args);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ed.onInit.add(function() {
|
||||
// Display "media" instead of "img" in element path
|
||||
if (ed.theme && ed.theme.onResolveName) {
|
||||
ed.theme.onResolveName.add(function(theme, path_object) {
|
||||
if (path_object.name === 'img' && ed.dom.hasClass(path_object.node, 'mceItemMedia'))
|
||||
path_object.name = 'media';
|
||||
});
|
||||
}
|
||||
|
||||
// Add contect menu if it's loaded
|
||||
if (ed && ed.plugins.contextmenu) {
|
||||
ed.plugins.contextmenu.onContextMenu.add(function(plugin, menu, element) {
|
||||
if (element.nodeName === 'IMG' && element.className.indexOf('mceItemMedia') !== -1)
|
||||
menu.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceMedia', function() {
|
||||
var data, img;
|
||||
|
||||
img = ed.selection.getNode();
|
||||
if (isMediaImg(img)) {
|
||||
data = ed.dom.getAttrib(img, 'data-mce-json');
|
||||
if (data) {
|
||||
data = JSON.parse(data);
|
||||
|
||||
// Add some extra properties to the data object
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
var value = ed.dom.getAttrib(img, name);
|
||||
|
||||
if (value)
|
||||
data[name] = value;
|
||||
});
|
||||
|
||||
data.type = self.getType(img.className).name.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
data = {
|
||||
type : 'flash',
|
||||
video: {sources:[]},
|
||||
params: {}
|
||||
};
|
||||
}
|
||||
|
||||
ed.windowManager.open({
|
||||
file : url + '/media.htm',
|
||||
width : 430 + parseInt(ed.getLang('media.delta_width', 0)),
|
||||
height : 500 + parseInt(ed.getLang('media.delta_height', 0)),
|
||||
inline : 1
|
||||
}, {
|
||||
plugin_url : url,
|
||||
data : data
|
||||
});
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});
|
||||
|
||||
// Update media selection status
|
||||
ed.onNodeChange.add(function(ed, cm, node) {
|
||||
cm.setActive('media', isMediaImg(node));
|
||||
});
|
||||
},
|
||||
|
||||
convertUrl : function(url, force_absolute) {
|
||||
var self = this, editor = self.editor, settings = editor.settings,
|
||||
urlConverter = settings.url_converter,
|
||||
urlConverterScope = settings.url_converter_scope || self;
|
||||
|
||||
if (!url)
|
||||
return url;
|
||||
|
||||
if (force_absolute)
|
||||
return editor.documentBaseURI.toAbsolute(url);
|
||||
|
||||
return urlConverter.call(urlConverterScope, url, 'src', 'object');
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Media',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the JSON data object to an img node.
|
||||
*/
|
||||
dataToImg : function(data, force_absolute) {
|
||||
var self = this, editor = self.editor, baseUri = editor.documentBaseURI, sources, attrs, img, i;
|
||||
|
||||
data.params.src = self.convertUrl(data.params.src, force_absolute);
|
||||
|
||||
attrs = data.video.attrs;
|
||||
if (attrs)
|
||||
attrs.src = self.convertUrl(attrs.src, force_absolute);
|
||||
|
||||
if (attrs)
|
||||
attrs.poster = self.convertUrl(attrs.poster, force_absolute);
|
||||
|
||||
sources = toArray(data.video.sources);
|
||||
if (sources) {
|
||||
for (i = 0; i < sources.length; i++)
|
||||
sources[i].src = self.convertUrl(sources[i].src, force_absolute);
|
||||
}
|
||||
|
||||
img = self.editor.dom.create('img', {
|
||||
id : data.id,
|
||||
style : data.style,
|
||||
align : data.align,
|
||||
hspace : data.hspace,
|
||||
vspace : data.vspace,
|
||||
src : self.editor.theme.url + '/img/trans.gif',
|
||||
'class' : 'mceItemMedia mceItem' + self.getType(data.type).name,
|
||||
'data-mce-json' : JSON.serialize(data, "'")
|
||||
});
|
||||
|
||||
img.width = data.width = normalizeSize(data.width || (data.type == 'audio' ? "300" : "320"));
|
||||
img.height = data.height = normalizeSize(data.height || (data.type == 'audio' ? "32" : "240"));
|
||||
|
||||
return img;
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the JSON data object to a HTML string.
|
||||
*/
|
||||
dataToHtml : function(data, force_absolute) {
|
||||
return this.editor.serializer.serialize(this.dataToImg(data, force_absolute), {forced_root_block : '', force_absolute : force_absolute});
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the JSON data object to a HTML string.
|
||||
*/
|
||||
htmlToData : function(html) {
|
||||
var fragment, img, data;
|
||||
|
||||
data = {
|
||||
type : 'flash',
|
||||
video: {sources:[]},
|
||||
params: {}
|
||||
};
|
||||
|
||||
fragment = this.editor.parser.parse(html);
|
||||
img = fragment.getAll('img')[0];
|
||||
|
||||
if (img) {
|
||||
data = JSON.parse(img.attr('data-mce-json'));
|
||||
data.type = this.getType(img.attr('class')).name.toLowerCase();
|
||||
|
||||
// Add some extra properties to the data object
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
var value = img.attr(name);
|
||||
|
||||
if (value)
|
||||
data[name] = value;
|
||||
});
|
||||
}
|
||||
|
||||
return data;
|
||||
},
|
||||
|
||||
/**
|
||||
* Get type item by extension, class, clsid or mime type.
|
||||
*
|
||||
* @method getType
|
||||
* @param {String} value Value to get type item by.
|
||||
* @return {Object} Type item object or undefined.
|
||||
*/
|
||||
getType : function(value) {
|
||||
var i, values, typeItem;
|
||||
|
||||
// Find type by checking the classes
|
||||
values = tinymce.explode(value, ' ');
|
||||
for (i = 0; i < values.length; i++) {
|
||||
typeItem = this.lookup[values[i]];
|
||||
|
||||
if (typeItem)
|
||||
return typeItem;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a tinymce.html.Node image element to video/object/embed.
|
||||
*/
|
||||
imgToObject : function(node, args) {
|
||||
var self = this, editor = self.editor, video, object, embed, iframe, name, value, data,
|
||||
source, sources, params, param, typeItem, i, item, mp4Source, replacement,
|
||||
posterSrc, style, audio;
|
||||
|
||||
// Adds the flash player
|
||||
function addPlayer(video_src, poster_src) {
|
||||
var baseUri, flashVars, flashVarsOutput, params, flashPlayer;
|
||||
|
||||
flashPlayer = editor.getParam('flash_video_player_url', self.convertUrl(self.url + '/moxieplayer.swf'));
|
||||
if (flashPlayer) {
|
||||
baseUri = editor.documentBaseURI;
|
||||
data.params.src = flashPlayer;
|
||||
|
||||
// Convert the movie url to absolute urls
|
||||
if (editor.getParam('flash_video_player_absvideourl', true)) {
|
||||
video_src = baseUri.toAbsolute(video_src || '', true);
|
||||
poster_src = baseUri.toAbsolute(poster_src || '', true);
|
||||
}
|
||||
|
||||
// Generate flash vars
|
||||
flashVarsOutput = '';
|
||||
flashVars = editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'});
|
||||
tinymce.each(flashVars, function(value, name) {
|
||||
// Replace $url and $poster variables in flashvars value
|
||||
value = value.replace(/\$url/, video_src || '');
|
||||
value = value.replace(/\$poster/, poster_src || '');
|
||||
|
||||
if (value.length > 0)
|
||||
flashVarsOutput += (flashVarsOutput ? '&' : '') + name + '=' + escape(value);
|
||||
});
|
||||
|
||||
if (flashVarsOutput.length)
|
||||
data.params.flashvars = flashVarsOutput;
|
||||
|
||||
params = editor.getParam('flash_video_player_params', {
|
||||
allowfullscreen: true,
|
||||
allowscriptaccess: true
|
||||
});
|
||||
|
||||
tinymce.each(params, function(value, name) {
|
||||
data.params[name] = "" + value;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
data = node.attr('data-mce-json');
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
data = JSON.parse(data);
|
||||
typeItem = this.getType(node.attr('class'));
|
||||
|
||||
style = node.attr('data-mce-style');
|
||||
if (!style) {
|
||||
style = node.attr('style');
|
||||
|
||||
if (style)
|
||||
style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img'));
|
||||
}
|
||||
|
||||
// Use node width/height to override the data width/height when the placeholder is resized
|
||||
data.width = node.attr('width') || data.width;
|
||||
data.height = node.attr('height') || data.height;
|
||||
|
||||
// Handle iframe
|
||||
if (typeItem.name === 'Iframe') {
|
||||
replacement = new Node('iframe', 1);
|
||||
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
var value = node.attr(name);
|
||||
|
||||
if (name == 'class' && value)
|
||||
value = value.replace(/mceItem.+ ?/g, '');
|
||||
|
||||
if (value && value.length > 0)
|
||||
replacement.attr(name, value);
|
||||
});
|
||||
|
||||
for (name in data.params)
|
||||
replacement.attr(name, data.params[name]);
|
||||
|
||||
replacement.attr({
|
||||
style: style,
|
||||
src: data.params.src
|
||||
});
|
||||
|
||||
node.replace(replacement);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle scripts
|
||||
if (this.editor.settings.media_use_script) {
|
||||
replacement = new Node('script', 1).attr('type', 'text/javascript');
|
||||
|
||||
value = new Node('#text', 3);
|
||||
value.value = 'write' + typeItem.name + '(' + JSON.serialize(tinymce.extend(data.params, {
|
||||
width: node.attr('width'),
|
||||
height: node.attr('height')
|
||||
})) + ');';
|
||||
|
||||
replacement.append(value);
|
||||
node.replace(replacement);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Add HTML5 video element
|
||||
if (typeItem.name === 'Video' && data.video.sources[0]) {
|
||||
// Create new object element
|
||||
video = new Node('video', 1).attr(tinymce.extend({
|
||||
id : node.attr('id'),
|
||||
width: normalizeSize(node.attr('width')),
|
||||
height: normalizeSize(node.attr('height')),
|
||||
style : style
|
||||
}, data.video.attrs));
|
||||
|
||||
// Get poster source and use that for flash fallback
|
||||
if (data.video.attrs)
|
||||
posterSrc = data.video.attrs.poster;
|
||||
|
||||
sources = data.video.sources = toArray(data.video.sources);
|
||||
for (i = 0; i < sources.length; i++) {
|
||||
if (/\.mp4$/.test(sources[i].src))
|
||||
mp4Source = sources[i].src;
|
||||
}
|
||||
|
||||
if (!sources[0].type) {
|
||||
video.attr('src', sources[0].src);
|
||||
sources.splice(0, 1);
|
||||
}
|
||||
|
||||
for (i = 0; i < sources.length; i++) {
|
||||
source = new Node('source', 1).attr(sources[i]);
|
||||
source.shortEnded = true;
|
||||
video.append(source);
|
||||
}
|
||||
|
||||
// Create flash fallback for video if we have a mp4 source
|
||||
if (mp4Source) {
|
||||
addPlayer(mp4Source, posterSrc);
|
||||
typeItem = self.getType('flash');
|
||||
} else
|
||||
data.params.src = '';
|
||||
}
|
||||
|
||||
// Add HTML5 audio element
|
||||
if (typeItem.name === 'Audio' && data.video.sources[0]) {
|
||||
// Create new object element
|
||||
audio = new Node('audio', 1).attr(tinymce.extend({
|
||||
id : node.attr('id'),
|
||||
width: normalizeSize(node.attr('width')),
|
||||
height: normalizeSize(node.attr('height')),
|
||||
style : style
|
||||
}, data.video.attrs));
|
||||
|
||||
// Get poster source and use that for flash fallback
|
||||
if (data.video.attrs)
|
||||
posterSrc = data.video.attrs.poster;
|
||||
|
||||
sources = data.video.sources = toArray(data.video.sources);
|
||||
if (!sources[0].type) {
|
||||
audio.attr('src', sources[0].src);
|
||||
sources.splice(0, 1);
|
||||
}
|
||||
|
||||
for (i = 0; i < sources.length; i++) {
|
||||
source = new Node('source', 1).attr(sources[i]);
|
||||
source.shortEnded = true;
|
||||
audio.append(source);
|
||||
}
|
||||
|
||||
data.params.src = '';
|
||||
}
|
||||
|
||||
if (typeItem.name === 'EmbeddedAudio') {
|
||||
embed = new Node('embed', 1);
|
||||
embed.shortEnded = true;
|
||||
embed.attr({
|
||||
id: node.attr('id'),
|
||||
width: normalizeSize(node.attr('width')),
|
||||
height: normalizeSize(node.attr('height')),
|
||||
style : style,
|
||||
type: node.attr('type')
|
||||
});
|
||||
|
||||
for (name in data.params)
|
||||
embed.attr(name, data.params[name]);
|
||||
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
if (data[name] && name != 'type')
|
||||
embed.attr(name, data[name]);
|
||||
});
|
||||
|
||||
data.params.src = '';
|
||||
}
|
||||
|
||||
// Do we have a params src then we can generate object
|
||||
if (data.params.src) {
|
||||
// Is flv movie add player for it
|
||||
if (/\.flv$/i.test(data.params.src))
|
||||
addPlayer(data.params.src, '');
|
||||
|
||||
if (args && args.force_absolute)
|
||||
data.params.src = editor.documentBaseURI.toAbsolute(data.params.src);
|
||||
|
||||
// Create new object element
|
||||
object = new Node('object', 1).attr({
|
||||
id : node.attr('id'),
|
||||
width: normalizeSize(node.attr('width')),
|
||||
height: normalizeSize(node.attr('height')),
|
||||
style : style
|
||||
});
|
||||
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
var value = data[name];
|
||||
|
||||
if (name == 'class' && value)
|
||||
value = value.replace(/mceItem.+ ?/g, '');
|
||||
|
||||
if (value && name != 'type')
|
||||
object.attr(name, value);
|
||||
});
|
||||
|
||||
// Add params
|
||||
for (name in data.params) {
|
||||
param = new Node('param', 1);
|
||||
param.shortEnded = true;
|
||||
value = data.params[name];
|
||||
|
||||
// Windows media needs to use url instead of src for the media URL
|
||||
if (name === 'src' && typeItem.name === 'WindowsMedia')
|
||||
name = 'url';
|
||||
|
||||
param.attr({name: name, value: value});
|
||||
object.append(param);
|
||||
}
|
||||
|
||||
// Setup add type and classid if strict is disabled
|
||||
if (this.editor.getParam('media_strict', true)) {
|
||||
object.attr({
|
||||
data: data.params.src,
|
||||
type: typeItem.mimes[0]
|
||||
});
|
||||
} else {
|
||||
object.attr({
|
||||
classid: "clsid:" + typeItem.clsids[0],
|
||||
codebase: typeItem.codebase
|
||||
});
|
||||
|
||||
embed = new Node('embed', 1);
|
||||
embed.shortEnded = true;
|
||||
embed.attr({
|
||||
id: node.attr('id'),
|
||||
width: normalizeSize(node.attr('width')),
|
||||
height: normalizeSize(node.attr('height')),
|
||||
style : style,
|
||||
type: typeItem.mimes[0]
|
||||
});
|
||||
|
||||
for (name in data.params)
|
||||
embed.attr(name, data.params[name]);
|
||||
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
if (data[name] && name != 'type')
|
||||
embed.attr(name, data[name]);
|
||||
});
|
||||
|
||||
object.append(embed);
|
||||
}
|
||||
|
||||
// Insert raw HTML
|
||||
if (data.object_html) {
|
||||
value = new Node('#text', 3);
|
||||
value.raw = true;
|
||||
value.value = data.object_html;
|
||||
object.append(value);
|
||||
}
|
||||
|
||||
// Append object to video element if it exists
|
||||
if (video)
|
||||
video.append(object);
|
||||
}
|
||||
|
||||
if (video) {
|
||||
// Insert raw HTML
|
||||
if (data.video_html) {
|
||||
value = new Node('#text', 3);
|
||||
value.raw = true;
|
||||
value.value = data.video_html;
|
||||
video.append(value);
|
||||
}
|
||||
}
|
||||
|
||||
if (audio) {
|
||||
// Insert raw HTML
|
||||
if (data.video_html) {
|
||||
value = new Node('#text', 3);
|
||||
value.raw = true;
|
||||
value.value = data.video_html;
|
||||
audio.append(value);
|
||||
}
|
||||
}
|
||||
|
||||
var n = video || audio || object || embed;
|
||||
if (n)
|
||||
node.replace(n);
|
||||
else
|
||||
node.remove();
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts a tinymce.html.Node video/object/embed to an img element.
|
||||
*
|
||||
* The video/object/embed will be converted into an image placeholder with a JSON data attribute like this:
|
||||
* <img class="mceItemMedia mceItemFlash" width="100" height="100" data-mce-json="{..}" />
|
||||
*
|
||||
* The JSON structure will be like this:
|
||||
* {'params':{'flashvars':'something','quality':'high','src':'someurl'}, 'video':{'sources':[{src: 'someurl', type: 'video/mp4'}]}}
|
||||
*/
|
||||
objectToImg : function(node) {
|
||||
var object, embed, video, iframe, img, name, id, width, height, style, i, html,
|
||||
param, params, source, sources, data, type, lookup = this.lookup,
|
||||
matches, attrs, urlConverter = this.editor.settings.url_converter,
|
||||
urlConverterScope = this.editor.settings.url_converter_scope,
|
||||
hspace, vspace, align, bgcolor;
|
||||
|
||||
function getInnerHTML(node) {
|
||||
return new tinymce.html.Serializer({
|
||||
inner: true,
|
||||
validate: false
|
||||
}).serialize(node);
|
||||
};
|
||||
|
||||
function lookupAttribute(o, attr) {
|
||||
return lookup[(o.attr(attr) || '').toLowerCase()];
|
||||
}
|
||||
|
||||
function lookupExtension(src) {
|
||||
var ext = src.replace(/^.*\.([^.]+)$/, '$1');
|
||||
return lookup[ext.toLowerCase() || ''];
|
||||
}
|
||||
|
||||
// If node isn't in document
|
||||
if (!node.parent)
|
||||
return;
|
||||
|
||||
// Handle media scripts
|
||||
if (node.name === 'script') {
|
||||
if (node.firstChild)
|
||||
matches = scriptRegExp.exec(node.firstChild.value);
|
||||
|
||||
if (!matches)
|
||||
return;
|
||||
|
||||
type = matches[1];
|
||||
data = {video : {}, params : JSON.parse(matches[2])};
|
||||
width = data.params.width;
|
||||
height = data.params.height;
|
||||
}
|
||||
|
||||
// Setup data objects
|
||||
data = data || {
|
||||
video : {},
|
||||
params : {}
|
||||
};
|
||||
|
||||
// Setup new image object
|
||||
img = new Node('img', 1);
|
||||
img.attr({
|
||||
src : this.editor.theme.url + '/img/trans.gif'
|
||||
});
|
||||
|
||||
// Video element
|
||||
name = node.name;
|
||||
if (name === 'video' || name == 'audio') {
|
||||
video = node;
|
||||
object = node.getAll('object')[0];
|
||||
embed = node.getAll('embed')[0];
|
||||
width = video.attr('width');
|
||||
height = video.attr('height');
|
||||
id = video.attr('id');
|
||||
data.video = {attrs : {}, sources : []};
|
||||
|
||||
// Get all video attributes
|
||||
attrs = data.video.attrs;
|
||||
for (name in video.attributes.map)
|
||||
attrs[name] = video.attributes.map[name];
|
||||
|
||||
source = node.attr('src');
|
||||
if (source)
|
||||
data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', node.name)});
|
||||
|
||||
// Get all sources
|
||||
sources = video.getAll("source");
|
||||
for (i = 0; i < sources.length; i++) {
|
||||
source = sources[i].remove();
|
||||
|
||||
data.video.sources.push({
|
||||
src: urlConverter.call(urlConverterScope, source.attr('src'), 'src', 'source'),
|
||||
type: source.attr('type'),
|
||||
media: source.attr('media')
|
||||
});
|
||||
}
|
||||
|
||||
// Convert the poster URL
|
||||
if (attrs.poster)
|
||||
attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', node.name);
|
||||
}
|
||||
|
||||
// Object element
|
||||
if (node.name === 'object') {
|
||||
object = node;
|
||||
embed = node.getAll('embed')[0];
|
||||
}
|
||||
|
||||
// Embed element
|
||||
if (node.name === 'embed')
|
||||
embed = node;
|
||||
|
||||
// Iframe element
|
||||
if (node.name === 'iframe') {
|
||||
iframe = node;
|
||||
type = 'Iframe';
|
||||
}
|
||||
|
||||
if (object) {
|
||||
// Get width/height
|
||||
width = width || object.attr('width');
|
||||
height = height || object.attr('height');
|
||||
style = style || object.attr('style');
|
||||
id = id || object.attr('id');
|
||||
hspace = hspace || object.attr('hspace');
|
||||
vspace = vspace || object.attr('vspace');
|
||||
align = align || object.attr('align');
|
||||
bgcolor = bgcolor || object.attr('bgcolor');
|
||||
data.name = object.attr('name');
|
||||
|
||||
// Get all object params
|
||||
params = object.getAll("param");
|
||||
for (i = 0; i < params.length; i++) {
|
||||
param = params[i];
|
||||
name = param.remove().attr('name');
|
||||
|
||||
if (!excludedAttrs[name])
|
||||
data.params[name] = param.attr('value');
|
||||
}
|
||||
|
||||
data.params.src = data.params.src || object.attr('data');
|
||||
}
|
||||
|
||||
if (embed) {
|
||||
// Get width/height
|
||||
width = width || embed.attr('width');
|
||||
height = height || embed.attr('height');
|
||||
style = style || embed.attr('style');
|
||||
id = id || embed.attr('id');
|
||||
hspace = hspace || embed.attr('hspace');
|
||||
vspace = vspace || embed.attr('vspace');
|
||||
align = align || embed.attr('align');
|
||||
bgcolor = bgcolor || embed.attr('bgcolor');
|
||||
|
||||
// Get all embed attributes
|
||||
for (name in embed.attributes.map) {
|
||||
if (!excludedAttrs[name] && !data.params[name])
|
||||
data.params[name] = embed.attributes.map[name];
|
||||
}
|
||||
}
|
||||
|
||||
if (iframe) {
|
||||
// Get width/height
|
||||
width = normalizeSize(iframe.attr('width'));
|
||||
height = normalizeSize(iframe.attr('height'));
|
||||
style = style || iframe.attr('style');
|
||||
id = iframe.attr('id');
|
||||
hspace = iframe.attr('hspace');
|
||||
vspace = iframe.attr('vspace');
|
||||
align = iframe.attr('align');
|
||||
bgcolor = iframe.attr('bgcolor');
|
||||
|
||||
tinymce.each(rootAttributes, function(name) {
|
||||
img.attr(name, iframe.attr(name));
|
||||
});
|
||||
|
||||
// Get all iframe attributes
|
||||
for (name in iframe.attributes.map) {
|
||||
if (!excludedAttrs[name] && !data.params[name])
|
||||
data.params[name] = iframe.attributes.map[name];
|
||||
}
|
||||
}
|
||||
|
||||
// Use src not movie
|
||||
if (data.params.movie) {
|
||||
data.params.src = data.params.src || data.params.movie;
|
||||
delete data.params.movie;
|
||||
}
|
||||
|
||||
// Convert the URL to relative/absolute depending on configuration
|
||||
if (data.params.src)
|
||||
data.params.src = urlConverter.call(urlConverterScope, data.params.src, 'src', 'object');
|
||||
|
||||
if (video) {
|
||||
if (node.name === 'video')
|
||||
type = lookup.video.name;
|
||||
else if (node.name === 'audio')
|
||||
type = lookup.audio.name;
|
||||
}
|
||||
|
||||
if (object && !type)
|
||||
type = (lookupAttribute(object, 'clsid') || lookupAttribute(object, 'classid') || lookupAttribute(object, 'type') || {}).name;
|
||||
|
||||
if (embed && !type)
|
||||
type = (lookupAttribute(embed, 'type') || lookupExtension(data.params.src) || {}).name;
|
||||
|
||||
// for embedded audio we preserve the original specified type
|
||||
if (embed && type == 'EmbeddedAudio') {
|
||||
data.params.type = embed.attr('type');
|
||||
}
|
||||
|
||||
// Replace the video/object/embed element with a placeholder image containing the data
|
||||
node.replace(img);
|
||||
|
||||
// Remove embed
|
||||
if (embed)
|
||||
embed.remove();
|
||||
|
||||
// Serialize the inner HTML of the object element
|
||||
if (object) {
|
||||
html = getInnerHTML(object.remove());
|
||||
|
||||
if (html)
|
||||
data.object_html = html;
|
||||
}
|
||||
|
||||
// Serialize the inner HTML of the video element
|
||||
if (video) {
|
||||
html = getInnerHTML(video.remove());
|
||||
|
||||
if (html)
|
||||
data.video_html = html;
|
||||
}
|
||||
|
||||
data.hspace = hspace;
|
||||
data.vspace = vspace;
|
||||
data.align = align;
|
||||
data.bgcolor = bgcolor;
|
||||
|
||||
// Set width/height of placeholder
|
||||
img.attr({
|
||||
id : id,
|
||||
'class' : 'mceItemMedia mceItem' + (type || 'Flash'),
|
||||
style : style,
|
||||
width : width || (node.name == 'audio' ? "300" : "320"),
|
||||
height : height || (node.name == 'audio' ? "32" : "240"),
|
||||
hspace : hspace,
|
||||
vspace : vspace,
|
||||
align : align,
|
||||
bgcolor : bgcolor,
|
||||
"data-mce-json" : JSON.serialize(data, "'")
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);
|
||||
})();
|
73
wp-includes/js/tinymce/plugins/media/js/embed.js
Normal file
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
|
||||
*/
|
||||
|
||||
function writeFlash(p) {
|
||||
writeEmbed(
|
||||
'D27CDB6E-AE6D-11cf-96B8-444553540000',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
||||
'application/x-shockwave-flash',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeShockWave(p) {
|
||||
writeEmbed(
|
||||
'166B1BCA-3F9C-11CF-8075-444553540000',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
|
||||
'application/x-director',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeQuickTime(p) {
|
||||
writeEmbed(
|
||||
'02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
|
||||
'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
|
||||
'video/quicktime',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeRealMedia(p) {
|
||||
writeEmbed(
|
||||
'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
|
||||
'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
|
||||
'audio/x-pn-realaudio-plugin',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeWindowsMedia(p) {
|
||||
p.url = p.src;
|
||||
writeEmbed(
|
||||
'6BF52A52-394A-11D3-B153-00C04F79FAA6',
|
||||
'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
|
||||
'application/x-mplayer2',
|
||||
p
|
||||
);
|
||||
}
|
||||
|
||||
function writeEmbed(cls, cb, mt, p) {
|
||||
var h = '', n;
|
||||
|
||||
h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
|
||||
h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
|
||||
h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
|
||||
h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
|
||||
h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
|
||||
h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
|
||||
h += '>';
|
||||
|
||||
for (n in p)
|
||||
h += '<param name="' + n + '" value="' + p[n] + '">';
|
||||
|
||||
h += '<embed type="' + mt + '"';
|
||||
|
||||
for (n in p)
|
||||
h += n + '="' + p[n] + '" ';
|
||||
|
||||
h += '></embed></object>';
|
||||
|
||||
document.write(h);
|
||||
}
|
513
wp-includes/js/tinymce/plugins/media/js/media.js
Normal file
@ -0,0 +1,513 @@
|
||||
(function() {
|
||||
var url;
|
||||
|
||||
if (url = tinyMCEPopup.getParam("media_external_list_url"))
|
||||
document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
|
||||
|
||||
function get(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
function clone(obj) {
|
||||
var i, len, copy, attr;
|
||||
|
||||
if (null == obj || "object" != typeof obj)
|
||||
return obj;
|
||||
|
||||
// Handle Array
|
||||
if ('length' in obj) {
|
||||
copy = [];
|
||||
|
||||
for (i = 0, len = obj.length; i < len; ++i) {
|
||||
copy[i] = clone(obj[i]);
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
// Handle Object
|
||||
copy = {};
|
||||
for (attr in obj) {
|
||||
if (obj.hasOwnProperty(attr))
|
||||
copy[attr] = clone(obj[attr]);
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
function getVal(id) {
|
||||
var elm = get(id);
|
||||
|
||||
if (elm.nodeName == "SELECT")
|
||||
return elm.options[elm.selectedIndex].value;
|
||||
|
||||
if (elm.type == "checkbox")
|
||||
return elm.checked;
|
||||
|
||||
return elm.value;
|
||||
}
|
||||
|
||||
function setVal(id, value, name) {
|
||||
if (typeof(value) != 'undefined' && value != null) {
|
||||
var elm = get(id);
|
||||
|
||||
if (elm.nodeName == "SELECT")
|
||||
selectByValue(document.forms[0], id, value);
|
||||
else if (elm.type == "checkbox") {
|
||||
if (typeof(value) == 'string') {
|
||||
value = value.toLowerCase();
|
||||
value = (!name && value === 'true') || (name && value === name.toLowerCase());
|
||||
}
|
||||
elm.checked = !!value;
|
||||
} else
|
||||
elm.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
window.Media = {
|
||||
init : function() {
|
||||
var html, editor, self = this;
|
||||
|
||||
self.editor = editor = tinyMCEPopup.editor;
|
||||
|
||||
// Setup file browsers and color pickers
|
||||
get('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
|
||||
get('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','quicktime_qtsrc','media','media');
|
||||
get('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
|
||||
get('video_altsource1_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource1','video_altsource1','media','media');
|
||||
get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource2','video_altsource2','media','media');
|
||||
get('audio_altsource1_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource1','audio_altsource1','media','media');
|
||||
get('audio_altsource2_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource2','audio_altsource2','media','media');
|
||||
get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','image','media');
|
||||
|
||||
html = self.getMediaListHTML('medialist', 'src', 'media', 'media');
|
||||
if (html == "")
|
||||
get("linklistrow").style.display = 'none';
|
||||
else
|
||||
get("linklistcontainer").innerHTML = html;
|
||||
|
||||
if (isVisible('filebrowser'))
|
||||
get('src').style.width = '230px';
|
||||
|
||||
if (isVisible('video_filebrowser_altsource1'))
|
||||
get('video_altsource1').style.width = '220px';
|
||||
|
||||
if (isVisible('video_filebrowser_altsource2'))
|
||||
get('video_altsource2').style.width = '220px';
|
||||
|
||||
if (isVisible('audio_filebrowser_altsource1'))
|
||||
get('audio_altsource1').style.width = '220px';
|
||||
|
||||
if (isVisible('audio_filebrowser_altsource2'))
|
||||
get('audio_altsource2').style.width = '220px';
|
||||
|
||||
if (isVisible('filebrowser_poster'))
|
||||
get('video_poster').style.width = '220px';
|
||||
|
||||
editor.dom.setOuterHTML(get('media_type'), self.getMediaTypeHTML(editor));
|
||||
|
||||
self.setDefaultDialogSettings(editor);
|
||||
self.data = clone(tinyMCEPopup.getWindowArg('data'));
|
||||
self.dataToForm();
|
||||
self.preview();
|
||||
|
||||
updateColor('bgcolor_pick', 'bgcolor');
|
||||
},
|
||||
|
||||
insert : function() {
|
||||
var editor = tinyMCEPopup.editor;
|
||||
|
||||
this.formToData();
|
||||
editor.execCommand('mceRepaint');
|
||||
tinyMCEPopup.restoreSelection();
|
||||
editor.selection.setNode(editor.plugins.media.dataToImg(this.data));
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
preview : function() {
|
||||
get('prev').innerHTML = this.editor.plugins.media.dataToHtml(this.data, true);
|
||||
},
|
||||
|
||||
moveStates : function(to_form, field) {
|
||||
var data = this.data, editor = this.editor,
|
||||
mediaPlugin = editor.plugins.media, ext, src, typeInfo, defaultStates, src;
|
||||
|
||||
defaultStates = {
|
||||
// QuickTime
|
||||
quicktime_autoplay : true,
|
||||
quicktime_controller : true,
|
||||
|
||||
// Flash
|
||||
flash_play : true,
|
||||
flash_loop : true,
|
||||
flash_menu : true,
|
||||
|
||||
// WindowsMedia
|
||||
windowsmedia_autostart : true,
|
||||
windowsmedia_enablecontextmenu : true,
|
||||
windowsmedia_invokeurls : true,
|
||||
|
||||
// RealMedia
|
||||
realmedia_autogotourl : true,
|
||||
realmedia_imagestatus : true
|
||||
};
|
||||
|
||||
function parseQueryParams(str) {
|
||||
var out = {};
|
||||
|
||||
if (str) {
|
||||
tinymce.each(str.split('&'), function(item) {
|
||||
var parts = item.split('=');
|
||||
|
||||
out[unescape(parts[0])] = unescape(parts[1]);
|
||||
});
|
||||
}
|
||||
|
||||
return out;
|
||||
};
|
||||
|
||||
function setOptions(type, names) {
|
||||
var i, name, formItemName, value, list;
|
||||
|
||||
if (type == data.type || type == 'global') {
|
||||
names = tinymce.explode(names);
|
||||
for (i = 0; i < names.length; i++) {
|
||||
name = names[i];
|
||||
formItemName = type == 'global' ? name : type + '_' + name;
|
||||
|
||||
if (type == 'global')
|
||||
list = data;
|
||||
else if (type == 'video' || type == 'audio') {
|
||||
list = data.video.attrs;
|
||||
|
||||
if (!list && !to_form)
|
||||
data.video.attrs = list = {};
|
||||
} else
|
||||
list = data.params;
|
||||
|
||||
if (list) {
|
||||
if (to_form) {
|
||||
setVal(formItemName, list[name], type == 'video' || type == 'audio' ? name : '');
|
||||
} else {
|
||||
delete list[name];
|
||||
|
||||
value = getVal(formItemName);
|
||||
if ((type == 'video' || type == 'audio') && value === true)
|
||||
value = name;
|
||||
|
||||
if (defaultStates[formItemName]) {
|
||||
if (value !== defaultStates[formItemName]) {
|
||||
value = "" + value;
|
||||
list[name] = value;
|
||||
}
|
||||
} else if (value) {
|
||||
value = "" + value;
|
||||
list[name] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!to_form) {
|
||||
data.type = get('media_type').options[get('media_type').selectedIndex].value;
|
||||
data.width = getVal('width');
|
||||
data.height = getVal('height');
|
||||
|
||||
// Switch type based on extension
|
||||
src = getVal('src');
|
||||
if (field == 'src') {
|
||||
ext = src.replace(/^.*\.([^.]+)$/, '$1');
|
||||
if (typeInfo = mediaPlugin.getType(ext))
|
||||
data.type = typeInfo.name.toLowerCase();
|
||||
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
|
||||
if (data.type == "video" || data.type == "audio") {
|
||||
if (!data.video.sources)
|
||||
data.video.sources = [];
|
||||
|
||||
data.video.sources[0] = {src: getVal('src')};
|
||||
}
|
||||
}
|
||||
|
||||
// Hide all fieldsets and show the one active
|
||||
get('video_options').style.display = 'none';
|
||||
get('audio_options').style.display = 'none';
|
||||
get('flash_options').style.display = 'none';
|
||||
get('quicktime_options').style.display = 'none';
|
||||
get('shockwave_options').style.display = 'none';
|
||||
get('windowsmedia_options').style.display = 'none';
|
||||
get('realmedia_options').style.display = 'none';
|
||||
get('embeddedaudio_options').style.display = 'none';
|
||||
|
||||
if (get(data.type + '_options'))
|
||||
get(data.type + '_options').style.display = 'block';
|
||||
|
||||
setVal('media_type', data.type);
|
||||
|
||||
setOptions('flash', 'play,loop,menu,swliveconnect,quality,scale,salign,wmode,base,flashvars');
|
||||
setOptions('quicktime', 'loop,autoplay,cache,controller,correction,enablejavascript,kioskmode,autohref,playeveryframe,targetcache,scale,starttime,endtime,target,qtsrcchokespeed,volume,qtsrc');
|
||||
setOptions('shockwave', 'sound,progress,autostart,swliveconnect,swvolume,swstretchstyle,swstretchhalign,swstretchvalign');
|
||||
setOptions('windowsmedia', 'autostart,enabled,enablecontextmenu,fullscreen,invokeurls,mute,stretchtofit,windowlessvideo,balance,baseurl,captioningid,currentmarker,currentposition,defaultframe,playcount,rate,uimode,volume');
|
||||
setOptions('realmedia', 'autostart,loop,autogotourl,center,imagestatus,maintainaspect,nojava,prefetch,shuffle,console,controls,numloop,scriptcallbacks');
|
||||
setOptions('video', 'poster,autoplay,loop,muted,preload,controls');
|
||||
setOptions('audio', 'autoplay,loop,preload,controls');
|
||||
setOptions('embeddedaudio', 'autoplay,loop,controls');
|
||||
setOptions('global', 'id,name,vspace,hspace,bgcolor,align,width,height');
|
||||
|
||||
if (to_form) {
|
||||
if (data.type == 'video') {
|
||||
if (data.video.sources[0])
|
||||
setVal('src', data.video.sources[0].src);
|
||||
|
||||
src = data.video.sources[1];
|
||||
if (src)
|
||||
setVal('video_altsource1', src.src);
|
||||
|
||||
src = data.video.sources[2];
|
||||
if (src)
|
||||
setVal('video_altsource2', src.src);
|
||||
} else if (data.type == 'audio') {
|
||||
if (data.video.sources[0])
|
||||
setVal('src', data.video.sources[0].src);
|
||||
|
||||
src = data.video.sources[1];
|
||||
if (src)
|
||||
setVal('audio_altsource1', src.src);
|
||||
|
||||
src = data.video.sources[2];
|
||||
if (src)
|
||||
setVal('audio_altsource2', src.src);
|
||||
} else {
|
||||
// Check flash vars
|
||||
if (data.type == 'flash') {
|
||||
tinymce.each(editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'}), function(value, name) {
|
||||
if (value == '$url')
|
||||
data.params.src = parseQueryParams(data.params.flashvars)[name] || data.params.src || '';
|
||||
});
|
||||
}
|
||||
|
||||
setVal('src', data.params.src);
|
||||
}
|
||||
} else {
|
||||
src = getVal("src");
|
||||
|
||||
// YouTube Embed
|
||||
if (src.match(/youtube\.com\/embed\/\w+/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
data.type = 'iframe';
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
} else {
|
||||
// YouTube *NEW*
|
||||
if (src.match(/youtu\.be\/[a-z1-9.-_]+/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
data.type = 'iframe';
|
||||
src = 'http://www.youtube.com/embed/' + src.match(/youtu.be\/([a-z1-9.-_]+)/)[1];
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
|
||||
// YouTube
|
||||
if (src.match(/youtube\.com(.+)v=([^&]+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
data.type = 'iframe';
|
||||
src = 'http://www.youtube.com/embed/' + src.match(/v=([^&]+)/)[1];
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
}
|
||||
|
||||
// Google video
|
||||
if (src.match(/video\.google\.com(.+)docid=([^&]+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 326;
|
||||
data.type = 'flash';
|
||||
src = 'http://video.google.com/googleplayer.swf?docId=' + src.match(/docid=([^&]+)/)[1] + '&hl=en';
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
|
||||
// Vimeo
|
||||
if (src.match(/vimeo\.com\/([0-9]+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
data.type = 'iframe';
|
||||
src = 'http://player.vimeo.com/video/' + src.match(/vimeo.com\/([0-9]+)/)[1];
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
|
||||
// stream.cz
|
||||
if (src.match(/stream\.cz\/((?!object).)*\/([0-9]+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
data.type = 'iframe';
|
||||
src = 'http://www.stream.cz/object/' + src.match(/stream.cz\/[^/]+\/([0-9]+)/)[1];
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
|
||||
// Google maps
|
||||
if (src.match(/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/)) {
|
||||
data.width = 425;
|
||||
data.height = 350;
|
||||
data.params.frameborder = '0';
|
||||
data.type = 'iframe';
|
||||
src = 'http://maps.google.com/maps/ms?msid=' + src.match(/msid=(.+)/)[1] + "&output=embed";
|
||||
setVal('src', src);
|
||||
setVal('media_type', data.type);
|
||||
}
|
||||
|
||||
if (data.type == 'video') {
|
||||
if (!data.video.sources)
|
||||
data.video.sources = [];
|
||||
|
||||
data.video.sources[0] = {src : src};
|
||||
|
||||
src = getVal("video_altsource1");
|
||||
if (src)
|
||||
data.video.sources[1] = {src : src};
|
||||
|
||||
src = getVal("video_altsource2");
|
||||
if (src)
|
||||
data.video.sources[2] = {src : src};
|
||||
} else if (data.type == 'audio') {
|
||||
if (!data.video.sources)
|
||||
data.video.sources = [];
|
||||
|
||||
data.video.sources[0] = {src : src};
|
||||
|
||||
src = getVal("audio_altsource1");
|
||||
if (src)
|
||||
data.video.sources[1] = {src : src};
|
||||
|
||||
src = getVal("audio_altsource2");
|
||||
if (src)
|
||||
data.video.sources[2] = {src : src};
|
||||
} else
|
||||
data.params.src = src;
|
||||
|
||||
// Set default size
|
||||
setVal('width', data.width || (data.type == 'audio' ? 300 : 320));
|
||||
setVal('height', data.height || (data.type == 'audio' ? 32 : 240));
|
||||
}
|
||||
},
|
||||
|
||||
dataToForm : function() {
|
||||
this.moveStates(true);
|
||||
},
|
||||
|
||||
formToData : function(field) {
|
||||
if (field == "width" || field == "height")
|
||||
this.changeSize(field);
|
||||
|
||||
if (field == 'source') {
|
||||
this.moveStates(false, field);
|
||||
setVal('source', this.editor.plugins.media.dataToHtml(this.data));
|
||||
this.panel = 'source';
|
||||
} else {
|
||||
if (this.panel == 'source') {
|
||||
this.data = clone(this.editor.plugins.media.htmlToData(getVal('source')));
|
||||
this.dataToForm();
|
||||
this.panel = '';
|
||||
}
|
||||
|
||||
this.moveStates(false, field);
|
||||
this.preview();
|
||||
}
|
||||
},
|
||||
|
||||
beforeResize : function() {
|
||||
this.width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10);
|
||||
this.height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10);
|
||||
},
|
||||
|
||||
changeSize : function(type) {
|
||||
var width, height, scale, size;
|
||||
|
||||
if (get('constrain').checked) {
|
||||
width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10);
|
||||
height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10);
|
||||
|
||||
if (type == 'width') {
|
||||
this.height = Math.round((width / this.width) * height);
|
||||
setVal('height', this.height);
|
||||
} else {
|
||||
this.width = Math.round((height / this.height) * width);
|
||||
setVal('width', this.width);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getMediaListHTML : function() {
|
||||
if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {
|
||||
var html = "";
|
||||
|
||||
html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;Media.formToData(\'src\');">';
|
||||
html += '<option value="">---</option>';
|
||||
|
||||
for (var i=0; i<tinyMCEMediaList.length; i++)
|
||||
html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';
|
||||
|
||||
html += '</select>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
return "";
|
||||
},
|
||||
|
||||
getMediaTypeHTML : function(editor) {
|
||||
function option(media_type, element) {
|
||||
if (!editor.schema.getElementRule(element || media_type)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return '<option value="'+media_type+'">'+tinyMCEPopup.editor.translate("media_dlg."+media_type)+'</option>'
|
||||
}
|
||||
|
||||
var html = "";
|
||||
|
||||
html += '<select id="media_type" name="media_type" onchange="Media.formToData(\'type\');">';
|
||||
html += option("video");
|
||||
html += option("audio");
|
||||
html += option("flash", "object");
|
||||
html += option("quicktime", "object");
|
||||
html += option("shockwave", "object");
|
||||
html += option("windowsmedia", "object");
|
||||
html += option("realmedia", "object");
|
||||
html += option("iframe");
|
||||
|
||||
if (editor.getParam('media_embedded_audio', false)) {
|
||||
html += option('embeddedaudio', "object");
|
||||
}
|
||||
|
||||
html += '</select>';
|
||||
return html;
|
||||
},
|
||||
|
||||
setDefaultDialogSettings : function(editor) {
|
||||
var defaultDialogSettings = editor.getParam("media_dialog_defaults", {});
|
||||
tinymce.each(defaultDialogSettings, function(v, k) {
|
||||
setVal(k, v);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.requireLangPack();
|
||||
tinyMCEPopup.onInit.add(function() {
|
||||
Media.init();
|
||||
});
|
||||
})();
|
922
wp-includes/js/tinymce/plugins/media/media.htm
Normal file
@ -0,0 +1,922 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#media_dlg.title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js?ver=358-20121205"></script>
|
||||
<script type="text/javascript" src="js/media.js?ver=358-20121205"></script>
|
||||
<script type="text/javascript" src="../../utils/mctabs.js?ver=358-20121205"></script>
|
||||
<script type="text/javascript" src="../../utils/validate.js?ver=358-20121205"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js?ver=358-20121205"></script>
|
||||
<script type="text/javascript" src="../../utils/editable_selects.js?ver=358-20121205"></script>
|
||||
<link href="css/media.css?ver=358-20121205" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body style="display: none" role="application">
|
||||
<form onsubmit="Media.insert();return false;" action="#">
|
||||
<div class="tabs" role="presentation">
|
||||
<ul>
|
||||
<li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');Media.formToData();" onmousedown="return false;">{#media_dlg.general}</a></span></li>
|
||||
<li id="advanced_tab" aria-controls="advanced_panel"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');Media.formToData();" onmousedown="return false;">{#media_dlg.advanced}</a></span></li>
|
||||
<li id="source_tab" aria-controls="source_panel"><span><a href="javascript:mcTabs.displayTab('source_tab','source_panel');Media.formToData('source');" onmousedown="return false;">{#media_dlg.source}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="panel_wrapper">
|
||||
<div id="general_panel" class="panel current">
|
||||
<fieldset>
|
||||
<legend>{#media_dlg.general}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td><label for="media_type">{#media_dlg.type}</label></td>
|
||||
<td>
|
||||
<select id="media_type"></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="src">{#media_dlg.file}</label></td>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input id="src" name="src" type="text" value="" class="mceFocus" onchange="Media.formToData();" /></td>
|
||||
<td id="filebrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="linklistrow">
|
||||
<td><label for="linklist">{#media_dlg.list}</label></td>
|
||||
<td id="linklistcontainer"><select id="linklist"><option value=""></option></select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="width">{#media_dlg.size}</label></td>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="text" id="width" name="width" value="" class="size" onchange="Media.formToData('width');" onfocus="Media.beforeResize();" /> x <input type="text" id="height" name="height" value="" class="size" onfocus="Media.beforeResize();" onchange="Media.formToData('height');" /></td>
|
||||
<td> <input id="constrain" type="checkbox" name="constrain" class="checkbox" checked="checked" /></td>
|
||||
<td><label id="constrainlabel" for="constrain">{#media_dlg.constrain_proportions}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>{#media_dlg.preview}</legend>
|
||||
<div id="prev"></div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="advanced_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#media_dlg.advanced}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td><label for="id">{#media_dlg.id}</label></td>
|
||||
<td><input type="text" id="id" name="id" onchange="Media.formToData();" /></td>
|
||||
<td><label for="name">{#media_dlg.name}</label></td>
|
||||
<td><input type="text" id="name" name="name" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="align">{#media_dlg.align}</label></td>
|
||||
<td>
|
||||
<select id="align" name="align" onchange="Media.formToData();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="top">{#media_dlg.align_top}</option>
|
||||
<option value="right">{#media_dlg.align_right}</option>
|
||||
<option value="bottom">{#media_dlg.align_bottom}</option>
|
||||
<option value="left">{#media_dlg.align_left}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="bgcolor">{#media_dlg.bgcolor}</label></td>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input id="bgcolor" name="bgcolor" type="text" value="" size="9" onchange="updateColor('bgcolor_pick','bgcolor');Media.formToData();" /></td>
|
||||
<td id="bgcolor_pickcontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="vspace">{#media_dlg.vspace}</label></td>
|
||||
<td><input type="text" id="vspace" name="vspace" class="number" onchange="Media.formToData();" /></td>
|
||||
<td><label for="hspace">{#media_dlg.hspace}</label></td>
|
||||
<td><input type="text" id="hspace" name="hspace" class="number" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="video_options">
|
||||
<legend>{#media_dlg.html5_video_options}</legend>
|
||||
|
||||
<table role="presentation">
|
||||
<tr>
|
||||
<td><label for="video_altsource1">{#media_dlg.altsource1}</label></td>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input type="text" id="video_altsource1" name="video_altsource1" onchange="Media.formToData();" style="width: 240px" /></td>
|
||||
<td id="video_altsource1_filebrowser"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="video_altsource2">{#media_dlg.altsource2}</label></td>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input type="text" id="video_altsource2" name="video_altsource2" onchange="Media.formToData();" style="width: 240px" /></td>
|
||||
<td id="video_altsource2_filebrowser"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="video_poster">{#media_dlg.poster}</label></td>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input type="text" id="video_poster" name="video_poster" onchange="Media.formToData();" style="width: 240px" /></td>
|
||||
<td id="video_poster_filebrowser"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="video_preload">{#media_dlg.preload}</label></td>
|
||||
<td>
|
||||
<select id="video_preload" name="video_preload" onchange="Media.formToData();">
|
||||
<option value="none">{#media_dlg.preload_none}</option>
|
||||
<option value="metadata">{#media_dlg.preload_metadata}</option>
|
||||
<option value="auto">{#media_dlg.preload_auto}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="video_autoplay" name="video_autoplay" onchange="Media.formToData();" /></td>
|
||||
<td><label for="video_autoplay">{#media_dlg.play}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="video_muted" name="video_muted" onchange="Media.formToData();" /></td>
|
||||
<td><label for="video_muted">{#media_dlg.mute}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="video_loop" name="video_loop" onchange="Media.formToData();" /></td>
|
||||
<td><label for="video_loop">{#media_dlg.loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="video_controls" name="video_controls" onchange="Media.formToData();" /></td>
|
||||
<td><label for="video_controls">{#media_dlg.controls}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="embeddedaudio_options">
|
||||
<legend>{#media_dlg.embedded_audio_options}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="embeddedaudio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td>
|
||||
<td><label for="audio_autoplay">{#media_dlg.play}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="embeddedaudio_loop" name="audio_loop" onchange="Media.formToData();" /></td>
|
||||
<td><label for="audio_loop">{#media_dlg.loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="embeddedaudio_controls" name="audio_controls" onchange="Media.formToData();" /></td>
|
||||
<td><label for="audio_controls">{#media_dlg.controls}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="audio_options">
|
||||
<legend>{#media_dlg.html5_audio_options}</legend>
|
||||
|
||||
<table role="presentation">
|
||||
<tr>
|
||||
<td><label for="audio_altsource1">{#media_dlg.altsource1}</label></td>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input type="text" id="audio_altsource1" name="audio_altsource1" onchange="Media.formToData();" style="width: 240px" /></td>
|
||||
<td id="audio_altsource1_filebrowser"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="audio_altsource2">{#media_dlg.altsource2}</label></td>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input type="text" id="audio_altsource2" name="audio_altsource2" onchange="Media.formToData();" style="width: 240px" /></td>
|
||||
<td id="audio_altsource2_filebrowser"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="audio_preload">{#media_dlg.preload}</label></td>
|
||||
<td>
|
||||
<select id="audio_preload" name="audio_preload" onchange="Media.formToData();">
|
||||
<option value="none">{#media_dlg.preload_none}</option>
|
||||
<option value="metadata">{#media_dlg.preload_metadata}</option>
|
||||
<option value="auto">{#media_dlg.preload_auto}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="audio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td>
|
||||
<td><label for="audio_autoplay">{#media_dlg.play}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="audio_loop" name="audio_loop" onchange="Media.formToData();" /></td>
|
||||
<td><label for="audio_loop">{#media_dlg.loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="audio_controls" name="audio_controls" onchange="Media.formToData();" /></td>
|
||||
<td><label for="audio_controls">{#media_dlg.controls}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="flash_options">
|
||||
<legend>{#media_dlg.flash_options}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td><label for="flash_quality">{#media_dlg.quality}</label></td>
|
||||
<td>
|
||||
<select id="flash_quality" name="flash_quality" onchange="Media.formToData();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="high">high</option>
|
||||
<option value="low">low</option>
|
||||
<option value="autolow">autolow</option>
|
||||
<option value="autohigh">autohigh</option>
|
||||
<option value="best">best</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="flash_scale">{#media_dlg.scale}</label></td>
|
||||
<td>
|
||||
<select id="flash_scale" name="flash_scale" onchange="Media.formToData();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="showall">showall</option>
|
||||
<option value="noborder">noborder</option>
|
||||
<option value="exactfit">exactfit</option>
|
||||
<option value="noscale">noscale</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="flash_wmode">{#media_dlg.wmode}</label></td>
|
||||
<td>
|
||||
<select id="flash_wmode" name="flash_wmode" onchange="Media.formToData();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="window">window</option>
|
||||
<option value="opaque">opaque</option>
|
||||
<option value="transparent">transparent</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="flash_salign">{#media_dlg.salign}</label></td>
|
||||
<td>
|
||||
<select id="flash_salign" name="flash_salign" onchange="Media.formToData();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="l">{#media_dlg.align_left}</option>
|
||||
<option value="t">{#media_dlg.align_top}</option>
|
||||
<option value="r">{#media_dlg.align_right}</option>
|
||||
<option value="b">{#media_dlg.align_bottom}</option>
|
||||
<option value="tl">{#media_dlg.align_top_left}</option>
|
||||
<option value="tr">{#media_dlg.align_top_right}</option>
|
||||
<option value="bl">{#media_dlg.align_bottom_left}</option>
|
||||
<option value="br">{#media_dlg.align_bottom_right}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flash_play" name="flash_play" checked="checked" onchange="Media.formToData();" /></td>
|
||||
<td><label for="flash_play">{#media_dlg.play}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flash_loop" name="flash_loop" checked="checked" onchange="Media.formToData();" /></td>
|
||||
<td><label for="flash_loop">{#media_dlg.loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flash_menu" name="flash_menu" checked="checked" onchange="Media.formToData();" /></td>
|
||||
<td><label for="flash_menu">{#media_dlg.menu}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="flash_swliveconnect" name="flash_swliveconnect" onchange="Media.formToData();" /></td>
|
||||
<td><label for="flash_swliveconnect">{#media_dlg.liveconnect}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table role="presentation">
|
||||
<tr>
|
||||
<td><label for="flash_base">{#media_dlg.base}</label></td>
|
||||
<td><input type="text" id="flash_base" name="flash_base" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="flash_flashvars">{#media_dlg.flashvars}</label></td>
|
||||
<td><input type="text" id="flash_flashvars" name="flash_flashvars" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="quicktime_options">
|
||||
<legend>{#media_dlg.qt_options}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="quicktime_loop" name="quicktime_loop" onchange="Media.formToData();" /></td>
|
||||
<td><label for="quicktime_loop">{#media_dlg.loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="quicktime_autoplay" name="quicktime_autoplay" checked="checked" onchange="Media.formToData();" /></td>
|
||||
<td><label for="quicktime_autoplay">{#media_dlg.play}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="quicktime_cache" name="quicktime_cache" onchange="Media.formToData();" /></td>
|
||||
<td><label for="quicktime_cache">{#media_dlg.cache}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="quicktime_controller" name="quicktime_controller" checked="checked" onchange="Media.formToData();" /></td>
|
||||
<td><label for="quicktime_controller">{#media_dlg.controller}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="quicktime_correction" name="quicktime_correction" onchange="Media.formToData();" /></td>
|
||||
<td><label for="quicktime_correction">{#media_dlg.correction}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="quicktime_enablejavascript" name="quicktime_enablejavascript" onchange="Media.formToData();" /></td>
|
||||
<td><label for="quicktime_enablejavascript">{#media_dlg.enablejavascript}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="quicktime_kioskmode" name="quicktime_kioskmode" onchange="Media.formToData();" /></td>
|
||||
<td><label for="quicktime_kioskmode">{#media_dlg.kioskmode}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="quicktime_autohref" name="quicktime_autohref" onchange="Media.formToData();" /></td>
|
||||
<td><label for="quicktime_autohref">{#media_dlg.autohref}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="quicktime_playeveryframe" name="quicktime_playeveryframe" onchange="Media.formToData();" /></td>
|
||||
<td><label for="quicktime_playeveryframe">{#media_dlg.playeveryframe}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="quicktime_targetcache" name="quicktime_targetcache" onchange="Media.formToData();" /></td>
|
||||
<td><label for="quicktime_targetcache">{#media_dlg.targetcache}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="quicktime_scale">{#media_dlg.scale}</label></td>
|
||||
<td><select id="quicktime_scale" name="quicktime_scale" class="mceEditableSelect" onchange="Media.formToData();">
|
||||
<option value="">{#not_set}</option>
|
||||
<option value="tofit">tofit</option>
|
||||
<option value="aspect">aspect</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td colspan="2"> </td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="quicktime_starttime">{#media_dlg.starttime}</label></td>
|
||||
<td><input type="text" id="quicktime_starttime" name="quicktime_starttime" onchange="Media.formToData();" /></td>
|
||||
|
||||
<td><label for="quicktime_endtime">{#media_dlg.endtime}</label></td>
|
||||
<td><input type="text" id="quicktime_endtime" name="quicktime_endtime" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="quicktime_target">{#media_dlg.target}</label></td>
|
||||
<td><input type="text" id="quicktime_target" name="quicktime_target" onchange="Media.formToData();" /></td>
|
||||
|
||||
<td><label for="quicktime_href">{#media_dlg.href}</label></td>
|
||||
<td><input type="text" id="quicktime_href" name="quicktime_href" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="quicktime_qtsrcchokespeed">{#media_dlg.qtsrcchokespeed}</label></td>
|
||||
<td><input type="text" id="quicktime_qtsrcchokespeed" name="quicktime_qtsrcchokespeed" onchange="Media.formToData();" /></td>
|
||||
|
||||
<td><label for="quicktime_volume">{#media_dlg.volume}</label></td>
|
||||
<td><input type="text" id="quicktime_volume" name="quicktime_volume" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="quicktime_qtsrc">{#media_dlg.qtsrc}</label></td>
|
||||
<td colspan="4">
|
||||
<table role="presentation" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td><input type="text" id="quicktime_qtsrc" name="quicktime_qtsrc" onchange="Media.formToData();" /></td>
|
||||
<td id="qtsrcfilebrowsercontainer"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="windowsmedia_options">
|
||||
<legend>{#media_dlg.wmp_options}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="windowsmedia_autostart" name="windowsmedia_autostart" checked="checked" onchange="Media.formToData();" /></td>
|
||||
<td><label for="windowsmedia_autostart">{#media_dlg.autostart}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="windowsmedia_enabled" name="windowsmedia_enabled" onchange="Media.formToData();" /></td>
|
||||
<td><label for="windowsmedia_enabled">{#media_dlg.enabled}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="windowsmedia_enablecontextmenu" name="windowsmedia_enablecontextmenu" checked="checked" onchange="Media.formToData();" /></td>
|
||||
<td><label for="windowsmedia_enablecontextmenu">{#media_dlg.menu}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="windowsmedia_fullscreen" name="windowsmedia_fullscreen" onchange="Media.formToData();" /></td>
|
||||
<td><label for="windowsmedia_fullscreen">{#media_dlg.fullscreen}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="windowsmedia_invokeurls" name="windowsmedia_invokeurls" checked="checked" onchange="Media.formToData();" /></td>
|
||||
<td><label for="windowsmedia_invokeurls">{#media_dlg.invokeurls}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="windowsmedia_mute" name="windowsmedia_mute" onchange="Media.formToData();" /></td>
|
||||
<td><label for="windowsmedia_mute">{#media_dlg.mute}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="windowsmedia_stretchtofit" name="windowsmedia_stretchtofit" onchange="Media.formToData();" /></td>
|
||||
<td><label for="windowsmedia_stretchtofit">{#media_dlg.stretchtofit}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="windowsmedia_windowlessvideo" name="windowsmedia_windowlessvideo" onchange="Media.formToData();" /></td>
|
||||
<td><label for="windowsmedia_windowlessvideo">{#media_dlg.windowlessvideo}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="windowsmedia_balance">{#media_dlg.balance}</label></td>
|
||||
<td><input type="text" id="windowsmedia_balance" name="windowsmedia_balance" onchange="Media.formToData();" /></td>
|
||||
|
||||
<td><label for="windowsmedia_baseurl">{#media_dlg.baseurl}</label></td>
|
||||
<td><input type="text" id="windowsmedia_baseurl" name="windowsmedia_baseurl" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="windowsmedia_captioningid">{#media_dlg.captioningid}</label></td>
|
||||
<td><input type="text" id="windowsmedia_captioningid" name="windowsmedia_captioningid" onchange="Media.formToData();" /></td>
|
||||
|
||||
<td><label for="windowsmedia_currentmarker">{#media_dlg.currentmarker}</label></td>
|
||||
<td><input type="text" id="windowsmedia_currentmarker" name="windowsmedia_currentmarker" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="windowsmedia_currentposition">{#media_dlg.currentposition}</label></td>
|
||||
<td><input type="text" id="windowsmedia_currentposition" name="windowsmedia_currentposition" onchange="Media.formToData();" /></td>
|
||||
|
||||
<td><label for="windowsmedia_defaultframe">{#media_dlg.defaultframe}</label></td>
|
||||
<td><input type="text" id="windowsmedia_defaultframe" name="windowsmedia_defaultframe" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="windowsmedia_playcount">{#media_dlg.playcount}</label></td>
|
||||
<td><input type="text" id="windowsmedia_playcount" name="windowsmedia_playcount" onchange="Media.formToData();" /></td>
|
||||
|
||||
<td><label for="windowsmedia_rate">{#media_dlg.rate}</label></td>
|
||||
<td><input type="text" id="windowsmedia_rate" name="windowsmedia_rate" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="windowsmedia_uimode">{#media_dlg.uimode}</label></td>
|
||||
<td><input type="text" id="windowsmedia_uimode" name="windowsmedia_uimode" onchange="Media.formToData();" /></td>
|
||||
|
||||
<td><label for="windowsmedia_volume">{#media_dlg.volume}</label></td>
|
||||
<td><input type="text" id="windowsmedia_volume" name="windowsmedia_volume" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="realmedia_options">
|
||||
<legend>{#media_dlg.rmp_options}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="realmedia_autostart" name="realmedia_autostart" onchange="Media.formToData();" /></td>
|
||||
<td><label for="realmedia_autostart">{#media_dlg.autostart}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="realmedia_loop" name="realmedia_loop" onchange="Media.formToData();" /></td>
|
||||
<td><label for="realmedia_loop">{#media_dlg.loop}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="realmedia_autogotourl" name="realmedia_autogotourl" checked="checked" onchange="Media.formToData();" /></td>
|
||||
<td><label for="realmedia_autogotourl">{#media_dlg.autogotourl}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="realmedia_center" name="realmedia_center" onchange="Media.formToData();" /></td>
|
||||
<td><label for="realmedia_center">{#media_dlg.center}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="realmedia_imagestatus" name="realmedia_imagestatus" checked="checked" onchange="Media.formToData();" /></td>
|
||||
<td><label for="realmedia_imagestatus">{#media_dlg.imagestatus}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="realmedia_maintainaspect" name="realmedia_maintainaspect" onchange="Media.formToData();" /></td>
|
||||
<td><label for="realmedia_maintainaspect">{#media_dlg.maintainaspect}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="realmedia_nojava" name="realmedia_nojava" onchange="Media.formToData();" /></td>
|
||||
<td><label for="realmedia_nojava">{#media_dlg.nojava}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="realmedia_prefetch" name="realmedia_prefetch" onchange="Media.formToData();" /></td>
|
||||
<td><label for="realmedia_prefetch">{#media_dlg.prefetch}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="realmedia_shuffle" name="realmedia_shuffle" onchange="Media.formToData();" /></td>
|
||||
<td><label for="realmedia_shuffle">{#media_dlg.shuffle}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="realmedia_console">{#media_dlg.console}</label></td>
|
||||
<td><input type="text" id="realmedia_console" name="realmedia_console" onchange="Media.formToData();" /></td>
|
||||
|
||||
<td><label for="realmedia_controls">{#media_dlg.controls}</label></td>
|
||||
<td><input type="text" id="realmedia_controls" name="realmedia_controls" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="realmedia_numloop">{#media_dlg.numloop}</label></td>
|
||||
<td><input type="text" id="realmedia_numloop" name="realmedia_numloop" onchange="Media.formToData();" /></td>
|
||||
|
||||
<td><label for="realmedia_scriptcallbacks">{#media_dlg.scriptcallbacks}</label></td>
|
||||
<td><input type="text" id="realmedia_scriptcallbacks" name="realmedia_scriptcallbacks" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="shockwave_options">
|
||||
<legend>{#media_dlg.shockwave_options}</legend>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td><label for="shockwave_swstretchstyle">{#media_dlg.swstretchstyle}</label></td>
|
||||
<td>
|
||||
<select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="Media.formToData();">
|
||||
<option value="none">{#not_set}</option>
|
||||
<option value="meet">Meet</option>
|
||||
<option value="fill">Fill</option>
|
||||
<option value="stage">Stage</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="shockwave_swvolume">{#media_dlg.volume}</label></td>
|
||||
<td><input type="text" id="shockwave_swvolume" name="shockwave_swvolume" onchange="Media.formToData();" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><label for="shockwave_swstretchhalign">{#media_dlg.swstretchhalign}</label></td>
|
||||
<td>
|
||||
<select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="Media.formToData();">
|
||||
<option value="none">{#not_set}</option>
|
||||
<option value="left">{#media_dlg.align_left}</option>
|
||||
<option value="center">{#media_dlg.align_center}</option>
|
||||
<option value="right">{#media_dlg.align_right}</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="shockwave_swstretchvalign">{#media_dlg.swstretchvalign}</label></td>
|
||||
<td>
|
||||
<select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="Media.formToData();">
|
||||
<option value="none">{#not_set}</option>
|
||||
<option value="meet">Meet</option>
|
||||
<option value="fill">Fill</option>
|
||||
<option value="stage">Stage</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="shockwave_autostart" name="shockwave_autostart" onchange="Media.formToData();" checked="checked" /></td>
|
||||
<td><label for="shockwave_autostart">{#media_dlg.autostart}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="shockwave_sound" name="shockwave_sound" onchange="Media.formToData();" checked="checked" /></td>
|
||||
<td><label for="shockwave_sound">{#media_dlg.sound}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="Media.formToData();" /></td>
|
||||
<td><label for="shockwave_swliveconnect">{#media_dlg.liveconnect}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
<td colspan="2">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="checkbox" id="shockwave_progress" name="shockwave_progress" onchange="Media.formToData();" checked="checked" /></td>
|
||||
<td><label for="shockwave_progress">{#media_dlg.progress}</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div id="source_panel" class="panel">
|
||||
<fieldset>
|
||||
<legend>{#media_dlg.source}</legend>
|
||||
<textarea id="source" style="width: 99%; height: 390px"></textarea>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
1
wp-includes/js/tinymce/plugins/media/moxieplayer.swf
Normal file
@ -0,0 +1 @@
|
||||
<html><body>You are being <a href="https://raw.github.com/moxiecode/moxieplayer/master/bin-release/moxieplayer.swf">redirected</a>.</body></html>
|
1
wp-includes/js/tinymce/plugins/paste/editor_plugin.js
Normal file
885
wp-includes/js/tinymce/plugins/paste/editor_plugin_src.js
Normal file
@ -0,0 +1,885 @@
|
||||
/**
|
||||
* 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 each = tinymce.each,
|
||||
defs = {
|
||||
paste_auto_cleanup_on_paste : true,
|
||||
paste_enable_default_filters : true,
|
||||
paste_block_drop : false,
|
||||
paste_retain_style_properties : "none",
|
||||
paste_strip_class_attributes : "mso",
|
||||
paste_remove_spans : false,
|
||||
paste_remove_styles : false,
|
||||
paste_remove_styles_if_webkit : true,
|
||||
paste_convert_middot_lists : true,
|
||||
paste_convert_headers_to_strong : false,
|
||||
paste_dialog_width : "450",
|
||||
paste_dialog_height : "400",
|
||||
paste_max_consecutive_linebreaks: 2,
|
||||
paste_text_use_dialog : false,
|
||||
paste_text_sticky : false,
|
||||
paste_text_sticky_default : false,
|
||||
paste_text_notifyalways : false,
|
||||
paste_text_linebreaktype : "combined",
|
||||
paste_text_replacements : [
|
||||
[/\u2026/g, "..."],
|
||||
[/[\x93\x94\u201c\u201d]/g, '"'],
|
||||
[/[\x60\x91\x92\u2018\u2019]/g, "'"]
|
||||
]
|
||||
};
|
||||
|
||||
function getParam(ed, name) {
|
||||
return ed.getParam(name, defs[name]);
|
||||
}
|
||||
|
||||
tinymce.create('tinymce.plugins.PastePlugin', {
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.editor = ed;
|
||||
t.url = url;
|
||||
|
||||
// Setup plugin events
|
||||
t.onPreProcess = new tinymce.util.Dispatcher(t);
|
||||
t.onPostProcess = new tinymce.util.Dispatcher(t);
|
||||
|
||||
// Register default handlers
|
||||
t.onPreProcess.add(t._preProcess);
|
||||
t.onPostProcess.add(t._postProcess);
|
||||
|
||||
// Register optional preprocess handler
|
||||
t.onPreProcess.add(function(pl, o) {
|
||||
ed.execCallback('paste_preprocess', pl, o);
|
||||
});
|
||||
|
||||
// Register optional postprocess
|
||||
t.onPostProcess.add(function(pl, o) {
|
||||
ed.execCallback('paste_postprocess', pl, o);
|
||||
});
|
||||
|
||||
ed.onKeyDown.addToTop(function(ed, e) {
|
||||
// Block ctrl+v from adding an undo level since the default logic in tinymce.Editor will add that
|
||||
if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
|
||||
return false; // Stop other listeners
|
||||
});
|
||||
|
||||
// Initialize plain text flag
|
||||
ed.pasteAsPlainText = getParam(ed, 'paste_text_sticky_default');
|
||||
|
||||
// This function executes the process handlers and inserts the contents
|
||||
// force_rich overrides plain text mode set by user, important for pasting with execCommand
|
||||
function process(o, force_rich) {
|
||||
var dom = ed.dom, rng;
|
||||
|
||||
// Execute pre process handlers
|
||||
t.onPreProcess.dispatch(t, o);
|
||||
|
||||
// Create DOM structure
|
||||
o.node = dom.create('div', 0, o.content);
|
||||
|
||||
// If pasting inside the same element and the contents is only one block
|
||||
// remove the block and keep the text since Firefox will copy parts of pre and h1-h6 as a pre element
|
||||
if (tinymce.isGecko) {
|
||||
rng = ed.selection.getRng(true);
|
||||
if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) {
|
||||
// Is only one block node and it doesn't contain word stuff
|
||||
if (o.node.childNodes.length === 1 && /^(p|h[1-6]|pre)$/i.test(o.node.firstChild.nodeName) && o.content.indexOf('__MCE_ITEM__') === -1)
|
||||
dom.remove(o.node.firstChild, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Execute post process handlers
|
||||
t.onPostProcess.dispatch(t, o);
|
||||
|
||||
// Serialize content
|
||||
o.content = ed.serializer.serialize(o.node, {getInner : 1, forced_root_block : ''});
|
||||
|
||||
// Plain text option active?
|
||||
if ((!force_rich) && (ed.pasteAsPlainText)) {
|
||||
t._insertPlainText(o.content);
|
||||
|
||||
if (!getParam(ed, "paste_text_sticky")) {
|
||||
ed.pasteAsPlainText = false;
|
||||
ed.controlManager.setActive("pastetext", false);
|
||||
}
|
||||
} else {
|
||||
t._insert(o.content);
|
||||
}
|
||||
}
|
||||
|
||||
// Add command for external usage
|
||||
ed.addCommand('mceInsertClipboardContent', function(u, o) {
|
||||
process(o, true);
|
||||
});
|
||||
|
||||
if (!getParam(ed, "paste_text_use_dialog")) {
|
||||
ed.addCommand('mcePasteText', function(u, v) {
|
||||
var cookie = tinymce.util.Cookie;
|
||||
|
||||
ed.pasteAsPlainText = !ed.pasteAsPlainText;
|
||||
ed.controlManager.setActive('pastetext', ed.pasteAsPlainText);
|
||||
|
||||
if ((ed.pasteAsPlainText) && (!cookie.get("tinymcePasteText"))) {
|
||||
if (getParam(ed, "paste_text_sticky")) {
|
||||
ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
|
||||
} else {
|
||||
ed.windowManager.alert(ed.translate('paste.plaintext_mode'));
|
||||
}
|
||||
|
||||
if (!getParam(ed, "paste_text_notifyalways")) {
|
||||
cookie.set("tinymcePasteText", "1", new Date(new Date().getFullYear() + 1, 12, 31))
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ed.addButton('pastetext', {title: 'paste.paste_text_desc', cmd: 'mcePasteText'});
|
||||
ed.addButton('selectall', {title: 'paste.selectall_desc', cmd: 'selectall'});
|
||||
|
||||
// This function grabs the contents from the clipboard by adding a
|
||||
// hidden div and placing the caret inside it and after the browser paste
|
||||
// is done it grabs that contents and processes that
|
||||
function grabContent(e) {
|
||||
var n, or, rng, oldRng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY, textContent;
|
||||
|
||||
// Check if browser supports direct plaintext access
|
||||
if (e.clipboardData || dom.doc.dataTransfer) {
|
||||
textContent = (e.clipboardData || dom.doc.dataTransfer).getData('Text');
|
||||
|
||||
if (ed.pasteAsPlainText) {
|
||||
e.preventDefault();
|
||||
process({content : dom.encode(textContent).replace(/\r?\n/g, '<br />')});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (dom.get('_mcePaste'))
|
||||
return;
|
||||
|
||||
// Create container to paste into
|
||||
n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste', 'data-mce-bogus' : '1'}, '\uFEFF\uFEFF');
|
||||
|
||||
// If contentEditable mode we need to find out the position of the closest element
|
||||
if (body != ed.getDoc().body)
|
||||
posY = dom.getPos(ed.selection.getStart(), body).y;
|
||||
else
|
||||
posY = body.scrollTop + dom.getViewPort(ed.getWin()).y;
|
||||
|
||||
// Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles
|
||||
// If also needs to be in view on IE or the paste would fail
|
||||
dom.setStyles(n, {
|
||||
position : 'absolute',
|
||||
left : tinymce.isGecko ? -40 : 0, // Need to move it out of site on Gecko since it will othewise display a ghost resize rect for the div
|
||||
top : posY - 25,
|
||||
width : 1,
|
||||
height : 1,
|
||||
overflow : 'hidden'
|
||||
});
|
||||
|
||||
if (tinymce.isIE) {
|
||||
// Store away the old range
|
||||
oldRng = sel.getRng();
|
||||
|
||||
// Select the container
|
||||
rng = dom.doc.body.createTextRange();
|
||||
rng.moveToElementText(n);
|
||||
rng.execCommand('Paste');
|
||||
|
||||
// Remove container
|
||||
dom.remove(n);
|
||||
|
||||
// Check if the contents was changed, if it wasn't then clipboard extraction failed probably due
|
||||
// to IE security settings so we pass the junk though better than nothing right
|
||||
if (n.innerHTML === '\uFEFF\uFEFF') {
|
||||
ed.execCommand('mcePasteWord');
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
// Restore the old range and clear the contents before pasting
|
||||
sel.setRng(oldRng);
|
||||
sel.setContent('');
|
||||
|
||||
// For some odd reason we need to detach the the mceInsertContent call from the paste event
|
||||
// It's like IE has a reference to the parent element that you paste in and the selection gets messed up
|
||||
// when it tries to restore the selection
|
||||
setTimeout(function() {
|
||||
// Process contents
|
||||
process({content : n.innerHTML});
|
||||
}, 0);
|
||||
|
||||
// Block the real paste event
|
||||
return tinymce.dom.Event.cancel(e);
|
||||
} else {
|
||||
function block(e) {
|
||||
e.preventDefault();
|
||||
};
|
||||
|
||||
// Block mousedown and click to prevent selection change
|
||||
dom.bind(ed.getDoc(), 'mousedown', block);
|
||||
dom.bind(ed.getDoc(), 'keydown', block);
|
||||
|
||||
or = ed.selection.getRng();
|
||||
|
||||
// Move select contents inside DIV
|
||||
n = n.firstChild;
|
||||
rng = ed.getDoc().createRange();
|
||||
rng.setStart(n, 0);
|
||||
rng.setEnd(n, 2);
|
||||
sel.setRng(rng);
|
||||
|
||||
// Wait a while and grab the pasted contents
|
||||
window.setTimeout(function() {
|
||||
var h = '', nl;
|
||||
|
||||
// Paste divs duplicated in paste divs seems to happen when you paste plain text so lets first look for that broken behavior in WebKit
|
||||
if (!dom.select('div.mcePaste > div.mcePaste').length) {
|
||||
nl = dom.select('div.mcePaste');
|
||||
|
||||
// WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
|
||||
each(nl, function(n) {
|
||||
var child = n.firstChild;
|
||||
|
||||
// WebKit inserts a DIV container with lots of odd styles
|
||||
if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) {
|
||||
dom.remove(child, 1);
|
||||
}
|
||||
|
||||
// Remove apply style spans
|
||||
each(dom.select('span.Apple-style-span', n), function(n) {
|
||||
dom.remove(n, 1);
|
||||
});
|
||||
|
||||
// Remove bogus br elements
|
||||
each(dom.select('br[data-mce-bogus]', n), function(n) {
|
||||
dom.remove(n);
|
||||
});
|
||||
|
||||
// WebKit will make a copy of the DIV for each line of plain text pasted and insert them into the DIV
|
||||
if (n.parentNode.className != 'mcePaste')
|
||||
h += n.innerHTML;
|
||||
});
|
||||
} else {
|
||||
// Found WebKit weirdness so force the content into paragraphs this seems to happen when you paste plain text from Nodepad etc
|
||||
// So this logic will replace double enter with paragraphs and single enter with br so it kind of looks the same
|
||||
h = '<p>' + dom.encode(textContent).replace(/\r?\n\r?\n/g, '</p><p>').replace(/\r?\n/g, '<br />') + '</p>';
|
||||
}
|
||||
|
||||
// Remove the nodes
|
||||
each(dom.select('div.mcePaste'), function(n) {
|
||||
dom.remove(n);
|
||||
});
|
||||
|
||||
// Restore the old selection
|
||||
if (or)
|
||||
sel.setRng(or);
|
||||
|
||||
process({content : h});
|
||||
|
||||
// Unblock events ones we got the contents
|
||||
dom.unbind(ed.getDoc(), 'mousedown', block);
|
||||
dom.unbind(ed.getDoc(), 'keydown', block);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we should use the new auto process method
|
||||
if (getParam(ed, "paste_auto_cleanup_on_paste")) {
|
||||
// Is it's Opera or older FF use key handler
|
||||
if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {
|
||||
ed.onKeyDown.addToTop(function(ed, e) {
|
||||
if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
|
||||
grabContent(e);
|
||||
});
|
||||
} else {
|
||||
// Grab contents on paste event on Gecko and WebKit
|
||||
ed.onPaste.addToTop(function(ed, e) {
|
||||
return grabContent(e);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ed.onInit.add(function() {
|
||||
ed.controlManager.setActive("pastetext", ed.pasteAsPlainText);
|
||||
|
||||
// Block all drag/drop events
|
||||
if (getParam(ed, "paste_block_drop")) {
|
||||
ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Add legacy support
|
||||
t._legacySupport();
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Paste text/word',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
_preProcess : function(pl, o) {
|
||||
var ed = this.editor,
|
||||
h = o.content,
|
||||
grep = tinymce.grep,
|
||||
explode = tinymce.explode,
|
||||
trim = tinymce.trim,
|
||||
len, stripClass;
|
||||
|
||||
//console.log('Before preprocess:' + o.content);
|
||||
|
||||
function process(items) {
|
||||
each(items, function(v) {
|
||||
// Remove or replace
|
||||
if (v.constructor == RegExp)
|
||||
h = h.replace(v, '');
|
||||
else
|
||||
h = h.replace(v[0], v[1]);
|
||||
});
|
||||
}
|
||||
|
||||
if (ed.settings.paste_enable_default_filters == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
|
||||
if (tinymce.isIE && document.documentMode >= 9 && /<(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)/.test(o.content)) {
|
||||
// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
|
||||
process([[/(?:<br> [\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br> [\s\r\n]+|<br>)*/g, '$1']]);
|
||||
|
||||
// IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break
|
||||
process([
|
||||
[/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact
|
||||
[/<br>/g, ' '], // Replace single br elements with space since they are word wrap BR:s
|
||||
[/<BR><BR>/g, '<br>'] // Replace back the double brs but into a single BR
|
||||
]);
|
||||
}
|
||||
|
||||
// Detect Word content and process it more aggressive
|
||||
if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {
|
||||
o.wordContent = true; // Mark the pasted contents as word specific content
|
||||
//console.log('Word contents detected.');
|
||||
|
||||
// Process away some basic content
|
||||
process([
|
||||
/^\s*( )+/gi, // entities at the start of contents
|
||||
/( |<br[^>]*>)+\s*$/gi // entities at the end of contents
|
||||
]);
|
||||
|
||||
if (getParam(ed, "paste_convert_headers_to_strong")) {
|
||||
h = h.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>");
|
||||
}
|
||||
|
||||
if (getParam(ed, "paste_convert_middot_lists")) {
|
||||
process([
|
||||
[/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'], // Convert supportLists to a list item marker
|
||||
[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'], // Convert mso-list and symbol spans to item markers
|
||||
[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi, '$1__MCE_ITEM__'] // Convert mso-list and symbol paragraphs to item markers (FF)
|
||||
]);
|
||||
}
|
||||
|
||||
process([
|
||||
// Word comments like conditional comments etc
|
||||
/<!--[\s\S]+?-->/gi,
|
||||
|
||||
// Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags
|
||||
/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
|
||||
|
||||
// Convert <s> into <strike> for line-though
|
||||
[/<(\/?)s>/gi, "<$1strike>"],
|
||||
|
||||
// Replace nsbp entites to char since it's easier to handle
|
||||
[/ /gi, "\u00a0"]
|
||||
]);
|
||||
|
||||
// Remove bad attributes, with or without quotes, ensuring that attribute text is really inside a tag.
|
||||
// If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot.
|
||||
do {
|
||||
len = h.length;
|
||||
h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
|
||||
} while (len != h.length);
|
||||
|
||||
// Remove all spans if no styles is to be retained
|
||||
if (getParam(ed, "paste_retain_style_properties").replace(/^none$/i, "").length == 0) {
|
||||
h = h.replace(/<\/?span[^>]*>/gi, "");
|
||||
} else {
|
||||
// We're keeping styles, so at least clean them up.
|
||||
// CSS Reference: http://msdn.microsoft.com/en-us/library/aa155477.aspx
|
||||
|
||||
process([
|
||||
// Convert <span style="mso-spacerun:yes">___</span> to string of alternating breaking/non-breaking spaces of same length
|
||||
[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
|
||||
function(str, spaces) {
|
||||
return (spaces.length > 0)? spaces.replace(/./, " ").slice(Math.floor(spaces.length/2)).split("").join("\u00a0") : "";
|
||||
}
|
||||
],
|
||||
|
||||
// Examine all styles: delete junk, transform some, and keep the rest
|
||||
[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,
|
||||
function(str, tag, style) {
|
||||
var n = [],
|
||||
i = 0,
|
||||
s = explode(trim(style).replace(/"/gi, "'"), ";");
|
||||
|
||||
// Examine each style definition within the tag's style attribute
|
||||
each(s, function(v) {
|
||||
var name, value,
|
||||
parts = explode(v, ":");
|
||||
|
||||
function ensureUnits(v) {
|
||||
return v + ((v !== "0") && (/\d$/.test(v)))? "px" : "";
|
||||
}
|
||||
|
||||
if (parts.length == 2) {
|
||||
name = parts[0].toLowerCase();
|
||||
value = parts[1].toLowerCase();
|
||||
|
||||
// Translate certain MS Office styles into their CSS equivalents
|
||||
switch (name) {
|
||||
case "mso-padding-alt":
|
||||
case "mso-padding-top-alt":
|
||||
case "mso-padding-right-alt":
|
||||
case "mso-padding-bottom-alt":
|
||||
case "mso-padding-left-alt":
|
||||
case "mso-margin-alt":
|
||||
case "mso-margin-top-alt":
|
||||
case "mso-margin-right-alt":
|
||||
case "mso-margin-bottom-alt":
|
||||
case "mso-margin-left-alt":
|
||||
case "mso-table-layout-alt":
|
||||
case "mso-height":
|
||||
case "mso-width":
|
||||
case "mso-vertical-align-alt":
|
||||
n[i++] = name.replace(/^mso-|-alt$/g, "") + ":" + ensureUnits(value);
|
||||
return;
|
||||
|
||||
case "horiz-align":
|
||||
n[i++] = "text-align:" + value;
|
||||
return;
|
||||
|
||||
case "vert-align":
|
||||
n[i++] = "vertical-align:" + value;
|
||||
return;
|
||||
|
||||
case "font-color":
|
||||
case "mso-foreground":
|
||||
n[i++] = "color:" + value;
|
||||
return;
|
||||
|
||||
case "mso-background":
|
||||
case "mso-highlight":
|
||||
n[i++] = "background:" + value;
|
||||
return;
|
||||
|
||||
case "mso-default-height":
|
||||
n[i++] = "min-height:" + ensureUnits(value);
|
||||
return;
|
||||
|
||||
case "mso-default-width":
|
||||
n[i++] = "min-width:" + ensureUnits(value);
|
||||
return;
|
||||
|
||||
case "mso-padding-between-alt":
|
||||
n[i++] = "border-collapse:separate;border-spacing:" + ensureUnits(value);
|
||||
return;
|
||||
|
||||
case "text-line-through":
|
||||
if ((value == "single") || (value == "double")) {
|
||||
n[i++] = "text-decoration:line-through";
|
||||
}
|
||||
return;
|
||||
|
||||
case "mso-zero-height":
|
||||
if (value == "yes") {
|
||||
n[i++] = "display:none";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Eliminate all MS Office style definitions that have no CSS equivalent by examining the first characters in the name
|
||||
if (/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If it reached this point, it must be a valid CSS style
|
||||
n[i++] = name + ":" + parts[1]; // Lower-case name, but keep value case
|
||||
}
|
||||
});
|
||||
|
||||
// If style attribute contained any valid styles the re-write it; otherwise delete style attribute.
|
||||
if (i > 0) {
|
||||
return tag + ' style="' + n.join(';') + '"';
|
||||
} else {
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
// Replace headers with <strong>
|
||||
if (getParam(ed, "paste_convert_headers_to_strong")) {
|
||||
process([
|
||||
[/<h[1-6][^>]*>/gi, "<p><strong>"],
|
||||
[/<\/h[1-6][^>]*>/gi, "</strong></p>"]
|
||||
]);
|
||||
}
|
||||
|
||||
process([
|
||||
// Copy paste from Java like Open Office will produce this junk on FF
|
||||
[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi, '']
|
||||
]);
|
||||
|
||||
// Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").
|
||||
// Note:- paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.
|
||||
stripClass = getParam(ed, "paste_strip_class_attributes");
|
||||
|
||||
if (stripClass !== "none") {
|
||||
function removeClasses(match, g1) {
|
||||
if (stripClass === "all")
|
||||
return '';
|
||||
|
||||
var cls = grep(explode(g1.replace(/^(["'])(.*)\1$/, "$2"), " "),
|
||||
function(v) {
|
||||
return (/^(?!mso)/i.test(v));
|
||||
}
|
||||
);
|
||||
|
||||
return cls.length ? ' class="' + cls.join(" ") + '"' : '';
|
||||
};
|
||||
|
||||
h = h.replace(/ class="([^"]+)"/gi, removeClasses);
|
||||
h = h.replace(/ class=([\-\w]+)/gi, removeClasses);
|
||||
}
|
||||
|
||||
// Remove spans option
|
||||
if (getParam(ed, "paste_remove_spans")) {
|
||||
h = h.replace(/<\/?span[^>]*>/gi, "");
|
||||
}
|
||||
|
||||
//console.log('After preprocess:' + h);
|
||||
|
||||
o.content = h;
|
||||
},
|
||||
|
||||
/**
|
||||
* Various post process items.
|
||||
*/
|
||||
_postProcess : function(pl, o) {
|
||||
var t = this, ed = t.editor, dom = ed.dom, styleProps;
|
||||
|
||||
if (ed.settings.paste_enable_default_filters == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (o.wordContent) {
|
||||
// Remove named anchors or TOC links
|
||||
each(dom.select('a', o.node), function(a) {
|
||||
if (!a.href || a.href.indexOf('#_Toc') != -1)
|
||||
dom.remove(a, 1);
|
||||
});
|
||||
|
||||
if (getParam(ed, "paste_convert_middot_lists")) {
|
||||
t._convertLists(pl, o);
|
||||
}
|
||||
|
||||
// Process styles
|
||||
styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties
|
||||
|
||||
// Process only if a string was specified and not equal to "all" or "*"
|
||||
if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) {
|
||||
styleProps = tinymce.explode(styleProps.replace(/^none$/i, ""));
|
||||
|
||||
// Retains some style properties
|
||||
each(dom.select('*', o.node), function(el) {
|
||||
var newStyle = {}, npc = 0, i, sp, sv;
|
||||
|
||||
// Store a subset of the existing styles
|
||||
if (styleProps) {
|
||||
for (i = 0; i < styleProps.length; i++) {
|
||||
sp = styleProps[i];
|
||||
sv = dom.getStyle(el, sp);
|
||||
|
||||
if (sv) {
|
||||
newStyle[sp] = sv;
|
||||
npc++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all of the existing styles
|
||||
dom.setAttrib(el, 'style', '');
|
||||
|
||||
if (styleProps && npc > 0)
|
||||
dom.setStyles(el, newStyle); // Add back the stored subset of styles
|
||||
else // Remove empty span tags that do not have class attributes
|
||||
if (el.nodeName == 'SPAN' && !el.className)
|
||||
dom.remove(el, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all style information or only specifically on WebKit to avoid the style bug on that browser
|
||||
if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
|
||||
each(dom.select('*[style]', o.node), function(el) {
|
||||
el.removeAttribute('style');
|
||||
el.removeAttribute('data-mce-style');
|
||||
});
|
||||
} else {
|
||||
if (tinymce.isWebKit) {
|
||||
// We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." />
|
||||
// Removing the mce_style that contains the real value will force the Serializer engine to compress the styles
|
||||
each(dom.select('*', o.node), function(el) {
|
||||
el.removeAttribute('data-mce-style');
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Converts the most common bullet and number formats in Office into a real semantic UL/LI list.
|
||||
*/
|
||||
_convertLists : function(pl, o) {
|
||||
var dom = pl.editor.dom, listElm, li, lastMargin = -1, margin, levels = [], lastType, html;
|
||||
|
||||
// Convert middot lists into real semantic lists
|
||||
each(dom.select('p', o.node), function(p) {
|
||||
var sib, val = '', type, html, idx, parents;
|
||||
|
||||
// Get text node value at beginning of paragraph
|
||||
for (sib = p.firstChild; sib && sib.nodeType == 3; sib = sib.nextSibling)
|
||||
val += sib.nodeValue;
|
||||
|
||||
val = p.innerHTML.replace(/<\/?\w+[^>]*>/gi, '').replace(/ /g, '\u00a0');
|
||||
|
||||
// Detect unordered lists look for bullets
|
||||
if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(val))
|
||||
type = 'ul';
|
||||
|
||||
// Detect ordered lists 1., a. or ixv.
|
||||
if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(val))
|
||||
type = 'ol';
|
||||
|
||||
// Check if node value matches the list pattern: o
|
||||
if (type) {
|
||||
margin = parseFloat(p.style.marginLeft || 0);
|
||||
|
||||
if (margin > lastMargin)
|
||||
levels.push(margin);
|
||||
|
||||
if (!listElm || type != lastType) {
|
||||
listElm = dom.create(type);
|
||||
dom.insertAfter(listElm, p);
|
||||
} else {
|
||||
// Nested list element
|
||||
if (margin > lastMargin) {
|
||||
listElm = li.appendChild(dom.create(type));
|
||||
} else if (margin < lastMargin) {
|
||||
// Find parent level based on margin value
|
||||
idx = tinymce.inArray(levels, margin);
|
||||
parents = dom.getParents(listElm.parentNode, type);
|
||||
listElm = parents[parents.length - 1 - idx] || listElm;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove middot or number spans if they exists
|
||||
each(dom.select('span', p), function(span) {
|
||||
var html = span.innerHTML.replace(/<\/?\w+[^>]*>/gi, '');
|
||||
|
||||
// Remove span with the middot or the number
|
||||
if (type == 'ul' && /^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(html))
|
||||
dom.remove(span);
|
||||
else if (/^__MCE_ITEM__[\s\S]*\w+\.( |\u00a0)*\s*/.test(html))
|
||||
dom.remove(span);
|
||||
});
|
||||
|
||||
html = p.innerHTML;
|
||||
|
||||
// Remove middot/list items
|
||||
if (type == 'ul')
|
||||
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*( |\u00a0)+\s*/, '');
|
||||
else
|
||||
html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.( |\u00a0)+\s*/, '');
|
||||
|
||||
// Create li and add paragraph data into the new li
|
||||
li = listElm.appendChild(dom.create('li', 0, html));
|
||||
dom.remove(p);
|
||||
|
||||
lastMargin = margin;
|
||||
lastType = type;
|
||||
} else
|
||||
listElm = lastMargin = 0; // End list element
|
||||
});
|
||||
|
||||
// Remove any left over makers
|
||||
html = o.node.innerHTML;
|
||||
if (html.indexOf('__MCE_ITEM__') != -1)
|
||||
o.node.innerHTML = html.replace(/__MCE_ITEM__/g, '');
|
||||
},
|
||||
|
||||
/**
|
||||
* Inserts the specified contents at the caret position.
|
||||
*/
|
||||
_insert : function(h, skip_undo) {
|
||||
var ed = this.editor, r = ed.selection.getRng();
|
||||
|
||||
// First delete the contents seems to work better on WebKit when the selection spans multiple list items or multiple table cells.
|
||||
if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer)
|
||||
ed.getDoc().execCommand('Delete', false, null);
|
||||
|
||||
ed.execCommand('mceInsertContent', false, h, {skip_undo : skip_undo});
|
||||
},
|
||||
|
||||
/**
|
||||
* Instead of the old plain text method which tried to re-create a paste operation, the
|
||||
* new approach adds a plain text mode toggle switch that changes the behavior of paste.
|
||||
* This function is passed the same input that the regular paste plugin produces.
|
||||
* It performs additional scrubbing and produces (and inserts) the plain text.
|
||||
* This approach leverages all of the great existing functionality in the paste
|
||||
* plugin, and requires minimal changes to add the new functionality.
|
||||
* Speednet - June 2009
|
||||
*/
|
||||
_insertPlainText : function(content) {
|
||||
var ed = this.editor,
|
||||
linebr = getParam(ed, "paste_text_linebreaktype"),
|
||||
rl = getParam(ed, "paste_text_replacements"),
|
||||
is = tinymce.is;
|
||||
|
||||
function process(items) {
|
||||
each(items, function(v) {
|
||||
if (v.constructor == RegExp)
|
||||
content = content.replace(v, "");
|
||||
else
|
||||
content = content.replace(v[0], v[1]);
|
||||
});
|
||||
};
|
||||
|
||||
if ((typeof(content) === "string") && (content.length > 0)) {
|
||||
// If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line
|
||||
if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(content)) {
|
||||
process([
|
||||
/[\n\r]+/g
|
||||
]);
|
||||
} else {
|
||||
// Otherwise just get rid of carriage returns (only need linefeeds)
|
||||
process([
|
||||
/\r+/g
|
||||
]);
|
||||
}
|
||||
|
||||
process([
|
||||
[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi, "\n\n"], // Block tags get a blank line after them
|
||||
[/<br[^>]*>|<\/tr>/gi, "\n"], // Single linebreak for <br /> tags and table rows
|
||||
[/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"], // Table cells get tabs betweem them
|
||||
/<[a-z!\/?][^>]*>/gi, // Delete all remaining tags
|
||||
[/ /gi, " "], // Convert non-break spaces to regular spaces (remember, *plain text*)
|
||||
[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"] // Cool little RegExp deletes whitespace around linebreak chars.
|
||||
]);
|
||||
|
||||
var maxLinebreaks = Number(getParam(ed, "paste_max_consecutive_linebreaks"));
|
||||
if (maxLinebreaks > -1) {
|
||||
var maxLinebreaksRegex = new RegExp("\n{" + (maxLinebreaks + 1) + ",}", "g");
|
||||
var linebreakReplacement = "";
|
||||
|
||||
while (linebreakReplacement.length < maxLinebreaks) {
|
||||
linebreakReplacement += "\n";
|
||||
}
|
||||
|
||||
process([
|
||||
[maxLinebreaksRegex, linebreakReplacement] // Limit max consecutive linebreaks
|
||||
]);
|
||||
}
|
||||
|
||||
content = ed.dom.decode(tinymce.html.Entities.encodeRaw(content));
|
||||
|
||||
// Perform default or custom replacements
|
||||
if (is(rl, "array")) {
|
||||
process(rl);
|
||||
} else if (is(rl, "string")) {
|
||||
process(new RegExp(rl, "gi"));
|
||||
}
|
||||
|
||||
// Treat paragraphs as specified in the config
|
||||
if (linebr == "none") {
|
||||
// Convert all line breaks to space
|
||||
process([
|
||||
[/\n+/g, " "]
|
||||
]);
|
||||
} else if (linebr == "br") {
|
||||
// Convert all line breaks to <br />
|
||||
process([
|
||||
[/\n/g, "<br />"]
|
||||
]);
|
||||
} else if (linebr == "p") {
|
||||
// Convert all line breaks to <p>...</p>
|
||||
process([
|
||||
[/\n+/g, "</p><p>"],
|
||||
[/^(.*<\/p>)(<p>)$/, '<p>$1']
|
||||
]);
|
||||
} else {
|
||||
// defaults to "combined"
|
||||
// Convert single line breaks to <br /> and double line breaks to <p>...</p>
|
||||
process([
|
||||
[/\n\n/g, "</p><p>"],
|
||||
[/^(.*<\/p>)(<p>)$/, '<p>$1'],
|
||||
[/\n/g, "<br />"]
|
||||
]);
|
||||
}
|
||||
|
||||
ed.execCommand('mceInsertContent', false, content);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine.
|
||||
*/
|
||||
_legacySupport : function() {
|
||||
var t = this, ed = t.editor;
|
||||
|
||||
// Register command(s) for backwards compatibility
|
||||
ed.addCommand("mcePasteWord", function() {
|
||||
ed.windowManager.open({
|
||||
file: t.url + "/pasteword.htm",
|
||||
width: parseInt(getParam(ed, "paste_dialog_width")),
|
||||
height: parseInt(getParam(ed, "paste_dialog_height")),
|
||||
inline: 1
|
||||
});
|
||||
});
|
||||
|
||||
if (getParam(ed, "paste_text_use_dialog")) {
|
||||
ed.addCommand("mcePasteText", function() {
|
||||
ed.windowManager.open({
|
||||
file : t.url + "/pastetext.htm",
|
||||
width: parseInt(getParam(ed, "paste_dialog_width")),
|
||||
height: parseInt(getParam(ed, "paste_dialog_height")),
|
||||
inline : 1
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Register button for backwards compatibility
|
||||
ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"});
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add("paste", tinymce.plugins.PastePlugin);
|
||||
})();
|
36
wp-includes/js/tinymce/plugins/paste/js/pastetext.js
Normal file
@ -0,0 +1,36 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var PasteTextDialog = {
|
||||
init : function() {
|
||||
this.resize();
|
||||
},
|
||||
|
||||
insert : function() {
|
||||
var h = tinyMCEPopup.dom.encode(document.getElementById('content').value), lines;
|
||||
|
||||
// Convert linebreaks into paragraphs
|
||||
if (document.getElementById('linebreaks').checked) {
|
||||
lines = h.split(/\r?\n/);
|
||||
if (lines.length > 1) {
|
||||
h = '';
|
||||
tinymce.each(lines, function(row) {
|
||||
h += '<p>' + row + '</p>';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h});
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
resize : function() {
|
||||
var vp = tinyMCEPopup.dom.getViewPort(window), el;
|
||||
|
||||
el = document.getElementById('content');
|
||||
|
||||
el.style.width = (vp.w - 20) + 'px';
|
||||
el.style.height = (vp.h - 90) + 'px';
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.onInit.add(PasteTextDialog.init, PasteTextDialog);
|
51
wp-includes/js/tinymce/plugins/paste/js/pasteword.js
Normal file
@ -0,0 +1,51 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
|
||||
var PasteWordDialog = {
|
||||
init : function() {
|
||||
var ed = tinyMCEPopup.editor, el = document.getElementById('iframecontainer'), ifr, doc, css, cssHTML = '';
|
||||
|
||||
// Create iframe
|
||||
el.innerHTML = '<iframe id="iframe" src="javascript:\'\';" frameBorder="0" style="border: 1px solid gray"></iframe>';
|
||||
ifr = document.getElementById('iframe');
|
||||
doc = ifr.contentWindow.document;
|
||||
|
||||
// Force absolute CSS urls
|
||||
css = [ed.baseURI.toAbsolute("themes/" + ed.settings.theme + "/skins/" + ed.settings.skin + "/content.css")];
|
||||
css = css.concat(tinymce.explode(ed.settings.content_css) || []);
|
||||
tinymce.each(css, function(u) {
|
||||
cssHTML += '<link href="' + ed.documentBaseURI.toAbsolute('' + u) + '" rel="stylesheet" type="text/css" />';
|
||||
});
|
||||
|
||||
// Write content into iframe
|
||||
doc.open();
|
||||
doc.write('<html><head>' + cssHTML + '</head><body class="mceContentBody" spellcheck="false"></body></html>');
|
||||
doc.close();
|
||||
|
||||
doc.designMode = 'on';
|
||||
this.resize();
|
||||
|
||||
window.setTimeout(function() {
|
||||
ifr.contentWindow.focus();
|
||||
}, 10);
|
||||
},
|
||||
|
||||
insert : function() {
|
||||
var h = document.getElementById('iframe').contentWindow.document.body.innerHTML;
|
||||
|
||||
tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : h, wordContent : true});
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
resize : function() {
|
||||
var vp = tinyMCEPopup.dom.getViewPort(window), el;
|
||||
|
||||
el = document.getElementById('iframe');
|
||||
|
||||
if (el) {
|
||||
el.style.width = (vp.w - 20) + 'px';
|
||||
el.style.height = (vp.h - 90) + 'px';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
tinyMCEPopup.onInit.add(PasteWordDialog.init, PasteWordDialog);
|
27
wp-includes/js/tinymce/plugins/paste/pastetext.htm
Normal file
@ -0,0 +1,27 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#paste.paste_text_desc}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js?ver=358-20121205"></script>
|
||||
<script type="text/javascript" src="js/pastetext.js?ver=358-20121205"></script>
|
||||
</head>
|
||||
<body onresize="PasteTextDialog.resize();" style="display:none; overflow:hidden;">
|
||||
<form name="source" onsubmit="return PasteTextDialog.insert();" action="#">
|
||||
<div style="float: left" class="title">{#paste.paste_text_desc}</div>
|
||||
|
||||
<div style="float: right">
|
||||
<input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{#paste_dlg.text_linebreaks}</label>
|
||||
</div>
|
||||
|
||||
<br style="clear: both" />
|
||||
|
||||
<div>{#paste_dlg.text_title}</div>
|
||||
|
||||
<textarea id="content" name="content" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft" class="mceFocus"></textarea>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" name="insert" value="{#insert}" id="insert" />
|
||||
<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
21
wp-includes/js/tinymce/plugins/paste/pasteword.htm
Normal file
@ -0,0 +1,21 @@
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>{#paste.paste_word_desc}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js?ver=358-20121205"></script>
|
||||
<script type="text/javascript" src="js/pasteword.js?ver=358-20121205"></script>
|
||||
</head>
|
||||
<body onresize="PasteWordDialog.resize();" style="display:none; overflow:hidden;">
|
||||
<form name="source" onsubmit="return PasteWordDialog.insert();" action="#">
|
||||
<div class="title">{#paste.paste_word_desc}</div>
|
||||
|
||||
<div>{#paste_dlg.word_title}</div>
|
||||
|
||||
<div id="iframecontainer"></div>
|
||||
|
||||
<div class="mceActionPanel">
|
||||
<input type="submit" id="insert" name="insert" value="{#insert}" />
|
||||
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
33
wp-includes/js/tinymce/plugins/spellchecker/changelog.txt
Normal file
@ -0,0 +1,33 @@
|
||||
Version 2.0.6 (2011-09-29)
|
||||
Fixed incorrect position of suggestion menu.
|
||||
Fixed handling of mispelled words with no suggestions in PSpellShell engine.
|
||||
Fixed PSpellShell command on Windows.
|
||||
Fixed bug where Javascript error is produced when enchant_dict_suggest() returns unexpected result.
|
||||
Version 2.0.5 (2011-03-24)
|
||||
Merged with the latest TinyMCE spellchecker version.
|
||||
Version 2.0.4 (2010-12-20)
|
||||
Fixed issue with the JSON class not having the correct number of parameters to ord calls.
|
||||
Version 2.0.3 (2010-04-19)
|
||||
Added standalone support. Will use native spellchecker for supported browsers.
|
||||
Added @package phpdoc comments. Patch contributed by Jacob Santos.
|
||||
Fixed some PHP missing function issue.
|
||||
Version 2.0.2 (2008-04-30)
|
||||
Added new EnchantSpell engine class contributed by Michel Weimerskirch.
|
||||
Added new general.remote_rpc_url option, enables you to proxy requests to another server.
|
||||
Fixed security hole in PSpellShell.php file if PSpellShell engine was used.
|
||||
Version 2.0.1 (2008-03-07)
|
||||
Fixed bug where spellchecker was auto focusing the editor in IE.
|
||||
Version 2.0 (2008-01-30)
|
||||
Fixed bug where the suggestions menu was placed at an incorrect location.
|
||||
Version 2.0rc1 (2008-01-14)
|
||||
Moved package from beta to release candidate.
|
||||
Version 2.0b3 (2007-12-xx)
|
||||
Fixed bug where the suggestions menu could appear at the wrong location.
|
||||
Version 2.0b2 (2007-11-29)
|
||||
Fixed bug where the spellchecker was removing the word when it was ignored.
|
||||
Version 2.0b1 (2007-11-21)
|
||||
Moved spellchecker from alpha to beta status.
|
||||
Version 2.0a2 (2007-11-13)
|
||||
Updated plugin so it works correctly with the TinyMCE 3.0a3 version.
|
||||
Version 2.0a1 (2007-11-01)
|
||||
Rewritten version for TinyMCE 3.0 this new version uses JSON RPC.
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* This class was contributed by Michel Weimerskirch.
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class EnchantSpell extends SpellChecker {
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
|
||||
* @param Array $words Array of words to check.
|
||||
* @return Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
$r = enchant_broker_init();
|
||||
|
||||
if (enchant_broker_dict_exists($r,$lang)) {
|
||||
$d = enchant_broker_request_dict($r, $lang);
|
||||
|
||||
$returnData = array();
|
||||
foreach($words as $key => $value) {
|
||||
$correct = enchant_dict_check($d, $value);
|
||||
if(!$correct) {
|
||||
$returnData[] = trim($value);
|
||||
}
|
||||
}
|
||||
|
||||
return $returnData;
|
||||
enchant_broker_free_dict($d);
|
||||
} else {
|
||||
|
||||
}
|
||||
enchant_broker_free($r);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions for a specific word.
|
||||
*
|
||||
* @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
|
||||
* @param String $word Specific word to get suggestions for.
|
||||
* @return Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
$r = enchant_broker_init();
|
||||
|
||||
if (enchant_broker_dict_exists($r,$lang)) {
|
||||
$d = enchant_broker_request_dict($r, $lang);
|
||||
$suggs = enchant_dict_suggest($d, $word);
|
||||
|
||||
// enchant_dict_suggest() sometimes returns NULL
|
||||
if (!is_array($suggs))
|
||||
$suggs = array();
|
||||
|
||||
enchant_broker_free_dict($d);
|
||||
} else {
|
||||
$suggs = array();
|
||||
}
|
||||
|
||||
enchant_broker_free($r);
|
||||
|
||||
return $suggs;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class GoogleSpell extends SpellChecker {
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {Array} $words Array of words to spellcheck.
|
||||
* @return {Array} Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
$wordstr = implode(' ', $words);
|
||||
$matches = $this->_getMatches($lang, $wordstr);
|
||||
$words = array();
|
||||
|
||||
for ($i=0; $i<count($matches); $i++)
|
||||
$words[] = $this->_unhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8"));
|
||||
|
||||
return $words;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions of for a specific word.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {String} $word Specific word to get suggestions for.
|
||||
* @return {Array} Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
$sug = array();
|
||||
$osug = array();
|
||||
$matches = $this->_getMatches($lang, $word);
|
||||
|
||||
if (count($matches) > 0)
|
||||
$sug = explode("\t", utf8_encode($this->_unhtmlentities($matches[0][4])));
|
||||
|
||||
// Remove empty
|
||||
foreach ($sug as $item) {
|
||||
if ($item)
|
||||
$osug[] = $item;
|
||||
}
|
||||
|
||||
return $osug;
|
||||
}
|
||||
|
||||
protected function &_getMatches($lang, $str) {
|
||||
$lang = preg_replace('/[^a-z\-]/i', '', $lang);
|
||||
$str = preg_replace('/[\x00-\x1F\x7F]/', '', $str);
|
||||
$server = "www.google.com";
|
||||
$port = 443;
|
||||
$path = "/tbproxy/spell?lang=" . $lang . "&hl=en";
|
||||
$host = "www.google.com";
|
||||
$url = "https://" . $server;
|
||||
|
||||
// Setup XML request
|
||||
$xml = '<?xml version="1.0" encoding="utf-8" ?><spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1"><text>' . $str . '</text></spellrequest>';
|
||||
|
||||
$header = "POST ".$path." HTTP/1.0 \r\n";
|
||||
$header .= "MIME-Version: 1.0 \r\n";
|
||||
$header .= "Content-type: application/PTI26 \r\n";
|
||||
$header .= "Content-length: ".strlen($xml)." \r\n";
|
||||
$header .= "Content-transfer-encoding: text \r\n";
|
||||
$header .= "Request-number: 1 \r\n";
|
||||
$header .= "Document-type: Request \r\n";
|
||||
$header .= "Interface-Version: Test 1.4 \r\n";
|
||||
$header .= "Connection: close \r\n\r\n";
|
||||
$header .= $xml;
|
||||
|
||||
// Use curl if it exists
|
||||
if (function_exists('curl_init')) {
|
||||
// Use curl
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL,$url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
$xml = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
} else {
|
||||
// Use raw sockets
|
||||
$fp = fsockopen("ssl://" . $server, $port, $errno, $errstr, 30);
|
||||
if ($fp) {
|
||||
// Send request
|
||||
fwrite($fp, $header);
|
||||
|
||||
// Read response
|
||||
$xml = "";
|
||||
while (!feof($fp))
|
||||
$xml .= fgets($fp, 128);
|
||||
|
||||
fclose($fp);
|
||||
} else
|
||||
echo "Could not open SSL connection to google.";
|
||||
}
|
||||
|
||||
// Grab and parse content
|
||||
$matches = array();
|
||||
preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
|
||||
|
||||
return $matches;
|
||||
}
|
||||
|
||||
protected function _unhtmlentities($string) {
|
||||
$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
|
||||
$string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
|
||||
|
||||
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
|
||||
$trans_tbl = array_flip($trans_tbl);
|
||||
|
||||
return strtr($string, $trans_tbl);
|
||||
}
|
||||
}
|
||||
|
||||
// Patch in multibyte support
|
||||
if (!function_exists('mb_substr')) {
|
||||
function mb_substr($str, $start, $len = '', $encoding="UTF-8"){
|
||||
$limit = strlen($str);
|
||||
|
||||
for ($s = 0; $start > 0;--$start) {// found the real start
|
||||
if ($s >= $limit)
|
||||
break;
|
||||
|
||||
if ($str[$s] <= "\x7F")
|
||||
++$s;
|
||||
else {
|
||||
++$s; // skip length
|
||||
|
||||
while ($str[$s] >= "\x80" && $str[$s] <= "\xBF")
|
||||
++$s;
|
||||
}
|
||||
}
|
||||
|
||||
if ($len == '')
|
||||
return substr($str, $s);
|
||||
else
|
||||
for ($e = $s; $len > 0; --$len) {//found the real end
|
||||
if ($e >= $limit)
|
||||
break;
|
||||
|
||||
if ($str[$e] <= "\x7F")
|
||||
++$e;
|
||||
else {
|
||||
++$e;//skip length
|
||||
|
||||
while ($str[$e] >= "\x80" && $str[$e] <= "\xBF" && $e < $limit)
|
||||
++$e;
|
||||
}
|
||||
}
|
||||
|
||||
return substr($str, $s, $e - $s);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class PSpell extends SpellChecker {
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {Array} $words Array of words to spellcheck.
|
||||
* @return {Array} Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
$plink = $this->_getPLink($lang);
|
||||
|
||||
$outWords = array();
|
||||
foreach ($words as $word) {
|
||||
if (!pspell_check($plink, trim($word)))
|
||||
$outWords[] = utf8_encode($word);
|
||||
}
|
||||
|
||||
return $outWords;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions of for a specific word.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {String} $word Specific word to get suggestions for.
|
||||
* @return {Array} Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
$words = pspell_suggest($this->_getPLink($lang), $word);
|
||||
|
||||
for ($i=0; $i<count($words); $i++)
|
||||
$words[$i] = utf8_encode($words[$i]);
|
||||
|
||||
return $words;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a link for pspell.
|
||||
*/
|
||||
function &_getPLink($lang) {
|
||||
// Check for native PSpell support
|
||||
if (!function_exists("pspell_new"))
|
||||
$this->throwError("PSpell support not found in PHP installation.");
|
||||
|
||||
// Setup PSpell link
|
||||
$plink = pspell_new(
|
||||
$lang,
|
||||
$this->_config['PSpell.spelling'],
|
||||
$this->_config['PSpell.jargon'],
|
||||
$this->_config['PSpell.encoding'],
|
||||
$this->_config['PSpell.mode']
|
||||
);
|
||||
|
||||
// Setup PSpell link
|
||||
/* if (!$plink) {
|
||||
$pspellConfig = pspell_config_create(
|
||||
$lang,
|
||||
$this->_config['PSpell.spelling'],
|
||||
$this->_config['PSpell.jargon'],
|
||||
$this->_config['PSpell.encoding']
|
||||
);
|
||||
|
||||
$plink = pspell_new_config($pspell_config);
|
||||
}*/
|
||||
|
||||
if (!$plink)
|
||||
$this->throwError("No PSpell link found opened.");
|
||||
|
||||
return $plink;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class PSpellShell extends SpellChecker {
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {Array} $words Array of words to spellcheck.
|
||||
* @return {Array} Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
$cmd = $this->_getCMD($lang);
|
||||
|
||||
if ($fh = fopen($this->_tmpfile, "w")) {
|
||||
fwrite($fh, "!\n");
|
||||
|
||||
foreach($words as $key => $value)
|
||||
fwrite($fh, "^" . $value . "\n");
|
||||
|
||||
fclose($fh);
|
||||
} else
|
||||
$this->throwError("PSpell support was not found.");
|
||||
|
||||
$data = shell_exec($cmd);
|
||||
@unlink($this->_tmpfile);
|
||||
|
||||
$returnData = array();
|
||||
$dataArr = preg_split("/[\r\n]/", $data, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
foreach ($dataArr as $dstr) {
|
||||
$matches = array();
|
||||
|
||||
// Skip this line.
|
||||
if ($dstr[0] == "@")
|
||||
continue;
|
||||
|
||||
preg_match("/(\&|#) ([^ ]+) .*/i", $dstr, $matches);
|
||||
|
||||
if (!empty($matches[2]))
|
||||
$returnData[] = utf8_encode(trim($matches[2]));
|
||||
}
|
||||
|
||||
return $returnData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions of for a specific word.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {String} $word Specific word to get suggestions for.
|
||||
* @return {Array} Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
$cmd = $this->_getCMD($lang);
|
||||
|
||||
if (function_exists("mb_convert_encoding"))
|
||||
$word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8"));
|
||||
else
|
||||
$word = utf8_encode($word);
|
||||
|
||||
if ($fh = fopen($this->_tmpfile, "w")) {
|
||||
fwrite($fh, "!\n");
|
||||
fwrite($fh, "^$word\n");
|
||||
fclose($fh);
|
||||
} else
|
||||
$this->throwError("Error opening tmp file.");
|
||||
|
||||
$data = shell_exec($cmd);
|
||||
@unlink($this->_tmpfile);
|
||||
|
||||
$returnData = array();
|
||||
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
foreach($dataArr as $dstr) {
|
||||
$matches = array();
|
||||
|
||||
// Skip this line.
|
||||
if ($dstr[0] == "@")
|
||||
continue;
|
||||
|
||||
preg_match("/\&[^:]+:(.*)/i", $dstr, $matches);
|
||||
|
||||
if (!empty($matches[1])) {
|
||||
$words = array_slice(explode(',', $matches[1]), 0, 10);
|
||||
|
||||
for ($i=0; $i<count($words); $i++)
|
||||
$words[$i] = trim($words[$i]);
|
||||
|
||||
return $words;
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
function _getCMD($lang) {
|
||||
$this->_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell");
|
||||
|
||||
$file = $this->_tmpfile;
|
||||
$lang = preg_replace("/[^-_a-z]/", "", strtolower($lang));
|
||||
$bin = $this->_config['PSpellShell.aspell'];
|
||||
|
||||
if (preg_match("#win#i", php_uname()))
|
||||
return "$bin -a --lang=$lang --encoding=utf-8 -H < $file 2>&1";
|
||||
|
||||
return "cat $file | $bin -a --lang=$lang --encoding=utf-8 -H";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
class SpellChecker {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param $config Configuration name/value array.
|
||||
*/
|
||||
function SpellChecker(&$config) {
|
||||
$this->_config = $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple loopback function everything that gets in will be send back.
|
||||
*
|
||||
* @param $args.. Arguments.
|
||||
* @return {Array} Array of all input arguments.
|
||||
*/
|
||||
function &loopback(/* args.. */) {
|
||||
return func_get_args();
|
||||
}
|
||||
|
||||
/**
|
||||
* Spellchecks an array of words.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {Array} $words Array of words to spellcheck.
|
||||
* @return {Array} Array of misspelled words.
|
||||
*/
|
||||
function &checkWords($lang, $words) {
|
||||
return $words;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns suggestions of for a specific word.
|
||||
*
|
||||
* @param {String} $lang Language code like sv or en.
|
||||
* @param {String} $word Specific word to get suggestions for.
|
||||
* @return {Array} Array of suggestions for the specified word.
|
||||
*/
|
||||
function &getSuggestions($lang, $word) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws an error message back to the user. This will stop all execution.
|
||||
*
|
||||
* @param {String} $str Message to send back to user.
|
||||
*/
|
||||
function throwError($str) {
|
||||
die('{"result":null,"id":null,"error":{"errstr":"' . addslashes($str) . '","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,595 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: JSON.php 40 2007-06-18 11:43:15Z spocke $
|
||||
*
|
||||
* @package MCManager.utils
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
define('JSON_BOOL', 1);
|
||||
define('JSON_INT', 2);
|
||||
define('JSON_STR', 3);
|
||||
define('JSON_FLOAT', 4);
|
||||
define('JSON_NULL', 5);
|
||||
define('JSON_START_OBJ', 6);
|
||||
define('JSON_END_OBJ', 7);
|
||||
define('JSON_START_ARRAY', 8);
|
||||
define('JSON_END_ARRAY', 9);
|
||||
define('JSON_KEY', 10);
|
||||
define('JSON_SKIP', 11);
|
||||
|
||||
define('JSON_IN_ARRAY', 30);
|
||||
define('JSON_IN_OBJECT', 40);
|
||||
define('JSON_IN_BETWEEN', 50);
|
||||
|
||||
class Moxiecode_JSONReader {
|
||||
var $_data, $_len, $_pos;
|
||||
var $_value, $_token;
|
||||
var $_location, $_lastLocations;
|
||||
var $_needProp;
|
||||
|
||||
function Moxiecode_JSONReader($data) {
|
||||
$this->_data = $data;
|
||||
$this->_len = strlen($data);
|
||||
$this->_pos = -1;
|
||||
$this->_location = JSON_IN_BETWEEN;
|
||||
$this->_lastLocations = array();
|
||||
$this->_needProp = false;
|
||||
}
|
||||
|
||||
function getToken() {
|
||||
return $this->_token;
|
||||
}
|
||||
|
||||
function getLocation() {
|
||||
return $this->_location;
|
||||
}
|
||||
|
||||
function getTokenName() {
|
||||
switch ($this->_token) {
|
||||
case JSON_BOOL:
|
||||
return 'JSON_BOOL';
|
||||
|
||||
case JSON_INT:
|
||||
return 'JSON_INT';
|
||||
|
||||
case JSON_STR:
|
||||
return 'JSON_STR';
|
||||
|
||||
case JSON_FLOAT:
|
||||
return 'JSON_FLOAT';
|
||||
|
||||
case JSON_NULL:
|
||||
return 'JSON_NULL';
|
||||
|
||||
case JSON_START_OBJ:
|
||||
return 'JSON_START_OBJ';
|
||||
|
||||
case JSON_END_OBJ:
|
||||
return 'JSON_END_OBJ';
|
||||
|
||||
case JSON_START_ARRAY:
|
||||
return 'JSON_START_ARRAY';
|
||||
|
||||
case JSON_END_ARRAY:
|
||||
return 'JSON_END_ARRAY';
|
||||
|
||||
case JSON_KEY:
|
||||
return 'JSON_KEY';
|
||||
}
|
||||
|
||||
return 'UNKNOWN';
|
||||
}
|
||||
|
||||
function getValue() {
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
function readToken() {
|
||||
$chr = $this->read();
|
||||
|
||||
if ($chr != null) {
|
||||
switch ($chr) {
|
||||
case '[':
|
||||
$this->_lastLocation[] = $this->_location;
|
||||
$this->_location = JSON_IN_ARRAY;
|
||||
$this->_token = JSON_START_ARRAY;
|
||||
$this->_value = null;
|
||||
$this->readAway();
|
||||
return true;
|
||||
|
||||
case ']':
|
||||
$this->_location = array_pop($this->_lastLocation);
|
||||
$this->_token = JSON_END_ARRAY;
|
||||
$this->_value = null;
|
||||
$this->readAway();
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
|
||||
case '{':
|
||||
$this->_lastLocation[] = $this->_location;
|
||||
$this->_location = JSON_IN_OBJECT;
|
||||
$this->_needProp = true;
|
||||
$this->_token = JSON_START_OBJ;
|
||||
$this->_value = null;
|
||||
$this->readAway();
|
||||
return true;
|
||||
|
||||
case '}':
|
||||
$this->_location = array_pop($this->_lastLocation);
|
||||
$this->_token = JSON_END_OBJ;
|
||||
$this->_value = null;
|
||||
$this->readAway();
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
|
||||
// String
|
||||
case '"':
|
||||
case '\'':
|
||||
return $this->_readString($chr);
|
||||
|
||||
// Null
|
||||
case 'n':
|
||||
return $this->_readNull();
|
||||
|
||||
// Bool
|
||||
case 't':
|
||||
case 'f':
|
||||
return $this->_readBool($chr);
|
||||
|
||||
default:
|
||||
// Is number
|
||||
if (is_numeric($chr) || $chr == '-' || $chr == '.')
|
||||
return $this->_readNumber($chr);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function _readBool($chr) {
|
||||
$this->_token = JSON_BOOL;
|
||||
$this->_value = $chr == 't';
|
||||
|
||||
if ($chr == 't')
|
||||
$this->skip(3); // rue
|
||||
else
|
||||
$this->skip(4); // alse
|
||||
|
||||
$this->readAway();
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _readNull() {
|
||||
$this->_token = JSON_NULL;
|
||||
$this->_value = null;
|
||||
|
||||
$this->skip(3); // ull
|
||||
$this->readAway();
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _readString($quote) {
|
||||
$output = "";
|
||||
$this->_token = JSON_STR;
|
||||
$endString = false;
|
||||
|
||||
while (($chr = $this->peek()) != -1) {
|
||||
switch ($chr) {
|
||||
case '\\':
|
||||
// Read away slash
|
||||
$this->read();
|
||||
|
||||
// Read escape code
|
||||
$chr = $this->read();
|
||||
switch ($chr) {
|
||||
case 't':
|
||||
$output .= "\t";
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
$output .= "\b";
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
$output .= "\f";
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
$output .= "\r";
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
$output .= "\n";
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
$output .= $this->_int2utf8(hexdec($this->read(4)));
|
||||
break;
|
||||
|
||||
default:
|
||||
$output .= $chr;
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
case '"':
|
||||
if ($chr == $quote)
|
||||
$endString = true;
|
||||
|
||||
$chr = $this->read();
|
||||
if ($chr != -1 && $chr != $quote)
|
||||
$output .= $chr;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$output .= $this->read();
|
||||
}
|
||||
|
||||
// String terminated
|
||||
if ($endString)
|
||||
break;
|
||||
}
|
||||
|
||||
$this->readAway();
|
||||
$this->_value = $output;
|
||||
|
||||
// Needed a property
|
||||
if ($this->_needProp) {
|
||||
$this->_token = JSON_KEY;
|
||||
$this->_needProp = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _int2utf8($int) {
|
||||
$int = intval($int);
|
||||
|
||||
switch ($int) {
|
||||
case 0:
|
||||
return chr(0);
|
||||
|
||||
case ($int & 0x7F):
|
||||
return chr($int);
|
||||
|
||||
case ($int & 0x7FF):
|
||||
return chr(0xC0 | (($int >> 6) & 0x1F)) . chr(0x80 | ($int & 0x3F));
|
||||
|
||||
case ($int & 0xFFFF):
|
||||
return chr(0xE0 | (($int >> 12) & 0x0F)) . chr(0x80 | (($int >> 6) & 0x3F)) . chr (0x80 | ($int & 0x3F));
|
||||
|
||||
case ($int & 0x1FFFFF):
|
||||
return chr(0xF0 | ($int >> 18)) . chr(0x80 | (($int >> 12) & 0x3F)) . chr(0x80 | (($int >> 6) & 0x3F)) . chr(0x80 | ($int & 0x3F));
|
||||
}
|
||||
}
|
||||
|
||||
function _readNumber($start) {
|
||||
$value = "";
|
||||
$isFloat = false;
|
||||
|
||||
$this->_token = JSON_INT;
|
||||
$value .= $start;
|
||||
|
||||
while (($chr = $this->peek()) != -1) {
|
||||
if (is_numeric($chr) || $chr == '-' || $chr == '.') {
|
||||
if ($chr == '.')
|
||||
$isFloat = true;
|
||||
|
||||
$value .= $this->read();
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
$this->readAway();
|
||||
|
||||
if ($isFloat) {
|
||||
$this->_token = JSON_FLOAT;
|
||||
$this->_value = floatval($value);
|
||||
} else
|
||||
$this->_value = intval($value);
|
||||
|
||||
if ($this->_location == JSON_IN_OBJECT && !$this->_needProp)
|
||||
$this->_needProp = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function readAway() {
|
||||
while (($chr = $this->peek()) != null) {
|
||||
if ($chr != ':' && $chr != ',' && $chr != ' ')
|
||||
return;
|
||||
|
||||
$this->read();
|
||||
}
|
||||
}
|
||||
|
||||
function read($len = 1) {
|
||||
if ($this->_pos < $this->_len) {
|
||||
if ($len > 1) {
|
||||
$str = substr($this->_data, $this->_pos + 1, $len);
|
||||
$this->_pos += $len;
|
||||
|
||||
return $str;
|
||||
} else
|
||||
return $this->_data[++$this->_pos];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function skip($len) {
|
||||
$this->_pos += $len;
|
||||
}
|
||||
|
||||
function peek() {
|
||||
if ($this->_pos < $this->_len)
|
||||
return $this->_data[$this->_pos + 1];
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class handles JSON stuff.
|
||||
*
|
||||
* @package MCManager.utils
|
||||
*/
|
||||
class Moxiecode_JSON {
|
||||
function Moxiecode_JSON() {
|
||||
}
|
||||
|
||||
function decode($input) {
|
||||
$reader = new Moxiecode_JSONReader($input);
|
||||
|
||||
return $this->readValue($reader);
|
||||
}
|
||||
|
||||
function readValue(&$reader) {
|
||||
$this->data = array();
|
||||
$this->parents = array();
|
||||
$this->cur =& $this->data;
|
||||
$key = null;
|
||||
$loc = JSON_IN_ARRAY;
|
||||
|
||||
while ($reader->readToken()) {
|
||||
switch ($reader->getToken()) {
|
||||
case JSON_STR:
|
||||
case JSON_INT:
|
||||
case JSON_BOOL:
|
||||
case JSON_FLOAT:
|
||||
case JSON_NULL:
|
||||
switch ($reader->getLocation()) {
|
||||
case JSON_IN_OBJECT:
|
||||
$this->cur[$key] = $reader->getValue();
|
||||
break;
|
||||
|
||||
case JSON_IN_ARRAY:
|
||||
$this->cur[] = $reader->getValue();
|
||||
break;
|
||||
|
||||
default:
|
||||
return $reader->getValue();
|
||||
}
|
||||
break;
|
||||
|
||||
case JSON_KEY:
|
||||
$key = $reader->getValue();
|
||||
break;
|
||||
|
||||
case JSON_START_OBJ:
|
||||
case JSON_START_ARRAY:
|
||||
if ($loc == JSON_IN_OBJECT)
|
||||
$this->addArray($key);
|
||||
else
|
||||
$this->addArray(null);
|
||||
|
||||
$cur =& $obj;
|
||||
|
||||
$loc = $reader->getLocation();
|
||||
break;
|
||||
|
||||
case JSON_END_OBJ:
|
||||
case JSON_END_ARRAY:
|
||||
$loc = $reader->getLocation();
|
||||
|
||||
if (count($this->parents) > 0) {
|
||||
$this->cur =& $this->parents[count($this->parents) - 1];
|
||||
array_pop($this->parents);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->data[0];
|
||||
}
|
||||
|
||||
// This method was needed since PHP is crapy and doesn't have pointers/references
|
||||
function addArray($key) {
|
||||
$this->parents[] =& $this->cur;
|
||||
$ar = array();
|
||||
|
||||
if ($key)
|
||||
$this->cur[$key] =& $ar;
|
||||
else
|
||||
$this->cur[] =& $ar;
|
||||
|
||||
$this->cur =& $ar;
|
||||
}
|
||||
|
||||
function getDelim($index, &$reader) {
|
||||
switch ($reader->getLocation()) {
|
||||
case JSON_IN_ARRAY:
|
||||
case JSON_IN_OBJECT:
|
||||
if ($index > 0)
|
||||
return ",";
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
function encode($input) {
|
||||
switch (gettype($input)) {
|
||||
case 'boolean':
|
||||
return $input ? 'true' : 'false';
|
||||
|
||||
case 'integer':
|
||||
return (int) $input;
|
||||
|
||||
case 'float':
|
||||
case 'double':
|
||||
return (float) $input;
|
||||
|
||||
case 'NULL':
|
||||
return 'null';
|
||||
|
||||
case 'string':
|
||||
return $this->encodeString($input);
|
||||
|
||||
case 'array':
|
||||
return $this->_encodeArray($input);
|
||||
|
||||
case 'object':
|
||||
return $this->_encodeArray(get_object_vars($input));
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function encodeString($input) {
|
||||
// Needs to be escaped
|
||||
if (preg_match('/[^a-zA-Z0-9]/', $input)) {
|
||||
$output = '';
|
||||
|
||||
for ($i=0; $i<strlen($input); $i++) {
|
||||
switch ($input[$i]) {
|
||||
case "\b":
|
||||
$output .= "\\b";
|
||||
break;
|
||||
|
||||
case "\t":
|
||||
$output .= "\\t";
|
||||
break;
|
||||
|
||||
case "\f":
|
||||
$output .= "\\f";
|
||||
break;
|
||||
|
||||
case "\r":
|
||||
$output .= "\\r";
|
||||
break;
|
||||
|
||||
case "\n":
|
||||
$output .= "\\n";
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
$output .= "\\\\";
|
||||
break;
|
||||
|
||||
case '\'':
|
||||
$output .= "\\'";
|
||||
break;
|
||||
|
||||
case '"':
|
||||
$output .= '\"';
|
||||
break;
|
||||
|
||||
default:
|
||||
$byte = ord($input[$i]);
|
||||
|
||||
if (($byte & 0xE0) == 0xC0) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]));
|
||||
$i += 1;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} if (($byte & 0xF0) == 0xE0) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]));
|
||||
$i += 2;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} if (($byte & 0xF8) == 0xF0) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]), ord($input[$i + 3]));
|
||||
$i += 3;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} if (($byte & 0xFC) == 0xF8) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]), ord($input[$i + 3]), ord($input[$i + 4]));
|
||||
$i += 4;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} if (($byte & 0xFE) == 0xFC) {
|
||||
$char = pack('C*', $byte, ord($input[$i + 1]), ord($input[$i + 2]), ord($input[$i + 3]), ord($input[$i + 4]), ord($input[$i + 5]));
|
||||
$i += 5;
|
||||
$output .= sprintf('\u%04s', bin2hex($this->_utf82utf16($char)));
|
||||
} else if ($byte < 128)
|
||||
$output .= $input[$i];
|
||||
}
|
||||
}
|
||||
|
||||
return '"' . $output . '"';
|
||||
}
|
||||
|
||||
return '"' . $input . '"';
|
||||
}
|
||||
|
||||
function _utf82utf16($utf8) {
|
||||
if (function_exists('mb_convert_encoding'))
|
||||
return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
|
||||
|
||||
switch (strlen($utf8)) {
|
||||
case 1:
|
||||
return $utf8;
|
||||
|
||||
case 2:
|
||||
return chr(0x07 & (ord($utf8[0]) >> 2)) . chr((0xC0 & (ord($utf8[0]) << 6)) | (0x3F & ord($utf8[1])));
|
||||
|
||||
case 3:
|
||||
return chr((0xF0 & (ord($utf8[0]) << 4)) | (0x0F & (ord($utf8[1]) >> 2))) . chr((0xC0 & (ord($utf8[1]) << 6)) | (0x7F & ord($utf8[2])));
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
function _encodeArray($input) {
|
||||
$output = '';
|
||||
$isIndexed = true;
|
||||
|
||||
$keys = array_keys($input);
|
||||
for ($i=0; $i<count($keys); $i++) {
|
||||
if (!is_int($keys[$i])) {
|
||||
$output .= $this->encodeString($keys[$i]) . ':' . $this->encode($input[$keys[$i]]);
|
||||
$isIndexed = false;
|
||||
} else
|
||||
$output .= $this->encode($input[$keys[$i]]);
|
||||
|
||||
if ($i != count($keys) - 1)
|
||||
$output .= ',';
|
||||
}
|
||||
|
||||
return $isIndexed ? '[' . $output . ']' : '{' . $output . '}';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,268 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: Logger.class.php 10 2007-05-27 10:55:12Z spocke $
|
||||
*
|
||||
* @package MCFileManager.filesystems
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2005, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
// File type contstants
|
||||
define('MC_LOGGER_DEBUG', 0);
|
||||
define('MC_LOGGER_INFO', 10);
|
||||
define('MC_LOGGER_WARN', 20);
|
||||
define('MC_LOGGER_ERROR', 30);
|
||||
define('MC_LOGGER_FATAL', 40);
|
||||
|
||||
/**
|
||||
* Logging utility class. This class handles basic logging with levels, log rotation and custom log formats. It's
|
||||
* designed to be compact but still powerful and flexible.
|
||||
*/
|
||||
class Moxiecode_Logger {
|
||||
// Private fields
|
||||
var $_path;
|
||||
var $_filename;
|
||||
var $_maxSize;
|
||||
var $_maxFiles;
|
||||
var $_maxSizeBytes;
|
||||
var $_level;
|
||||
var $_format;
|
||||
|
||||
/**
|
||||
* Constructs a new logger instance.
|
||||
*/
|
||||
function Moxiecode_Logger() {
|
||||
$this->_path = "";
|
||||
$this->_filename = "{level}.log";
|
||||
$this->setMaxSize("100k");
|
||||
$this->_maxFiles = 10;
|
||||
$this->_level = MC_LOGGER_DEBUG;
|
||||
$this->_format = "[{time}] [{level}] {message}";
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current log level, use the MC_LOGGER constants.
|
||||
*
|
||||
* @param int $level Log level instance for example MC_LOGGER_DEBUG.
|
||||
*/
|
||||
function setLevel($level) {
|
||||
if (is_string($level)) {
|
||||
switch (strtolower($level)) {
|
||||
case "debug":
|
||||
$level = MC_LOGGER_DEBUG;
|
||||
break;
|
||||
|
||||
case "info":
|
||||
$level = MC_LOGGER_INFO;
|
||||
break;
|
||||
|
||||
case "warn":
|
||||
case "warning":
|
||||
$level = MC_LOGGER_WARN;
|
||||
break;
|
||||
|
||||
case "error":
|
||||
$level = MC_LOGGER_ERROR;
|
||||
break;
|
||||
|
||||
case "fatal":
|
||||
$level = MC_LOGGER_FATAL;
|
||||
break;
|
||||
|
||||
default:
|
||||
$level = MC_LOGGER_FATAL;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_level = $level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current log level for example MC_LOGGER_DEBUG.
|
||||
*
|
||||
* @return int Current log level for example MC_LOGGER_DEBUG.
|
||||
*/
|
||||
function getLevel() {
|
||||
return $this->_level;
|
||||
}
|
||||
|
||||
function setPath($path) {
|
||||
$this->_path = $path;
|
||||
}
|
||||
|
||||
function getPath() {
|
||||
return $this->_path;
|
||||
}
|
||||
|
||||
function setFileName($file_name) {
|
||||
$this->_filename = $file_name;
|
||||
}
|
||||
|
||||
function getFileName() {
|
||||
return $this->_filename;
|
||||
}
|
||||
|
||||
function setFormat($format) {
|
||||
$this->_format = $format;
|
||||
}
|
||||
|
||||
function getFormat() {
|
||||
return $this->_format;
|
||||
}
|
||||
|
||||
function setMaxSize($size) {
|
||||
// Fix log max size
|
||||
$logMaxSizeBytes = intval(preg_replace("/[^0-9]/", "", $size));
|
||||
|
||||
// Is KB
|
||||
if (strpos((strtolower($size)), "k") > 0)
|
||||
$logMaxSizeBytes *= 1024;
|
||||
|
||||
// Is MB
|
||||
if (strpos((strtolower($size)), "m") > 0)
|
||||
$logMaxSizeBytes *= (1024 * 1024);
|
||||
|
||||
$this->_maxSizeBytes = $logMaxSizeBytes;
|
||||
$this->_maxSize = $size;
|
||||
}
|
||||
|
||||
function getMaxSize() {
|
||||
return $this->_maxSize;
|
||||
}
|
||||
|
||||
function setMaxFiles($max_files) {
|
||||
$this->_maxFiles = $max_files;
|
||||
}
|
||||
|
||||
function getMaxFiles() {
|
||||
return $this->_maxFiles;
|
||||
}
|
||||
|
||||
function debug($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_DEBUG, implode(', ', $args));
|
||||
}
|
||||
|
||||
function info($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_INFO, implode(', ', $args));
|
||||
}
|
||||
|
||||
function warn($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_WARN, implode(', ', $args));
|
||||
}
|
||||
|
||||
function error($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_ERROR, implode(', ', $args));
|
||||
}
|
||||
|
||||
function fatal($msg) {
|
||||
$args = func_get_args();
|
||||
$this->_logMsg(MC_LOGGER_FATAL, implode(', ', $args));
|
||||
}
|
||||
|
||||
function isDebugEnabled() {
|
||||
return $this->_level >= MC_LOGGER_DEBUG;
|
||||
}
|
||||
|
||||
function isInfoEnabled() {
|
||||
return $this->_level >= MC_LOGGER_INFO;
|
||||
}
|
||||
|
||||
function isWarnEnabled() {
|
||||
return $this->_level >= MC_LOGGER_WARN;
|
||||
}
|
||||
|
||||
function isErrorEnabled() {
|
||||
return $this->_level >= MC_LOGGER_ERROR;
|
||||
}
|
||||
|
||||
function isFatalEnabled() {
|
||||
return $this->_level >= MC_LOGGER_FATAL;
|
||||
}
|
||||
|
||||
function _logMsg($level, $message) {
|
||||
$roll = false;
|
||||
|
||||
if ($level < $this->_level)
|
||||
return;
|
||||
|
||||
$logFile = $this->toOSPath($this->_path . "/" . $this->_filename);
|
||||
|
||||
switch ($level) {
|
||||
case MC_LOGGER_DEBUG:
|
||||
$levelName = "DEBUG";
|
||||
break;
|
||||
|
||||
case MC_LOGGER_INFO:
|
||||
$levelName = "INFO";
|
||||
break;
|
||||
|
||||
case MC_LOGGER_WARN:
|
||||
$levelName = "WARN";
|
||||
break;
|
||||
|
||||
case MC_LOGGER_ERROR:
|
||||
$levelName = "ERROR";
|
||||
break;
|
||||
|
||||
case MC_LOGGER_FATAL:
|
||||
$levelName = "FATAL";
|
||||
break;
|
||||
}
|
||||
|
||||
$logFile = str_replace('{level}', strtolower($levelName), $logFile);
|
||||
|
||||
$text = $this->_format;
|
||||
$text = str_replace('{time}', date("Y-m-d H:i:s"), $text);
|
||||
$text = str_replace('{level}', strtolower($levelName), $text);
|
||||
$text = str_replace('{message}', $message, $text);
|
||||
$message = $text . "\r\n";
|
||||
|
||||
// Check filesize
|
||||
if (file_exists($logFile)) {
|
||||
$size = @filesize($logFile);
|
||||
|
||||
if ($size + strlen($message) > $this->_maxSizeBytes)
|
||||
$roll = true;
|
||||
}
|
||||
|
||||
// Roll if the size is right
|
||||
if ($roll) {
|
||||
for ($i=$this->_maxFiles-1; $i>=1; $i--) {
|
||||
$rfile = $this->toOSPath($logFile . "." . $i);
|
||||
$nfile = $this->toOSPath($logFile . "." . ($i+1));
|
||||
|
||||
if (@file_exists($rfile))
|
||||
@rename($rfile, $nfile);
|
||||
}
|
||||
|
||||
@rename($logFile, $this->toOSPath($logFile . ".1"));
|
||||
|
||||
// Delete last logfile
|
||||
$delfile = $this->toOSPath($logFile . "." . ($this->_maxFiles + 1));
|
||||
if (@file_exists($delfile))
|
||||
@unlink($delfile);
|
||||
}
|
||||
|
||||
// Append log line
|
||||
if (($fp = @fopen($logFile, "a")) != null) {
|
||||
@fputs($fp, $message);
|
||||
@fflush($fp);
|
||||
@fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a Unix path to OS specific path.
|
||||
*
|
||||
* @param String $path Unix path to convert.
|
||||
*/
|
||||
function toOSPath($path) {
|
||||
return str_replace("/", DIRECTORY_SEPARATOR, $path);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
27
wp-includes/js/tinymce/plugins/spellchecker/config.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* config.php
|
||||
*
|
||||
* @package MCManager.includes
|
||||
*/
|
||||
// General settings
|
||||
$config['general.engine'] = 'GoogleSpell';
|
||||
//$config['general.engine'] = 'PSpell';
|
||||
//$config['general.engine'] = 'PSpellShell';
|
||||
//$config['general.remote_rpc_url'] = 'http://some.other.site/some/url/rpc.php';
|
||||
|
||||
// PSpell settings
|
||||
$config['PSpell.mode'] = PSPELL_FAST;
|
||||
$config['PSpell.spelling'] = "";
|
||||
$config['PSpell.jargon'] = "";
|
||||
$config['PSpell.encoding'] = "";
|
||||
|
||||
// PSpellShell settings
|
||||
$config['PSpellShell.mode'] = PSPELL_FAST;
|
||||
$config['PSpellShell.aspell'] = '/usr/bin/aspell';
|
||||
$config['PSpellShell.tmp'] = '/tmp';
|
||||
|
||||
// Windows PSpellShell settings
|
||||
//$config['PSpellShell.aspell'] = '"c:\Program Files\Aspell\bin\aspell.exe"';
|
||||
//$config['PSpellShell.tmp'] = 'c:/temp';
|
||||
?>
|
@ -0,0 +1 @@
|
||||
.mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;}
|
436
wp-includes/js/tinymce/plugins/spellchecker/editor_plugin_src.js
Normal file
@ -0,0 +1,436 @@
|
||||
/**
|
||||
* 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 JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM;
|
||||
|
||||
tinymce.create('tinymce.plugins.SpellcheckerPlugin', {
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Spellchecker',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
},
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this, cm;
|
||||
|
||||
t.url = url;
|
||||
t.editor = ed;
|
||||
t.rpcUrl = ed.getParam("spellchecker_rpc_url", "{backend}");
|
||||
|
||||
if (t.rpcUrl == '{backend}') {
|
||||
// Sniff if the browser supports native spellchecking (Don't know of a better way)
|
||||
if (tinymce.isIE)
|
||||
return;
|
||||
|
||||
t.hasSupport = true;
|
||||
|
||||
// Disable the context menu when spellchecking is active
|
||||
ed.onContextMenu.addToTop(function(ed, e) {
|
||||
if (t.active)
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('mceSpellCheck', function() {
|
||||
if (t.rpcUrl == '{backend}') {
|
||||
// Enable/disable native spellchecker
|
||||
t.editor.getBody().spellcheck = t.active = !t.active;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!t.active) {
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) {
|
||||
if (r.length > 0) {
|
||||
t.active = 1;
|
||||
t._markWords(r);
|
||||
ed.setProgressState(0);
|
||||
ed.nodeChanged();
|
||||
} else {
|
||||
ed.setProgressState(0);
|
||||
|
||||
if (ed.getParam('spellchecker_report_no_misspellings', true))
|
||||
ed.windowManager.alert('spellchecker.no_mpell');
|
||||
}
|
||||
});
|
||||
} else
|
||||
t._done();
|
||||
});
|
||||
|
||||
if (ed.settings.content_css !== false)
|
||||
ed.contentCSS.push(url + '/css/content.css');
|
||||
|
||||
ed.onClick.add(t._showMenu, t);
|
||||
ed.onContextMenu.add(t._showMenu, t);
|
||||
ed.onBeforeGetContent.add(function() {
|
||||
if (t.active)
|
||||
t._removeWords();
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm) {
|
||||
cm.setActive('spellchecker', t.active);
|
||||
});
|
||||
|
||||
ed.onSetContent.add(function() {
|
||||
t._done();
|
||||
});
|
||||
|
||||
ed.onBeforeGetContent.add(function() {
|
||||
t._done();
|
||||
});
|
||||
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd) {
|
||||
if (cmd == 'mceFullScreen')
|
||||
t._done();
|
||||
});
|
||||
|
||||
// Find selected language
|
||||
t.languages = {};
|
||||
each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) {
|
||||
if (k.indexOf('+') === 0) {
|
||||
k = k.substring(1);
|
||||
t.selectedLang = v;
|
||||
}
|
||||
|
||||
t.languages[k] = v;
|
||||
});
|
||||
},
|
||||
|
||||
createControl : function(n, cm) {
|
||||
var t = this, c, ed = t.editor;
|
||||
|
||||
if (n == 'spellchecker') {
|
||||
// Use basic button if we use the native spellchecker
|
||||
if (t.rpcUrl == '{backend}') {
|
||||
// Create simple toggle button if we have native support
|
||||
if (t.hasSupport)
|
||||
c = cm.createButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
|
||||
|
||||
c.onRenderMenu.add(function(c, m) {
|
||||
m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
each(t.languages, function(v, k) {
|
||||
var o = {icon : 1}, mi;
|
||||
|
||||
o.onclick = function() {
|
||||
if (v == t.selectedLang) {
|
||||
return;
|
||||
}
|
||||
mi.setSelected(1);
|
||||
t.selectedItem.setSelected(0);
|
||||
t.selectedItem = mi;
|
||||
t.selectedLang = v;
|
||||
};
|
||||
|
||||
o.title = k;
|
||||
mi = m.add(o);
|
||||
mi.setSelected(v == t.selectedLang);
|
||||
|
||||
if (v == t.selectedLang)
|
||||
t.selectedItem = mi;
|
||||
})
|
||||
});
|
||||
|
||||
return c;
|
||||
}
|
||||
},
|
||||
|
||||
// Internal functions
|
||||
|
||||
_walk : function(n, f) {
|
||||
var d = this.editor.getDoc(), w;
|
||||
|
||||
if (d.createTreeWalker) {
|
||||
w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
|
||||
|
||||
while ((n = w.nextNode()) != null)
|
||||
f.call(this, n);
|
||||
} else
|
||||
tinymce.walk(n, f, 'childNodes');
|
||||
},
|
||||
|
||||
_getSeparators : function() {
|
||||
var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}<7D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\u201d\u201c');
|
||||
|
||||
// Build word separator regexp
|
||||
for (i=0; i<str.length; i++)
|
||||
re += '\\' + str.charAt(i);
|
||||
|
||||
return re;
|
||||
},
|
||||
|
||||
_getWords : function() {
|
||||
var ed = this.editor, wl = [], tx = '', lo = {}, rawWords = [];
|
||||
|
||||
// Get area text
|
||||
this._walk(ed.getBody(), function(n) {
|
||||
if (n.nodeType == 3)
|
||||
tx += n.nodeValue + ' ';
|
||||
});
|
||||
|
||||
// split the text up into individual words
|
||||
if (ed.getParam('spellchecker_word_pattern')) {
|
||||
// look for words that match the pattern
|
||||
rawWords = tx.match('(' + ed.getParam('spellchecker_word_pattern') + ')', 'gi');
|
||||
} else {
|
||||
// Split words by separator
|
||||
tx = tx.replace(new RegExp('([0-9]|[' + this._getSeparators() + '])', 'g'), ' ');
|
||||
tx = tinymce.trim(tx.replace(/(\s+)/g, ' '));
|
||||
rawWords = tx.split(' ');
|
||||
}
|
||||
|
||||
// Build word array and remove duplicates
|
||||
each(rawWords, function(v) {
|
||||
if (!lo[v]) {
|
||||
wl.push(v);
|
||||
lo[v] = 1;
|
||||
}
|
||||
});
|
||||
|
||||
return wl;
|
||||
},
|
||||
|
||||
_removeWords : function(w) {
|
||||
var ed = this.editor, dom = ed.dom, se = ed.selection, r = se.getRng(true);
|
||||
|
||||
each(dom.select('span').reverse(), function(n) {
|
||||
if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) {
|
||||
if (!w || dom.decode(n.innerHTML) == w)
|
||||
dom.remove(n, 1);
|
||||
}
|
||||
});
|
||||
|
||||
se.setRng(r);
|
||||
},
|
||||
|
||||
_markWords : function(wl) {
|
||||
var ed = this.editor, dom = ed.dom, doc = ed.getDoc(), se = ed.selection, r = se.getRng(true), nl = [],
|
||||
w = wl.join('|'), re = this._getSeparators(), rx = new RegExp('(^|[' + re + '])(' + w + ')(?=[' + re + ']|$)', 'g');
|
||||
|
||||
// Collect all text nodes
|
||||
this._walk(ed.getBody(), function(n) {
|
||||
if (n.nodeType == 3) {
|
||||
nl.push(n);
|
||||
}
|
||||
});
|
||||
|
||||
// Wrap incorrect words in spans
|
||||
each(nl, function(n) {
|
||||
var node, elem, txt, pos, v = n.nodeValue;
|
||||
|
||||
if (rx.test(v)) {
|
||||
// Encode the content
|
||||
v = dom.encode(v);
|
||||
// Create container element
|
||||
elem = dom.create('span', {'class' : 'mceItemHidden'});
|
||||
|
||||
// Following code fixes IE issues by creating text nodes
|
||||
// using DOM methods instead of innerHTML.
|
||||
// Bug #3124: <PRE> elements content is broken after spellchecking.
|
||||
// Bug #1408: Preceding whitespace characters are removed
|
||||
// @TODO: I'm not sure that both are still issues on IE9.
|
||||
if (tinymce.isIE) {
|
||||
// Enclose mispelled words with temporal tag
|
||||
v = v.replace(rx, '$1<mcespell>$2</mcespell>');
|
||||
// Loop over the content finding mispelled words
|
||||
while ((pos = v.indexOf('<mcespell>')) != -1) {
|
||||
// Add text node for the content before the word
|
||||
txt = v.substring(0, pos);
|
||||
if (txt.length) {
|
||||
node = doc.createTextNode(dom.decode(txt));
|
||||
elem.appendChild(node);
|
||||
}
|
||||
v = v.substring(pos+10);
|
||||
pos = v.indexOf('</mcespell>');
|
||||
txt = v.substring(0, pos);
|
||||
v = v.substring(pos+11);
|
||||
// Add span element for the word
|
||||
elem.appendChild(dom.create('span', {'class' : 'mceItemHiddenSpellWord'}, txt));
|
||||
}
|
||||
// Add text node for the rest of the content
|
||||
if (v.length) {
|
||||
node = doc.createTextNode(dom.decode(v));
|
||||
elem.appendChild(node);
|
||||
}
|
||||
} else {
|
||||
// Other browsers preserve whitespace characters on innerHTML usage
|
||||
elem.innerHTML = v.replace(rx, '$1<span class="mceItemHiddenSpellWord">$2</span>');
|
||||
}
|
||||
|
||||
// Finally, replace the node with the container
|
||||
dom.replace(elem, n);
|
||||
}
|
||||
});
|
||||
|
||||
se.setRng(r);
|
||||
},
|
||||
|
||||
_showMenu : function(ed, e) {
|
||||
var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin()), wordSpan = e.target;
|
||||
|
||||
e = 0; // Fixes IE memory leak
|
||||
|
||||
if (!m) {
|
||||
m = ed.controlManager.createDropMenu('spellcheckermenu', {'class' : 'mceNoIcons'});
|
||||
t._menu = m;
|
||||
}
|
||||
|
||||
if (dom.hasClass(wordSpan, 'mceItemHiddenSpellWord')) {
|
||||
m.removeAll();
|
||||
m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
|
||||
t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(wordSpan.innerHTML)], function(r) {
|
||||
var ignoreRpc;
|
||||
|
||||
m.removeAll();
|
||||
|
||||
if (r.length > 0) {
|
||||
m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
each(r, function(v) {
|
||||
m.add({title : v, onclick : function() {
|
||||
dom.replace(ed.getDoc().createTextNode(v), wordSpan);
|
||||
t._checkDone();
|
||||
}});
|
||||
});
|
||||
|
||||
m.addSeparator();
|
||||
} else
|
||||
m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
|
||||
|
||||
if (ed.getParam('show_ignore_words', true)) {
|
||||
ignoreRpc = t.editor.getParam("spellchecker_enable_ignore_rpc", '');
|
||||
m.add({
|
||||
title : 'spellchecker.ignore_word',
|
||||
onclick : function() {
|
||||
var word = wordSpan.innerHTML;
|
||||
|
||||
dom.remove(wordSpan, 1);
|
||||
t._checkDone();
|
||||
|
||||
// tell the server if we need to
|
||||
if (ignoreRpc) {
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('ignoreWord', [t.selectedLang, word], function(r) {
|
||||
ed.setProgressState(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
m.add({
|
||||
title : 'spellchecker.ignore_words',
|
||||
onclick : function() {
|
||||
var word = wordSpan.innerHTML;
|
||||
|
||||
t._removeWords(dom.decode(word));
|
||||
t._checkDone();
|
||||
|
||||
// tell the server if we need to
|
||||
if (ignoreRpc) {
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('ignoreWords', [t.selectedLang, word], function(r) {
|
||||
ed.setProgressState(0);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (t.editor.getParam("spellchecker_enable_learn_rpc")) {
|
||||
m.add({
|
||||
title : 'spellchecker.learn_word',
|
||||
onclick : function() {
|
||||
var word = wordSpan.innerHTML;
|
||||
|
||||
dom.remove(wordSpan, 1);
|
||||
t._checkDone();
|
||||
|
||||
ed.setProgressState(1);
|
||||
t._sendRPC('learnWord', [t.selectedLang, word], function(r) {
|
||||
ed.setProgressState(0);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
m.update();
|
||||
});
|
||||
|
||||
p1 = DOM.getPos(ed.getContentAreaContainer());
|
||||
m.settings.offset_x = p1.x;
|
||||
m.settings.offset_y = p1.y;
|
||||
|
||||
ed.selection.select(wordSpan);
|
||||
p1 = dom.getPos(wordSpan);
|
||||
m.showMenu(p1.x, p1.y + wordSpan.offsetHeight - vp.y);
|
||||
|
||||
return tinymce.dom.Event.cancel(e);
|
||||
} else
|
||||
m.hideMenu();
|
||||
},
|
||||
|
||||
_checkDone : function() {
|
||||
var t = this, ed = t.editor, dom = ed.dom, o;
|
||||
|
||||
each(dom.select('span'), function(n) {
|
||||
if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) {
|
||||
o = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if (!o)
|
||||
t._done();
|
||||
},
|
||||
|
||||
_done : function() {
|
||||
var t = this, la = t.active;
|
||||
|
||||
if (t.active) {
|
||||
t.active = 0;
|
||||
t._removeWords();
|
||||
|
||||
if (t._menu)
|
||||
t._menu.hideMenu();
|
||||
|
||||
if (la)
|
||||
t.editor.nodeChanged();
|
||||
}
|
||||
},
|
||||
|
||||
_sendRPC : function(m, p, cb) {
|
||||
var t = this;
|
||||
|
||||
JSONRequest.sendRPC({
|
||||
url : t.rpcUrl,
|
||||
method : m,
|
||||
params : p,
|
||||
success : cb,
|
||||
error : function(e, x) {
|
||||
t.editor.setProgressState(0);
|
||||
t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
|
||||
})();
|
BIN
wp-includes/js/tinymce/plugins/spellchecker/img/wline.gif
Normal file
After Width: | Height: | Size: 46 B |
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* general.php
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
@error_reporting(E_ALL ^ E_NOTICE);
|
||||
$config = array();
|
||||
|
||||
require_once(dirname(__FILE__) . "/../classes/utils/Logger.php");
|
||||
require_once(dirname(__FILE__) . "/../classes/utils/JSON.php");
|
||||
require_once(dirname(__FILE__) . "/../config.php");
|
||||
require_once(dirname(__FILE__) . "/../classes/SpellChecker.php");
|
||||
|
||||
if (isset($config['general.engine']))
|
||||
require_once(dirname(__FILE__) . "/../classes/" . $config["general.engine"] . ".php");
|
||||
|
||||
/**
|
||||
* Returns an request value by name without magic quoting.
|
||||
*
|
||||
* @param String $name Name of parameter to get.
|
||||
* @param String $default_value Default value to return if value not found.
|
||||
* @return String request value by name without magic quoting or default value.
|
||||
*/
|
||||
function getRequestParam($name, $default_value = false) {
|
||||
if (!isset($_REQUEST[$name]))
|
||||
return $default_value;
|
||||
|
||||
if (is_array($_REQUEST[$name])) {
|
||||
$newarray = array();
|
||||
|
||||
foreach ($_REQUEST[$name] as $name => $value)
|
||||
$newarray[$name] = $value;
|
||||
|
||||
return $newarray;
|
||||
}
|
||||
|
||||
return $_REQUEST[$name];
|
||||
}
|
||||
|
||||
function &getLogger() {
|
||||
global $mcLogger, $man;
|
||||
|
||||
if (isset($man))
|
||||
$mcLogger = $man->getLogger();
|
||||
|
||||
if (!$mcLogger) {
|
||||
$mcLogger = new Moxiecode_Logger();
|
||||
|
||||
// Set logger options
|
||||
$mcLogger->setPath(dirname(__FILE__) . "/../logs");
|
||||
$mcLogger->setMaxSize("100kb");
|
||||
$mcLogger->setMaxFiles("10");
|
||||
$mcLogger->setFormat("{time} - {message}");
|
||||
}
|
||||
|
||||
return $mcLogger;
|
||||
}
|
||||
|
||||
function debug($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->debug(implode(', ', $args));
|
||||
}
|
||||
|
||||
function info($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->info(implode(', ', $args));
|
||||
}
|
||||
|
||||
function error($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->error(implode(', ', $args));
|
||||
}
|
||||
|
||||
function warn($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->warn(implode(', ', $args));
|
||||
}
|
||||
|
||||
function fatal($msg) {
|
||||
$args = func_get_args();
|
||||
|
||||
$log = getLogger();
|
||||
$log->fatal(implode(', ', $args));
|
||||
}
|
||||
|
||||
?>
|
112
wp-includes/js/tinymce/plugins/spellchecker/rpc.php
Normal file
@ -0,0 +1,112 @@
|
||||
<?php
|
||||
/**
|
||||
* $Id: rpc.php 915 2008-09-03 08:45:28Z spocke $
|
||||
*
|
||||
* @package MCManager.includes
|
||||
* @author Moxiecode
|
||||
* @copyright Copyright <20> 2004-2007, Moxiecode Systems AB, All rights reserved.
|
||||
*/
|
||||
|
||||
require_once("./includes/general.php");
|
||||
|
||||
// Set RPC response headers
|
||||
header('Content-Type: text/plain');
|
||||
header('Content-Encoding: UTF-8');
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
$raw = "";
|
||||
|
||||
// Try param
|
||||
if (isset($_POST["json_data"]))
|
||||
$raw = getRequestParam("json_data");
|
||||
|
||||
// Try globals array
|
||||
if (!$raw && isset($_GLOBALS) && isset($_GLOBALS["HTTP_RAW_POST_DATA"]))
|
||||
$raw = $_GLOBALS["HTTP_RAW_POST_DATA"];
|
||||
|
||||
// Try globals variable
|
||||
if (!$raw && isset($HTTP_RAW_POST_DATA))
|
||||
$raw = $HTTP_RAW_POST_DATA;
|
||||
|
||||
// Try stream
|
||||
if (!$raw) {
|
||||
if (!function_exists('file_get_contents')) {
|
||||
$fp = fopen("php://input", "r");
|
||||
if ($fp) {
|
||||
$raw = "";
|
||||
|
||||
while (!feof($fp))
|
||||
$raw = fread($fp, 1024);
|
||||
|
||||
fclose($fp);
|
||||
}
|
||||
} else
|
||||
$raw = "" . file_get_contents("php://input");
|
||||
}
|
||||
|
||||
// No input data
|
||||
if (!$raw)
|
||||
die('{"result":null,"id":null,"error":{"errstr":"Could not get raw post data.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
|
||||
|
||||
// Passthrough request to remote server
|
||||
if (isset($config['general.remote_rpc_url'])) {
|
||||
$url = parse_url($config['general.remote_rpc_url']);
|
||||
|
||||
// Setup request
|
||||
$req = "POST " . $url["path"] . " HTTP/1.0\r\n";
|
||||
$req .= "Connection: close\r\n";
|
||||
$req .= "Host: " . $url['host'] . "\r\n";
|
||||
$req .= "Content-Length: " . strlen($raw) . "\r\n";
|
||||
$req .= "\r\n" . $raw;
|
||||
|
||||
if (!isset($url['port']) || !$url['port'])
|
||||
$url['port'] = 80;
|
||||
|
||||
$errno = $errstr = "";
|
||||
|
||||
$socket = fsockopen($url['host'], intval($url['port']), $errno, $errstr, 30);
|
||||
if ($socket) {
|
||||
// Send request headers
|
||||
fputs($socket, $req);
|
||||
|
||||
// Read response headers and data
|
||||
$resp = "";
|
||||
while (!feof($socket))
|
||||
$resp .= fgets($socket, 4096);
|
||||
|
||||
fclose($socket);
|
||||
|
||||
// Split response header/data
|
||||
$resp = explode("\r\n\r\n", $resp);
|
||||
echo $resp[1]; // Output body
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
// Get JSON data
|
||||
$json = new Moxiecode_JSON();
|
||||
$input = $json->decode($raw);
|
||||
|
||||
// Execute RPC
|
||||
if (isset($config['general.engine'])) {
|
||||
$spellchecker = new $config['general.engine']($config);
|
||||
$result = call_user_func_array(array($spellchecker, $input['method']), $input['params']);
|
||||
} else
|
||||
die('{"result":null,"id":null,"error":{"errstr":"You must choose an spellchecker engine in the config.php file.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
|
||||
|
||||
// Request and response id should always be the same
|
||||
$output = array(
|
||||
"id" => $input->id,
|
||||
"result" => $result,
|
||||
"error" => null
|
||||
);
|
||||
|
||||
// Return JSON encoded string
|
||||
echo $json->encode($output);
|
||||
|
||||
?>
|
1
wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js
Normal file
@ -0,0 +1 @@
|
||||
(function(){var c=tinymce.DOM,a=tinymce.dom.Event,d=tinymce.each,b=tinymce.explode;tinymce.create("tinymce.plugins.TabFocusPlugin",{init:function(f,g){function e(i,j){if(j.keyCode===9){return a.cancel(j)}}function h(l,p){var j,m,o,n,k;function q(t){n=c.select(":input:enabled,*[tabindex]:not(iframe)");function s(v){return v.nodeName==="BODY"||(v.type!="hidden"&&!(v.style.display=="none")&&!(v.style.visibility=="hidden")&&s(v.parentNode))}function i(v){return v.attributes.tabIndex.specified||v.nodeName=="INPUT"||v.nodeName=="TEXTAREA"}function u(){return tinymce.isIE6||tinymce.isIE7}function r(v){return((!u()||i(v)))&&v.getAttribute("tabindex")!="-1"&&s(v)}d(n,function(w,v){if(w.id==l.id){j=v;return false}});if(t>0){for(m=j+1;m<n.length;m++){if(r(n[m])){return n[m]}}}else{for(m=j-1;m>=0;m--){if(r(n[m])){return n[m]}}}return null}if(p.keyCode===9){k=b(l.getParam("tab_focus",l.getParam("tabfocus_elements",":prev,:next")));if(k.length==1){k[1]=k[0];k[0]=":prev"}if(p.shiftKey){if(k[0]==":prev"){n=q(-1)}else{n=c.get(k[0])}}else{if(k[1]==":next"){n=q(1)}else{n=c.get(k[1])}}if(n){if(n.id&&(l=tinymce.get(n.id||n.name))){l.focus()}else{window.setTimeout(function(){if(!tinymce.isWebKit){window.focus()}n.focus()},10)}return a.cancel(p)}}}f.onKeyUp.add(e);if(tinymce.isGecko){f.onKeyPress.add(h);f.onKeyDown.add(e)}else{f.onKeyDown.add(h)}},getInfo:function(){return{longname:"Tabfocus",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("tabfocus",tinymce.plugins.TabFocusPlugin)})();
|
122
wp-includes/js/tinymce/plugins/tabfocus/editor_plugin_src.js
Normal file
@ -0,0 +1,122 @@
|
||||
/**
|
||||
* 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, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;
|
||||
|
||||
tinymce.create('tinymce.plugins.TabFocusPlugin', {
|
||||
init : function(ed, url) {
|
||||
function tabCancel(ed, e) {
|
||||
if (e.keyCode === 9)
|
||||
return Event.cancel(e);
|
||||
}
|
||||
|
||||
function tabHandler(ed, e) {
|
||||
var x, i, f, el, v;
|
||||
|
||||
function find(d) {
|
||||
el = DOM.select(':input:enabled,*[tabindex]:not(iframe)');
|
||||
|
||||
function canSelectRecursive(e) {
|
||||
return e.nodeName==="BODY" || (e.type != 'hidden' &&
|
||||
!(e.style.display == "none") &&
|
||||
!(e.style.visibility == "hidden") && canSelectRecursive(e.parentNode));
|
||||
}
|
||||
function canSelectInOldIe(el) {
|
||||
return el.attributes["tabIndex"].specified || el.nodeName == "INPUT" || el.nodeName == "TEXTAREA";
|
||||
}
|
||||
function isOldIe() {
|
||||
return tinymce.isIE6 || tinymce.isIE7;
|
||||
}
|
||||
function canSelect(el) {
|
||||
return ((!isOldIe() || canSelectInOldIe(el))) && el.getAttribute("tabindex") != '-1' && canSelectRecursive(el);
|
||||
}
|
||||
|
||||
each(el, function(e, i) {
|
||||
if (e.id == ed.id) {
|
||||
x = i;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (d > 0) {
|
||||
for (i = x + 1; i < el.length; i++) {
|
||||
if (canSelect(el[i]))
|
||||
return el[i];
|
||||
}
|
||||
} else {
|
||||
for (i = x - 1; i >= 0; i--) {
|
||||
if (canSelect(el[i]))
|
||||
return el[i];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (e.keyCode === 9) {
|
||||
v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
|
||||
|
||||
if (v.length == 1) {
|
||||
v[1] = v[0];
|
||||
v[0] = ':prev';
|
||||
}
|
||||
|
||||
// Find element to focus
|
||||
if (e.shiftKey) {
|
||||
if (v[0] == ':prev')
|
||||
el = find(-1);
|
||||
else
|
||||
el = DOM.get(v[0]);
|
||||
} else {
|
||||
if (v[1] == ':next')
|
||||
el = find(1);
|
||||
else
|
||||
el = DOM.get(v[1]);
|
||||
}
|
||||
|
||||
if (el) {
|
||||
if (el.id && (ed = tinymce.get(el.id || el.name)))
|
||||
ed.focus();
|
||||
else
|
||||
window.setTimeout(function() {
|
||||
if (!tinymce.isWebKit)
|
||||
window.focus();
|
||||
el.focus();
|
||||
}, 10);
|
||||
|
||||
return Event.cancel(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ed.onKeyUp.add(tabCancel);
|
||||
|
||||
if (tinymce.isGecko) {
|
||||
ed.onKeyPress.add(tabHandler);
|
||||
ed.onKeyDown.add(tabCancel);
|
||||
} else
|
||||
ed.onKeyDown.add(tabHandler);
|
||||
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Tabfocus',
|
||||
author : 'Moxiecode Systems AB',
|
||||
authorurl : 'http://tinymce.moxiecode.com',
|
||||
infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
|
||||
version : tinymce.majorVersion + "." + tinymce.minorVersion
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
|
||||
})();
|
426
wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js
Normal file
@ -0,0 +1,426 @@
|
||||
/**
|
||||
* WordPress plugin.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var DOM = tinymce.DOM;
|
||||
|
||||
tinymce.create('tinymce.plugins.WordPress', {
|
||||
init : function(ed, url) {
|
||||
var t = this, tbId = ed.getParam('wordpress_adv_toolbar', 'toolbar2'), last = 0, moreHTML, nextpageHTML, closeOnClick, mod_key;
|
||||
moreHTML = '<img src="' + url + '/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
|
||||
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
|
||||
|
||||
if ( getUserSetting('hidetb', '0') == '1' )
|
||||
ed.settings.wordpress_adv_hidden = 0;
|
||||
|
||||
// Hides the specified toolbar and resizes the iframe
|
||||
ed.onPostRender.add(function() {
|
||||
var adv_toolbar = ed.controlManager.get(tbId);
|
||||
if ( ed.getParam('wordpress_adv_hidden', 1) && adv_toolbar ) {
|
||||
DOM.hide(adv_toolbar.id);
|
||||
t._resizeIframe(ed, tbId, 28);
|
||||
}
|
||||
});
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('WP_More', function() {
|
||||
ed.execCommand('mceInsertContent', 0, moreHTML);
|
||||
});
|
||||
|
||||
ed.addCommand('WP_Page', function() {
|
||||
ed.execCommand('mceInsertContent', 0, nextpageHTML);
|
||||
});
|
||||
|
||||
ed.addCommand('WP_Help', function() {
|
||||
ed.windowManager.open({
|
||||
url : tinymce.baseURL + '/wp-mce-help.php',
|
||||
width : 450,
|
||||
height : 420,
|
||||
inline : 1
|
||||
});
|
||||
});
|
||||
|
||||
ed.addCommand('WP_Adv', function() {
|
||||
var cm = ed.controlManager, id = cm.get(tbId).id;
|
||||
|
||||
if ( 'undefined' == id )
|
||||
return;
|
||||
|
||||
if ( DOM.isHidden(id) ) {
|
||||
cm.setActive('wp_adv', 1);
|
||||
DOM.show(id);
|
||||
t._resizeIframe(ed, tbId, -28);
|
||||
ed.settings.wordpress_adv_hidden = 0;
|
||||
setUserSetting('hidetb', '1');
|
||||
} else {
|
||||
cm.setActive('wp_adv', 0);
|
||||
DOM.hide(id);
|
||||
t._resizeIframe(ed, tbId, 28);
|
||||
ed.settings.wordpress_adv_hidden = 1;
|
||||
setUserSetting('hidetb', '0');
|
||||
}
|
||||
});
|
||||
|
||||
ed.addCommand('WP_Medialib', function() {
|
||||
if ( typeof wp !== 'undefined' && wp.media && wp.media.editor )
|
||||
wp.media.editor.open( ed.id );
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('wp_more', {
|
||||
title : 'wordpress.wp_more_desc',
|
||||
cmd : 'WP_More'
|
||||
});
|
||||
|
||||
ed.addButton('wp_page', {
|
||||
title : 'wordpress.wp_page_desc',
|
||||
image : url + '/img/page.gif',
|
||||
cmd : 'WP_Page'
|
||||
});
|
||||
|
||||
ed.addButton('wp_help', {
|
||||
title : 'wordpress.wp_help_desc',
|
||||
cmd : 'WP_Help'
|
||||
});
|
||||
|
||||
ed.addButton('wp_adv', {
|
||||
title : 'wordpress.wp_adv_desc',
|
||||
cmd : 'WP_Adv'
|
||||
});
|
||||
|
||||
// Add Media button
|
||||
ed.addButton('add_media', {
|
||||
title : 'wordpress.add_media',
|
||||
image : url + '/img/image.gif',
|
||||
cmd : 'WP_Medialib'
|
||||
});
|
||||
|
||||
// Add Media buttons to fullscreen and handle align buttons for image captions
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val, o) {
|
||||
var DOM = tinymce.DOM, n, DL, DIV, cls, a, align;
|
||||
if ( 'mceFullScreen' == cmd ) {
|
||||
if ( 'mce_fullscreen' != ed.id && DOM.select('a.thickbox').length )
|
||||
ed.settings.theme_advanced_buttons1 += ',|,add_media';
|
||||
}
|
||||
|
||||
if ( 'JustifyLeft' == cmd || 'JustifyRight' == cmd || 'JustifyCenter' == cmd ) {
|
||||
n = ed.selection.getNode();
|
||||
|
||||
if ( n.nodeName == 'IMG' ) {
|
||||
align = cmd.substr(7).toLowerCase();
|
||||
a = 'align' + align;
|
||||
DL = ed.dom.getParent(n, 'dl.wp-caption');
|
||||
DIV = ed.dom.getParent(n, 'div.mceTemp');
|
||||
|
||||
if ( DL && DIV ) {
|
||||
cls = ed.dom.hasClass(DL, a) ? 'alignnone' : a;
|
||||
DL.className = DL.className.replace(/align[^ '"]+\s?/g, '');
|
||||
ed.dom.addClass(DL, cls);
|
||||
|
||||
if (cls == 'aligncenter')
|
||||
ed.dom.addClass(DIV, 'mceIEcenter');
|
||||
else
|
||||
ed.dom.removeClass(DIV, 'mceIEcenter');
|
||||
|
||||
o.terminate = true;
|
||||
ed.execCommand('mceRepaint');
|
||||
} else {
|
||||
if ( ed.dom.hasClass(n, a) )
|
||||
ed.dom.addClass(n, 'alignnone');
|
||||
else
|
||||
ed.dom.removeClass(n, 'alignnone');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ed.onInit.add(function(ed) {
|
||||
var bodyClass = ed.getParam('body_class', ''), body = ed.getBody();
|
||||
|
||||
// add body classes
|
||||
if ( bodyClass )
|
||||
bodyClass = bodyClass.split(' ');
|
||||
else
|
||||
bodyClass = [];
|
||||
|
||||
if ( ed.getParam('directionality', '') == 'rtl' )
|
||||
bodyClass.push('rtl');
|
||||
|
||||
if ( tinymce.isIE9 )
|
||||
bodyClass.push('ie9');
|
||||
else if ( tinymce.isIE8 )
|
||||
bodyClass.push('ie8');
|
||||
else if ( tinymce.isIE7 )
|
||||
bodyClass.push('ie7');
|
||||
|
||||
if ( ed.id != 'wp_mce_fullscreen' && ed.id != 'mce_fullscreen' )
|
||||
bodyClass.push('wp-editor');
|
||||
else if ( ed.id == 'mce_fullscreen' )
|
||||
bodyClass.push('mce-fullscreen');
|
||||
|
||||
tinymce.each( bodyClass, function(cls){
|
||||
if ( cls )
|
||||
ed.dom.addClass(body, cls);
|
||||
});
|
||||
|
||||
// make sure these run last
|
||||
ed.onNodeChange.add( function(ed, cm, e) {
|
||||
var DL;
|
||||
|
||||
if ( e.nodeName == 'IMG' ) {
|
||||
DL = ed.dom.getParent(e, 'dl.wp-caption');
|
||||
} else if ( e.nodeName == 'DIV' && ed.dom.hasClass(e, 'mceTemp') ) {
|
||||
DL = e.firstChild;
|
||||
|
||||
if ( ! ed.dom.hasClass(DL, 'wp-caption') )
|
||||
DL = false;
|
||||
}
|
||||
|
||||
if ( DL ) {
|
||||
if ( ed.dom.hasClass(DL, 'alignleft') )
|
||||
cm.setActive('justifyleft', 1);
|
||||
else if ( ed.dom.hasClass(DL, 'alignright') )
|
||||
cm.setActive('justifyright', 1);
|
||||
else if ( ed.dom.hasClass(DL, 'aligncenter') )
|
||||
cm.setActive('justifycenter', 1);
|
||||
}
|
||||
});
|
||||
|
||||
// remove invalid parent paragraphs when pasting HTML and/or switching to the HTML editor and back
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
if ( o.content ) {
|
||||
o.content = o.content.replace(/<p>\s*<(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)( [^>]*)?>/gi, '<$1$2>');
|
||||
o.content = o.content.replace(/<\/(p|div|ul|ol|dl|table|blockquote|h[1-6]|fieldset|pre|address)>\s*<\/p>/gi, '</$1>');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Word count
|
||||
if ( 'undefined' != typeof(jQuery) ) {
|
||||
ed.onKeyUp.add(function(ed, e) {
|
||||
var k = e.keyCode || e.charCode;
|
||||
|
||||
if ( k == last )
|
||||
return;
|
||||
|
||||
if ( 13 == k || 8 == last || 46 == last )
|
||||
jQuery(document).triggerHandler('wpcountwords', [ ed.getContent({format : 'raw'}) ]);
|
||||
|
||||
last = k;
|
||||
});
|
||||
};
|
||||
|
||||
// keep empty paragraphs :(
|
||||
ed.onSaveContent.addToTop(function(ed, o) {
|
||||
o.content = o.content.replace(/<p>(<br ?\/?>|\u00a0|\uFEFF)?<\/p>/g, '<p> </p>');
|
||||
});
|
||||
|
||||
ed.onSaveContent.add(function(ed, o) {
|
||||
if ( ed.getParam('wpautop', true) && typeof(switchEditors) == 'object' ) {
|
||||
if ( ed.isHidden() )
|
||||
o.content = o.element.value;
|
||||
else
|
||||
o.content = switchEditors.pre_wpautop(o.content);
|
||||
}
|
||||
});
|
||||
|
||||
/* disable for now
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
o.content = t._setEmbed(o.content);
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if ( o.get )
|
||||
o.content = t._getEmbed(o.content);
|
||||
});
|
||||
*/
|
||||
|
||||
// Add listeners to handle more break
|
||||
t._handleMoreBreak(ed, url);
|
||||
|
||||
// Add custom shortcuts
|
||||
mod_key = 'alt+shift';
|
||||
|
||||
// if ( tinymce.isGecko ) // disable for mow, too many shortcuts conflicts
|
||||
// mod_key = 'ctrl+alt';
|
||||
|
||||
ed.addShortcut(mod_key + '+c', 'justifycenter_desc', 'JustifyCenter');
|
||||
ed.addShortcut(mod_key + '+r', 'justifyright_desc', 'JustifyRight');
|
||||
ed.addShortcut(mod_key + '+l', 'justifyleft_desc', 'JustifyLeft');
|
||||
ed.addShortcut(mod_key + '+j', 'justifyfull_desc', 'JustifyFull');
|
||||
ed.addShortcut(mod_key + '+q', 'blockquote_desc', 'mceBlockQuote');
|
||||
ed.addShortcut(mod_key + '+u', 'bullist_desc', 'InsertUnorderedList');
|
||||
ed.addShortcut(mod_key + '+o', 'numlist_desc', 'InsertOrderedList');
|
||||
ed.addShortcut(mod_key + '+n', 'spellchecker.desc', 'mceSpellCheck');
|
||||
ed.addShortcut(mod_key + '+a', 'link_desc', 'WP_Link');
|
||||
ed.addShortcut(mod_key + '+s', 'unlink_desc', 'unlink');
|
||||
ed.addShortcut(mod_key + '+m', 'image_desc', 'WP_Medialib');
|
||||
ed.addShortcut(mod_key + '+z', 'wordpress.wp_adv_desc', 'WP_Adv');
|
||||
ed.addShortcut(mod_key + '+t', 'wordpress.wp_more_desc', 'WP_More');
|
||||
ed.addShortcut(mod_key + '+d', 'striketrough_desc', 'Strikethrough');
|
||||
ed.addShortcut(mod_key + '+h', 'help_desc', 'WP_Help');
|
||||
ed.addShortcut(mod_key + '+p', 'wordpress.wp_page_desc', 'WP_Page');
|
||||
ed.addShortcut('ctrl+s', 'save_desc', function(){if('function'==typeof autosave)autosave();});
|
||||
|
||||
if ( /\bwpfullscreen\b/.test(ed.settings.plugins) )
|
||||
ed.addShortcut(mod_key + '+w', 'wordpress.wp_fullscreen_desc', 'wpFullScreen');
|
||||
else if ( /\bfullscreen\b/.test(ed.settings.plugins) )
|
||||
ed.addShortcut(mod_key + '+g', 'fullscreen.desc', 'mceFullScreen');
|
||||
|
||||
// popup buttons for images and the gallery
|
||||
ed.onInit.add(function(ed) {
|
||||
tinymce.dom.Event.add(ed.getWin(), 'scroll', function(e) {
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
tinymce.dom.Event.add(ed.getBody(), 'dragstart', function(e) {
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
});
|
||||
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
|
||||
ed.onSaveContent.add(function(ed, o) {
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
|
||||
ed.onMouseDown.add(function(ed, e) {
|
||||
if ( e.target.nodeName != 'IMG' )
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
|
||||
ed.onKeyDown.add(function(ed, e){
|
||||
if ( e.which == tinymce.VK.DELETE || e.which == tinymce.VK.BACKSPACE )
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
|
||||
closeOnClick = function(e){
|
||||
var id;
|
||||
|
||||
if ( e.target.id == 'mceModalBlocker' || e.target.className == 'ui-widget-overlay' ) {
|
||||
for ( id in ed.windowManager.windows ) {
|
||||
ed.windowManager.close(null, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// close popups when clicking on the background
|
||||
tinymce.dom.Event.remove(document.body, 'click', closeOnClick);
|
||||
tinymce.dom.Event.add(document.body, 'click', closeOnClick);
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'WordPress Plugin',
|
||||
author : 'WordPress', // add Moxiecode?
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : 'http://wordpress.org',
|
||||
version : '3.0'
|
||||
};
|
||||
},
|
||||
|
||||
// Internal functions
|
||||
_setEmbed : function(c) {
|
||||
return c.replace(/\[embed\]([\s\S]+?)\[\/embed\][\s\u00a0]*/g, function(a,b){
|
||||
return '<img width="300" height="200" src="' + tinymce.baseURL + '/plugins/wordpress/img/trans.gif" class="wp-oembed mceItemNoResize" alt="'+b+'" title="'+b+'" />';
|
||||
});
|
||||
},
|
||||
|
||||
_getEmbed : function(c) {
|
||||
return c.replace(/<img[^>]+>/g, function(a) {
|
||||
if ( a.indexOf('class="wp-oembed') != -1 ) {
|
||||
var u = a.match(/alt="([^\"]+)"/);
|
||||
if ( u[1] )
|
||||
a = '[embed]' + u[1] + '[/embed]';
|
||||
}
|
||||
return a;
|
||||
});
|
||||
},
|
||||
|
||||
_showButtons : function(n, id) {
|
||||
var ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
|
||||
|
||||
vp = ed.dom.getViewPort(ed.getWin());
|
||||
p1 = DOM.getPos(ed.getContentAreaContainer());
|
||||
p2 = ed.dom.getPos(n);
|
||||
|
||||
X = Math.max(p2.x - vp.x, 0) + p1.x;
|
||||
Y = Math.max(p2.y - vp.y, 0) + p1.y;
|
||||
|
||||
DOM.setStyles(id, {
|
||||
'top' : Y+5+'px',
|
||||
'left' : X+5+'px',
|
||||
'display' : 'block'
|
||||
});
|
||||
},
|
||||
|
||||
_hideButtons : function() {
|
||||
var DOM = tinymce.DOM;
|
||||
DOM.hide( DOM.select('#wp_editbtns, #wp_gallerybtns') );
|
||||
},
|
||||
|
||||
// Resizes the iframe by a relative height value
|
||||
_resizeIframe : function(ed, tb_id, dy) {
|
||||
var ifr = ed.getContentAreaContainer().firstChild;
|
||||
|
||||
DOM.setStyle(ifr, 'height', ifr.clientHeight + dy); // Resize iframe
|
||||
ed.theme.deltaHeight += dy; // For resize cookie
|
||||
},
|
||||
|
||||
_handleMoreBreak : function(ed, url) {
|
||||
var moreHTML, nextpageHTML;
|
||||
|
||||
moreHTML = '<img src="' + url + '/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
|
||||
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
|
||||
|
||||
// Display morebreak instead if img in element path
|
||||
ed.onPostRender.add(function() {
|
||||
if (ed.theme.onResolveName) {
|
||||
ed.theme.onResolveName.add(function(th, o) {
|
||||
if (o.node.nodeName == 'IMG') {
|
||||
if ( ed.dom.hasClass(o.node, 'mceWPmore') )
|
||||
o.name = 'wpmore';
|
||||
if ( ed.dom.hasClass(o.node, 'mceWPnextpage') )
|
||||
o.name = 'wppage';
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Replace morebreak with images
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
if ( o.content ) {
|
||||
o.content = o.content.replace(/<!--more(.*?)-->/g, moreHTML);
|
||||
o.content = o.content.replace(/<!--nextpage-->/g, nextpageHTML);
|
||||
}
|
||||
});
|
||||
|
||||
// Replace images with morebreak
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if (o.get)
|
||||
o.content = o.content.replace(/<img[^>]+>/g, function(im) {
|
||||
if (im.indexOf('class="mceWPmore') !== -1) {
|
||||
var m, moretext = (m = im.match(/alt="(.*?)"/)) ? m[1] : '';
|
||||
im = '<!--more'+moretext+'-->';
|
||||
}
|
||||
if (im.indexOf('class="mceWPnextpage') !== -1)
|
||||
im = '<!--nextpage-->';
|
||||
|
||||
return im;
|
||||
});
|
||||
});
|
||||
|
||||
// Set active buttons if user selected pagebreak or more break
|
||||
ed.onNodeChange.add(function(ed, cm, n) {
|
||||
cm.setActive('wp_page', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPnextpage'));
|
||||
cm.setActive('wp_more', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPmore'));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('wordpress', tinymce.plugins.WordPress);
|
||||
})();
|
BIN
wp-includes/js/tinymce/plugins/wordpress/img/audio.gif
Normal file
After Width: | Height: | Size: 146 B |
BIN
wp-includes/js/tinymce/plugins/wordpress/img/image.gif
Normal file
After Width: | Height: | Size: 95 B |
BIN
wp-includes/js/tinymce/plugins/wordpress/img/media.gif
Normal file
After Width: | Height: | Size: 149 B |
BIN
wp-includes/js/tinymce/plugins/wordpress/img/page.gif
Normal file
After Width: | Height: | Size: 108 B |
BIN
wp-includes/js/tinymce/plugins/wordpress/img/trans.gif
Normal file
After Width: | Height: | Size: 43 B |
BIN
wp-includes/js/tinymce/plugins/wordpress/img/video.gif
Normal file
After Width: | Height: | Size: 93 B |
@ -0,0 +1 @@
|
||||
(function(){tinymce.create("tinymce.plugins.WPDialogs",{init:function(a,b){tinymce.create("tinymce.WPWindowManager:tinymce.InlineWindowManager",{WPWindowManager:function(c){this.parent(c)},open:function(e,g){var d=this,c;if(!e.wpDialog){return this.parent(e,g)}else{if(!e.id){return}}c=jQuery("#"+e.id);if(!c.length){return}d.features=e;d.params=g;d.onOpen.dispatch(d,e,g);d.element=d.windows[e.id]=c;d.bookmark=d.editor.selection.getBookmark(1);if(!c.data("wpdialog")){c.wpdialog({title:e.title,width:e.width,height:e.height,modal:true,dialogClass:"wp-dialog",zIndex:300000})}c.wpdialog("open")},close:function(){if(!this.features.wpDialog){return this.parent.apply(this,arguments)}this.element.wpdialog("close")}});a.onBeforeRenderUI.add(function(){a.windowManager=new tinymce.WPWindowManager(a)})},getInfo:function(){return{longname:"WPDialogs",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"0.1"}}});tinymce.PluginManager.add("wpdialogs",tinymce.plugins.WPDialogs)})();
|
@ -0,0 +1,80 @@
|
||||
/**
|
||||
* 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() {
|
||||
tinymce.create('tinymce.plugins.WPDialogs', {
|
||||
init : function(ed, url) {
|
||||
tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', {
|
||||
WPWindowManager : function(ed) {
|
||||
this.parent(ed);
|
||||
},
|
||||
|
||||
open : function(f, p) {
|
||||
var t = this, element;
|
||||
|
||||
if ( ! f.wpDialog )
|
||||
return this.parent( f, p );
|
||||
else if ( ! f.id )
|
||||
return;
|
||||
|
||||
element = jQuery('#' + f.id);
|
||||
if ( ! element.length )
|
||||
return;
|
||||
|
||||
t.features = f;
|
||||
t.params = p;
|
||||
t.onOpen.dispatch(t, f, p);
|
||||
t.element = t.windows[ f.id ] = element;
|
||||
|
||||
// Store selection
|
||||
t.bookmark = t.editor.selection.getBookmark(1);
|
||||
|
||||
// Create the dialog if necessary
|
||||
if ( ! element.data('wpdialog') ) {
|
||||
element.wpdialog({
|
||||
title: f.title,
|
||||
width: f.width,
|
||||
height: f.height,
|
||||
modal: true,
|
||||
dialogClass: 'wp-dialog',
|
||||
zIndex: 300000
|
||||
});
|
||||
}
|
||||
|
||||
element.wpdialog('open');
|
||||
},
|
||||
close : function() {
|
||||
if ( ! this.features.wpDialog )
|
||||
return this.parent.apply( this, arguments );
|
||||
|
||||
this.element.wpdialog('close');
|
||||
}
|
||||
});
|
||||
|
||||
// Replace window manager
|
||||
ed.onBeforeRenderUI.add(function() {
|
||||
ed.windowManager = new tinymce.WPWindowManager(ed);
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'WPDialogs',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : 'http://wordpress.org',
|
||||
version : '0.1'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('wpdialogs', tinymce.plugins.WPDialogs);
|
||||
})();
|
432
wp-includes/js/tinymce/plugins/wpdialogs/js/popup.js
Normal file
@ -0,0 +1,432 @@
|
||||
/**
|
||||
* popup.js
|
||||
*
|
||||
* An altered version of tinyMCEPopup to work in the same window as tinymce.
|
||||
*
|
||||
* ------------------------------------------------------------------
|
||||
*
|
||||
* Copyright 2009, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://tinymce.moxiecode.com/license
|
||||
* Contributing: http://tinymce.moxiecode.com/contributing
|
||||
*/
|
||||
|
||||
// Some global instances
|
||||
|
||||
/**
|
||||
* TinyMCE popup/dialog helper class. This gives you easy access to the
|
||||
* parent editor instance and a bunch of other things. It's higly recommended
|
||||
* that you load this script into your dialogs.
|
||||
*
|
||||
* @static
|
||||
* @class tinyMCEPopup
|
||||
*/
|
||||
var tinyMCEPopup = {
|
||||
/**
|
||||
* Initializes the popup this will be called automatically.
|
||||
*
|
||||
* @method init
|
||||
*/
|
||||
init : function() {
|
||||
var t = this, w, ti;
|
||||
|
||||
// Find window & API
|
||||
w = t.getWin();
|
||||
tinymce = w.tinymce;
|
||||
tinyMCE = w.tinyMCE;
|
||||
t.editor = tinymce.EditorManager.activeEditor;
|
||||
t.params = t.editor.windowManager.params;
|
||||
t.features = t.editor.windowManager.features;
|
||||
t.dom = tinymce.dom;
|
||||
|
||||
// Setup on init listeners
|
||||
t.listeners = [];
|
||||
t.onInit = {
|
||||
add : function(f, s) {
|
||||
t.listeners.push({func : f, scope : s});
|
||||
}
|
||||
};
|
||||
|
||||
t.isWindow = false;
|
||||
t.id = t.features.id;
|
||||
t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the reference to the parent window that opened the dialog.
|
||||
*
|
||||
* @method getWin
|
||||
* @return {Window} Reference to the parent window that opened the dialog.
|
||||
*/
|
||||
getWin : function() {
|
||||
return window;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a window argument/parameter by name.
|
||||
*
|
||||
* @method getWindowArg
|
||||
* @param {String} n Name of the window argument to retrieve.
|
||||
* @param {String} dv Optional default value to return.
|
||||
* @return {String} Argument value or default value if it wasn't found.
|
||||
*/
|
||||
getWindowArg : function(n, dv) {
|
||||
var v = this.params[n];
|
||||
|
||||
return tinymce.is(v) ? v : dv;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a editor parameter/config option value.
|
||||
*
|
||||
* @method getParam
|
||||
* @param {String} n Name of the editor config option to retrieve.
|
||||
* @param {String} dv Optional default value to return.
|
||||
* @return {String} Parameter value or default value if it wasn't found.
|
||||
*/
|
||||
getParam : function(n, dv) {
|
||||
return this.editor.getParam(n, dv);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a language item by key.
|
||||
*
|
||||
* @method getLang
|
||||
* @param {String} n Language item like mydialog.something.
|
||||
* @param {String} dv Optional default value to return.
|
||||
* @return {String} Language value for the item like "my string" or the default value if it wasn't found.
|
||||
*/
|
||||
getLang : function(n, dv) {
|
||||
return this.editor.getLang(n, dv);
|
||||
},
|
||||
|
||||
/**
|
||||
* Executed a command on editor that opened the dialog/popup.
|
||||
*
|
||||
* @method execCommand
|
||||
* @param {String} cmd Command to execute.
|
||||
* @param {Boolean} ui Optional boolean value if the UI for the command should be presented or not.
|
||||
* @param {Object} val Optional value to pass with the comman like an URL.
|
||||
* @param {Object} a Optional arguments object.
|
||||
*/
|
||||
execCommand : function(cmd, ui, val, a) {
|
||||
a = a || {};
|
||||
a.skip_focus = 1;
|
||||
|
||||
this.restoreSelection();
|
||||
return this.editor.execCommand(cmd, ui, val, a);
|
||||
},
|
||||
|
||||
/**
|
||||
* Resizes the dialog to the inner size of the window. This is needed since various browsers
|
||||
* have different border sizes on windows.
|
||||
*
|
||||
* @method resizeToInnerSize
|
||||
*/
|
||||
resizeToInnerSize : function() {
|
||||
var t = this;
|
||||
|
||||
// Detach it to workaround a Chrome specific bug
|
||||
// https://sourceforge.net/tracker/?func=detail&atid=635682&aid=2926339&group_id=103281
|
||||
setTimeout(function() {
|
||||
var vp = t.dom.getViewPort(window);
|
||||
|
||||
t.editor.windowManager.resizeBy(
|
||||
t.getWindowArg('mce_width') - vp.w,
|
||||
t.getWindowArg('mce_height') - vp.h,
|
||||
t.id || window
|
||||
);
|
||||
}, 0);
|
||||
},
|
||||
|
||||
/**
|
||||
* Will executed the specified string when the page has been loaded. This function
|
||||
* was added for compatibility with the 2.x branch.
|
||||
*
|
||||
* @method executeOnLoad
|
||||
* @param {String} s String to evalutate on init.
|
||||
*/
|
||||
executeOnLoad : function(s) {
|
||||
this.onInit.add(function() {
|
||||
eval(s);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Stores the current editor selection for later restoration. This can be useful since some browsers
|
||||
* looses it's selection if a control element is selected/focused inside the dialogs.
|
||||
*
|
||||
* @method storeSelection
|
||||
*/
|
||||
storeSelection : function() {
|
||||
this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1);
|
||||
},
|
||||
|
||||
/**
|
||||
* Restores any stored selection. This can be useful since some browsers
|
||||
* looses it's selection if a control element is selected/focused inside the dialogs.
|
||||
*
|
||||
* @method restoreSelection
|
||||
*/
|
||||
restoreSelection : function() {
|
||||
var t = tinyMCEPopup;
|
||||
|
||||
if (!t.isWindow && tinymce.isIE)
|
||||
t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads a specific dialog language pack. If you pass in plugin_url as a arugment
|
||||
* when you open the window it will load the <plugin url>/langs/<code>_dlg.js lang pack file.
|
||||
*
|
||||
* @method requireLangPack
|
||||
*/
|
||||
requireLangPack : function() {
|
||||
var t = this, u = t.getWindowArg('plugin_url') || t.getWindowArg('theme_url');
|
||||
|
||||
if (u && t.editor.settings.language && t.features.translate_i18n !== false) {
|
||||
u += '/langs/' + t.editor.settings.language + '_dlg.js';
|
||||
|
||||
if (!tinymce.ScriptLoader.isDone(u)) {
|
||||
document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>');
|
||||
tinymce.ScriptLoader.markDone(u);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Executes a color picker on the specified element id. When the user
|
||||
* then selects a color it will be set as the value of the specified element.
|
||||
*
|
||||
* @method pickColor
|
||||
* @param {DOMEvent} e DOM event object.
|
||||
* @param {string} element_id Element id to be filled with the color value from the picker.
|
||||
*/
|
||||
pickColor : function(e, element_id) {
|
||||
this.execCommand('mceColorPicker', true, {
|
||||
color : document.getElementById(element_id).value,
|
||||
func : function(c) {
|
||||
document.getElementById(element_id).value = c;
|
||||
|
||||
try {
|
||||
document.getElementById(element_id).onchange();
|
||||
} catch (ex) {
|
||||
// Try fire event, ignore errors
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Opens a filebrowser/imagebrowser this will set the output value from
|
||||
* the browser as a value on the specified element.
|
||||
*
|
||||
* @method openBrowser
|
||||
* @param {string} element_id Id of the element to set value in.
|
||||
* @param {string} type Type of browser to open image/file/flash.
|
||||
* @param {string} option Option name to get the file_broswer_callback function name from.
|
||||
*/
|
||||
openBrowser : function(element_id, type, option) {
|
||||
tinyMCEPopup.restoreSelection();
|
||||
this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a confirm dialog. Please don't use the blocking behavior of this
|
||||
* native version use the callback method instead then it can be extended.
|
||||
*
|
||||
* @method confirm
|
||||
* @param {String} t Title for the new confirm dialog.
|
||||
* @param {function} cb Callback function to be executed after the user has selected ok or cancel.
|
||||
* @param {Object} s Optional scope to execute the callback in.
|
||||
*/
|
||||
confirm : function(t, cb, s) {
|
||||
this.editor.windowManager.confirm(t, cb, s, window);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a alert dialog. Please don't use the blocking behavior of this
|
||||
* native version use the callback method instead then it can be extended.
|
||||
*
|
||||
* @method alert
|
||||
* @param {String} t Title for the new alert dialog.
|
||||
* @param {function} cb Callback function to be executed after the user has selected ok.
|
||||
* @param {Object} s Optional scope to execute the callback in.
|
||||
*/
|
||||
alert : function(tx, cb, s) {
|
||||
this.editor.windowManager.alert(tx, cb, s, window);
|
||||
},
|
||||
|
||||
/**
|
||||
* Closes the current window.
|
||||
*
|
||||
* @method close
|
||||
*/
|
||||
close : function() {
|
||||
var t = this;
|
||||
|
||||
// To avoid domain relaxing issue in Opera
|
||||
function close() {
|
||||
t.editor.windowManager.close(window);
|
||||
t.editor = null;
|
||||
};
|
||||
|
||||
if (tinymce.isOpera)
|
||||
t.getWin().setTimeout(close, 0);
|
||||
else
|
||||
close();
|
||||
},
|
||||
|
||||
// Internal functions
|
||||
|
||||
_restoreSelection : function() {
|
||||
var e = window.event.srcElement;
|
||||
|
||||
if (e.nodeName == 'INPUT' && (e.type == 'submit' || e.type == 'button'))
|
||||
tinyMCEPopup.restoreSelection();
|
||||
},
|
||||
|
||||
/* _restoreSelection : function() {
|
||||
var e = window.event.srcElement;
|
||||
|
||||
// If user focus a non text input or textarea
|
||||
if ((e.nodeName != 'INPUT' && e.nodeName != 'TEXTAREA') || e.type != 'text')
|
||||
tinyMCEPopup.restoreSelection();
|
||||
},*/
|
||||
|
||||
_onDOMLoaded : function() {
|
||||
var t = tinyMCEPopup, ti = document.title, bm, h, nv;
|
||||
|
||||
if (t.domLoaded)
|
||||
return;
|
||||
|
||||
t.domLoaded = 1;
|
||||
|
||||
tinyMCEPopup.init();
|
||||
|
||||
// Translate page
|
||||
if (t.features.translate_i18n !== false) {
|
||||
h = document.body.innerHTML;
|
||||
|
||||
// Replace a=x with a="x" in IE
|
||||
if (tinymce.isIE)
|
||||
h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"')
|
||||
|
||||
document.dir = t.editor.getParam('directionality','');
|
||||
|
||||
if ((nv = t.editor.translate(h)) && nv != h)
|
||||
document.body.innerHTML = nv;
|
||||
|
||||
if ((nv = t.editor.translate(ti)) && nv != ti)
|
||||
document.title = ti = nv;
|
||||
}
|
||||
|
||||
document.body.style.display = '';
|
||||
|
||||
// Restore selection in IE when focus is placed on a non textarea or input element of the type text
|
||||
if (tinymce.isIE) {
|
||||
document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection);
|
||||
|
||||
// Add base target element for it since it would fail with modal dialogs
|
||||
t.dom.add(t.dom.select('head')[0], 'base', {target : '_self'});
|
||||
}
|
||||
|
||||
t.restoreSelection();
|
||||
|
||||
// Set inline title
|
||||
if (!t.isWindow)
|
||||
t.editor.windowManager.setTitle(window, ti);
|
||||
else
|
||||
window.focus();
|
||||
|
||||
if (!tinymce.isIE && !t.isWindow) {
|
||||
tinymce.dom.Event._add(document, 'focus', function() {
|
||||
t.editor.windowManager.focus(t.id);
|
||||
});
|
||||
}
|
||||
|
||||
// Patch for accessibility
|
||||
tinymce.each(t.dom.select('select'), function(e) {
|
||||
e.onkeydown = tinyMCEPopup._accessHandler;
|
||||
});
|
||||
|
||||
// Call onInit
|
||||
// Init must be called before focus so the selection won't get lost by the focus call
|
||||
tinymce.each(t.listeners, function(o) {
|
||||
o.func.call(o.scope, t.editor);
|
||||
});
|
||||
|
||||
// Move focus to window
|
||||
if (t.getWindowArg('mce_auto_focus', true)) {
|
||||
window.focus();
|
||||
|
||||
// Focus element with mceFocus class
|
||||
tinymce.each(document.forms, function(f) {
|
||||
tinymce.each(f.elements, function(e) {
|
||||
if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) {
|
||||
e.focus();
|
||||
return false; // Break loop
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
document.onkeyup = tinyMCEPopup._closeWinKeyHandler;
|
||||
},
|
||||
|
||||
_accessHandler : function(e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (e.keyCode == 13 || e.keyCode == 32) {
|
||||
e = e.target || e.srcElement;
|
||||
|
||||
if (e.onchange)
|
||||
e.onchange();
|
||||
|
||||
return tinymce.dom.Event.cancel(e);
|
||||
}
|
||||
},
|
||||
|
||||
_closeWinKeyHandler : function(e) {
|
||||
e = e || window.event;
|
||||
|
||||
if (e.keyCode == 27)
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
_wait : function() {
|
||||
// Use IE method
|
||||
if (document.attachEvent) {
|
||||
document.attachEvent("onreadystatechange", function() {
|
||||
if (document.readyState === "complete") {
|
||||
document.detachEvent("onreadystatechange", arguments.callee);
|
||||
tinyMCEPopup._onDOMLoaded();
|
||||
}
|
||||
});
|
||||
|
||||
if (document.documentElement.doScroll && window == window.top) {
|
||||
(function() {
|
||||
if (tinyMCEPopup.domLoaded)
|
||||
return;
|
||||
|
||||
try {
|
||||
// If IE is used, use the trick by Diego Perini
|
||||
// http://javascript.nwbox.com/IEContentLoaded/
|
||||
document.documentElement.doScroll("left");
|
||||
} catch (ex) {
|
||||
setTimeout(arguments.callee, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
tinyMCEPopup._onDOMLoaded();
|
||||
})();
|
||||
}
|
||||
|
||||
document.attachEvent('onload', tinyMCEPopup._onDOMLoaded);
|
||||
} else if (document.addEventListener) {
|
||||
window.addEventListener('DOMContentLoaded', tinyMCEPopup._onDOMLoaded, false);
|
||||
window.addEventListener('load', tinyMCEPopup._onDOMLoaded, false);
|
||||
}
|
||||
}
|
||||
};
|
1
wp-includes/js/tinymce/plugins/wpdialogs/js/popup.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var tinyMCEPopup={init:function(){var b=this,a,c;a=b.getWin();tinymce=a.tinymce;tinyMCE=a.tinyMCE;b.editor=tinymce.EditorManager.activeEditor;b.params=b.editor.windowManager.params;b.features=b.editor.windowManager.features;b.dom=tinymce.dom;b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=false;b.id=b.features.id;b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return window},getWindowArg:function(c,b){var a=this.params[c];return tinymce.is(a)?a:b},getParam:function(b,a){return this.editor.getParam(b,a)},getLang:function(b,a){return this.editor.getLang(b,a)},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},resizeToInnerSize:function(){var a=this;setTimeout(function(){var b=a.dom.getViewPort(window);a.editor.windowManager.resizeBy(a.getWindowArg("mce_width")-b.w,a.getWindowArg("mce_height")-b.h,a.id||window)},0)},executeOnLoad:function(s){this.onInit.add(function(){eval(s)})},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(1)},restoreSelection:function(){var a=tinyMCEPopup;if(!a.isWindow&&tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}},requireLangPack:function(){var b=this,a=b.getWindowArg("plugin_url")||b.getWindowArg("theme_url");if(a&&b.editor.settings.language&&b.features.translate_i18n!==false){a+="/langs/"+b.editor.settings.language+"_dlg.js";if(!tinymce.ScriptLoader.isDone(a)){document.write('<script type="text/javascript" src="'+tinymce._addVer(a)+'"><\/script>');tinymce.ScriptLoader.markDone(a)}}},pickColor:function(b,a){this.execCommand("mceColorPicker",true,{color:document.getElementById(a).value,func:function(e){document.getElementById(a).value=e;try{document.getElementById(a).onchange()}catch(d){}}})},openBrowser:function(a,c,b){tinyMCEPopup.restoreSelection();this.editor.execCallback("file_browser_callback",a,document.getElementById(a).value,c,window)},confirm:function(b,a,c){this.editor.windowManager.confirm(b,a,c,window)},alert:function(b,a,c){this.editor.windowManager.alert(b,a,c,window)},close:function(){var a=this;function b(){a.editor.windowManager.close(window);a.editor=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(){var a=window.event.srcElement;if(a.nodeName=="INPUT"&&(a.type=="submit"||a.type=="button")){tinyMCEPopup.restoreSelection()}},_onDOMLoaded:function(){var b=tinyMCEPopup,d=document.title,e,c,a;if(b.domLoaded){return}b.domLoaded=1;tinyMCEPopup.init();if(b.features.translate_i18n!==false){c=document.body.innerHTML;if(tinymce.isIE){c=c.replace(/ (value|title|alt)=([^"][^\s>]+)/gi,' $1="$2"')}document.dir=b.editor.getParam("directionality","");if((a=b.editor.translate(c))&&a!=c){document.body.innerHTML=a}if((a=b.editor.translate(d))&&a!=d){document.title=d=a}}document.body.style.display="";if(tinymce.isIE){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}b.restoreSelection();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){tinymce.dom.Event._add(document,"focus",function(){b.editor.windowManager.focus(b.id)})}tinymce.each(b.dom.select("select"),function(f){f.onkeydown=tinyMCEPopup._accessHandler});tinymce.each(b.listeners,function(f){f.func.call(f.scope,b.editor)});if(b.getWindowArg("mce_auto_focus",true)){window.focus();tinymce.each(document.forms,function(g){tinymce.each(g.elements,function(f){if(b.dom.hasClass(f,"mceFocus")&&!f.disabled){f.focus();return false}})})}document.onkeyup=tinyMCEPopup._closeWinKeyHandler},_accessHandler:function(a){a=a||window.event;if(a.keyCode==13||a.keyCode==32){a=a.target||a.srcElement;if(a.onchange){a.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_wait:function(){if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);tinyMCEPopup._onDOMLoaded()}});if(document.documentElement.doScroll&&window==window.top){(function(){if(tinyMCEPopup.domLoaded){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}tinyMCEPopup._onDOMLoaded()})()}document.attachEvent("onload",tinyMCEPopup._onDOMLoaded)}else{if(document.addEventListener){window.addEventListener("DOMContentLoaded",tinyMCEPopup._onDOMLoaded,false);window.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};
|
28
wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.js
Normal file
@ -0,0 +1,28 @@
|
||||
(function($){
|
||||
$.ui.dialog.prototype.options.closeOnEscape = false;
|
||||
$.widget('wp.wpdialog', $.ui.dialog, {
|
||||
// Work around a bug in jQuery UI 1.9.1.
|
||||
// http://bugs.jqueryui.com/ticket/8805
|
||||
widgetEventPrefix: 'wpdialog',
|
||||
|
||||
open: function() {
|
||||
var ed;
|
||||
|
||||
// Initialize tinyMCEPopup if it exists and the editor is active.
|
||||
if ( tinyMCEPopup && typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
|
||||
tinyMCEPopup.init();
|
||||
}
|
||||
|
||||
// Add beforeOpen event.
|
||||
if ( this.isOpen() || false === this._trigger('beforeOpen') ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Open the dialog.
|
||||
this._super();
|
||||
// WebKit leaves focus in the TinyMCE editor unless we shift focus.
|
||||
this.element.focus();
|
||||
this._trigger('refresh');
|
||||
}
|
||||
});
|
||||
})(jQuery);
|
1
wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
(function(a){a.ui.dialog.prototype.options.closeOnEscape=false;a.widget("wp.wpdialog",a.ui.dialog,{widgetEventPrefix:"wpdialog",open:function(){var b;if(tinyMCEPopup&&typeof tinyMCE!="undefined"&&(b=tinyMCE.activeEditor)&&!b.isHidden()){tinyMCEPopup.init()}if(this.isOpen()||false===this._trigger("beforeOpen")){return}this._super();this.element.focus();this._trigger("refresh")}})})(jQuery);
|
443
wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css
Normal file
@ -0,0 +1,443 @@
|
||||
|
||||
html, body {
|
||||
background-color: #fff;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-size: 12px;
|
||||
line-height: 1.4em;
|
||||
}
|
||||
|
||||
a.button {
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
textarea,
|
||||
input,
|
||||
select {
|
||||
font: inherit;
|
||||
margin: 1px;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
p.help {
|
||||
margin: 4px 0;
|
||||
font-size: 12px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
abbr.required {
|
||||
color: #FF0000;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
img.alignright,
|
||||
.alignright {
|
||||
float: right;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
img.alignleft,
|
||||
.alignleft {
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
img.aligncenter {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
label {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
th.label {
|
||||
width: 107px;
|
||||
}
|
||||
|
||||
#media-upload #basic th.label {
|
||||
padding: 5px 5px 5px 0;
|
||||
}
|
||||
|
||||
.show-align {
|
||||
height: 200px;
|
||||
width: 480px;
|
||||
float: right;
|
||||
background-color: #f1f1f1;
|
||||
cursor: default;
|
||||
-moz-user-select: none;
|
||||
user-select: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#img-edit {
|
||||
border: 1px solid #dfdfdf;
|
||||
width: 623px;
|
||||
margin: 15px auto;
|
||||
}
|
||||
|
||||
#media-upload .media-upload-form table.describe {
|
||||
border-top-style: none;
|
||||
border-top-width: 0;
|
||||
}
|
||||
|
||||
#img_demo_txt {
|
||||
font-size: 9px;
|
||||
line-height: 13px;
|
||||
font-family: Monaco,"Courier New",Courier,monospace;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
#img_demo {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#saveeditimg {
|
||||
padding: 10px 0 0 5px;
|
||||
border-top: 1px solid #ccc;
|
||||
}
|
||||
|
||||
#sidemenu,
|
||||
#sidemenu li {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#sidemenu li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#sidemenu a {
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
border-top-style: solid;
|
||||
border-top-width: 1px;
|
||||
display: block;
|
||||
float: left;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
margin: 0;
|
||||
padding: 0pt 7px;
|
||||
background-color: #f9f9f9;
|
||||
border-color: #f9f9f9;
|
||||
border-bottom-color: #dfdfdf;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #21759B;
|
||||
}
|
||||
|
||||
a:hover,
|
||||
a:active,
|
||||
a:focus {
|
||||
color: #D54E21;
|
||||
}
|
||||
|
||||
#sidemenu a.current {
|
||||
-webkit-border-top-left-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
-webkit-border-top-right-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
font-weight: normal;
|
||||
background-color: #fff;
|
||||
border-color: #dfdfdf #dfdfdf #fff;
|
||||
color: #D54E21;
|
||||
}
|
||||
|
||||
#adv_settings .field label {
|
||||
padding: 0 5px 5px;
|
||||
}
|
||||
|
||||
#media-upload h3 {
|
||||
clear: both;
|
||||
padding: 0pt 0pt 3px;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-width: 1px;
|
||||
font-family: Georgia,"Times New Roman",Times,serif;
|
||||
font-size: 20px;
|
||||
font-weight: normal;
|
||||
line-height: normal;
|
||||
margin: 0 0 10px -4px;
|
||||
padding: 15px 0 3px;
|
||||
border-bottom-color: #DADADA;
|
||||
color: #5A5A5A;
|
||||
}
|
||||
|
||||
#img_dim #width,
|
||||
#img_dim #height,
|
||||
#img_prop #border,
|
||||
#img_prop #vspace,
|
||||
#img_prop #hspace {
|
||||
width: 36px;
|
||||
}
|
||||
|
||||
#img_dim abbr {
|
||||
padding: 0 4px;
|
||||
}
|
||||
|
||||
#show_align_sp {
|
||||
width: 115px;
|
||||
}
|
||||
|
||||
#img_dim input,
|
||||
#img_prop input {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#basic .align .field label {
|
||||
padding: 0 0 0 24px;
|
||||
}
|
||||
|
||||
#basic {
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
#img_size {
|
||||
float: right;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
background-color: #f1f1f1;
|
||||
padding: 5px 0;
|
||||
width: 45px;
|
||||
}
|
||||
|
||||
#img_size div {
|
||||
font-size: 10px;
|
||||
padding: 2px;
|
||||
border: 1px solid #f1f1f1;
|
||||
line-height: 15px;
|
||||
height: 15px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
color: #07273E;
|
||||
}
|
||||
|
||||
#img_size div#s100 {
|
||||
border-color: #A3A3A3;
|
||||
background-color: #E5E5E5;
|
||||
}
|
||||
|
||||
#img_size_div {
|
||||
width: 100px;
|
||||
float: left;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#img_size_title {
|
||||
margin: 0 7px 5px;
|
||||
text-align: right;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#img_align_td {
|
||||
padding: 2px 0 8px;
|
||||
}
|
||||
|
||||
#media-upload tr.align td.field {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.describe td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#media-upload .describe th.label {
|
||||
padding-top: .5em;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#media-upload .describe {
|
||||
border-top-width: 1px;
|
||||
border-top-style: solid;
|
||||
padding: 5px;
|
||||
width: 100%;
|
||||
clear: both;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
form {
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
.describe input[type="text"],
|
||||
.describe textarea {
|
||||
width: 460px;
|
||||
border: 1px solid #dfdfdf;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.media-upload-form label,
|
||||
.media-upload-form legend {
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
color: #464646;
|
||||
}
|
||||
|
||||
.align .field label {
|
||||
display: inline;
|
||||
padding: 0 0 0 28px;
|
||||
margin: 0 1em 0 0;
|
||||
}
|
||||
|
||||
.image-align-none-label {
|
||||
background: url(../../../../../../wp-admin/images/align-none.png) no-repeat center left;
|
||||
}
|
||||
|
||||
.image-align-left-label {
|
||||
background: url(../../../../../../wp-admin/images/align-left.png) no-repeat center left;
|
||||
}
|
||||
|
||||
.image-align-center-label {
|
||||
background: url(../../../../../../wp-admin/images/align-center.png) no-repeat center left;
|
||||
}
|
||||
|
||||
.image-align-right-label {
|
||||
background: url(../../../../../../wp-admin/images/align-right.png) no-repeat center left;
|
||||
}
|
||||
|
||||
div#media-upload-header {
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
font-weight: bold;
|
||||
position: relative;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
height: 33px;
|
||||
background-color: #f9f9f9;
|
||||
border-bottom-color: #dfdfdf;
|
||||
}
|
||||
|
||||
body#media-upload ul#sidemenu {
|
||||
font-weight: normal;
|
||||
margin: 0 5px;
|
||||
position: relative;
|
||||
left: 0px;
|
||||
bottom: -4px;
|
||||
}
|
||||
|
||||
div#media-upload-error {
|
||||
margin: 1em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#TB_window #TB_title {
|
||||
background-color: #222222;
|
||||
color: #CFCFCF;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* RTL */
|
||||
body#media-upload.rtl ul#sidemenu {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.rtl #basic .align .field label {
|
||||
display: block;
|
||||
float: right;
|
||||
padding: 0 24px 0 0;
|
||||
margin: 5px 3px 5px 5px;
|
||||
}
|
||||
|
||||
.rtl .align .field input {
|
||||
display: block;
|
||||
float: right;
|
||||
margin: 5px 15px 5px 0;
|
||||
}
|
||||
|
||||
.rtl tr.image-size label {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.rtl tr.image-size input {
|
||||
margin: 3px 15px 0 5px;
|
||||
}
|
||||
|
||||
.rtl .image-align-none-label,
|
||||
.rtl .image-align-left-label,
|
||||
.rtl .image-align-center-label,
|
||||
.rtl .image-align-right-label {
|
||||
background-position: center right;
|
||||
}
|
||||
|
||||
#media-upload.rtl .describe th.label {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.rtl .show-align,
|
||||
.rtl #img_size,
|
||||
.rtl .alignright,
|
||||
.rtl #img_demo.alignleft {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.rtl tr.image-size label,
|
||||
.rtl tr.image-size input,
|
||||
.rtl #img_dim label,
|
||||
.rtl #img_dim input,
|
||||
.rtl #img_prop label,
|
||||
.rtl #img_prop input,
|
||||
.rtl #img_size_div,
|
||||
.rtl .alignleft,
|
||||
.rtl #img_demo.alignright {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.rtl #img_dim label,
|
||||
.rtl #img_prop label {
|
||||
margin: 5px 0pt;
|
||||
}
|
||||
|
||||
.rtl #img_dim input,
|
||||
.rtl #img_prop input {
|
||||
margin: 0 5px 0 10px;
|
||||
}
|
||||
|
||||
.rtl #img_size_title {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retina display 2x icons
|
||||
*/
|
||||
@media print,
|
||||
(-o-min-device-pixel-ratio: 5/4),
|
||||
(-webkit-min-device-pixel-ratio: 1.25),
|
||||
(min-resolution: 120dpi) {
|
||||
.image-align-none-label {
|
||||
background: url(../../../../../../wp-admin/images/align-none-2x.png) no-repeat center left;
|
||||
background-size: auto 15px;
|
||||
}
|
||||
|
||||
.image-align-left-label {
|
||||
background: url(../../../../../../wp-admin/images/align-left-2x.png) no-repeat center left;
|
||||
background-size: auto 15px;
|
||||
}
|
||||
|
||||
.image-align-center-label {
|
||||
background: url(../../../../../../wp-admin/images/align-center-2x.png) no-repeat center left;
|
||||
background-size: auto 15px;
|
||||
}
|
||||
|
||||
.image-align-right-label {
|
||||
background: url(../../../../../../wp-admin/images/align-right-2x.png) no-repeat center left;
|
||||
background-size: auto 15px;
|
||||
}
|
||||
}
|
274
wp-includes/js/tinymce/plugins/wpeditimage/editimage.html
Normal file
@ -0,0 +1,274 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title></title>
|
||||
|
||||
<link rel="stylesheet" href="css/editimage.css?ver=358-20121205" type="text/css" media="all" />
|
||||
<link rel="stylesheet" href="../../../../css/buttons.css?ver=358-20121205" type="text/css" media="all" />
|
||||
<script type="text/javascript" src="js/editimage.min.js?ver=358-20121205"></script>
|
||||
<script type="text/javascript" src="../../utils/form_utils.js?ver=358-20121205"></script>
|
||||
<base target="_self" />
|
||||
</head>
|
||||
|
||||
<body id="media-upload" class="wp-core-ui" style="display:none;">
|
||||
<script type="text/javascript">
|
||||
if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
|
||||
document.body.className += ' rtl';
|
||||
</script>
|
||||
<div id="media-upload-header">
|
||||
<ul id="sidemenu">
|
||||
<li><a href="javascript:;" id="tab_basic" class="current" onclick="wpImage.setTabs(this);">{#wpeditimage.edit_img}</a></li>
|
||||
<li><a href="javascript:;" id="tab_advanced" onclick="wpImage.setTabs(this);">{#wpeditimage.adv_settings}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="img-edit">
|
||||
<form class="media-upload-form" action="" onsubmit="wpImage.update();">
|
||||
<div id="img_size_div">
|
||||
<div id="img_size_title">{#wpeditimage.size}</div>
|
||||
<div id="img_size" onmouseout="wpImage.showSizeRem()">
|
||||
<div id="s130" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s130}</div>
|
||||
<div id="s120" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s120}</div>
|
||||
<div id="s110" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s110}</div>
|
||||
<div id="s100" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s100}</div>
|
||||
<div id="s90" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s90}</div>
|
||||
<div id="s80" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s80}</div>
|
||||
<div id="s70" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s70}</div>
|
||||
<div id="s60" onmouseover="wpImage.showSize(this)" onclick="wpImage.imgEditSize(this)">{#wpeditimage.s60}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="show-align" id="show_align">
|
||||
<img id="img_demo" src="img/image.png" alt="" />
|
||||
<span id="img_demo_txt">
|
||||
Lorem ipsum dolor sit amet consectetuer velit pretium euismod ipsum enim. Mi cursus at a mollis senectus id arcu gravida quis urna. Sed et felis id tempus Morbi mauris tincidunt enim In mauris. Pede eu risus velit libero natoque enim lorem adipiscing ipsum consequat. In malesuada et sociis tincidunt tempus pellentesque cursus convallis ipsum Suspendisse. Risus In ac quis ut Nunc convallis laoreet ante Suspendisse Nam. Amet amet urna condimentum Vestibulum sem at Curabitur lorem et cursus. Sodales tortor fermentum leo dui habitant Nunc Sed Vestibulum.
|
||||
Ut lorem In penatibus libero id ipsum sagittis nec elit Sed. Condimentum eget Vivamus vel consectetuer lorem molestie turpis amet tellus id. Condimentum vel ridiculus Fusce sed pede Nam nunc sodales eros tempor. Sit lacus magna dictumst Curabitur fringilla auctor id vitae wisi facilisi. Fermentum eget turpis felis velit leo Nunc Proin orci molestie Praesent. Curabitur tellus scelerisque suscipit ut sem amet cursus mi Morbi eu. Donec libero Vestibulum augue et mollis accumsan ornare condimentum In enim. Leo eget ac consectetuer quis condimentum malesuada.
|
||||
Condimentum commodo et Lorem fringilla malesuada libero volutpat sem tellus enim. Tincidunt sed at Aenean nec nonummy porttitor Nam Sed Nulla ut. Auctor leo In aliquet Curabitur eros et velit Quisque justo morbi. Et vel mauris sit nulla semper vitae et quis at dui. Id at elit laoreet justo eu mauris Quisque et interdum pharetra. Nullam accumsan interdum Maecenas condimentum quis quis Fusce a sollicitudin Sed. Non Quisque Vivamus congue porttitor non semper ipsum porttitor quis vel. Donec eros lacus volutpat et tincidunt sem convallis id venenatis sit. Consectetuer odio.
|
||||
Semper faucibus Morbi nulla convallis orci Aliquam Sed porttitor et Pellentesque. Venenatis laoreet lorem id a a Morbi augue turpis id semper. Arcu volutpat ac mauris Vestibulum fringilla Aenean condimentum nibh sed id. Sagittis eu lacus orci urna tellus tellus pretium Curabitur dui nunc. Et nibh eu eu nibh adipiscing at lorem Vestibulum adipiscing augue. Magna convallis Phasellus dolor malesuada Curabitur ornare adipiscing tellus Aliquam tempus. Id Aliquam Integer augue Nulla consectetuer ac Donec Curabitur tincidunt et. Id vel Nunc amet lacus dui magna ridiculus penatibus laoreet Duis. Enim sagittis nibh quis Nulla nec laoreet vel Maecenas mattis vel.
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="div_basic">
|
||||
<table id="basic" class="describe">
|
||||
<tbody>
|
||||
|
||||
<tr class="align">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_align_td">
|
||||
<span class="alignleft">{#contextmenu.align}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field" id="img_align_td">
|
||||
<input type="radio" onclick="wpImage.imgAlignCls('alignnone')" name="img_align" id="alignnone" value="alignnone" />
|
||||
<label for="alignnone" class="align image-align-none-label">{#wpeditimage.none}</label>
|
||||
|
||||
<input type="radio" onclick="wpImage.imgAlignCls('alignleft')" name="img_align" id="alignleft" value="alignleft" />
|
||||
<label for="alignleft" class="align image-align-left-label">{#contextmenu.left}</label>
|
||||
|
||||
<input type="radio" onclick="wpImage.imgAlignCls('aligncenter')" name="img_align" id="aligncenter" value="aligncenter" />
|
||||
<label for="aligncenter" class="align image-align-center-label">{#contextmenu.center}</label>
|
||||
|
||||
<input type="radio" onclick="wpImage.imgAlignCls('alignright')" name="img_align" id="alignright" value="alignright" />
|
||||
<label for="alignright" class="align image-align-right-label">{#contextmenu.right}</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_title">
|
||||
<span class="alignleft">{#wpeditimage.img_title}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_title" name="img_title" value="" aria-required="true" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_alt">
|
||||
<span class="alignleft">{#wpeditimage.alt}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_alt" name="img_alt" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="cap_field">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_cap">
|
||||
<span class="alignleft">{#wpeditimage.caption}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<textarea id="img_cap_text"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_href">
|
||||
<span class="alignleft" id="lb_link_href">{#advanced_dlg.link_url}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_href" name="link_href" value="" size="60" /><br />
|
||||
<input type="button" class="button" onclick="wpImage.I('link_href').value='';" value="{#wpeditimage.none}" />
|
||||
<input type="button" class="button" id="img_url_current" onclick="wpImage.img_seturl('current')" value="{#wpeditimage.current_link}" />
|
||||
<input type="button" class="button" id="img_url_img" onclick="wpImage.img_seturl('link')" value="{#wpeditimage.link_to_img}" />
|
||||
<p class="help">{#wpeditimage.link_help}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
|
||||
<div id="div_advanced" style="display:none;">
|
||||
<h3>{#wpeditimage.adv_img_settings}</h3>
|
||||
<table id="adv_settings_img" class="describe">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_src">
|
||||
<span class="alignleft">{#wpeditimage.source}</span>
|
||||
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_src" name="img_src" value="" onblur="wpImage.checkVal(this)" aria-required="true" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="img_dim">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label>
|
||||
<span class="alignleft">{#wpeditimage.size}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<label for="width">{#wpeditimage.width}</label>
|
||||
<input type="text" maxlength="5" id="width" name="width" value="" />
|
||||
|
||||
<label for="height">{#wpeditimage.height}</label>
|
||||
<input type="text" maxlength="5" id="height" name="height" value="" />
|
||||
|
||||
<input type="button" class="button" id="orig_size" name="orig_size" value="{#wpeditimage.orig_size}" onclick="wpImage.origSize();" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_classes">
|
||||
<span class="alignleft">{#wpeditimage.css}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_classes" name="img_classes" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_style">
|
||||
<span class="alignleft">{#advanced.style_select}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="img_style" name="img_style" value="" size="60" onblur="wpImage.demoSetStyle();" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="img_prop">
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="img_prop">
|
||||
<span class="alignleft">{#advanced.image_props_desc}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<label for="border">{#advanced_dlg.image_border}</label>
|
||||
<input type="text" maxlength="5" id="border" name="border" value="" onblur="wpImage.updateStyle('border')" />
|
||||
|
||||
<label for="vspace">{#advanced_dlg.image_vspace}</label>
|
||||
<input type="text" maxlength="5" id="vspace" name="vspace" value="" onblur="wpImage.updateStyle('vspace')" />
|
||||
|
||||
<label for="hspace">{#advanced_dlg.image_hspace}</label>
|
||||
<input type="text" maxlength="5" id="hspace" name="hspace" value="" onblur="wpImage.updateStyle('hspace')" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3>{#wpeditimage.adv_link_settings}</h3>
|
||||
<table id="adv_settings_link" class="describe">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_title">
|
||||
<span class="alignleft">{#advanced_dlg.link_titlefield}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_title" name="link_title" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_rel">
|
||||
<span class="alignleft">{#wpeditimage.link_rel}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_rel" name="link_rel" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_classes">
|
||||
<span class="alignleft">{#wpeditimage.css}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_classes" name="link_classes" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label for="link_style">
|
||||
<span class="alignleft">{#advanced.style_select}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<input type="text" id="link_style" name="link_style" value="" size="60" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<label>
|
||||
<span class="alignleft">{#advanced_dlg.link_target}</span>
|
||||
</label>
|
||||
</th>
|
||||
<td class="field">
|
||||
<label for="link_target">
|
||||
{#advanced_dlg.link_target_blank}
|
||||
</label>
|
||||
<input type="checkbox" id="link_target" name="link_target" value="_blank" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
|
||||
<div id="saveeditimg">
|
||||
<input type="hidden" id="align" name="align" value="" />
|
||||
|
||||
<input type="submit" id="saveimg" class="button" value="{#update}" />
|
||||
<input type="button" class="button" id="cancelimg" name="cancelimg" value="{#cancel}" onclick="tinyMCEPopup.close();" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
325
wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js
Normal file
@ -0,0 +1,325 @@
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.wpEditImage', {
|
||||
url: '',
|
||||
editor: {},
|
||||
|
||||
init: function(ed, url) {
|
||||
var t = this, mouse = {};
|
||||
|
||||
t.url = url;
|
||||
t.editor = ed;
|
||||
t._createButtons();
|
||||
|
||||
ed.addCommand('WP_EditImage', t._editImage);
|
||||
|
||||
ed.onInit.add(function(ed) {
|
||||
ed.dom.events.add(ed.getBody(), 'mousedown', function(e) {
|
||||
var parent;
|
||||
|
||||
if ( e.target.nodeName == 'IMG' && ( parent = ed.dom.getParent(e.target, 'div.mceTemp') ) ) {
|
||||
if ( tinymce.isGecko )
|
||||
ed.selection.select(parent);
|
||||
else if ( tinymce.isWebKit )
|
||||
ed.dom.events.prevent(e);
|
||||
}
|
||||
});
|
||||
|
||||
// when pressing Return inside a caption move the caret to a new parapraph under it
|
||||
ed.dom.events.add(ed.getBody(), 'keydown', function(e) {
|
||||
var n, DL, DIV, P, content;
|
||||
|
||||
if ( e.keyCode == 13 ) {
|
||||
n = ed.selection.getNode();
|
||||
DL = ed.dom.getParent(n, 'dl.wp-caption');
|
||||
|
||||
if ( DL )
|
||||
DIV = ed.dom.getParent(DL, 'div.mceTemp');
|
||||
|
||||
if ( DIV ) {
|
||||
ed.dom.events.cancel(e);
|
||||
P = ed.dom.create('p', {}, '\uFEFF');
|
||||
ed.dom.insertAfter( P, DIV );
|
||||
ed.selection.setCursorLocation(P, 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// iOS6 doesn't show the buttons properly on click, show them on 'touchstart'
|
||||
if ( 'ontouchstart' in window ) {
|
||||
ed.dom.events.add(ed.getBody(), 'touchstart', function(e){
|
||||
t._showButtons(e);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// resize the caption <dl> when the image is soft-resized by the user
|
||||
ed.onMouseUp.add(function(ed, e) {
|
||||
if ( tinymce.isWebKit || tinymce.isOpera )
|
||||
return;
|
||||
|
||||
if ( mouse.x && (e.clientX != mouse.x || e.clientY != mouse.y) ) {
|
||||
var n = ed.selection.getNode();
|
||||
|
||||
if ( 'IMG' == n.nodeName ) {
|
||||
window.setTimeout(function(){
|
||||
var DL = ed.dom.getParent(n, 'dl.wp-caption'), width;
|
||||
|
||||
if ( n.width != mouse.img_w || n.height != mouse.img_h )
|
||||
n.className = n.className.replace(/size-[^ "']+/, '');
|
||||
|
||||
if ( DL ) {
|
||||
width = ed.dom.getAttrib(n, 'width') || n.width;
|
||||
width = parseInt(width, 10);
|
||||
ed.dom.setStyle(DL, 'width', 10 + width);
|
||||
ed.execCommand('mceRepaint');
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
mouse = {};
|
||||
});
|
||||
|
||||
// show editimage buttons
|
||||
ed.onMouseDown.add(function(ed, e){
|
||||
t._showButtons(e);
|
||||
});
|
||||
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
o.content = ed.wpSetImgCaption(o.content);
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if (o.get)
|
||||
o.content = ed.wpGetImgCaption(o.content);
|
||||
});
|
||||
|
||||
ed.wpSetImgCaption = function(content) {
|
||||
return t._do_shcode(content);
|
||||
};
|
||||
|
||||
ed.wpGetImgCaption = function(content) {
|
||||
return t._get_shcode(content);
|
||||
};
|
||||
|
||||
// When inserting content, if the caret is inside a caption create new paragraph under
|
||||
// and move the caret there
|
||||
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
|
||||
var node, p;
|
||||
|
||||
if ( cmd == 'mceInsertContent' ) {
|
||||
node = ed.dom.getParent(ed.selection.getNode(), 'div.mceTemp');
|
||||
|
||||
if ( !node )
|
||||
return;
|
||||
|
||||
p = ed.dom.create('p');
|
||||
ed.dom.insertAfter( p, node );
|
||||
ed.selection.setCursorLocation(p, 0);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
_do_shcode : function(content) {
|
||||
return content.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?/g, function(a,b,c){
|
||||
var id, cls, w, cap, div_cls, img, trim = tinymce.trim;
|
||||
|
||||
id = b.match(/id=['"]([^'"]*)['"] ?/);
|
||||
if ( id )
|
||||
b = b.replace(id[0], '');
|
||||
|
||||
cls = b.match(/align=['"]([^'"]*)['"] ?/);
|
||||
if ( cls )
|
||||
b = b.replace(cls[0], '');
|
||||
|
||||
w = b.match(/width=['"]([0-9]*)['"] ?/);
|
||||
if ( w )
|
||||
b = b.replace(w[0], '');
|
||||
|
||||
c = trim(c);
|
||||
img = c.match(/((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)([\s\S]*)/i);
|
||||
|
||||
if ( img && img[2] ) {
|
||||
cap = trim( img[2] );
|
||||
img = trim( img[1] );
|
||||
} else {
|
||||
// old captions shortcode style
|
||||
cap = trim(b).replace(/caption=['"]/, '').replace(/['"]$/, '');
|
||||
img = c;
|
||||
}
|
||||
|
||||
id = ( id && id[1] ) ? id[1] : '';
|
||||
cls = ( cls && cls[1] ) ? cls[1] : 'alignnone';
|
||||
w = ( w && w[1] ) ? w[1] : '';
|
||||
|
||||
if ( !w || !cap )
|
||||
return c;
|
||||
|
||||
div_cls = 'mceTemp';
|
||||
if ( cls == 'aligncenter' )
|
||||
div_cls += ' mceIEcenter';
|
||||
|
||||
return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+( 10 + parseInt(w) )+
|
||||
'px"><dt class="wp-caption-dt">'+img+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>';
|
||||
});
|
||||
},
|
||||
|
||||
_get_shcode : function(content) {
|
||||
return content.replace(/<div (?:id="attachment_|class="mceTemp)[^>]*>([\s\S]+?)<\/div>/g, function(a, b){
|
||||
var ret = b.replace(/<dl ([^>]+)>\s*<dt [^>]+>([\s\S]+?)<\/dt>\s*<dd [^>]+>([\s\S]*?)<\/dd>\s*<\/dl>/gi, function(a,b,c,cap){
|
||||
var id, cls, w;
|
||||
|
||||
w = c.match(/width="([0-9]*)"/);
|
||||
w = ( w && w[1] ) ? w[1] : '';
|
||||
|
||||
if ( !w || !cap )
|
||||
return c;
|
||||
|
||||
id = b.match(/id="([^"]*)"/);
|
||||
id = ( id && id[1] ) ? id[1] : '';
|
||||
|
||||
cls = b.match(/class="([^"]*)"/);
|
||||
cls = ( cls && cls[1] ) ? cls[1] : '';
|
||||
cls = cls.match(/align[a-z]+/) || 'alignnone';
|
||||
|
||||
cap = cap.replace(/\r\n|\r/g, '\n').replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){
|
||||
// no line breaks inside HTML tags
|
||||
return a.replace(/[\r\n\t]+/, ' ');
|
||||
});
|
||||
|
||||
// convert remaining line breaks to <br>
|
||||
cap = cap.replace(/\s*\n\s*/g, '<br />');
|
||||
|
||||
return '[caption id="'+id+'" align="'+cls+'" width="'+w+'"]'+c+' '+cap+'[/caption]';
|
||||
});
|
||||
|
||||
if ( ret.indexOf('[caption') !== 0 ) {
|
||||
// the caption html seems brocken, try to find the image that may be wrapped in a link
|
||||
// and may be followed by <p> with the caption text.
|
||||
ret = b.replace(/[\s\S]*?((?:<a [^>]+>)?<img [^>]+>(?:<\/a>)?)(<p>[\s\S]*<\/p>)?[\s\S]*/gi, '<p>$1</p>$2');
|
||||
}
|
||||
|
||||
return ret;
|
||||
});
|
||||
},
|
||||
|
||||
_createButtons : function() {
|
||||
var t = this, ed = tinymce.activeEditor, DOM = tinymce.DOM, editButton, dellButton, isRetina;
|
||||
|
||||
if ( DOM.get('wp_editbtns') )
|
||||
return;
|
||||
|
||||
isRetina = ( window.devicePixelRatio && window.devicePixelRatio > 1 ) || // WebKit, Opera
|
||||
( window.matchMedia && window.matchMedia('(min-resolution:130dpi)').matches ); // Firefox, IE10, Opera
|
||||
|
||||
DOM.add(document.body, 'div', {
|
||||
id : 'wp_editbtns',
|
||||
style : 'display:none;'
|
||||
});
|
||||
|
||||
editButton = DOM.add('wp_editbtns', 'img', {
|
||||
src : isRetina ? t.url+'/img/image-2x.png' : t.url+'/img/image.png',
|
||||
id : 'wp_editimgbtn',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wpeditimage.edit_img')
|
||||
});
|
||||
|
||||
tinymce.dom.Event.add(editButton, 'mousedown', function(e) {
|
||||
t._editImage();
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
|
||||
dellButton = DOM.add('wp_editbtns', 'img', {
|
||||
src : isRetina ? t.url+'/img/delete-2x.png' : t.url+'/img/delete.png',
|
||||
id : 'wp_delimgbtn',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wpeditimage.del_img')
|
||||
});
|
||||
|
||||
tinymce.dom.Event.add(dellButton, 'mousedown', function(e) {
|
||||
var ed = tinymce.activeEditor, el = ed.selection.getNode(), parent;
|
||||
|
||||
if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItem') == -1 ) {
|
||||
if ( (parent = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(parent, 'mceTemp') ) {
|
||||
ed.dom.remove(parent);
|
||||
} else {
|
||||
if ( el.parentNode.nodeName == 'A' && el.parentNode.childNodes.length == 1 )
|
||||
el = el.parentNode;
|
||||
|
||||
if ( el.parentNode.nodeName == 'P' && el.parentNode.childNodes.length == 1 )
|
||||
el = el.parentNode;
|
||||
|
||||
ed.dom.remove(el);
|
||||
}
|
||||
|
||||
ed.execCommand('mceRepaint');
|
||||
return false;
|
||||
}
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
},
|
||||
|
||||
_editImage : function() {
|
||||
var ed = tinymce.activeEditor, url = this.url, el = ed.selection.getNode(), vp, H, W, cls = el.className;
|
||||
|
||||
if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 || el.nodeName != 'IMG' )
|
||||
return;
|
||||
|
||||
vp = tinymce.DOM.getViewPort();
|
||||
H = 680 < (vp.h - 70) ? 680 : vp.h - 70;
|
||||
W = 650 < vp.w ? 650 : vp.w;
|
||||
|
||||
ed.windowManager.open({
|
||||
file: url + '/editimage.html',
|
||||
width: W+'px',
|
||||
height: H+'px',
|
||||
inline: true
|
||||
});
|
||||
},
|
||||
|
||||
_showButtons : function(e) {
|
||||
var ed = this.editor, target = e.target;
|
||||
|
||||
if ( target.nodeName != 'IMG' ) {
|
||||
if ( target.firstChild && target.firstChild.nodeName == 'IMG' && target.childNodes.length == 1 ) {
|
||||
target = target.firstChild;
|
||||
} else {
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ed.dom.getAttrib(target, 'class').indexOf('mceItem') == -1 ) {
|
||||
mouse = {
|
||||
x: e.clientX,
|
||||
y: e.clientY,
|
||||
img_w: target.clientWidth,
|
||||
img_h: target.clientHeight
|
||||
};
|
||||
|
||||
if ( e.type == 'touchstart' ) {
|
||||
ed.selection.select(target);
|
||||
ed.dom.events.cancel(e);
|
||||
}
|
||||
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
ed.plugins.wordpress._showButtons(target, 'wp_editbtns');
|
||||
}
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Edit Image',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : '',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add('wpeditimage', tinymce.plugins.wpEditImage);
|
||||
})();
|
BIN
wp-includes/js/tinymce/plugins/wpeditimage/img/delete-2x.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
wp-includes/js/tinymce/plugins/wpeditimage/img/image-2x.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
wp-includes/js/tinymce/plugins/wpeditimage/img/image.png
Normal file
After Width: | Height: | Size: 946 B |
613
wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js
Normal file
@ -0,0 +1,613 @@
|
||||
|
||||
var tinymce = null, tinyMCEPopup, tinyMCE, wpImage;
|
||||
|
||||
tinyMCEPopup = {
|
||||
init: function() {
|
||||
var t = this, w, ti;
|
||||
|
||||
// Find window & API
|
||||
w = t.getWin();
|
||||
tinymce = w.tinymce;
|
||||
tinyMCE = w.tinyMCE;
|
||||
t.editor = tinymce.EditorManager.activeEditor;
|
||||
t.params = t.editor.windowManager.params;
|
||||
t.features = t.editor.windowManager.features;
|
||||
|
||||
// Setup local DOM
|
||||
t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
|
||||
t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
|
||||
},
|
||||
|
||||
getWin : function() {
|
||||
return (!window.frameElement && window.dialogArguments) || opener || parent || top;
|
||||
},
|
||||
|
||||
getParam : function(n, dv) {
|
||||
return this.editor.getParam(n, dv);
|
||||
},
|
||||
|
||||
close : function() {
|
||||
var t = this;
|
||||
|
||||
// To avoid domain relaxing issue in Opera
|
||||
function close() {
|
||||
t.editor.windowManager.close(window);
|
||||
tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
|
||||
};
|
||||
|
||||
if (tinymce.isOpera)
|
||||
t.getWin().setTimeout(close, 0);
|
||||
else
|
||||
close();
|
||||
},
|
||||
|
||||
execCommand : function(cmd, ui, val, a) {
|
||||
a = a || {};
|
||||
a.skip_focus = 1;
|
||||
|
||||
this.restoreSelection();
|
||||
return this.editor.execCommand(cmd, ui, val, a);
|
||||
},
|
||||
|
||||
storeSelection : function() {
|
||||
this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark(1);
|
||||
},
|
||||
|
||||
restoreSelection : function() {
|
||||
var t = tinyMCEPopup;
|
||||
|
||||
if ( tinymce.isIE )
|
||||
t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
|
||||
}
|
||||
}
|
||||
tinyMCEPopup.init();
|
||||
|
||||
wpImage = {
|
||||
preInit : function() {
|
||||
// import colors stylesheet from parent
|
||||
var ed = tinyMCEPopup.editor, win = tinyMCEPopup.getWin(), styles = win.document.styleSheets, url, i;
|
||||
|
||||
for ( i = 0; i < styles.length; i++ ) {
|
||||
url = styles.item(i).href;
|
||||
if ( url && url.indexOf('colors') != -1 ) {
|
||||
document.getElementsByTagName('head')[0].appendChild( ed.dom.create('link', {rel:'stylesheet', href: url}) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
I : function(e) {
|
||||
return document.getElementById(e);
|
||||
},
|
||||
|
||||
current : '',
|
||||
link : '',
|
||||
link_rel : '',
|
||||
target_value : '',
|
||||
current_size_sel : 's100',
|
||||
width : '',
|
||||
height : '',
|
||||
align : '',
|
||||
img_alt : '',
|
||||
|
||||
setTabs : function(tab) {
|
||||
var t = this;
|
||||
|
||||
if ( 'current' == tab.className ) return false;
|
||||
t.I('div_advanced').style.display = ( 'tab_advanced' == tab.id ) ? 'block' : 'none';
|
||||
t.I('div_basic').style.display = ( 'tab_basic' == tab.id ) ? 'block' : 'none';
|
||||
t.I('tab_basic').className = t.I('tab_advanced').className = '';
|
||||
tab.className = 'current';
|
||||
return false;
|
||||
},
|
||||
|
||||
img_seturl : function(u) {
|
||||
var t = this, rel = t.I('link_rel').value;
|
||||
|
||||
if ( 'current' == u ) {
|
||||
t.I('link_href').value = t.current;
|
||||
t.I('link_rel').value = t.link_rel;
|
||||
} else {
|
||||
t.I('link_href').value = t.link;
|
||||
if ( rel ) {
|
||||
rel = rel.replace( /attachment|wp-att-[0-9]+/gi, '' );
|
||||
t.I('link_rel').value = tinymce.trim(rel);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
imgAlignCls : function(v) {
|
||||
var t = this, cls = t.I('img_classes').value;
|
||||
|
||||
t.I('img_demo').className = t.align = v;
|
||||
|
||||
cls = cls.replace( /align[^ "']+/gi, '' );
|
||||
cls += (' ' + v);
|
||||
cls = cls.replace( /\s+/g, ' ' ).replace( /^\s/, '' );
|
||||
|
||||
if ( 'aligncenter' == v ) {
|
||||
t.I('hspace').value = '';
|
||||
t.updateStyle('hspace');
|
||||
}
|
||||
|
||||
t.I('img_classes').value = cls;
|
||||
},
|
||||
|
||||
showSize : function(el) {
|
||||
var t = this, demo = t.I('img_demo'), w = t.width, h = t.height, id = el.id || 's100', size;
|
||||
|
||||
size = parseInt(id.substring(1)) / 200;
|
||||
demo.width = Math.round(w * size);
|
||||
demo.height = Math.round(h * size);
|
||||
|
||||
t.showSizeClear();
|
||||
el.style.borderColor = '#A3A3A3';
|
||||
el.style.backgroundColor = '#E5E5E5';
|
||||
},
|
||||
|
||||
showSizeSet : function() {
|
||||
var t = this, s130, s120, s110;
|
||||
|
||||
if ( (t.width * 1.3) > parseInt(t.preloadImg.width) ) {
|
||||
s130 = t.I('s130'), s120 = t.I('s120'), s110 = t.I('s110');
|
||||
|
||||
s130.onclick = s120.onclick = s110.onclick = null;
|
||||
s130.onmouseover = s120.onmouseover = s110.onmouseover = null;
|
||||
s130.style.color = s120.style.color = s110.style.color = '#aaa';
|
||||
}
|
||||
},
|
||||
|
||||
showSizeRem : function() {
|
||||
var t = this, demo = t.I('img_demo'), f = document.forms[0];
|
||||
|
||||
demo.width = Math.round(f.width.value * 0.5);
|
||||
demo.height = Math.round(f.height.value * 0.5);
|
||||
t.showSizeClear();
|
||||
t.I(t.current_size_sel).style.borderColor = '#A3A3A3';
|
||||
t.I(t.current_size_sel).style.backgroundColor = '#E5E5E5';
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
showSizeClear : function() {
|
||||
var divs = this.I('img_size').getElementsByTagName('div'), i;
|
||||
|
||||
for ( i = 0; i < divs.length; i++ ) {
|
||||
divs[i].style.borderColor = '#f1f1f1';
|
||||
divs[i].style.backgroundColor = '#f1f1f1';
|
||||
}
|
||||
},
|
||||
|
||||
imgEditSize : function(el) {
|
||||
var t = this, f = document.forms[0], W, H, w, h, id;
|
||||
|
||||
if ( ! t.preloadImg || ! t.preloadImg.width || ! t.preloadImg.height )
|
||||
return;
|
||||
|
||||
W = parseInt(t.preloadImg.width), H = parseInt(t.preloadImg.height), w = t.width || W, h = t.height || H, id = el.id || 's100';
|
||||
|
||||
size = parseInt(id.substring(1)) / 100;
|
||||
|
||||
w = Math.round(w * size);
|
||||
h = Math.round(h * size);
|
||||
|
||||
f.width.value = Math.min(W, w);
|
||||
f.height.value = Math.min(H, h);
|
||||
|
||||
t.current_size_sel = id;
|
||||
t.demoSetSize();
|
||||
},
|
||||
|
||||
demoSetSize : function(img) {
|
||||
var demo = this.I('img_demo'), f = document.forms[0];
|
||||
|
||||
demo.width = f.width.value ? Math.round(f.width.value * 0.5) : '';
|
||||
demo.height = f.height.value ? Math.round(f.height.value * 0.5) : '';
|
||||
},
|
||||
|
||||
demoSetStyle : function() {
|
||||
var f = document.forms[0], demo = this.I('img_demo'), dom = tinyMCEPopup.editor.dom;
|
||||
|
||||
if (demo) {
|
||||
dom.setAttrib(demo, 'style', f.img_style.value);
|
||||
dom.setStyle(demo, 'width', '');
|
||||
dom.setStyle(demo, 'height', '');
|
||||
}
|
||||
},
|
||||
|
||||
origSize : function() {
|
||||
var t = this, f = document.forms[0], el = t.I('s100');
|
||||
|
||||
f.width.value = t.width = t.preloadImg.width;
|
||||
f.height.value = t.height = t.preloadImg.height;
|
||||
t.showSizeSet();
|
||||
t.demoSetSize();
|
||||
t.showSize(el);
|
||||
},
|
||||
|
||||
init : function() {
|
||||
var ed = tinyMCEPopup.editor, h;
|
||||
|
||||
h = document.body.innerHTML;
|
||||
document.body.innerHTML = ed.translate(h);
|
||||
window.setTimeout( function(){wpImage.setup();}, 500 );
|
||||
},
|
||||
|
||||
setup : function() {
|
||||
var t = this, c, el, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor,
|
||||
d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, DD, caption = '', dlc, pa;
|
||||
|
||||
document.dir = tinyMCEPopup.editor.getParam('directionality','');
|
||||
|
||||
if ( tinyMCEPopup.editor.getParam('wpeditimage_disable_captions', false) )
|
||||
t.I('cap_field').style.display = 'none';
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getNode();
|
||||
if (el.nodeName != 'IMG')
|
||||
return;
|
||||
|
||||
f.img_src.value = d.src = link = ed.dom.getAttrib(el, 'src');
|
||||
ed.dom.setStyle(el, 'float', '');
|
||||
t.getImageData();
|
||||
c = ed.dom.getAttrib(el, 'class');
|
||||
|
||||
if ( DL = dom.getParent(el, 'dl') ) {
|
||||
dlc = ed.dom.getAttrib(DL, 'class');
|
||||
dlc = dlc.match(/align[^ "']+/i);
|
||||
if ( dlc && ! dom.hasClass(el, dlc) ) {
|
||||
c += ' '+dlc;
|
||||
tinymce.trim(c);
|
||||
}
|
||||
|
||||
DD = ed.dom.select('dd.wp-caption-dd', DL);
|
||||
if ( DD && DD[0] )
|
||||
caption = ed.serializer.serialize(DD[0]).replace(/^<p>/, '').replace(/<\/p>$/, '');
|
||||
}
|
||||
|
||||
f.img_cap_text.value = caption;
|
||||
f.img_title.value = ed.dom.getAttrib(el, 'title');
|
||||
f.img_alt.value = ed.dom.getAttrib(el, 'alt');
|
||||
f.border.value = ed.dom.getAttrib(el, 'border');
|
||||
f.vspace.value = ed.dom.getAttrib(el, 'vspace');
|
||||
f.hspace.value = ed.dom.getAttrib(el, 'hspace');
|
||||
f.align.value = ed.dom.getAttrib(el, 'align');
|
||||
f.width.value = t.width = ed.dom.getAttrib(el, 'width');
|
||||
f.height.value = t.height = ed.dom.getAttrib(el, 'height');
|
||||
f.img_classes.value = c;
|
||||
f.img_style.value = ed.dom.getAttrib(el, 'style');
|
||||
|
||||
// Move attribs to styles
|
||||
if ( dom.getAttrib(el, 'hspace') )
|
||||
t.updateStyle('hspace');
|
||||
|
||||
if ( dom.getAttrib(el, 'border') )
|
||||
t.updateStyle('border');
|
||||
|
||||
if ( dom.getAttrib(el, 'vspace') )
|
||||
t.updateStyle('vspace');
|
||||
|
||||
if ( pa = ed.dom.getParent(el, 'A') ) {
|
||||
f.link_href.value = t.current = ed.dom.getAttrib(pa, 'href');
|
||||
f.link_title.value = ed.dom.getAttrib(pa, 'title');
|
||||
f.link_rel.value = t.link_rel = ed.dom.getAttrib(pa, 'rel');
|
||||
f.link_style.value = ed.dom.getAttrib(pa, 'style');
|
||||
t.target_value = ed.dom.getAttrib(pa, 'target');
|
||||
f.link_classes.value = ed.dom.getAttrib(pa, 'class');
|
||||
}
|
||||
|
||||
f.link_target.checked = ( t.target_value && t.target_value == '_blank' ) ? 'checked' : '';
|
||||
|
||||
fname = link.substring( link.lastIndexOf('/') );
|
||||
fname = fname.replace(/-[0-9]{2,4}x[0-9]{2,4}/, '' );
|
||||
t.link = link.substring( 0, link.lastIndexOf('/') ) + fname;
|
||||
|
||||
if ( c.indexOf('alignleft') != -1 ) {
|
||||
t.I('alignleft').checked = "checked";
|
||||
d.className = t.align = "alignleft";
|
||||
} else if ( c.indexOf('aligncenter') != -1 ) {
|
||||
t.I('aligncenter').checked = "checked";
|
||||
d.className = t.align = "aligncenter";
|
||||
} else if ( c.indexOf('alignright') != -1 ) {
|
||||
t.I('alignright').checked = "checked";
|
||||
d.className = t.align = "alignright";
|
||||
} else if ( c.indexOf('alignnone') != -1 ) {
|
||||
t.I('alignnone').checked = "checked";
|
||||
d.className = t.align = "alignnone";
|
||||
}
|
||||
|
||||
if ( t.width && t.preloadImg.width )
|
||||
t.showSizeSet();
|
||||
|
||||
document.body.style.display = '';
|
||||
},
|
||||
|
||||
remove : function() {
|
||||
var ed = tinyMCEPopup.editor, p, el;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getNode();
|
||||
if (el.nodeName != 'IMG') return;
|
||||
|
||||
if ( (p = ed.dom.getParent(el, 'div')) && ed.dom.hasClass(p, 'mceTemp') )
|
||||
ed.dom.remove(p);
|
||||
else if ( (p = ed.dom.getParent(el, 'A')) && p.childNodes.length == 1 )
|
||||
ed.dom.remove(p);
|
||||
else ed.dom.remove(el);
|
||||
|
||||
ed.execCommand('mceRepaint');
|
||||
tinyMCEPopup.close();
|
||||
return;
|
||||
},
|
||||
|
||||
update : function() {
|
||||
var t = this, f = document.forms[0], ed = tinyMCEPopup.editor, el, b, fixSafari = null,
|
||||
DL, P, A, DIV, do_caption = null, img_class = f.img_classes.value, html,
|
||||
id, cap_id = '', cap, DT, DD, cap_width, div_cls, lnk = '', pa, aa, caption;
|
||||
|
||||
tinyMCEPopup.restoreSelection();
|
||||
el = ed.selection.getNode();
|
||||
|
||||
if (el.nodeName != 'IMG') return;
|
||||
if (f.img_src.value === '') {
|
||||
t.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( f.img_cap_text.value != '' && f.width.value != '' ) {
|
||||
do_caption = 1;
|
||||
img_class = img_class.replace( /align[^ "']+\s?/gi, '' );
|
||||
}
|
||||
|
||||
A = ed.dom.getParent(el, 'a');
|
||||
P = ed.dom.getParent(el, 'p');
|
||||
DL = ed.dom.getParent(el, 'dl');
|
||||
DIV = ed.dom.getParent(el, 'div');
|
||||
|
||||
tinyMCEPopup.execCommand("mceBeginUndoLevel");
|
||||
|
||||
if ( f.width.value != el.width || f.height.value != el.height )
|
||||
img_class = img_class.replace(/size-[^ "']+/, '');
|
||||
|
||||
ed.dom.setAttribs(el, {
|
||||
src : f.img_src.value,
|
||||
title : f.img_title.value,
|
||||
alt : f.img_alt.value,
|
||||
width : f.width.value,
|
||||
height : f.height.value,
|
||||
style : f.img_style.value,
|
||||
'class' : img_class
|
||||
});
|
||||
|
||||
if ( f.link_href.value ) {
|
||||
// Create new anchor elements
|
||||
if ( A == null ) {
|
||||
if ( ! f.link_href.value.match(/https?:\/\//i) )
|
||||
f.link_href.value = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.link_href.value);
|
||||
|
||||
ed.getDoc().execCommand("unlink", false, null);
|
||||
tinyMCEPopup.execCommand("mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});
|
||||
|
||||
tinymce.each(ed.dom.select("a"), function(n) {
|
||||
if ( ed.dom.getAttrib(n, 'href') == '#mce_temp_url#' ) {
|
||||
|
||||
ed.dom.setAttribs(n, {
|
||||
href : f.link_href.value,
|
||||
title : f.link_title.value,
|
||||
rel : f.link_rel.value,
|
||||
target : (f.link_target.checked == true) ? '_blank' : '',
|
||||
'class' : f.link_classes.value,
|
||||
style : f.link_style.value
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ed.dom.setAttribs(A, {
|
||||
href : f.link_href.value,
|
||||
title : f.link_title.value,
|
||||
rel : f.link_rel.value,
|
||||
target : (f.link_target.checked == true) ? '_blank' : '',
|
||||
'class' : f.link_classes.value,
|
||||
style : f.link_style.value
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ( do_caption ) {
|
||||
cap_width = 10 + parseInt(f.width.value);
|
||||
div_cls = (t.align == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
|
||||
caption = f.img_cap_text.value;
|
||||
|
||||
caption = caption.replace(/\r\n|\r/g, '\n').replace(/<[a-zA-Z0-9]+( [^<>]+)?>/g, function(a){
|
||||
return a.replace(/[\r\n\t]+/, ' ');
|
||||
});
|
||||
|
||||
caption = caption.replace(/\s*\n\s*/g, '<br />');
|
||||
|
||||
if ( DL ) {
|
||||
ed.dom.setAttribs(DL, {
|
||||
'class' : 'wp-caption '+t.align,
|
||||
style : 'width: '+cap_width+'px;'
|
||||
});
|
||||
|
||||
if ( DIV )
|
||||
ed.dom.setAttrib(DIV, 'class', div_cls);
|
||||
|
||||
if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp-caption-dd') )
|
||||
ed.dom.setHTML(DD, caption);
|
||||
|
||||
} else {
|
||||
if ( (id = f.img_classes.value.match( /wp-image-([0-9]{1,6})/ )) && id[1] )
|
||||
cap_id = 'attachment_'+id[1];
|
||||
|
||||
if ( f.link_href.value && (lnk = ed.dom.getParent(el, 'a')) ) {
|
||||
if ( lnk.childNodes.length == 1 ) {
|
||||
html = ed.dom.getOuterHTML(lnk);
|
||||
} else {
|
||||
html = ed.dom.getOuterHTML(lnk);
|
||||
html = html.match(/<a [^>]+>/i);
|
||||
html = html+ed.dom.getOuterHTML(el)+'</a>';
|
||||
}
|
||||
} else {
|
||||
html = ed.dom.getOuterHTML(el);
|
||||
}
|
||||
|
||||
html = '<dl id="'+cap_id+'" class="wp-caption '+t.align+'" style="width: '+cap_width+
|
||||
'px"><dt class="wp-caption-dt">'+html+'</dt><dd class="wp-caption-dd">'+caption+'</dd></dl>';
|
||||
|
||||
cap = ed.dom.create('div', {'class': div_cls}, html);
|
||||
|
||||
if ( P ) {
|
||||
P.parentNode.insertBefore(cap, P);
|
||||
if ( P.childNodes.length == 1 )
|
||||
ed.dom.remove(P);
|
||||
else if ( lnk && lnk.childNodes.length == 1 )
|
||||
ed.dom.remove(lnk);
|
||||
else ed.dom.remove(el);
|
||||
} else if ( pa = ed.dom.getParent(el, 'TD,TH,LI') ) {
|
||||
pa.appendChild(cap);
|
||||
if ( lnk && lnk.childNodes.length == 1 )
|
||||
ed.dom.remove(lnk);
|
||||
else ed.dom.remove(el);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( DL && DIV ) {
|
||||
if ( f.link_href.value && (aa = ed.dom.getParent(el, 'a')) ) html = ed.dom.getOuterHTML(aa);
|
||||
else html = ed.dom.getOuterHTML(el);
|
||||
|
||||
P = ed.dom.create('p', {}, html);
|
||||
DIV.parentNode.insertBefore(P, DIV);
|
||||
ed.dom.remove(DIV);
|
||||
}
|
||||
}
|
||||
|
||||
if ( f.img_classes.value.indexOf('aligncenter') != -1 ) {
|
||||
if ( P && ( ! P.style || P.style.textAlign != 'center' ) )
|
||||
ed.dom.setStyle(P, 'textAlign', 'center');
|
||||
} else {
|
||||
if ( P && P.style && P.style.textAlign == 'center' )
|
||||
ed.dom.setStyle(P, 'textAlign', '');
|
||||
}
|
||||
|
||||
if ( ! f.link_href.value && A ) {
|
||||
b = ed.selection.getBookmark();
|
||||
ed.dom.remove(A, 1);
|
||||
ed.selection.moveToBookmark(b);
|
||||
}
|
||||
|
||||
tinyMCEPopup.execCommand("mceEndUndoLevel");
|
||||
ed.execCommand('mceRepaint');
|
||||
tinyMCEPopup.close();
|
||||
},
|
||||
|
||||
updateStyle : function(ty) {
|
||||
var dom = tinyMCEPopup.dom, v, f = document.forms[0], img = dom.create('img', {style : f.img_style.value});
|
||||
|
||||
if (tinyMCEPopup.editor.settings.inline_styles) {
|
||||
// Handle align
|
||||
if (ty == 'align') {
|
||||
dom.setStyle(img, 'float', '');
|
||||
dom.setStyle(img, 'vertical-align', '');
|
||||
|
||||
v = f.align.value;
|
||||
if (v) {
|
||||
if (v == 'left' || v == 'right')
|
||||
dom.setStyle(img, 'float', v);
|
||||
else
|
||||
img.style.verticalAlign = v;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle border
|
||||
if (ty == 'border') {
|
||||
dom.setStyle(img, 'border', '');
|
||||
|
||||
v = f.border.value;
|
||||
if (v || v == '0') {
|
||||
if (v == '0')
|
||||
img.style.border = '0';
|
||||
else
|
||||
img.style.border = v + 'px solid black';
|
||||
}
|
||||
}
|
||||
|
||||
// Handle hspace
|
||||
if (ty == 'hspace') {
|
||||
dom.setStyle(img, 'marginLeft', '');
|
||||
dom.setStyle(img, 'marginRight', '');
|
||||
|
||||
v = f.hspace.value;
|
||||
if (v) {
|
||||
img.style.marginLeft = v + 'px';
|
||||
img.style.marginRight = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Handle vspace
|
||||
if (ty == 'vspace') {
|
||||
dom.setStyle(img, 'marginTop', '');
|
||||
dom.setStyle(img, 'marginBottom', '');
|
||||
|
||||
v = f.vspace.value;
|
||||
if (v) {
|
||||
img.style.marginTop = v + 'px';
|
||||
img.style.marginBottom = v + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
// Merge
|
||||
f.img_style.value = dom.serializeStyle(dom.parseStyle(img.style.cssText));
|
||||
this.demoSetStyle();
|
||||
}
|
||||
},
|
||||
|
||||
checkVal : function(f) {
|
||||
|
||||
if ( f.value == '' ) {
|
||||
// if ( f.id == 'width' ) f.value = this.width || this.preloadImg.width;
|
||||
// if ( f.id == 'height' ) f.value = this.height || this.preloadImg.height;
|
||||
if ( f.id == 'img_src' ) f.value = this.I('img_demo').src || this.preloadImg.src;
|
||||
}
|
||||
},
|
||||
|
||||
resetImageData : function() {
|
||||
var f = document.forms[0];
|
||||
|
||||
f.width.value = f.height.value = '';
|
||||
},
|
||||
|
||||
updateImageData : function() {
|
||||
var f = document.forms[0], t = wpImage, w = f.width.value, h = f.height.value;
|
||||
|
||||
if ( !w && h )
|
||||
w = f.width.value = t.width = Math.round( t.preloadImg.width / (t.preloadImg.height / h) );
|
||||
else if ( w && !h )
|
||||
h = f.height.value = t.height = Math.round( t.preloadImg.height / (t.preloadImg.width / w) );
|
||||
|
||||
if ( !w )
|
||||
f.width.value = t.width = t.preloadImg.width;
|
||||
|
||||
if ( !h )
|
||||
f.height.value = t.height = t.preloadImg.height;
|
||||
|
||||
t.showSizeSet();
|
||||
t.demoSetSize();
|
||||
if ( f.img_style.value )
|
||||
t.demoSetStyle();
|
||||
},
|
||||
|
||||
getImageData : function() {
|
||||
var t = wpImage, f = document.forms[0];
|
||||
|
||||
t.preloadImg = new Image();
|
||||
t.preloadImg.onload = t.updateImageData;
|
||||
t.preloadImg.onerror = t.resetImageData;
|
||||
t.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.img_src.value);
|
||||
}
|
||||
};
|
||||
|
||||
window.onload = function(){wpImage.init();}
|
||||
wpImage.preInit();
|
||||
|
1
wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.min.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
Distraction Free Writing mode TinyMCE Styles
|
||||
*/
|
||||
|
||||
html,
|
||||
body {
|
||||
background: transparent;
|
||||
width: auto !important;
|
||||
max-width: none !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
min-height: 0 !important;
|
||||
}
|
@ -0,0 +1 @@
|
||||
(function(){tinymce.create("tinymce.plugins.wpFullscreenPlugin",{resize_timeout:false,init:function(a,c){var d=this,g=0,e={},f=tinymce.DOM;a.addCommand("wpFullScreenClose",function(){if(a.getParam("wp_fullscreen_is_enabled")){f.win.setTimeout(function(){tinyMCE.remove(a);f.remove("wp_mce_fullscreen_parent");tinyMCE.settings=tinyMCE.oldSettings},10)}});a.addCommand("wpFullScreenSave",function(){var h=tinyMCE.get("wp_mce_fullscreen"),i;h.focus();i=tinyMCE.get(h.getParam("wp_fullscreen_editor_id"));i.setContent(h.getContent({format:"raw"}),{format:"raw"})});a.addCommand("wpFullScreenInit",function(){var j,h,i;a=tinyMCE.activeEditor;j=a.getDoc();h=j.body;tinyMCE.oldSettings=tinyMCE.settings;tinymce.each(a.settings,function(k,l){e[l]=k});e.id="wp_mce_fullscreen";e.wp_fullscreen_is_enabled=true;e.wp_fullscreen_editor_id=a.id;e.theme_advanced_resizing=false;e.theme_advanced_statusbar_location="none";e.content_css=e.content_css?e.content_css+","+e.wp_fullscreen_content_css:e.wp_fullscreen_content_css;e.height=tinymce.isIE?h.scrollHeight:h.offsetHeight;tinymce.each(a.getParam("wp_fullscreen_settings"),function(m,l){e[l]=m});i=new tinymce.Editor("wp_mce_fullscreen",e);i.onInit.add(function(k){var m=tinymce.DOM,l=m.select("a.mceButton",m.get("wp-fullscreen-buttons"));if(!a.isHidden()){k.setContent(a.getContent())}else{k.setContent(switchEditors.wpautop(k.getElement().value))}setTimeout(function(){k.onNodeChange.add(function(o,n,p){tinymce.each(l,function(s){var r,q;if(r=m.get("wp_mce_fullscreen_"+s.id.substr(6))){q=r.className;if(q){s.className=q}}})})},1000);k.dom.addClass(k.getBody(),"wp-fullscreen-editor");k.focus()});i.render();if("undefined"!=fullscreen){i.dom.bind(i.dom.doc,"mousemove",function(k){fullscreen.bounder("showToolbar","hideToolbar",2000,k)})}});a.addCommand("wpFullScreen",function(){if(typeof(fullscreen)=="undefined"){return}if("wp_mce_fullscreen"==a.id){fullscreen.off()}else{fullscreen.on()}});a.addButton("wp_fullscreen",{title:"wordpress.wp_fullscreen_desc",cmd:"wpFullScreen"});if(a.getParam("fullscreen_is_enabled")||!a.getParam("wp_fullscreen_is_enabled")){return}function b(j,l){var k=tinymce.DOM,i=a.getBody(),n=k.get(a.id+"_ifr"),h,m=a.dom.win.scrollY;if(d.resize_timeout){return}d.resize_timeout=true;setTimeout(function(){d.resize_timeout=false},500);h=i.scrollHeight>300?i.scrollHeight:300;if(h!=n.scrollHeight){k.setStyle(n,"height",h+"px");a.getWin().scrollTo(0,0)}if(l&&l.type=="paste"&&tinymce.isWebKit){setTimeout(function(){a.dom.win.scrollTo(0,m)},40)}}a.onInit.add(function(i,h){i.onChange.add(b);i.onSetContent.add(b);i.onPaste.add(b);i.onKeyUp.add(b);i.onPostRender.add(b);i.getBody().style.overflowY="hidden"});if(a.getParam("autoresize_on_init",true)){a.onLoadContent.add(function(i,h){setTimeout(function(){b()},1200)})}a.addCommand("wpAutoResize",b)},getInfo:function(){return{longname:"WP Fullscreen",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpfullscreen",tinymce.plugins.wpFullscreenPlugin)})();
|
189
wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin_src.js
Normal file
@ -0,0 +1,189 @@
|
||||
/**
|
||||
* WP Fullscreen TinyMCE plugin
|
||||
*
|
||||
* Contains code from Moxiecode Systems AB released under LGPL License http://tinymce.moxiecode.com/license
|
||||
*/
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.wpFullscreenPlugin', {
|
||||
resize_timeout: false,
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this, oldHeight = 0, s = {}, DOM = tinymce.DOM;
|
||||
|
||||
// Register commands
|
||||
ed.addCommand('wpFullScreenClose', function() {
|
||||
// this removes the editor, content has to be saved first with tinyMCE.execCommand('wpFullScreenSave');
|
||||
if ( ed.getParam('wp_fullscreen_is_enabled') ) {
|
||||
DOM.win.setTimeout(function() {
|
||||
tinyMCE.remove(ed);
|
||||
DOM.remove('wp_mce_fullscreen_parent');
|
||||
tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
|
||||
}, 10);
|
||||
}
|
||||
});
|
||||
|
||||
ed.addCommand('wpFullScreenSave', function() {
|
||||
var ed = tinyMCE.get('wp_mce_fullscreen'), edd;
|
||||
|
||||
ed.focus();
|
||||
edd = tinyMCE.get( ed.getParam('wp_fullscreen_editor_id') );
|
||||
|
||||
edd.setContent( ed.getContent({format : 'raw'}), {format : 'raw'} );
|
||||
});
|
||||
|
||||
ed.addCommand('wpFullScreenInit', function() {
|
||||
var d, b, fsed;
|
||||
|
||||
ed = tinyMCE.activeEditor;
|
||||
d = ed.getDoc();
|
||||
b = d.body;
|
||||
|
||||
tinyMCE.oldSettings = tinyMCE.settings; // Store old settings
|
||||
|
||||
tinymce.each(ed.settings, function(v, n) {
|
||||
s[n] = v;
|
||||
});
|
||||
|
||||
s.id = 'wp_mce_fullscreen';
|
||||
s.wp_fullscreen_is_enabled = true;
|
||||
s.wp_fullscreen_editor_id = ed.id;
|
||||
s.theme_advanced_resizing = false;
|
||||
s.theme_advanced_statusbar_location = 'none';
|
||||
s.content_css = s.content_css ? s.content_css + ',' + s.wp_fullscreen_content_css : s.wp_fullscreen_content_css;
|
||||
s.height = tinymce.isIE ? b.scrollHeight : b.offsetHeight;
|
||||
|
||||
tinymce.each(ed.getParam('wp_fullscreen_settings'), function(v, k) {
|
||||
s[k] = v;
|
||||
});
|
||||
|
||||
fsed = new tinymce.Editor('wp_mce_fullscreen', s);
|
||||
fsed.onInit.add(function(edd) {
|
||||
var DOM = tinymce.DOM, buttons = DOM.select('a.mceButton', DOM.get('wp-fullscreen-buttons'));
|
||||
|
||||
if ( !ed.isHidden() )
|
||||
edd.setContent( ed.getContent() );
|
||||
else
|
||||
edd.setContent( switchEditors.wpautop( edd.getElement().value ) );
|
||||
|
||||
setTimeout(function(){ // add last
|
||||
edd.onNodeChange.add(function(ed, cm, e){
|
||||
tinymce.each(buttons, function(c) {
|
||||
var btn, cls;
|
||||
|
||||
if ( btn = DOM.get( 'wp_mce_fullscreen_' + c.id.substr(6) ) ) {
|
||||
cls = btn.className;
|
||||
|
||||
if ( cls )
|
||||
c.className = cls;
|
||||
}
|
||||
});
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
edd.dom.addClass(edd.getBody(), 'wp-fullscreen-editor');
|
||||
edd.focus();
|
||||
});
|
||||
|
||||
fsed.render();
|
||||
|
||||
if ( 'undefined' != fullscreen ) {
|
||||
fsed.dom.bind( fsed.dom.doc, 'mousemove', function(e){
|
||||
fullscreen.bounder( 'showToolbar', 'hideToolbar', 2000, e );
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
ed.addCommand('wpFullScreen', function() {
|
||||
if ( typeof(fullscreen) == 'undefined' )
|
||||
return;
|
||||
|
||||
if ( 'wp_mce_fullscreen' == ed.id )
|
||||
fullscreen.off();
|
||||
else
|
||||
fullscreen.on();
|
||||
});
|
||||
|
||||
// Register buttons
|
||||
ed.addButton('wp_fullscreen', {
|
||||
title : 'wordpress.wp_fullscreen_desc',
|
||||
cmd : 'wpFullScreen'
|
||||
});
|
||||
|
||||
// END fullscreen
|
||||
//----------------------------------------------------------------
|
||||
// START autoresize
|
||||
|
||||
if ( ed.getParam('fullscreen_is_enabled') || !ed.getParam('wp_fullscreen_is_enabled') )
|
||||
return;
|
||||
|
||||
/**
|
||||
* This method gets executed each time the editor needs to resize.
|
||||
*/
|
||||
function resize(editor, e) {
|
||||
var DOM = tinymce.DOM, body = ed.getBody(), ifr = DOM.get(ed.id + '_ifr'), height, y = ed.dom.win.scrollY;
|
||||
|
||||
if ( t.resize_timeout )
|
||||
return;
|
||||
|
||||
// sometimes several events are fired few ms apart, trottle down resizing a little
|
||||
t.resize_timeout = true;
|
||||
setTimeout(function(){
|
||||
t.resize_timeout = false;
|
||||
}, 500);
|
||||
|
||||
height = body.scrollHeight > 300 ? body.scrollHeight : 300;
|
||||
|
||||
if ( height != ifr.scrollHeight ) {
|
||||
DOM.setStyle(ifr, 'height', height + 'px');
|
||||
ed.getWin().scrollTo(0, 0); // iframe window object, make sure there's no scrolling
|
||||
}
|
||||
|
||||
// WebKit scrolls to top on paste...
|
||||
if ( e && e.type == 'paste' && tinymce.isWebKit ) {
|
||||
setTimeout(function(){
|
||||
ed.dom.win.scrollTo(0, y);
|
||||
}, 40);
|
||||
}
|
||||
};
|
||||
|
||||
// Add appropriate listeners for resizing content area
|
||||
ed.onInit.add(function(ed, l) {
|
||||
ed.onChange.add(resize);
|
||||
ed.onSetContent.add(resize);
|
||||
ed.onPaste.add(resize);
|
||||
ed.onKeyUp.add(resize);
|
||||
ed.onPostRender.add(resize);
|
||||
|
||||
ed.getBody().style.overflowY = "hidden";
|
||||
});
|
||||
|
||||
if ( ed.getParam('autoresize_on_init', true) ) {
|
||||
ed.onLoadContent.add(function(ed, l) {
|
||||
// Because the content area resizes when its content CSS loads,
|
||||
// and we can't easily add a listener to its onload event,
|
||||
// we'll just trigger a resize after a short loading period
|
||||
setTimeout(function() {
|
||||
resize();
|
||||
}, 1200);
|
||||
});
|
||||
}
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
||||
ed.addCommand('wpAutoResize', resize);
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'WP Fullscreen',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : '',
|
||||
version : '1.0'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('wpfullscreen', tinymce.plugins.wpFullscreenPlugin);
|
||||
})();
|
@ -0,0 +1 @@
|
||||
(function(){tinymce.create("tinymce.plugins.wpGallery",{init:function(a,b){var c=this;c.url=b;c.editor=a;c._createButtons();a.addCommand("WP_Gallery",function(){if(tinymce.isIE){a.selection.moveToBookmark(a.wpGalleryBookmark)}var e=a.selection.getNode(),d=wp.media.gallery,f;if(typeof wp==="undefined"||!wp.media||!wp.media.gallery){return}if(e.nodeName!="IMG"||a.dom.getAttrib(e,"class").indexOf("wpGallery")==-1){return}f=d.edit("["+a.dom.getAttrib(e,"title")+"]");f.state("gallery-edit").on("update",function(g){var h=d.shortcode(g).string().slice(1,-1);a.dom.setAttrib(e,"title",h)})});a.onInit.add(function(d){if("ontouchstart" in window){d.dom.events.add(d.getBody(),"touchstart",function(g){var f=g.target;if(f.nodeName=="IMG"&&d.dom.hasClass(f,"wpGallery")){d.selection.select(f);d.dom.events.cancel(g);d.plugins.wordpress._hideButtons();d.plugins.wordpress._showButtons(f,"wp_gallerybtns")}})}});a.onMouseDown.add(function(d,f){if(f.target.nodeName=="IMG"&&d.dom.hasClass(f.target,"wpGallery")){d.plugins.wordpress._hideButtons();d.plugins.wordpress._showButtons(f.target,"wp_gallerybtns")}});a.onBeforeSetContent.add(function(d,e){e.content=c._do_gallery(e.content)});a.onPostProcess.add(function(d,e){if(e.get){e.content=c._get_gallery(e.content)}})},_do_gallery:function(a){return a.replace(/\[gallery([^\]]*)\]/g,function(d,c){return'<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(c)+'" />'})},_get_gallery:function(b){function a(c,d){d=new RegExp(d+'="([^"]+)"',"g").exec(c);return d?tinymce.DOM.decode(d[1]):""}return b.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g,function(e,d){var c=a(d,"class");if(c.indexOf("wpGallery")!=-1){return"<p>["+tinymce.trim(a(d,"title"))+"]</p>"}return e})},_createButtons:function(){var b=this,a=tinymce.activeEditor,d=tinymce.DOM,e,c,f;if(d.get("wp_gallerybtns")){return}f=(window.devicePixelRatio&&window.devicePixelRatio>1)||(window.matchMedia&&window.matchMedia("(min-resolution:130dpi)").matches);d.add(document.body,"div",{id:"wp_gallerybtns",style:"display:none;"});e=d.add("wp_gallerybtns","img",{src:f?b.url+"/img/edit-2x.png":b.url+"/img/edit.png",id:"wp_editgallery",width:"24",height:"24",title:a.getLang("wordpress.editgallery")});tinymce.dom.Event.add(e,"mousedown",function(h){var g=tinymce.activeEditor;g.wpGalleryBookmark=g.selection.getBookmark("simple");g.execCommand("WP_Gallery");g.plugins.wordpress._hideButtons()});c=d.add("wp_gallerybtns","img",{src:f?b.url+"/img/delete-2x.png":b.url+"/img/delete.png",id:"wp_delgallery",width:"24",height:"24",title:a.getLang("wordpress.delgallery")});tinymce.dom.Event.add(c,"mousedown",function(i){var g=tinymce.activeEditor,h=g.selection.getNode();if(h.nodeName=="IMG"&&g.dom.hasClass(h,"wpGallery")){g.dom.remove(h);g.execCommand("mceRepaint");g.dom.events.cancel(i)}g.plugins.wordpress._hideButtons()})},getInfo:function(){return{longname:"Gallery Settings",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpgallery",tinymce.plugins.wpGallery)})();
|
156
wp-includes/js/tinymce/plugins/wpgallery/editor_plugin_src.js
Normal file
@ -0,0 +1,156 @@
|
||||
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.wpGallery', {
|
||||
|
||||
init : function(ed, url) {
|
||||
var t = this;
|
||||
|
||||
t.url = url;
|
||||
t.editor = ed;
|
||||
t._createButtons();
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
|
||||
ed.addCommand('WP_Gallery', function() {
|
||||
if ( tinymce.isIE )
|
||||
ed.selection.moveToBookmark( ed.wpGalleryBookmark );
|
||||
|
||||
var el = ed.selection.getNode(),
|
||||
gallery = wp.media.gallery,
|
||||
frame;
|
||||
|
||||
// Check if the `wp.media.gallery` API exists.
|
||||
if ( typeof wp === 'undefined' || ! wp.media || ! wp.media.gallery )
|
||||
return;
|
||||
|
||||
// Make sure we've selected a gallery node.
|
||||
if ( el.nodeName != 'IMG' || ed.dom.getAttrib(el, 'class').indexOf('wpGallery') == -1 )
|
||||
return;
|
||||
|
||||
frame = gallery.edit( '[' + ed.dom.getAttrib( el, 'title' ) + ']' );
|
||||
|
||||
frame.state('gallery-edit').on( 'update', function( selection ) {
|
||||
var shortcode = gallery.shortcode( selection ).string().slice( 1, -1 );
|
||||
ed.dom.setAttrib( el, 'title', shortcode );
|
||||
});
|
||||
});
|
||||
|
||||
ed.onInit.add(function(ed) {
|
||||
// iOS6 doesn't show the buttons properly on click, show them on 'touchstart'
|
||||
if ( 'ontouchstart' in window ) {
|
||||
ed.dom.events.add(ed.getBody(), 'touchstart', function(e){
|
||||
var target = e.target;
|
||||
|
||||
if ( target.nodeName == 'IMG' && ed.dom.hasClass(target, 'wpGallery') ) {
|
||||
ed.selection.select(target);
|
||||
ed.dom.events.cancel(e);
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
ed.plugins.wordpress._showButtons(target, 'wp_gallerybtns');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
ed.onMouseDown.add(function(ed, e) {
|
||||
if ( e.target.nodeName == 'IMG' && ed.dom.hasClass(e.target, 'wpGallery') ) {
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
ed.plugins.wordpress._showButtons(e.target, 'wp_gallerybtns');
|
||||
}
|
||||
});
|
||||
|
||||
ed.onBeforeSetContent.add(function(ed, o) {
|
||||
o.content = t._do_gallery(o.content);
|
||||
});
|
||||
|
||||
ed.onPostProcess.add(function(ed, o) {
|
||||
if (o.get)
|
||||
o.content = t._get_gallery(o.content);
|
||||
});
|
||||
},
|
||||
|
||||
_do_gallery : function(co) {
|
||||
return co.replace(/\[gallery([^\]]*)\]/g, function(a,b){
|
||||
return '<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(b)+'" />';
|
||||
});
|
||||
},
|
||||
|
||||
_get_gallery : function(co) {
|
||||
|
||||
function getAttr(s, n) {
|
||||
n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
|
||||
return n ? tinymce.DOM.decode(n[1]) : '';
|
||||
};
|
||||
|
||||
return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) {
|
||||
var cls = getAttr(im, 'class');
|
||||
|
||||
if ( cls.indexOf('wpGallery') != -1 )
|
||||
return '<p>['+tinymce.trim(getAttr(im, 'title'))+']</p>';
|
||||
|
||||
return a;
|
||||
});
|
||||
},
|
||||
|
||||
_createButtons : function() {
|
||||
var t = this, ed = tinymce.activeEditor, DOM = tinymce.DOM, editButton, dellButton, isRetina;
|
||||
|
||||
if ( DOM.get('wp_gallerybtns') )
|
||||
return;
|
||||
|
||||
isRetina = ( window.devicePixelRatio && window.devicePixelRatio > 1 ) || // WebKit, Opera
|
||||
( window.matchMedia && window.matchMedia('(min-resolution:130dpi)').matches ); // Firefox, IE10, Opera
|
||||
|
||||
DOM.add(document.body, 'div', {
|
||||
id : 'wp_gallerybtns',
|
||||
style : 'display:none;'
|
||||
});
|
||||
|
||||
editButton = DOM.add('wp_gallerybtns', 'img', {
|
||||
src : isRetina ? t.url+'/img/edit-2x.png' : t.url+'/img/edit.png',
|
||||
id : 'wp_editgallery',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wordpress.editgallery')
|
||||
});
|
||||
|
||||
tinymce.dom.Event.add(editButton, 'mousedown', function(e) {
|
||||
var ed = tinymce.activeEditor;
|
||||
ed.wpGalleryBookmark = ed.selection.getBookmark('simple');
|
||||
ed.execCommand("WP_Gallery");
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
|
||||
dellButton = DOM.add('wp_gallerybtns', 'img', {
|
||||
src : isRetina ? t.url+'/img/delete-2x.png' : t.url+'/img/delete.png',
|
||||
id : 'wp_delgallery',
|
||||
width : '24',
|
||||
height : '24',
|
||||
title : ed.getLang('wordpress.delgallery')
|
||||
});
|
||||
|
||||
tinymce.dom.Event.add(dellButton, 'mousedown', function(e) {
|
||||
var ed = tinymce.activeEditor, el = ed.selection.getNode();
|
||||
|
||||
if ( el.nodeName == 'IMG' && ed.dom.hasClass(el, 'wpGallery') ) {
|
||||
ed.dom.remove(el);
|
||||
|
||||
ed.execCommand('mceRepaint');
|
||||
ed.dom.events.cancel(e);
|
||||
}
|
||||
|
||||
ed.plugins.wordpress._hideButtons();
|
||||
});
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'Gallery Settings',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : '',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
tinymce.PluginManager.add('wpgallery', tinymce.plugins.wpGallery);
|
||||
})();
|
BIN
wp-includes/js/tinymce/plugins/wpgallery/img/delete-2x.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
wp-includes/js/tinymce/plugins/wpgallery/img/delete.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
wp-includes/js/tinymce/plugins/wpgallery/img/edit-2x.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
wp-includes/js/tinymce/plugins/wpgallery/img/edit.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
wp-includes/js/tinymce/plugins/wpgallery/img/t.gif
Normal file
After Width: | Height: | Size: 43 B |
1
wp-includes/js/tinymce/plugins/wplink/editor_plugin.js
Normal file
@ -0,0 +1 @@
|
||||
(function(){tinymce.create("tinymce.plugins.wpLink",{init:function(a,b){var c=true;a.addCommand("WP_Link",function(){if(c){return}a.windowManager.open({id:"wp-link",width:480,height:"auto",wpDialog:true,title:a.getLang("advlink.link_desc")},{plugin_url:b})});a.addButton("link",{title:"advanced.link_desc",cmd:"WP_Link"});a.onNodeChange.add(function(e,d,g,f){c=f&&g.nodeName!="A"})},getInfo:function(){return{longname:"WordPress Link Dialog",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wplink",tinymce.plugins.wpLink)})();
|
59
wp-includes/js/tinymce/plugins/wplink/editor_plugin_src.js
Normal file
@ -0,0 +1,59 @@
|
||||
(function() {
|
||||
tinymce.create('tinymce.plugins.wpLink', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init : function(ed, url) {
|
||||
var disabled = true;
|
||||
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
||||
ed.addCommand('WP_Link', function() {
|
||||
if ( disabled )
|
||||
return;
|
||||
ed.windowManager.open({
|
||||
id : 'wp-link',
|
||||
width : 480,
|
||||
height : "auto",
|
||||
wpDialog : true,
|
||||
title : ed.getLang('advlink.link_desc')
|
||||
}, {
|
||||
plugin_url : url // Plugin absolute URL
|
||||
});
|
||||
});
|
||||
|
||||
// Register example button
|
||||
ed.addButton('link', {
|
||||
title : 'advanced.link_desc',
|
||||
cmd : 'WP_Link'
|
||||
});
|
||||
|
||||
ed.onNodeChange.add(function(ed, cm, n, co) {
|
||||
disabled = co && n.nodeName != 'A';
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'WordPress Link Dialog',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : '',
|
||||
version : "1.0"
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('wplink', tinymce.plugins.wpLink);
|
||||
})();
|
||||
|
1
wp-includes/js/tinymce/plugins/wpview/editor_plugin.js
Normal file
@ -0,0 +1 @@
|
||||
(function(){var c=tinymce.VK,a=tinymce.dom.TreeWalker,b;tinymce.create("tinymce.plugins.wpView",{init:function(f,e){var d=this;if(typeof wp==="undefined"||!wp.mce){return}f.onPreInit.add(function(g){g.schema.addValidElements("div[*],span[*]")});f.onBeforeSetContent.add(function(g,h){if(!h.content){return}h.content=wp.mce.view.toViews(h.content)});f.onSetContent.add(function(g,h){wp.mce.view.render(g.getDoc())});f.onInit.add(function(g){g.selection.onBeforeSetContent.add(function(i,l){var h=d.getParentView(i.getNode()),k,j;if(!h){return}if(!h.nextSibling||d.isView(h.nextSibling)){j=g.getDoc().createTextNode("");g.dom.insertAfter(j,h)}else{k=new a(h.nextSibling,h.nextSibling);j=k.next()}i.select(j);i.collapse(true)});g.selection.onSetContent.add(function(h,j){if(!j.context){return}var i=h.getNode();if(!i.innerHTML){return}i.innerHTML=wp.mce.view.toViews(i.innerHTML);wp.mce.view.render(i)})});f.onPostProcess.add(function(g,h){if((!h.get&&!h.save)||!h.content){return}h.content=wp.mce.view.toText(h.content)});f.onNodeChange.addToTop(function(i,g,j,l,k){var h=d.getParentView(j);if(h){d.select(h);return false}else{d.deselect()}});f.onKeyDown.addToTop(function(i,j){var k=j.keyCode,h,g;if(!b){return}h=d.getParentView(i.selection.getNode());if(h!==b){d.deselect();return}if(k===c.DELETE||k===c.BACKSPACE){if((g=wp.mce.view.instance(b))){g.remove();d.deselect()}}if(j.metaKey||j.ctrlKey||(k>=112&&k<=123)){return}j.preventDefault()})},getParentView:function(d){while(d){if(this.isView(d)){return d}d=d.parentNode}},isView:function(d){return(/(?:^|\s)wp-view-wrap(?:\s|$)/).test(d.className)},select:function(d){if(d===b){return}this.deselect();b=d;wp.mce.view.select(b)},deselect:function(){if(b){wp.mce.view.deselect(b)}b=null},getInfo:function(){return{longname:"WordPress Views",author:"WordPress",authorurl:"http://wordpress.org",infourl:"http://wordpress.org",version:"1.0"}}});tinymce.PluginManager.add("wpview",tinymce.plugins.wpView)})();
|
188
wp-includes/js/tinymce/plugins/wpview/editor_plugin_src.js
Normal file
@ -0,0 +1,188 @@
|
||||
/**
|
||||
* WordPress View plugin.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var VK = tinymce.VK,
|
||||
TreeWalker = tinymce.dom.TreeWalker,
|
||||
selected;
|
||||
|
||||
tinymce.create('tinymce.plugins.wpView', {
|
||||
init : function( editor, url ) {
|
||||
var wpView = this;
|
||||
|
||||
// Check if the `wp.mce` API exists.
|
||||
if ( typeof wp === 'undefined' || ! wp.mce )
|
||||
return;
|
||||
|
||||
editor.onPreInit.add( function( editor ) {
|
||||
// Add elements so we can set `contenteditable` to false.
|
||||
editor.schema.addValidElements('div[*],span[*]');
|
||||
});
|
||||
|
||||
// When the editor's content changes, scan the new content for
|
||||
// matching view patterns, and transform the matches into
|
||||
// view wrappers. Since the editor's DOM is outdated at this point,
|
||||
// we'll wait to render the views.
|
||||
editor.onBeforeSetContent.add( function( editor, o ) {
|
||||
if ( ! o.content )
|
||||
return;
|
||||
|
||||
o.content = wp.mce.view.toViews( o.content );
|
||||
});
|
||||
|
||||
// When the editor's content has been updated and the DOM has been
|
||||
// processed, render the views in the document.
|
||||
editor.onSetContent.add( function( editor, o ) {
|
||||
wp.mce.view.render( editor.getDoc() );
|
||||
});
|
||||
|
||||
editor.onInit.add( function( editor ) {
|
||||
|
||||
// When a view is selected, ensure content that is being pasted
|
||||
// or inserted is added to a text node (instead of the view).
|
||||
editor.selection.onBeforeSetContent.add( function( selection, o ) {
|
||||
var view = wpView.getParentView( selection.getNode() ),
|
||||
walker, target;
|
||||
|
||||
// If the selection is not within a view, bail.
|
||||
if ( ! view )
|
||||
return;
|
||||
|
||||
// If there are no additional nodes or the next node is a
|
||||
// view, create a text node after the current view.
|
||||
if ( ! view.nextSibling || wpView.isView( view.nextSibling ) ) {
|
||||
target = editor.getDoc().createTextNode('');
|
||||
editor.dom.insertAfter( target, view );
|
||||
|
||||
// Otherwise, find the next text node.
|
||||
} else {
|
||||
walker = new TreeWalker( view.nextSibling, view.nextSibling );
|
||||
target = walker.next();
|
||||
}
|
||||
|
||||
// Select the `target` text node.
|
||||
selection.select( target );
|
||||
selection.collapse( true );
|
||||
});
|
||||
|
||||
// When the selection's content changes, scan any new content
|
||||
// for matching views and immediately render them.
|
||||
//
|
||||
// Runs on paste and on inserting nodes/html.
|
||||
editor.selection.onSetContent.add( function( selection, o ) {
|
||||
if ( ! o.context )
|
||||
return;
|
||||
|
||||
var node = selection.getNode();
|
||||
|
||||
if ( ! node.innerHTML )
|
||||
return;
|
||||
|
||||
node.innerHTML = wp.mce.view.toViews( node.innerHTML );
|
||||
wp.mce.view.render( node );
|
||||
});
|
||||
});
|
||||
|
||||
// When the editor's contents are being accessed as a string,
|
||||
// transform any views back to their text representations.
|
||||
editor.onPostProcess.add( function( editor, o ) {
|
||||
if ( ( ! o.get && ! o.save ) || ! o.content )
|
||||
return;
|
||||
|
||||
o.content = wp.mce.view.toText( o.content );
|
||||
});
|
||||
|
||||
// Triggers when the selection is changed.
|
||||
// Add the event handler to the top of the stack.
|
||||
editor.onNodeChange.addToTop( function( editor, controlManager, node, collapsed, o ) {
|
||||
var view = wpView.getParentView( node );
|
||||
|
||||
// Update the selected view.
|
||||
if ( view ) {
|
||||
wpView.select( view );
|
||||
|
||||
// Prevent the selection from propagating to other plugins.
|
||||
return false;
|
||||
|
||||
// If we've clicked off of the selected view, deselect it.
|
||||
} else {
|
||||
wpView.deselect();
|
||||
}
|
||||
});
|
||||
|
||||
editor.onKeyDown.addToTop( function( editor, event ) {
|
||||
var keyCode = event.keyCode,
|
||||
view, instance;
|
||||
|
||||
// If a view isn't selected, let the event go on its merry way.
|
||||
if ( ! selected )
|
||||
return;
|
||||
|
||||
// If the caret is not within the selected view, deselect the
|
||||
// view and bail.
|
||||
view = wpView.getParentView( editor.selection.getNode() );
|
||||
if ( view !== selected ) {
|
||||
wpView.deselect();
|
||||
return;
|
||||
}
|
||||
|
||||
// If delete or backspace is pressed, delete the view.
|
||||
if ( keyCode === VK.DELETE || keyCode === VK.BACKSPACE ) {
|
||||
if ( (instance = wp.mce.view.instance( selected )) ) {
|
||||
instance.remove();
|
||||
wpView.deselect();
|
||||
}
|
||||
}
|
||||
|
||||
// Let keypresses that involve the command or control keys through.
|
||||
// Also, let any of the F# keys through.
|
||||
if ( event.metaKey || event.ctrlKey || ( keyCode >= 112 && keyCode <= 123 ) )
|
||||
return;
|
||||
|
||||
event.preventDefault();
|
||||
});
|
||||
},
|
||||
|
||||
getParentView : function( node ) {
|
||||
while ( node ) {
|
||||
if ( this.isView( node ) )
|
||||
return node;
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
},
|
||||
|
||||
isView : function( node ) {
|
||||
return (/(?:^|\s)wp-view-wrap(?:\s|$)/).test( node.className );
|
||||
},
|
||||
|
||||
select : function( view ) {
|
||||
if ( view === selected )
|
||||
return;
|
||||
|
||||
this.deselect();
|
||||
selected = view;
|
||||
wp.mce.view.select( selected );
|
||||
},
|
||||
|
||||
deselect : function() {
|
||||
if ( selected )
|
||||
wp.mce.view.deselect( selected );
|
||||
selected = null;
|
||||
},
|
||||
|
||||
getInfo : function() {
|
||||
return {
|
||||
longname : 'WordPress Views',
|
||||
author : 'WordPress',
|
||||
authorurl : 'http://wordpress.org',
|
||||
infourl : 'http://wordpress.org',
|
||||
version : '1.0'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add( 'wpview', tinymce.plugins.wpView );
|
||||
})();
|