mirror of
https://github.com/e107inc/e107.git
synced 2025-10-13 14:04:51 +02:00
TinyMce Upgrade to 3.5.6 and fixes for youtube and emoticon plugins.
This commit is contained in:
@@ -395,12 +395,14 @@ var ImageDialog = {
|
|||||||
if (v == '0')
|
if (v == '0')
|
||||||
img.style.border = isIE ? '0' : '0 none none';
|
img.style.border = isIE ? '0' : '0 none none';
|
||||||
else {
|
else {
|
||||||
if (b.length == 3 && b[isIE ? 2 : 1])
|
var isOldIE = tinymce.isIE && (!document.documentMode || document.documentMode < 9);
|
||||||
bStyle = b[isIE ? 2 : 1];
|
|
||||||
|
if (b.length == 3 && b[isOldIE ? 2 : 1])
|
||||||
|
bStyle = b[isOldIE ? 2 : 1];
|
||||||
else if (!bStyle || bStyle == 'none')
|
else if (!bStyle || bStyle == 'none')
|
||||||
bStyle = 'solid';
|
bStyle = 'solid';
|
||||||
if (b.length == 3 && b[isIE ? 0 : 2])
|
if (b.length == 3 && b[isIE ? 0 : 2])
|
||||||
bColor = b[isIE ? 0 : 2];
|
bColor = b[isOldIE ? 0 : 2];
|
||||||
else if (!bColor || bColor == 'none')
|
else if (!bColor || bColor == 'none')
|
||||||
bColor = 'black';
|
bColor = 'black';
|
||||||
img.style.border = v + 'px ' + bStyle + ' ' + bColor;
|
img.style.border = v + 'px ' + bStyle + ' ' + bColor;
|
||||||
|
@@ -1 +1 @@
|
|||||||
(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(a,b){var c=this;c.editor=a;a.addCommand("mceDirectionLTR",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="ltr"){a.dom.setAttrib(d,"dir","ltr")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addCommand("mceDirectionRTL",function(){var d=a.dom.getParent(a.selection.getNode(),a.dom.isBlock);if(d){if(a.dom.getAttrib(d,"dir")!="rtl"){a.dom.setAttrib(d,"dir","rtl")}else{a.dom.setAttrib(d,"dir","")}}a.nodeChanged()});a.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});a.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});a.onNodeChange.add(c._nodeChange,c)},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)})();
|
(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)})();
|
@@ -15,30 +15,33 @@
|
|||||||
|
|
||||||
t.editor = ed;
|
t.editor = ed;
|
||||||
|
|
||||||
ed.addCommand('mceDirectionLTR', function() {
|
function setDir(dir) {
|
||||||
var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
|
var dom = ed.dom, curDir, blocks = ed.selection.getSelectedBlocks();
|
||||||
|
|
||||||
if (e) {
|
if (blocks.length) {
|
||||||
if (ed.dom.getAttrib(e, "dir") != "ltr")
|
curDir = dom.getAttrib(blocks[0], "dir");
|
||||||
ed.dom.setAttrib(e, "dir", "ltr");
|
|
||||||
else
|
tinymce.each(blocks, function(block) {
|
||||||
ed.dom.setAttrib(e, "dir", "");
|
// 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.nodeChanged();
|
ed.addCommand('mceDirectionLTR', function() {
|
||||||
|
setDir("ltr");
|
||||||
});
|
});
|
||||||
|
|
||||||
ed.addCommand('mceDirectionRTL', function() {
|
ed.addCommand('mceDirectionRTL', function() {
|
||||||
var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
|
setDir("rtl");
|
||||||
|
|
||||||
if (e) {
|
|
||||||
if (ed.dom.getAttrib(e, "dir") != "rtl")
|
|
||||||
ed.dom.setAttrib(e, "dir", "rtl");
|
|
||||||
else
|
|
||||||
ed.dom.setAttrib(e, "dir", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
ed.nodeChanged();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
|
ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
* @author Moxiecode
|
* @author Moxiecode
|
||||||
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
* @copyright Copyright <20> 2004-2008, Moxiecode Systems AB, All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
@@ -35,7 +35,19 @@
|
|||||||
// Register example button
|
// Register example button
|
||||||
ed.addButton('emoticons', {
|
ed.addButton('emoticons', {
|
||||||
title : 'emoticons.desc',
|
title : 'emoticons.desc',
|
||||||
cmd : 'mceEmotion',
|
onclick: function(){
|
||||||
|
|
||||||
|
$.colorbox({
|
||||||
|
href: url + "/emoticons.php",
|
||||||
|
iframe: true,
|
||||||
|
width:"200px",
|
||||||
|
height:"200px",
|
||||||
|
speed:2,
|
||||||
|
opacity: 0.3,
|
||||||
|
scrolling: false
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//cmd : 'mceEmotion',
|
||||||
image : url + '/images/emoticons.png'
|
image : url + '/images/emoticons.png'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -3,18 +3,53 @@ require_once("../../../../class2.php");
|
|||||||
if(!USER || check_class($pref['post_html']) == FALSE){
|
if(!USER || check_class($pref['post_html']) == FALSE){
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
define("e_IFRAME",true); //FIXME Not functioning on front-end yet.
|
||||||
$HEADER = "";
|
$HEADER = "";
|
||||||
|
$FOOTER = "";
|
||||||
|
|
||||||
|
e107::css('inline',"
|
||||||
|
|
||||||
|
.selectEmote { display:inline-block; cursor:pointer;margin:3px }
|
||||||
|
|
||||||
|
");
|
||||||
|
|
||||||
|
e107::js('tinymce','tiny_mce_popup.js');
|
||||||
|
e107::js('inline',"
|
||||||
|
|
||||||
|
$(document).ready(function()
|
||||||
|
{
|
||||||
|
$('.selectEmote').click(function () {
|
||||||
|
var file_name = $(this).attr('src');
|
||||||
|
var html = '<img src=\"' + file_name + '\" alt=\"\" />';
|
||||||
|
tinyMCEPopup.editor.execCommand('mceInsertContent', false, html);
|
||||||
|
parent.$.colorbox.close()
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
",'jquery');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once(HEADERF);
|
require_once(HEADERF);
|
||||||
|
|
||||||
|
|
||||||
$emotes = $sysprefs->getArray("emote_".$pref['emotepack']);
|
$emotes = $sysprefs->getArray("emote_".$pref['emotepack']);
|
||||||
$str = "<div style='text-align:center'><div class='spacer' style='white-space:wrap;width:130px;text-align:center'>";
|
$str = "<div style='text-align:center;margin:0px'><div class='spacer' style='white-space:wrap;width:180px;text-align:center'>";
|
||||||
foreach($emotes as $key => $value){
|
foreach($emotes as $key => $value){
|
||||||
$key = str_replace("!", ".", $key);
|
$key = str_replace("!", ".", $key);
|
||||||
$key = preg_replace("#_(\w{3})$#", ".\\1", $key);
|
$key = preg_replace("#_(\w{3})$#", ".\\1", $key);
|
||||||
$value2 = substr($value, 0, strpos($value, " "));
|
$value2 = substr($value, 0, strpos($value, " "));
|
||||||
$value = ($value2 ? $value2 : $value);
|
$value = ($value2 ? $value2 : $value);
|
||||||
$str .= "\n<a href='javascript:void(0);' onmousedown=\"javascript:insertEmotion('$key')\"><img src=\"".e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/$key\" style=\"border:0; padding-top:2px;\" alt=\"\" /></a> ";
|
// $str .= "\n<a href='javascript:void(0);' onmousedown=\"javascript:insertEmotion('$key')\"><img src=\"".e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/$key\" style=\"border:0; padding-top:2px;\" alt=\"\" /></a> ";
|
||||||
|
|
||||||
|
$str .= "\n<img class='selectEmote' src=\"".e_IMAGE_ABS."emotes/" . $pref['emotepack'] . "/$key\" style=\"border:0; padding-top:2px;\" alt=\"\" />";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$str .= "</div>
|
$str .= "</div>
|
||||||
@@ -24,12 +59,12 @@ require_once(HEADERF);
|
|||||||
|
|
||||||
function headerjs(){
|
function headerjs(){
|
||||||
global $pref;
|
global $pref;
|
||||||
$js = "<script type='text/javascript' src='../../tiny_mce_popup.js'></script>";
|
// $js = "<script type='text/javascript' src='../../tiny_mce_popup.js'></script>";
|
||||||
$js .= " <script type='text/javascript'>
|
$js .= " <script type='text/javascript'>
|
||||||
|
|
||||||
function init() {
|
// function init() {
|
||||||
tinyMCEPopup.resizeToInnerSize();
|
// tinyMCEPopup.resizeToInnerSize();
|
||||||
}
|
// }
|
||||||
|
|
||||||
function insertEmotion(file_name, title) {
|
function insertEmotion(file_name, title) {
|
||||||
var html = '<img src=\'".e_IMAGE_ABS."emotes/".$pref['emotepack']."/' + file_name + '\' alt=\'' + file_name + '\' />';
|
var html = '<img src=\'".e_IMAGE_ABS."emotes/".$pref['emotepack']."/' + file_name + '\' alt=\'' + file_name + '\' />';
|
||||||
@@ -43,7 +78,10 @@ function headerjs(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "</body></html>";
|
//require_once(FOOTERF);
|
||||||
|
//exit;
|
||||||
|
|
||||||
|
echo "</body></html>";
|
||||||
|
exit;
|
||||||
|
|
||||||
?>
|
?>
|
@@ -1 +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().firstChild);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)})();
|
(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)})();
|
@@ -127,7 +127,7 @@
|
|||||||
var vp = tinymce.DOM.getViewPort(), fed = t.fullscreenEditor, outerSize, innerSize;
|
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
|
// 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().firstChild);
|
outerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('table')[0]);
|
||||||
innerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('iframe')[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);
|
fed.theme.resizeTo(vp.w - outerSize.w + innerSize.w, vp.h - outerSize.h + innerSize.h);
|
||||||
|
@@ -35,7 +35,17 @@
|
|||||||
// Register ibrowser button
|
// Register ibrowser button
|
||||||
ed.addButton('ibrowser', {
|
ed.addButton('ibrowser', {
|
||||||
title : 'ibrowser.desc',
|
title : 'ibrowser.desc',
|
||||||
cmd : 'mceibrowser',
|
// cmd : 'mceibrowser',
|
||||||
|
onclick: function() {
|
||||||
|
$.colorbox({
|
||||||
|
href: url + "/ibrowser.php",
|
||||||
|
iframe: true,
|
||||||
|
width:"60%",
|
||||||
|
height:"70%",
|
||||||
|
speed:10,
|
||||||
|
opacity: 0.4
|
||||||
|
});
|
||||||
|
},
|
||||||
image : url + '/images/ibrowser.gif'
|
image : url + '/images/ibrowser.gif'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -382,7 +382,7 @@
|
|||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
typeItem = this.getType(node.attr('class'));
|
typeItem = this.getType(node.attr('class'));
|
||||||
|
|
||||||
style = node.attr('data-mce-style')
|
style = node.attr('data-mce-style');
|
||||||
if (!style) {
|
if (!style) {
|
||||||
style = node.attr('style');
|
style = node.attr('style');
|
||||||
|
|
||||||
|
@@ -78,7 +78,7 @@
|
|||||||
get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource2','video_altsource2','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_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('audio_altsource2_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource2','audio_altsource2','media','media');
|
||||||
get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','media','image');
|
get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','image','media');
|
||||||
|
|
||||||
html = self.getMediaListHTML('medialist', 'src', 'media', 'media');
|
html = self.getMediaListHTML('medialist', 'src', 'media', 'media');
|
||||||
if (html == "")
|
if (html == "")
|
||||||
@@ -327,6 +327,39 @@
|
|||||||
setVal('media_type', data.type);
|
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.type == 'video') {
|
||||||
if (!data.video.sources)
|
if (!data.video.sources)
|
||||||
data.video.sources = [];
|
data.video.sources = [];
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -14,10 +14,7 @@
|
|||||||
var VK = tinymce.VK;
|
var VK = tinymce.VK;
|
||||||
|
|
||||||
function handleContentEditableSelection(ed) {
|
function handleContentEditableSelection(ed) {
|
||||||
var dom = ed.dom, selection = ed.selection, invisibleChar, caretContainerId = 'mce_noneditablecaret';
|
var dom = ed.dom, selection = ed.selection, invisibleChar, caretContainerId = 'mce_noneditablecaret', invisibleChar = '\uFEFF';
|
||||||
|
|
||||||
// Setup invisible character use zero width space on Gecko since it doesn't change the height of the container
|
|
||||||
invisibleChar = tinymce.isGecko ? '\u200B' : '\uFEFF';
|
|
||||||
|
|
||||||
// Returns the content editable state of a node "true/false" or null
|
// Returns the content editable state of a node "true/false" or null
|
||||||
function getContentEditable(node) {
|
function getContentEditable(node) {
|
||||||
|
109
e107_plugins/tinymce/plugins/youtube/editor_plugin.js
Normal file
109
e107_plugins/tinymce/plugins/youtube/editor_plugin.js
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
/**
|
||||||
|
* 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 () {
|
||||||
|
// Load plugin specific language pack
|
||||||
|
tinymce.PluginManager.requireLangPack('youtube');
|
||||||
|
|
||||||
|
tinymce.create('tinymce.plugins.YoutubePlugin', {
|
||||||
|
/**
|
||||||
|
* 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) {
|
||||||
|
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
||||||
|
/*
|
||||||
|
ed.addCommand('mceYoutube', function () {
|
||||||
|
ed.windowManager.open({
|
||||||
|
file: url + '/youtube.htm',
|
||||||
|
width: 320 + parseInt(ed.getLang('example.delta_width', 0)),
|
||||||
|
height: 120 + parseInt(ed.getLang('example.delta_height', 0)),
|
||||||
|
inline: 1
|
||||||
|
}, {
|
||||||
|
plugin_url: url, // Plugin absolute URL
|
||||||
|
some_custom_arg: 'custom arg' // Custom argument
|
||||||
|
});
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// Register example button
|
||||||
|
ed.addButton('youtube', {
|
||||||
|
title: 'youtube.desc',
|
||||||
|
onclick: function(){
|
||||||
|
|
||||||
|
$.colorbox({
|
||||||
|
href: url + "/youtube.php",
|
||||||
|
iframe: true,
|
||||||
|
width:"500px",
|
||||||
|
height:"240px",
|
||||||
|
speed:10,
|
||||||
|
opacity: 0.3
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// cmd: 'mceYoutube',
|
||||||
|
image: url + '/img/youtube.gif'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add a node change handler, selects the button in the UI when a image is selected
|
||||||
|
ed.onNodeChange.add(function (ed, cm, n) {
|
||||||
|
var active = false;
|
||||||
|
if (n.nodeName == 'IMG') {
|
||||||
|
try {
|
||||||
|
var src = n.attributes["src"].value;
|
||||||
|
var alt = n.attributes["alt"].value;
|
||||||
|
var regexRes = src.match("vi/([^&#]*)/0.jpg");
|
||||||
|
active = regexRes[1] === alt;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cm.setActive('youtube', active);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates control instances based in the incomming name. This method is normally not
|
||||||
|
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
|
||||||
|
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
|
||||||
|
* method can be used to create those.
|
||||||
|
*
|
||||||
|
* @param {String} n Name of the control to create.
|
||||||
|
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
|
||||||
|
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
||||||
|
*/
|
||||||
|
createControl: function (n, cm) {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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: 'Youtube plugin',
|
||||||
|
author: 'travelogie.com',
|
||||||
|
authorurl: 'http://travelogie.com',
|
||||||
|
infourl: 'http://travelogie.com/blog',
|
||||||
|
version: "1.0"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Register plugin
|
||||||
|
tinymce.PluginManager.add('youtube', tinymce.plugins.YoutubePlugin);
|
||||||
|
})();
|
BIN
e107_plugins/tinymce/plugins/youtube/img/youtube.gif
Normal file
BIN
e107_plugins/tinymce/plugins/youtube/img/youtube.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 196 B |
143
e107_plugins/tinymce/plugins/youtube/youtube.php
Normal file
143
e107_plugins/tinymce/plugins/youtube/youtube.php
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
<?php
|
||||||
|
define('e_ADMIN_AREA',true);
|
||||||
|
require_once("../../../../class2.php");
|
||||||
|
|
||||||
|
|
||||||
|
define("e_IFRAME",true);
|
||||||
|
e107::css('inline',"
|
||||||
|
|
||||||
|
.sizeblock { display:inline-block; width: 180px; padding:4px }
|
||||||
|
|
||||||
|
");
|
||||||
|
|
||||||
|
e107::js('tinymce','tiny_mce_popup.js');
|
||||||
|
e107::js('inline',"
|
||||||
|
|
||||||
|
$(document).ready(function()
|
||||||
|
{
|
||||||
|
$('#insert').click(function () {
|
||||||
|
|
||||||
|
var url = $('#youtubeURL').val();
|
||||||
|
var size = $('input:radio[name=size]:checked').val();
|
||||||
|
var convert = {};
|
||||||
|
|
||||||
|
convert['tiny'] = 'width:320px;height:205px';
|
||||||
|
convert['small'] = 'width:560px;height:340px';
|
||||||
|
convert['medium'] = 'width:640px;height:385px';
|
||||||
|
convert['large'] = 'width:853px;height:505px';
|
||||||
|
convert['huge'] = 'width:1280px;height:745px';
|
||||||
|
|
||||||
|
if(url === null)
|
||||||
|
{
|
||||||
|
|
||||||
|
alert('Please enter a valid Youtube URL');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var code, regexRes;
|
||||||
|
regexRes = url.match('[\\?&]v=([^&#]*)');
|
||||||
|
code = (regexRes === null) ? url : regexRes[1];
|
||||||
|
|
||||||
|
if(size == 'custom')
|
||||||
|
{
|
||||||
|
var w = $('#width').val();
|
||||||
|
var h = $('#height').val();
|
||||||
|
size = w + ',' + h;
|
||||||
|
style = 'width:' + w + 'px;height:' + h + 'px';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var style = convert[size];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code === '') {
|
||||||
|
alert('Please enter a valid Youtube URL');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var s = '[youtube='+size+']'+code+'[/youtube]';
|
||||||
|
|
||||||
|
var p = $.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: '".e_PLUGIN_ABS."tinymce/plugins/e107bbcode/parser.php',
|
||||||
|
data: { content: s, mode: 'tohtml' },
|
||||||
|
async: false,
|
||||||
|
|
||||||
|
dataType: 'html',
|
||||||
|
success: function(html) {
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
}).responseText;
|
||||||
|
|
||||||
|
tinyMCEPopup.editor.execCommand('mceInsertContent', false, p);
|
||||||
|
|
||||||
|
// tinyMCEPopup.editor.execCommand('mceInsertContent', false, '<img class=\"youtube-' + size + '\" src=\"http://img.youtube.com/vi/' + code + '/0.jpg\" alt=\"' + code + '\" style=\"' + style + '\" />');
|
||||||
|
parent.$.colorbox.close()
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#cancel').click(function () {
|
||||||
|
|
||||||
|
parent.$.colorbox.close()
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
",'jquery');
|
||||||
|
|
||||||
|
|
||||||
|
require_once(e_ADMIN."auth.php");
|
||||||
|
/*
|
||||||
|
case 'tiny':
|
||||||
|
$params['w'] = 320; // 200;
|
||||||
|
$params['h'] = 205; // 180;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'small':
|
||||||
|
$params['w'] = 560; // 445;
|
||||||
|
$params['h'] = 340; // 364;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'medium':
|
||||||
|
$params['w'] = 640; // 500;
|
||||||
|
$params['h'] = 385; // 405;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'big':
|
||||||
|
case 'large':
|
||||||
|
$params['w'] = 853; // 660;
|
||||||
|
$params['h'] = 505; // 525;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'huge':
|
||||||
|
$params['w'] = 1280; // 980;
|
||||||
|
$params['h'] = 745; // 765;
|
||||||
|
break;
|
||||||
|
*/
|
||||||
|
|
||||||
|
$text = '<div><form onsubmit="YoutubeDialog.insert();return false;" action="#">
|
||||||
|
<p><label for="youtubeURL">Youtube URL or Code</label>
|
||||||
|
<input id="youtubeURL" name="youtubeURL" type="text" class="text" style="width:97%" autofocus="autofocus" /></p>
|
||||||
|
|
||||||
|
<div class="sizeblock"><input type="radio" name="size" value="tiny" checked="checked" />Tiny (320 x 205)</div>
|
||||||
|
<div class="sizeblock"><input type="radio" name="size" value="small" />Small (560 x 340)</div>
|
||||||
|
<div class="sizeblock"><input type="radio" name="size" value="medium" />Medium (640 x 385)</div>
|
||||||
|
<div class="sizeblock"><input type="radio" name="size" value="large" />Large (854 x 505)</div>
|
||||||
|
<div class="sizeblock"><input type="radio" name="size" value="huge" />Huge (1280 x 745)</div>
|
||||||
|
<div class="sizeblock"><input type="radio" name="size" value="custom" />Custom
|
||||||
|
<input type="text" id="width" name="width" value="" size="3" /> x <input type="text" id="height" name="height" value="" size="3" /></div>
|
||||||
|
|
||||||
|
<div style="padding:10px">
|
||||||
|
<input type="button" id="insert" name="insert" value="Insert" />
|
||||||
|
<input type="button" id="cancel" name="cancel" value="'.LAN_CANCEL.'" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>';
|
||||||
|
|
||||||
|
$ns = e107::getRender();
|
||||||
|
$ns->tablerender("Insert Youtube Video",$text);
|
||||||
|
require_once(e_ADMIN."footer.php");
|
||||||
|
exit;
|
||||||
|
?>
|
File diff suppressed because one or more lines are too long
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
// Generates a preview for a format
|
// Generates a preview for a format
|
||||||
function getPreviewCss(ed, fmt) {
|
function getPreviewCss(ed, fmt) {
|
||||||
var previewElm, dom = ed.dom, previewCss = '', parentFontSize, previewStylesName;
|
var name, previewElm, dom = ed.dom, previewCss = '', parentFontSize, previewStylesName;
|
||||||
|
|
||||||
previewStyles = ed.settings.preview_styles;
|
previewStyles = ed.settings.preview_styles;
|
||||||
|
|
||||||
@@ -831,6 +831,7 @@
|
|||||||
var f = Event.add(ed.id + '_external_close', 'click', function() {
|
var f = Event.add(ed.id + '_external_close', 'click', function() {
|
||||||
DOM.hide(ed.id + '_external');
|
DOM.hide(ed.id + '_external');
|
||||||
Event.remove(ed.id + '_external_close', 'click', f);
|
Event.remove(ed.id + '_external_close', 'click', f);
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
DOM.show(e);
|
DOM.show(e);
|
||||||
@@ -1038,6 +1039,8 @@
|
|||||||
width = startWidth + (e.screenX - startX);
|
width = startWidth + (e.screenX - startX);
|
||||||
height = startHeight + (e.screenY - startY);
|
height = startHeight + (e.screenY - startY);
|
||||||
t.resizeTo(width, height, true);
|
t.resizeTo(width, height, true);
|
||||||
|
|
||||||
|
ed.nodeChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -1286,7 +1289,7 @@
|
|||||||
ti += 'id: ' + v + ' ';
|
ti += 'id: ' + v + ' ';
|
||||||
|
|
||||||
if (v = n.className) {
|
if (v = n.className) {
|
||||||
v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '')
|
v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '');
|
||||||
|
|
||||||
if (v) {
|
if (v) {
|
||||||
ti += 'class: ' + v + ' ';
|
ti += 'class: ' + v + ' ';
|
||||||
|
2
e107_plugins/tinymce/tiny_mce.js
vendored
2
e107_plugins/tinymce/tiny_mce.js
vendored
File diff suppressed because one or more lines are too long
387
e107_plugins/tinymce/tiny_mce_src.js
vendored
387
e107_plugins/tinymce/tiny_mce_src.js
vendored
@@ -6,9 +6,9 @@
|
|||||||
var tinymce = {
|
var tinymce = {
|
||||||
majorVersion : '3',
|
majorVersion : '3',
|
||||||
|
|
||||||
minorVersion : '5.4.1',
|
minorVersion : '5.6',
|
||||||
|
|
||||||
releaseDate : '2012-06-24',
|
releaseDate : '2012-07-26',
|
||||||
|
|
||||||
_init : function() {
|
_init : function() {
|
||||||
var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
|
var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
|
||||||
@@ -1338,7 +1338,8 @@ tinymce.create('static tinymce.util.XHR', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
metaKeyPressed: function(e) {
|
metaKeyPressed: function(e) {
|
||||||
return tinymce.isMac ? e.metaKey : e.ctrlKey;
|
// Check if ctrl or meta key is pressed also check if alt is false for Polish users
|
||||||
|
return tinymce.isMac ? e.metaKey : e.ctrlKey && !e.altKey;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})(tinymce);
|
})(tinymce);
|
||||||
@@ -1432,7 +1433,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
var allRng = dom.createRng();
|
var allRng = dom.createRng();
|
||||||
allRng.selectNode(editor.getBody());
|
allRng.selectNode(editor.getBody());
|
||||||
|
|
||||||
var allSelection = serializeRng(allRng);//console.log(selection, "----", allSelection);
|
var allSelection = serializeRng(allRng);
|
||||||
return selection === allSelection;
|
return selection === allSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1565,7 +1566,7 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isSelectionAcrossElements() {
|
function isSelectionAcrossElements() {
|
||||||
return !selection.isCollapsed() && selection.getStart() != selection.getEnd();
|
return !selection.isCollapsed() && dom.getParent(selection.getStart(), dom.isBlock) != dom.getParent(selection.getEnd(), dom.isBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
function blockEvent(editor, e) {
|
function blockEvent(editor, e) {
|
||||||
@@ -1884,77 +1885,237 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function fakeImageResize() {
|
function fakeImageResize() {
|
||||||
var mouseDownImg, startX, startY, startW, startH;
|
var selectedElmX, selectedElmY, selectedElm, selectedElmGhost, selectedHandle, startX, startY, startW, startH, ratio,
|
||||||
|
resizeHandles, width, height, rootDocument = document, editableDoc = editor.getDoc();
|
||||||
|
|
||||||
if (!settings.object_resizing || settings.webkit_fake_resize === false) {
|
if (!settings.object_resizing || settings.webkit_fake_resize === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.contentStyles.push('.mceResizeImages img {cursor: se-resize !important}');
|
// Try disabling object resizing if WebKit implements resizing in the future
|
||||||
|
setEditorCommandState("enableObjectResizing", false);
|
||||||
|
|
||||||
function resizeImage(e) {
|
// Details about each resize handle how to scale etc
|
||||||
var deltaX, deltaY, ratio, width, height;
|
resizeHandles = {
|
||||||
|
// Name: x multiplier, y multiplier, delta size x, delta size y
|
||||||
|
n: [.5, 0, 0, -1],
|
||||||
|
e: [1, .5, 1, 0],
|
||||||
|
s: [.5, 1, 0, 1],
|
||||||
|
w: [0, .5, -1, 0],
|
||||||
|
nw: [0, 0, -1, -1],
|
||||||
|
ne: [1, 0, 1, -1],
|
||||||
|
se: [1, 1, 1, 1],
|
||||||
|
sw : [0, 1, -1, 1]
|
||||||
|
};
|
||||||
|
|
||||||
if (mouseDownImg) {
|
function resizeElement(e) {
|
||||||
deltaX = e.screenX - startX;
|
var deltaX, deltaY;
|
||||||
deltaY = e.screenY - startY;
|
|
||||||
ratio = Math.max((startW + deltaX) / startW, (startH + deltaY) / startH);
|
|
||||||
|
|
||||||
// Only update styles if the user draged one pixel or more
|
// Calc new width/height
|
||||||
if (Math.abs(deltaX) > 1 || Math.abs(deltaY) > 1) {
|
deltaX = e.screenX - startX;
|
||||||
// Constrain proportions
|
deltaY = e.screenY - startY;
|
||||||
width = Math.round(startW * ratio);
|
|
||||||
height = Math.round(startH * ratio);
|
|
||||||
|
|
||||||
|
// Calc new size
|
||||||
|
width = deltaX * selectedHandle[2] + startW;
|
||||||
|
height = deltaY * selectedHandle[3] + startH;
|
||||||
|
|
||||||
|
// Never scale down lower than 5 pixels
|
||||||
|
width = width < 5 ? 5 : width;
|
||||||
|
height = height < 5 ? 5 : height;
|
||||||
|
|
||||||
|
// Constrain proportions when modifier key is pressed or if the nw, ne, sw, se corners are moved on an image
|
||||||
|
if (VK.modifierPressed(e) || (selectedElm.nodeName == "IMG" && selectedHandle[2] * selectedHandle[3] !== 0)) {
|
||||||
|
width = Math.round(height / ratio);
|
||||||
|
height = Math.round(width * ratio);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update ghost size
|
||||||
|
dom.setStyles(selectedElmGhost, {
|
||||||
|
width: width,
|
||||||
|
height: height
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update ghost X position if needed
|
||||||
|
if (selectedHandle[2] < 0 && selectedElmGhost.clientWidth <= width) {
|
||||||
|
dom.setStyle(selectedElmGhost, 'left', selectedElmX + (startW - width));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update ghost Y position if needed
|
||||||
|
if (selectedHandle[3] < 0 && selectedElmGhost.clientHeight <= height) {
|
||||||
|
dom.setStyle(selectedElmGhost, 'top', selectedElmY + (startH - height));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function endResize() {
|
||||||
|
function setSizeProp(name, value) {
|
||||||
|
if (value) {
|
||||||
// Resize by using style or attribute
|
// Resize by using style or attribute
|
||||||
if (mouseDownImg.style.width) {
|
if (selectedElm.style[name] || !editor.schema.isValid(selectedElm.nodeName.toLowerCase(), name)) {
|
||||||
dom.setStyle(mouseDownImg, 'width', width);
|
dom.setStyle(selectedElm, name, value);
|
||||||
} else {
|
} else {
|
||||||
dom.setAttrib(mouseDownImg, 'width', width);
|
dom.setAttrib(selectedElm, name, value);
|
||||||
}
|
|
||||||
|
|
||||||
// Resize by using style or attribute
|
|
||||||
if (mouseDownImg.style.height) {
|
|
||||||
dom.setStyle(mouseDownImg, 'height', height);
|
|
||||||
} else {
|
|
||||||
dom.setAttrib(mouseDownImg, 'height', height);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!dom.hasClass(editor.getBody(), 'mceResizeImages')) {
|
|
||||||
dom.addClass(editor.getBody(), 'mceResizeImages');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
editor.onMouseDown.add(function(editor, e) {
|
// Set width/height properties
|
||||||
var target = e.target;
|
setSizeProp('width', width);
|
||||||
|
setSizeProp('height', height);
|
||||||
|
|
||||||
if (target.nodeName == "IMG") {
|
dom.unbind(editableDoc, 'mousemove', resizeElement);
|
||||||
mouseDownImg = target;
|
dom.unbind(editableDoc, 'mouseup', endResize);
|
||||||
startX = e.screenX;
|
|
||||||
startY = e.screenY;
|
|
||||||
startW = mouseDownImg.clientWidth;
|
|
||||||
startH = mouseDownImg.clientHeight;
|
|
||||||
dom.bind(editor.getDoc(), 'mousemove', resizeImage);
|
|
||||||
e.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Unbind events on node change and restore resize cursor
|
if (rootDocument != editableDoc) {
|
||||||
editor.onNodeChange.add(function() {
|
dom.unbind(rootDocument, 'mousemove', resizeElement);
|
||||||
if (mouseDownImg) {
|
dom.unbind(rootDocument, 'mouseup', endResize);
|
||||||
mouseDownImg = null;
|
|
||||||
dom.unbind(editor.getDoc(), 'mousemove', resizeImage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selection.getNode().nodeName == "IMG") {
|
// Remove ghost and update resize handle positions
|
||||||
dom.addClass(editor.getBody(), 'mceResizeImages');
|
dom.remove(selectedElmGhost);
|
||||||
|
showResizeRect(selectedElm);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showResizeRect(targetElm) {
|
||||||
|
var position, targetWidth, targetHeight;
|
||||||
|
|
||||||
|
hideResizeRect();
|
||||||
|
|
||||||
|
// Get position and size of target
|
||||||
|
position = dom.getPos(targetElm);
|
||||||
|
selectedElmX = position.x;
|
||||||
|
selectedElmY = position.y;
|
||||||
|
targetWidth = targetElm.offsetWidth;
|
||||||
|
targetHeight = targetElm.offsetHeight;
|
||||||
|
|
||||||
|
// Reset width/height if user selects a new image/table
|
||||||
|
if (selectedElm != targetElm) {
|
||||||
|
selectedElm = targetElm;
|
||||||
|
width = height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tinymce.each(resizeHandles, function(handle, name) {
|
||||||
|
var handleElm;
|
||||||
|
|
||||||
|
// Get existing or render resize handle
|
||||||
|
handleElm = dom.get('mceResizeHandle' + name);
|
||||||
|
if (!handleElm) {
|
||||||
|
handleElm = dom.add(editableDoc.documentElement, 'div', {
|
||||||
|
id: 'mceResizeHandle' + name,
|
||||||
|
'class': 'mceResizeHandle',
|
||||||
|
style: 'cursor:' + name + '-resize; margin:0; padding:0'
|
||||||
|
});
|
||||||
|
|
||||||
|
dom.bind(handleElm, 'mousedown', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
endResize();
|
||||||
|
|
||||||
|
startX = e.screenX;
|
||||||
|
startY = e.screenY;
|
||||||
|
startW = selectedElm.clientWidth;
|
||||||
|
startH = selectedElm.clientHeight;
|
||||||
|
ratio = startH / startW;
|
||||||
|
selectedHandle = handle;
|
||||||
|
|
||||||
|
selectedElmGhost = selectedElm.cloneNode(true);
|
||||||
|
dom.addClass(selectedElmGhost, 'mceClonedResizable');
|
||||||
|
dom.setStyles(selectedElmGhost, {
|
||||||
|
left: selectedElmX,
|
||||||
|
top: selectedElmY,
|
||||||
|
margin: 0
|
||||||
|
});
|
||||||
|
|
||||||
|
editableDoc.documentElement.appendChild(selectedElmGhost);
|
||||||
|
|
||||||
|
dom.bind(editableDoc, 'mousemove', resizeElement);
|
||||||
|
dom.bind(editableDoc, 'mouseup', endResize);
|
||||||
|
|
||||||
|
if (rootDocument != editableDoc) {
|
||||||
|
dom.bind(rootDocument, 'mousemove', resizeElement);
|
||||||
|
dom.bind(rootDocument, 'mouseup', endResize);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
dom.show(handleElm);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Position element
|
||||||
|
dom.setStyles(handleElm, {
|
||||||
|
left: (targetWidth * handle[0] + selectedElmX) - (handleElm.offsetWidth / 2),
|
||||||
|
top: (targetHeight * handle[1] + selectedElmY) - (handleElm.offsetHeight / 2)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Only add resize rectangle on WebKit and only on images
|
||||||
|
if (!tinymce.isOpera && selectedElm.nodeName == "IMG") {
|
||||||
|
selectedElm.setAttribute('data-mce-selected', '1');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideResizeRect() {
|
||||||
|
if (selectedElm) {
|
||||||
|
selectedElm.removeAttribute('data-mce-selected');
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var name in resizeHandles) {
|
||||||
|
dom.hide('mceResizeHandle' + name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add CSS for resize handles, cloned element and selected
|
||||||
|
editor.contentStyles.push(
|
||||||
|
'.mceResizeHandle {' +
|
||||||
|
'position: absolute;' +
|
||||||
|
'border: 1px solid black;' +
|
||||||
|
'background: #FFF;' +
|
||||||
|
'width: 5px;' +
|
||||||
|
'height: 5px;' +
|
||||||
|
'z-index: 10000' +
|
||||||
|
'}' +
|
||||||
|
'.mceResizeHandle:hover {' +
|
||||||
|
'background: #000' +
|
||||||
|
'}' +
|
||||||
|
'img[data-mce-selected] {' +
|
||||||
|
'outline: 1px solid black' +
|
||||||
|
'}' +
|
||||||
|
'img.mceClonedResizable, table.mceClonedResizable {' +
|
||||||
|
'position: absolute;' +
|
||||||
|
'outline: 1px dashed black;' +
|
||||||
|
'opacity: .5;' +
|
||||||
|
'z-index: 10000' +
|
||||||
|
'}'
|
||||||
|
);
|
||||||
|
|
||||||
|
function updateResizeRect() {
|
||||||
|
var controlElm = dom.getParent(selection.getNode(), 'table,img');
|
||||||
|
|
||||||
|
// Remove data-mce-selected from all elements since they might have been copied using Ctrl+c/v
|
||||||
|
tinymce.each(dom.select('img[data-mce-selected]'), function(img) {
|
||||||
|
img.removeAttribute('data-mce-selected');
|
||||||
|
});
|
||||||
|
|
||||||
|
if (controlElm) {
|
||||||
|
showResizeRect(controlElm);
|
||||||
} else {
|
} else {
|
||||||
dom.removeClass(editor.getBody(), 'mceResizeImages');
|
hideResizeRect();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show/hide resize rect when image is selected
|
||||||
|
editor.onNodeChange.add(updateResizeRect);
|
||||||
|
|
||||||
|
// Fixes WebKit quirk where it returns IMG on getNode if caret is after last image in container
|
||||||
|
dom.bind(editableDoc, 'selectionchange', updateResizeRect);
|
||||||
|
|
||||||
|
// Remove the internal attribute when serializing the DOM
|
||||||
|
editor.serializer.addAttributeFilter('data-mce-selected', function(nodes, name) {
|
||||||
|
var i = nodes.length;
|
||||||
|
|
||||||
|
while (i--) {
|
||||||
|
nodes[i].attr(name, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
// All browsers
|
// All browsers
|
||||||
disableBackspaceIntoATable();
|
disableBackspaceIntoATable();
|
||||||
@@ -1997,6 +2158,11 @@ tinymce.util.Quirks = function(editor) {
|
|||||||
addBrAfterLastLinks();
|
addBrAfterLastLinks();
|
||||||
removeGhostSelection();
|
removeGhostSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Opera
|
||||||
|
if (tinymce.isOpera) {
|
||||||
|
fakeImageResize();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
(function(tinymce) {
|
(function(tinymce) {
|
||||||
var namedEntities, baseEntities, reverseEntities,
|
var namedEntities, baseEntities, reverseEntities,
|
||||||
@@ -5818,7 +5984,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
|
|||||||
styleElm.id = 'mceDefaultStyles';
|
styleElm.id = 'mceDefaultStyles';
|
||||||
styleElm.type = 'text/css';
|
styleElm.type = 'text/css';
|
||||||
|
|
||||||
head = doc.getElementsByTagName('head')[0]
|
head = doc.getElementsByTagName('head')[0];
|
||||||
if (head.firstChild) {
|
if (head.firstChild) {
|
||||||
head.insertBefore(styleElm, head.firstChild);
|
head.insertBefore(styleElm, head.firstChild);
|
||||||
} else {
|
} else {
|
||||||
@@ -7568,7 +7734,8 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.addRange = function(rng) {
|
this.addRange = function(rng) {
|
||||||
var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, sibling, doc = selection.dom.doc, body = doc.body;
|
var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, sibling,
|
||||||
|
doc = selection.dom.doc, body = doc.body, nativeRng, ctrlElm;
|
||||||
|
|
||||||
function setEndPoint(start) {
|
function setEndPoint(start) {
|
||||||
var container, offset, marker, tmpRng, nodes;
|
var container, offset, marker, tmpRng, nodes;
|
||||||
@@ -7654,10 +7821,17 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
|
|||||||
|
|
||||||
if (startOffset == endOffset - 1) {
|
if (startOffset == endOffset - 1) {
|
||||||
try {
|
try {
|
||||||
|
ctrlElm = startContainer.childNodes[startOffset];
|
||||||
ctrlRng = body.createControlRange();
|
ctrlRng = body.createControlRange();
|
||||||
ctrlRng.addElement(startContainer.childNodes[startOffset]);
|
ctrlRng.addElement(ctrlElm);
|
||||||
ctrlRng.select();
|
ctrlRng.select();
|
||||||
return;
|
|
||||||
|
// Check if the range produced is on the correct element and is a control range
|
||||||
|
// On IE 8 it will select the parent contentEditable container if you select an inner element see: #5398
|
||||||
|
nativeRng = selection.getRng();
|
||||||
|
if (nativeRng.item && ctrlElm === nativeRng.item(0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
@@ -9155,7 +9329,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
|
|||||||
|
|
||||||
// Replace all BOM characters for now until we can find a better solution
|
// Replace all BOM characters for now until we can find a better solution
|
||||||
if (!args.cleanup)
|
if (!args.cleanup)
|
||||||
args.content = args.content.replace(/\uFEFF|\u200B/g, '');
|
args.content = args.content.replace(/\uFEFF/g, '');
|
||||||
|
|
||||||
// Post process
|
// Post process
|
||||||
if (!args.no_events)
|
if (!args.no_events)
|
||||||
@@ -12142,6 +12316,11 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Load specified content CSS last
|
||||||
|
if (s.content_style) {
|
||||||
|
t.contentStyles.push(s.content_style);
|
||||||
|
}
|
||||||
|
|
||||||
// Content editable mode ends here
|
// Content editable mode ends here
|
||||||
if (s.content_editable) {
|
if (s.content_editable) {
|
||||||
e = n = o = null; // Fix IE leak
|
e = n = o = null; // Fix IE leak
|
||||||
@@ -12916,7 +13095,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
getContent : function(args) {
|
getContent : function(args) {
|
||||||
var self = this, content;
|
var self = this, content, body = self.getBody();
|
||||||
|
|
||||||
// Setup args object
|
// Setup args object
|
||||||
args = args || {};
|
args = args || {};
|
||||||
@@ -12930,11 +13109,18 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
|
|||||||
|
|
||||||
// Get raw contents or by default the cleaned contents
|
// Get raw contents or by default the cleaned contents
|
||||||
if (args.format == 'raw')
|
if (args.format == 'raw')
|
||||||
content = self.getBody().innerHTML;
|
content = body.innerHTML;
|
||||||
|
else if (args.format == 'text')
|
||||||
|
content = body.innerText || body.textContent;
|
||||||
else
|
else
|
||||||
content = self.serializer.serialize(self.getBody(), args);
|
content = self.serializer.serialize(body, args);
|
||||||
|
|
||||||
args.content = tinymce.trim(content);
|
// Trim whitespace in beginning/end of HTML
|
||||||
|
if (args.format != 'text') {
|
||||||
|
args.content = tinymce.trim(content);
|
||||||
|
} else {
|
||||||
|
args.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
// Do post processing
|
// Do post processing
|
||||||
if (!args.no_events)
|
if (!args.no_events)
|
||||||
@@ -13750,7 +13936,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
|
|||||||
|
|
||||||
// Insert bookmark node and get the parent
|
// Insert bookmark node and get the parent
|
||||||
selection.setContent(bookmarkHtml);
|
selection.setContent(bookmarkHtml);
|
||||||
parentNode = editor.selection.getNode();
|
parentNode = selection.getNode();
|
||||||
rootNode = editor.getBody();
|
rootNode = editor.getBody();
|
||||||
|
|
||||||
// Opera will return the document node when selection is in root
|
// Opera will return the document node when selection is in root
|
||||||
@@ -13917,10 +14103,15 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
|
|||||||
selectAll : function() {
|
selectAll : function() {
|
||||||
var root = dom.getRoot(), rng = dom.createRng();
|
var root = dom.getRoot(), rng = dom.createRng();
|
||||||
|
|
||||||
rng.setStart(root, 0);
|
// Old IE does a better job with selectall than new versions
|
||||||
rng.setEnd(root, root.childNodes.length);
|
if (selection.getRng().setStart) {
|
||||||
|
rng.setStart(root, 0);
|
||||||
|
rng.setEnd(root, root.childNodes.length);
|
||||||
|
|
||||||
editor.selection.setRng(rng);
|
selection.setRng(rng);
|
||||||
|
} else {
|
||||||
|
execNativeCommand('SelectAll');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -13959,7 +14150,10 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
|
|||||||
},
|
},
|
||||||
|
|
||||||
'InsertUnorderedList,InsertOrderedList' : function(command) {
|
'InsertUnorderedList,InsertOrderedList' : function(command) {
|
||||||
return dom.getParent(selection.getNode(), command == 'insertunorderedlist' ? 'UL' : 'OL');
|
var list = dom.getParent(selection.getNode(), 'ul,ol');
|
||||||
|
return list &&
|
||||||
|
(command === 'insertunorderedlist' && list.tagName === 'UL'
|
||||||
|
|| command === 'insertorderedlist' && list.tagName === 'OL');
|
||||||
}
|
}
|
||||||
}, 'state');
|
}, 'state');
|
||||||
|
|
||||||
@@ -14260,6 +14454,14 @@ tinymce.ForceBlocks = function(editor) {
|
|||||||
node = rootNode.firstChild;
|
node = rootNode.firstChild;
|
||||||
while (node) {
|
while (node) {
|
||||||
if (node.nodeType === 3 || (node.nodeType == 1 && !blockElements[node.nodeName])) {
|
if (node.nodeType === 3 || (node.nodeType == 1 && !blockElements[node.nodeName])) {
|
||||||
|
// Remove empty text nodes
|
||||||
|
if (node.nodeType === 3 && node.nodeValue.length == 0) {
|
||||||
|
tempNode = node;
|
||||||
|
node = node.nextSibling;
|
||||||
|
dom.remove(tempNode);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!rootBlockNode) {
|
if (!rootBlockNode) {
|
||||||
rootBlockNode = dom.create(settings.forced_root_block);
|
rootBlockNode = dom.create(settings.forced_root_block);
|
||||||
node.parentNode.insertBefore(rootBlockNode, node);
|
node.parentNode.insertBefore(rootBlockNode, node);
|
||||||
@@ -14830,7 +15032,7 @@ tinymce.ForceBlocks = function(editor) {
|
|||||||
isBlock = dom.isBlock,
|
isBlock = dom.isBlock,
|
||||||
forcedRootBlock = ed.settings.forced_root_block,
|
forcedRootBlock = ed.settings.forced_root_block,
|
||||||
nodeIndex = dom.nodeIndex,
|
nodeIndex = dom.nodeIndex,
|
||||||
INVISIBLE_CHAR = tinymce.isGecko ? '\u200B' : '\uFEFF',
|
INVISIBLE_CHAR = '\uFEFF',
|
||||||
MCE_ATTR_RE = /^(src|href|style)$/,
|
MCE_ATTR_RE = /^(src|href|style)$/,
|
||||||
FALSE = false,
|
FALSE = false,
|
||||||
TRUE = true,
|
TRUE = true,
|
||||||
@@ -15745,7 +15947,7 @@ tinymce.ForceBlocks = function(editor) {
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
function formatChanged(formats, callback) {
|
function formatChanged(formats, callback, similar) {
|
||||||
var currentFormats;
|
var currentFormats;
|
||||||
|
|
||||||
// Setup format node change logic
|
// Setup format node change logic
|
||||||
@@ -15759,7 +15961,7 @@ tinymce.ForceBlocks = function(editor) {
|
|||||||
// Check for new formats
|
// Check for new formats
|
||||||
each(formatChangeData, function(callbacks, format) {
|
each(formatChangeData, function(callbacks, format) {
|
||||||
each(parents, function(node) {
|
each(parents, function(node) {
|
||||||
if (matchNode(node, format, {}, true)) {
|
if (matchNode(node, format, {}, callbacks.similar)) {
|
||||||
if (!currentFormats[format]) {
|
if (!currentFormats[format]) {
|
||||||
// Execute callbacks
|
// Execute callbacks
|
||||||
each(callbacks, function(callback) {
|
each(callbacks, function(callback) {
|
||||||
@@ -15792,6 +15994,7 @@ tinymce.ForceBlocks = function(editor) {
|
|||||||
each(formats.split(','), function(format) {
|
each(formats.split(','), function(format) {
|
||||||
if (!formatChangeData[format]) {
|
if (!formatChangeData[format]) {
|
||||||
formatChangeData[format] = [];
|
formatChangeData[format] = [];
|
||||||
|
formatChangeData[format].similar = similar;
|
||||||
}
|
}
|
||||||
|
|
||||||
formatChangeData[format].push(callback);
|
formatChangeData[format].push(callback);
|
||||||
@@ -16887,7 +17090,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
|
|||||||
var dom = editor.dom, selection = editor.selection, settings = editor.settings, undoManager = editor.undoManager, nonEmptyElementsMap = editor.schema.getNonEmptyElements();
|
var dom = editor.dom, selection = editor.selection, settings = editor.settings, undoManager = editor.undoManager, nonEmptyElementsMap = editor.schema.getNonEmptyElements();
|
||||||
|
|
||||||
function handleEnterKey(evt) {
|
function handleEnterKey(evt) {
|
||||||
var rng = selection.getRng(true), tmpRng, editableRoot, container, offset, parentBlock, documentMode,
|
var rng = selection.getRng(true), tmpRng, editableRoot, container, offset, parentBlock, documentMode, shiftKey,
|
||||||
newBlock, fragment, containerBlock, parentBlockName, containerBlockName, newBlockName, isAfterLastNodeInContainer;
|
newBlock, fragment, containerBlock, parentBlockName, containerBlockName, newBlockName, isAfterLastNodeInContainer;
|
||||||
|
|
||||||
// Returns true if the block can be split into two blocks or not
|
// Returns true if the block can be split into two blocks or not
|
||||||
@@ -16932,6 +17135,11 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
|
|||||||
node = firstChilds[i];
|
node = firstChilds[i];
|
||||||
if (!node.hasChildNodes() || (node.firstChild == node.lastChild && node.firstChild.nodeValue === '')) {
|
if (!node.hasChildNodes() || (node.firstChild == node.lastChild && node.firstChild.nodeValue === '')) {
|
||||||
dom.remove(node);
|
dom.remove(node);
|
||||||
|
} else {
|
||||||
|
// Remove <a> </a> see #5381
|
||||||
|
if (node.nodeName == "A" && (node.innerText || node.textContent) === ' ') {
|
||||||
|
dom.remove(node);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -17210,7 +17418,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
|
|||||||
if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {
|
if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {
|
||||||
// Insert extra BR element at the end block elements
|
// Insert extra BR element at the end block elements
|
||||||
if (!tinymce.isIE && !hasRightSideBr()) {
|
if (!tinymce.isIE && !hasRightSideBr()) {
|
||||||
brElm = dom.create('br')
|
brElm = dom.create('br');
|
||||||
rng.insertNode(brElm);
|
rng.insertNode(brElm);
|
||||||
rng.setStartAfter(brElm);
|
rng.setStartAfter(brElm);
|
||||||
rng.setEndAfter(brElm);
|
rng.setEndAfter(brElm);
|
||||||
@@ -17295,9 +17503,10 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
|
|||||||
// Setup range items and newBlockName
|
// Setup range items and newBlockName
|
||||||
container = rng.startContainer;
|
container = rng.startContainer;
|
||||||
offset = rng.startOffset;
|
offset = rng.startOffset;
|
||||||
newBlockName = settings.forced_root_block;
|
newBlockName = (settings.force_p_newlines ? 'p' : '') || settings.forced_root_block;
|
||||||
newBlockName = newBlockName ? newBlockName.toUpperCase() : '';
|
newBlockName = newBlockName ? newBlockName.toUpperCase() : '';
|
||||||
documentMode = dom.doc.documentMode;
|
documentMode = dom.doc.documentMode;
|
||||||
|
shiftKey = evt.shiftKey;
|
||||||
|
|
||||||
// Resolve node index
|
// Resolve node index
|
||||||
if (container.nodeType == 1 && container.hasChildNodes()) {
|
if (container.nodeType == 1 && container.hasChildNodes()) {
|
||||||
@@ -17322,7 +17531,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
|
|||||||
|
|
||||||
// If editable root isn't block nor the root of the editor
|
// If editable root isn't block nor the root of the editor
|
||||||
if (!dom.isBlock(editableRoot) && editableRoot != dom.getRoot()) {
|
if (!dom.isBlock(editableRoot) && editableRoot != dom.getRoot()) {
|
||||||
if (!newBlockName || evt.shiftKey) {
|
if (!newBlockName || shiftKey) {
|
||||||
insertBr();
|
insertBr();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17332,7 +17541,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
|
|||||||
// Wrap the current node and it's sibling in a default block if it's needed.
|
// Wrap the current node and it's sibling in a default block if it's needed.
|
||||||
// for example this <td>text|<b>text2</b></td> will become this <td><p>text|<b>text2</p></b></td>
|
// for example this <td>text|<b>text2</b></td> will become this <td><p>text|<b>text2</p></b></td>
|
||||||
// This won't happen if root blocks are disabled or the shiftKey is pressed
|
// This won't happen if root blocks are disabled or the shiftKey is pressed
|
||||||
if ((newBlockName && !evt.shiftKey) || (!newBlockName && evt.shiftKey)) {
|
if ((newBlockName && !shiftKey) || (!newBlockName && shiftKey)) {
|
||||||
container = wrapSelfAndSiblingsInDefaultBlock(container, offset);
|
container = wrapSelfAndSiblingsInDefaultBlock(container, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17344,26 +17553,34 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
|
|||||||
parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
|
parentBlockName = parentBlock ? parentBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
|
||||||
containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
|
containerBlockName = containerBlock ? containerBlock.nodeName.toUpperCase() : ''; // IE < 9 & HTML5
|
||||||
|
|
||||||
// Handle enter inside an empty list item
|
// Handle enter in LI
|
||||||
if (parentBlockName == 'LI' && dom.isEmpty(parentBlock)) {
|
if (parentBlockName == 'LI') {
|
||||||
// Let the list plugin or browser handle nested lists for now
|
if (!newBlockName && shiftKey) {
|
||||||
if (/^(UL|OL|LI)$/.test(containerBlock.parentNode.nodeName)) {
|
insertBr();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleEmptyListItem();
|
// Handle enter inside an empty list item
|
||||||
return;
|
if (dom.isEmpty(parentBlock)) {
|
||||||
|
// Let the list plugin or browser handle nested lists for now
|
||||||
|
if (/^(UL|OL|LI)$/.test(containerBlock.parentNode.nodeName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleEmptyListItem();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't split PRE tags but insert a BR instead easier when writing code samples etc
|
// Don't split PRE tags but insert a BR instead easier when writing code samples etc
|
||||||
if (parentBlockName == 'PRE' && settings.br_in_pre !== false) {
|
if (parentBlockName == 'PRE' && settings.br_in_pre !== false) {
|
||||||
if (!evt.shiftKey) {
|
if (!shiftKey) {
|
||||||
insertBr();
|
insertBr();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If no root block is configured then insert a BR by default or if the shiftKey is pressed
|
// If no root block is configured then insert a BR by default or if the shiftKey is pressed
|
||||||
if ((!newBlockName && !evt.shiftKey && parentBlockName != 'LI') || (newBlockName && evt.shiftKey)) {
|
if ((!newBlockName && !shiftKey && parentBlockName != 'LI') || (newBlockName && shiftKey)) {
|
||||||
insertBr();
|
insertBr();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -273,22 +273,25 @@ class wysiwyg
|
|||||||
'theme_advanced_toolbar_location' => 'top',
|
'theme_advanced_toolbar_location' => 'top',
|
||||||
'theme_advanced_toolbar_align' => 'left',
|
'theme_advanced_toolbar_align' => 'left',
|
||||||
'theme_advanced_blockformats' => 'p,h2,h3,blockquote,code',
|
'theme_advanced_blockformats' => 'p,h2,h3,blockquote,code',
|
||||||
|
'theme_advanced_resize_vertical' => 'true',
|
||||||
'dialog_type' => "modal",
|
'dialog_type' => "modal",
|
||||||
|
'theme_advanced_source_editor_height' => '400',
|
||||||
|
|
||||||
// 'theme_advanced_statusbar_location' => 'bottom',
|
// 'theme_advanced_statusbar_location' => 'bottom',
|
||||||
'theme_advanced_resizing' => 'true',
|
'theme_advanced_resizing' => 'false',
|
||||||
'remove_linebreaks' => 'true',
|
'remove_linebreaks' => 'true',
|
||||||
'extended_valid_elements' => '',
|
'extended_valid_elements' => (ADMIN ? 'object[*],embed[*]' : ''),
|
||||||
'apply_source_formatting' => 'false',
|
'apply_source_formatting' => 'false',
|
||||||
'invalid_elements' => 'p,font,align,script,applet,iframe',
|
'invalid_elements' => 'p,font,align,script,applet',
|
||||||
'auto_cleanup_word' => 'true',
|
'auto_cleanup_word' => 'true',
|
||||||
|
// 'cleanup' => 'false',
|
||||||
'convert_fonts_to_spans' => 'true',
|
'convert_fonts_to_spans' => 'true',
|
||||||
'trim_span_elements' => 'true',
|
'trim_span_elements' => 'true',
|
||||||
'inline_styles' => 'true',
|
'inline_styles' => 'true',
|
||||||
'auto_resize' => 'true',
|
'auto_resize' => 'false',
|
||||||
'debug' => 'false',
|
'debug' => 'false',
|
||||||
'force_br_newlines' => 'true',
|
'force_br_newlines' => 'true',
|
||||||
|
'media_strict' => 'false',
|
||||||
// 'forced_root_block' => '',
|
// 'forced_root_block' => '',
|
||||||
'convert_newlines_to_brs' => 'true', // will break [list] if set to true
|
'convert_newlines_to_brs' => 'true', // will break [list] if set to true
|
||||||
// 'force_p_newlines' => 'false',
|
// 'force_p_newlines' => 'false',
|
||||||
@@ -343,7 +346,7 @@ class wysiwyg
|
|||||||
|
|
||||||
$smile_pref = e107::getConfig()->getPref('smiley_activate');
|
$smile_pref = e107::getConfig()->getPref('smiley_activate');
|
||||||
|
|
||||||
$admin_only = array("ibrowser","code");
|
$admin_only = array("ibrowser");
|
||||||
|
|
||||||
$plug_array = explode(",",$plugs);
|
$plug_array = explode(",",$plugs);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user