This commit is contained in:
Daniel Stolt
2014-03-26 00:03:21 +01:00
16 changed files with 403 additions and 161 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using Orchard.ContentManagement;
@@ -22,6 +23,9 @@ namespace Orchard.MediaLibrary.Factories {
if (!mimeType.StartsWith("image/")) {
return null;
}
if (!ImageCodecInfo.GetImageDecoders().Select(d => d.MimeType).Contains(mimeType)) {
return null;
}
if (!String.IsNullOrEmpty(contentType)) {
var contentDefinition = _contentDefinitionManager.GetTypeDefinition(contentType);

View File

@@ -357,11 +357,21 @@ namespace Orchard.Users.Controllers {
ModelState.AddModelError("username", T("You must specify a username."));
validate = false;
}
else {
if (userName.Length >= 255) {
ModelState.AddModelError("username", T("The username you provided is too long."));
validate = false;
}
}
if (String.IsNullOrEmpty(email)) {
ModelState.AddModelError("email", T("You must specify an email address."));
validate = false;
}
else if (email.Length >= 255) {
ModelState.AddModelError("email", T("The email address you provided is too long."));
validate = false;
}
else if (!Regex.IsMatch(email, UserPart.EmailPattern, RegexOptions.IgnoreCase)) {
// http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx
ModelState.AddModelError("email", T("You must specify a valid email address."));

View File

@@ -50,6 +50,7 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\..\lib\newtonsoft.json\Newtonsoft.Json.dll</HintPath>
<HintPath>..\..\..\..\lib\newtonsoft.json\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />

View File

@@ -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().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)})();
(function(){var b=tinymce.DOM;var a=function(d,f,e){var c=function(g){var i=d.controlManager.get(g);var h=f.controlManager.get(g);if(i&&h){h.displayColor(i.value)}};c("forecolor");c("backcolor");f.setContent(d.getContent({format:"raw"}),{format:"raw"});f.selection.moveToBookmark(e);if(d.plugins.spellchecker&&f.plugins.spellchecker){f.plugins.spellchecker.setLanguage(d.plugins.spellchecker.selectedLang)}};tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(i,c){var l=this,m={},k=b.doc.documentElement,d,o,h,g,f,e,j;i.addCommand("mceFullScreen",function(){var q,r;if(i.getParam("fullscreen_is_enabled")){if(i.getParam("fullscreen_new_window")){closeFullscreen()}else{b.win.setTimeout(function(){var t=i;var s=tinyMCE.get(t.getParam("fullscreen_editor_id"));s.plugins.fullscreen.saveState(t);tinyMCE.remove(t)},10)}return}if(i.getParam("fullscreen_new_window")){l.fullscreenSettings={bookmark:i.selection.getBookmark()};q=b.win.open(c+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{q.resizeTo(screen.availWidth,screen.availHeight)}catch(p){}}else{o=b.getStyle(b.doc.body,"overflow",1)||"auto";h=b.getStyle(k,"overflow",1);d=b.getViewPort();g=d.x;f=d.y;if(tinymce.isOpera&&o=="visible"){o="auto"}if(tinymce.isIE&&o=="scroll"){o="auto"}if(tinymce.isIE&&(h=="visible"||h=="scroll")){h="auto"}if(o=="0px"){o=""}b.setStyle(b.doc.body,"overflow","hidden");k.style.overflow="hidden";d=b.getViewPort();b.win.scrollTo(0,0);if(tinymce.isIE){d.h-=1}if(tinymce.isIE6||document.compatMode=="BackCompat"){e="absolute;top:"+d.y}else{e="fixed;top:0"}n=b.add(b.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+e+";left:0;width:"+d.w+"px;height:"+d.h+"px;z-index:200000;"});b.add(n,"div",{id:"mce_fullscreen"});tinymce.each(i.settings,function(s,t){m[t]=s});m.id="mce_fullscreen";m.width=n.clientWidth;m.height=n.clientHeight-15;m.fullscreen_is_enabled=true;m.fullscreen_editor_id=i.id;m.theme_advanced_resizing=false;m.save_onsavecallback=function(){i.setContent(tinyMCE.get(m.id).getContent());i.execCommand("mceSave")};tinymce.each(i.getParam("fullscreen_settings"),function(t,s){m[s]=t});l.fullscreenSettings={bookmark:i.selection.getBookmark(),fullscreen_overflow:o,fullscreen_html_overflow:h,fullscreen_scrollx:g,fullscreen_scrolly:f};if(m.theme_advanced_toolbar_location==="external"){m.theme_advanced_toolbar_location="top"}tinyMCE.oldSettings=tinyMCE.settings;l.fullscreenEditor=new tinymce.Editor("mce_fullscreen",m);l.fullscreenEditor.onInit.add(function(){l.loadState(l.fullscreenEditor)});l.fullscreenEditor.render();l.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");l.fullscreenElement.update();l.resizeFunc=tinymce.dom.Event.add(b.win,"resize",function(){var v=tinymce.DOM.getViewPort(),t=l.fullscreenEditor,s,u;s=t.dom.getSize(t.getContainer().getElementsByTagName("table")[0]);u=t.dom.getSize(t.getContainer().getElementsByTagName("iframe")[0]);t.theme.resizeTo(v.w-s.w+u.w,v.h-s.h+u.h)})}});i.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});i.onNodeChange.add(function(q,p){p.setActive("fullscreen",q.getParam("fullscreen_is_enabled"))});l.loadState=function(p){if(!(p&&l.fullscreenSettings)){throw"No fullscreen editor to load to"}a(i,p,l.fullscreenSettings.bookmark);p.focus()};l.saveState=function(q){if(!(q&&l.fullscreenSettings)){throw"No fullscreen editor to restore from"}var p=l.fullscreenSettings;a(q,i,q.selection.getBookmark());if(!i.getParam("fullscreen_new_window")){tinymce.dom.Event.remove(b.win,"resize",l.resizeFunc);delete l.resizeFunc;b.remove("mce_fullscreen_container");b.doc.documentElement.style.overflow=p.fullscreen_html_overflow;b.setStyle(b.doc.body,"overflow",p.fullscreen_overflow);b.win.scrollTo(p.fullscreen_scrollx,p.fullscreen_scrolly)}tinyMCE.settings=tinyMCE.oldSettings;delete tinyMCE.oldSettings;delete l.fullscreenEditor;delete l.fullscreenElement;delete l.fullscreenSettings;b.win.setTimeout(function(){i.selection.moveToBookmark(j);i.focus()},10)}},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();

View File

@@ -11,29 +11,48 @@
(function() {
var DOM = tinymce.DOM;
// State Transfer function
var transferState = function(oldEditor, newEditor, bookmark) {
var transferColorButtonState = function(swapme) {
var c = oldEditor.controlManager.get(swapme);
var newC = newEditor.controlManager.get(swapme);
if (c && newC) {
newC.displayColor(c.value);
}
};
transferColorButtonState('forecolor');
transferColorButtonState('backcolor');
newEditor.setContent(oldEditor.getContent({format : 'raw'}), {format : 'raw'});
newEditor.selection.moveToBookmark(bookmark);
if (oldEditor.plugins.spellchecker && newEditor.plugins.spellchecker) {
newEditor.plugins.spellchecker.setLanguage(oldEditor.plugins.spellchecker.selectedLang);
}
};
tinymce.create('tinymce.plugins.FullScreenPlugin', {
init : function(ed, url) {
var t = this, s = {}, vp, posCss;
t.editor = ed;
var t = this, s = {}, de = DOM.doc.documentElement, vp, fullscreen_overflow, fullscreen_html_overflow, fullscreen_scrollx, fullscreen_scrolly, posCss, bookmark;
// Register commands
ed.addCommand('mceFullScreen', function() {
var win, de = DOM.doc.documentElement;
var win, oed;
if (ed.getParam('fullscreen_is_enabled')) {
if (ed.getParam('fullscreen_new_window'))
closeFullscreen(); // Call to close in new window
closeFullscreen(); // Call to close in fullscreen.htm
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
var fullscreenEditor = ed;
// find the editor that opened this one, execute restore function there
var originalEditor = tinyMCE.get(fullscreenEditor.getParam('fullscreen_editor_id'));
originalEditor.plugins.fullscreen.saveState(fullscreenEditor);
tinyMCE.remove(fullscreenEditor);
}, 10);
}
@@ -41,6 +60,9 @@
}
if (ed.getParam('fullscreen_new_window')) {
t.fullscreenSettings = {
bookmark: ed.selection.getBookmark()
};
win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
try {
win.resizeTo(screen.availWidth, screen.availHeight);
@@ -48,27 +70,26 @@
// 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);
fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
vp = DOM.getViewPort();
s.fullscreen_scrollx = vp.x;
s.fullscreen_scrolly = vp.y;
fullscreen_scrollx = vp.x;
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';
if (tinymce.isOpera && fullscreen_overflow == 'visible')
fullscreen_overflow = 'auto';
// Fixes an IE bug where horizontal scrollbars would appear
if (tinymce.isIE && s.fullscreen_overflow == 'scroll')
s.fullscreen_overflow = 'auto';
if (tinymce.isIE && fullscreen_overflow == 'scroll')
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 (tinymce.isIE && (fullscreen_html_overflow == 'visible' || fullscreen_html_overflow == 'scroll'))
fullscreen_html_overflow = 'auto';
if (s.fullscreen_overflow == '0px')
s.fullscreen_overflow = '';
if (fullscreen_overflow == '0px')
fullscreen_overflow = '';
DOM.setStyle(DOM.doc.body, 'overflow', 'hidden');
de.style.overflow = 'hidden'; //Fix for IE6/7
@@ -108,13 +129,21 @@
s[k] = v;
});
t.fullscreenSettings = {
bookmark: ed.selection.getBookmark(),
fullscreen_overflow: fullscreen_overflow,
fullscreen_html_overflow: fullscreen_html_overflow,
fullscreen_scrollx: fullscreen_scrollx,
fullscreen_scrolly: fullscreen_scrolly
};
if (s.theme_advanced_toolbar_location === 'external')
s.theme_advanced_toolbar_location = 'top';
tinyMCE.oldSettings = tinyMCE.settings; // Store old settings, the Editor constructor overwrites them
t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
t.fullscreenEditor.onInit.add(function() {
t.fullscreenEditor.setContent(ed.getContent());
t.fullscreenEditor.focus();
t.loadState(t.fullscreenEditor);
});
t.fullscreenEditor.render();
@@ -141,6 +170,52 @@
ed.onNodeChange.add(function(ed, cm) {
cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled'));
});
// fullscreenEditor is a param here because in window mode we don't create it
t.loadState = function(fullscreenEditor) {
if (!(fullscreenEditor && t.fullscreenSettings)) {
throw "No fullscreen editor to load to";
}
transferState(ed, fullscreenEditor, t.fullscreenSettings.bookmark);
fullscreenEditor.focus();
};
// fullscreenEditor is a param here because in window mode we don't create it
t.saveState = function(fullscreenEditor) {
if (!(fullscreenEditor && t.fullscreenSettings)) {
throw "No fullscreen editor to restore from";
}
var settings = t.fullscreenSettings;
transferState(fullscreenEditor, ed, fullscreenEditor.selection.getBookmark());
// cleanup only required if window mode isn't used
if (!ed.getParam('fullscreen_new_window')) {
tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
delete t.resizeFunc;
DOM.remove('mce_fullscreen_container');
DOM.doc.documentElement.style.overflow = settings.fullscreen_html_overflow;
DOM.setStyle(DOM.doc.body, 'overflow', settings.fullscreen_overflow);
DOM.win.scrollTo(settings.fullscreen_scrollx, settings.fullscreen_scrolly);
}
tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
// clear variables
delete tinyMCE.oldSettings;
delete t.fullscreenEditor;
delete t.fullscreenElement;
delete t.fullscreenSettings;
// allow the fullscreen editor to be removed before restoring focus and selection
DOM.win.setTimeout(function() {
ed.selection.moveToBookmark(bookmark);
ed.focus();
}, 10);
};
},
getInfo : function() {

View File

@@ -46,7 +46,7 @@
settings['strict_loading_mode'] = true;
settings.save_onsavecallback = function() {
window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
moveContent();
window.opener.tinyMCE.get(oeID).execCommand('mceSave');
window.close();
};
@@ -56,11 +56,15 @@
}
function moveContent() {
window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent());
// find the original editor, execute restore state in it's plugin instance
window.opener.tinyMCE.get(oeID).plugins.fullscreen.saveState(tinyMCE.activeEditor);
// prevent moveContent from being called twice - e.g. if the unloadHandler runs after moveContent()
tinymce.dom.Event.remove(window, "beforeunload", unloadHandler);
}
function closeFullscreen() {
moveContent();
// moveContent() will be called by the unload handler
window.close();
}
@@ -78,17 +82,20 @@
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();
settings.oninit = function() {
var ed = tinyMCE.activeEditor;
window.opener.tinyMCE.get(oeID).plugins.fullscreen.loadState(ed);
tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
});
tinymce.dom.Event.add(window, 'resize', function() {
var vp = dom.getViewPort();
tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
});
}
tinyMCE.init(settings);
}

File diff suppressed because one or more lines are too long

View File

@@ -55,12 +55,12 @@
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();
id = DOM.uniqueId("mce_inlinepopups_"); // Use a prefix so this can't conflict with other ids
vp = DOM.getViewPort();
f.width = parseInt(f.width || 320);
f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0);
@@ -111,17 +111,17 @@
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'},
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', {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 + '_middle', 'class' : 'mceMiddle'},
['div', {id : id + '_left', 'class' : 'mceLeft', tabindex : '0'}],
['span', {id : id + '_content'}],
['div', {id : id + '_right', 'class' : 'mceRight', tabindex : '0'}]
@@ -188,7 +188,7 @@
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) {
@@ -268,7 +268,7 @@
}
}
});
// Make sure the tab order loops within the dialog.
Event.add([id + '_left', id + '_right'], 'focus', function(evt) {
var iframe = DOM.get(id + '_ifr');
@@ -284,7 +284,7 @@
DOM.get(id + '_ok').focus();
}
});
// Add window
w = t.windows[id] = {
id : id,
@@ -341,7 +341,7 @@
DOM.removeClass(t.lastId, 'mceFocus');
DOM.addClass(id, 'mceFocus');
t.lastId = id;
if (w.focussedElement) {
w.focussedElement.focus();
} else if (DOM.get(id + '_ok')) {
@@ -486,7 +486,7 @@
dw = v;
}
if (dh < (v = w.features.min_height - sz.h)) {
if (dy !== 0)
dy += dh - v;
@@ -505,7 +505,7 @@
if (dx + dy !== 0) {
if (sx + dx < 0)
dx = 0;
if (sy + dy < 0)
dy = 0;
@@ -567,7 +567,7 @@
t.focus(fw.id);
}
},
// Find front most window
_frontWindow : function() {
var fw, ix = 0;

View File

@@ -14,6 +14,7 @@ var SearchReplaceDialog = {
mcTabs.onChange.add(function(tab_id, panel_id) {
t.switchMode(tab_id.substring(0, tab_id.indexOf('_')));
});
},
switchMode : function(m) {
@@ -39,6 +40,11 @@ var SearchReplaceDialog = {
searchNext : function(a) {
var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0;
if (tinymce.isIE11 && !window.find) {
ed.windowManager.alert("This feature is not available in IE 11+. Upgrade TinyMCE to 4.x to get this functionallity back.");
return;
}
// Get input
f = document.forms[0];
s = f[m + '_panel_searchstring'].value;

View File

@@ -93,7 +93,7 @@
<input type="submit" id="insert" name="insert" value="{#searchreplace_dlg.findnext}" />
<input type="button" class="button" id="replaceBtn" name="replaceBtn" value="{#searchreplace_dlg.replace}" onclick="SearchReplaceDialog.searchNext('current');" />
<input type="button" class="button" id="replaceAllBtn" name="replaceAllBtn" value="{#searchreplace_dlg.replaceall}" onclick="SearchReplaceDialog.searchNext('all');" />
<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
<input type="button" id="cancel" name="close" value="{#close}" onclick="tinyMCEPopup.close();" />
</div>
</form>
</body>

File diff suppressed because one or more lines are too long

View File

@@ -956,7 +956,7 @@
a = s.theme_advanced_toolbar_align.toLowerCase();
a = 'mce' + t._ufirst(a);
n = DOM.add(DOM.add(c, 'tr', {role: 'toolbar'}), 'td', {'class' : 'mceToolbar ' + a, "role":"toolbar"});
n = DOM.add(DOM.add(c, 'tr', {role: 'presentation'}), 'td', {'class' : 'mceToolbar ' + a, "role":"toolbar"});
// Create toolbar and add the controls
for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {

File diff suppressed because one or more lines are too long

View File

@@ -2,4 +2,4 @@
// Uncomment and change this document.domain value if you are loading the script cross subdomains
// document.domain = 'moxiecode.com';
var tinymce=null,tinyMCEPopup,tinyMCE;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=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document,{ownEvents:true,proxy:tinyMCEPopup._eventProxy});b.dom.bind(window,"ready",b._onDOMLoaded,b);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},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)},10)},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&&b.editor.settings.language_load!==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);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=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.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}}if(!b.editor.getParam("browser_preferred_colors",false)||!b.isWindow){b.dom.addClass(document.body,"forceColors")}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();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){b.dom.bind(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){var b=a.target||a.srcElement;if(b.onchange){b.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_eventProxy:function(a){return function(b){tinyMCEPopup.dom.events.callNativeHandler(a,b)}}};tinyMCEPopup.init();
var tinymce=null,tinyMCEPopup,tinyMCE;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=b.editor.windowManager.createInstance("tinymce.dom.DOMUtils",document,{ownEvents:true,proxy:tinyMCEPopup._eventProxy});b.dom.bind(window,"ready",b._onDOMLoaded,b);if(b.features.popup_css!==false){b.dom.loadCSS(b.features.popup_css||b.editor.settings.popup_css)}b.listeners=[];b.onInit={add:function(e,d){b.listeners.push({func:e,scope:d})}};b.isWindow=!b.getWindowArg("mce_inline");b.id=b.getWindowArg("mce_window_id");b.editor.windowManager.onOpen.dispatch(b.editor.windowManager,window)},getWin:function(){return(!window.frameElement&&window.dialogArguments)||opener||parent||top},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)},10)},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&&b.editor.settings.language_load!==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);tinymce=tinyMCE=a.editor=a.params=a.dom=a.dom.doc=null}if(tinymce.isOpera){a.getWin().setTimeout(b,0)}else{b()}},_restoreSelection:function(a){var a=(a&&a.target)||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.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}}if(!b.editor.getParam("browser_preferred_colors",false)||!b.isWindow){b.dom.addClass(document.body,"forceColors")}document.body.style.display="";if(tinymce.isIE&&!tinymce.isIE11){document.attachEvent("onmouseup",tinyMCEPopup._restoreSelection);b.dom.add(b.dom.select("head")[0],"base",{target:"_self"})}else{if(tinymce.isIE11){document.addEventListener("mouseup",tinyMCEPopup._restoreSelection,false)}}b.restoreSelection();b.resizeToInnerSize();if(!b.isWindow){b.editor.windowManager.setTitle(window,d)}else{window.focus()}if(!tinymce.isIE&&!b.isWindow){b.dom.bind(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){var b=a.target||a.srcElement;if(b.onchange){b.onchange()}return tinymce.dom.Event.cancel(a)}},_closeWinKeyHandler:function(a){a=a||window.event;if(a.keyCode==27){tinyMCEPopup.close()}},_eventProxy:function(a){return function(b){tinyMCEPopup.dom.events.callNativeHandler(a,b)}}};tinyMCEPopup.init();

View File

@@ -6,18 +6,20 @@
var tinymce = {
majorVersion : '3',
minorVersion : '5.7',
minorVersion : '5.10',
releaseDate : '2012-09-20',
releaseDate : '2013-10-24',
_init : function() {
var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
t.isIE11 = ua.indexOf('Trident/') != -1 && (ua.indexOf('rv:') != -1 || na.appName.indexOf('Netscape') != -1);
t.isOpera = win.opera && opera.buildNumber;
t.isWebKit = /WebKit/.test(ua);
t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName);
t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName) || t.isIE11;
t.isIE6 = t.isIE && /MSIE [56]/.test(ua);
@@ -27,7 +29,7 @@
t.isIE9 = t.isIE && /MSIE [9]/.test(ua);
t.isGecko = !t.isWebKit && /Gecko/.test(ua);
t.isGecko = !t.isWebKit && !t.isIE11 && /Gecko/.test(ua);
t.isMac = ua.indexOf('Mac') != -1;
@@ -1098,7 +1100,7 @@ tinymce.create('static tinymce.util.XHR', {
tinymce.util.Quirks = function(editor) {
var VK = tinymce.VK, BACKSPACE = VK.BACKSPACE, DELETE = VK.DELETE, dom = editor.dom, selection = editor.selection,
settings = editor.settings, parser = editor.parser, serializer = editor.serializer;
settings = editor.settings, parser = editor.parser, serializer = editor.serializer, each = tinymce.each;
function setEditorCommandState(cmd, state) {
try {
@@ -1120,48 +1122,69 @@ tinymce.util.Quirks = function(editor) {
function cleanupStylesWhenDeleting() {
function removeMergedFormatSpans(isDelete) {
var rng, blockElm, node, clonedSpan;
var rng, blockElm, wrapperElm, bookmark, container, offset, elm;
function isAtStartOrEndOfElm() {
if (container.nodeType == 3) {
if (isDelete && offset == container.length) {
return true;
}
if (!isDelete && offset === 0) {
return true;
}
}
}
rng = selection.getRng();
var tmpRng = [rng.startContainer, rng.startOffset, rng.endContainer, rng.endOffset];
// Find root block
blockElm = dom.getParent(rng.startContainer, dom.isBlock);
if (!rng.collapsed) {
isDelete = true;
}
// On delete clone the root span of the next block element
if (isDelete)
blockElm = dom.getNext(blockElm, dom.isBlock);
container = rng[(isDelete ? 'start' : 'end') + 'Container'];
offset = rng[(isDelete ? 'start' : 'end') + 'Offset'];
// Locate root span element and clone it since it would otherwise get merged by the "apple-style-span" on delete/backspace
if (blockElm) {
node = blockElm.firstChild;
if (container.nodeType == 3) {
blockElm = dom.getParent(rng.startContainer, dom.isBlock);
// Ignore empty text nodes
while (node && node.nodeType == 3 && node.nodeValue.length === 0)
node = node.nextSibling;
// On delete clone the root span of the next block element
if (isDelete) {
blockElm = dom.getNext(blockElm, dom.isBlock);
}
if (node && node.nodeName === 'SPAN') {
clonedSpan = node.cloneNode(false);
if (blockElm && (isAtStartOrEndOfElm() || !rng.collapsed)) {
// Wrap children of block in a EM and let WebKit stick is
// runtime styles junk into that EM
wrapperElm = dom.create('em', {'id': '__mceDel'});
each(tinymce.grep(blockElm.childNodes), function(node) {
wrapperElm.appendChild(node);
});
blockElm.appendChild(wrapperElm);
}
}
// Do the backspace/delete action
rng = dom.createRng();
rng.setStart(tmpRng[0], tmpRng[1]);
rng.setEnd(tmpRng[2], tmpRng[3]);
selection.setRng(rng);
editor.getDoc().execCommand(isDelete ? 'ForwardDelete' : 'Delete', false, null);
// Find all odd apple-style-spans
blockElm = dom.getParent(rng.startContainer, dom.isBlock);
tinymce.each(dom.select('span.Apple-style-span,font.Apple-style-span', blockElm), function(span) {
var bm = selection.getBookmark();
// Remove temp wrapper element
if (wrapperElm) {
bookmark = selection.getBookmark();
if (clonedSpan) {
dom.replace(clonedSpan.cloneNode(false), span, true);
} else {
dom.remove(span, true);
while (elm = dom.get('__mceDel')) {
dom.remove(elm, true);
}
// Restore the selection
selection.moveToBookmark(bm);
});
};
selection.moveToBookmark(bookmark);
}
}
editor.onKeyDown.add(function(editor, e) {
var isDelete;
@@ -1315,7 +1338,7 @@ tinymce.util.Quirks = function(editor) {
if (target !== editor.getBody()) {
dom.setAttrib(target, "style", null);
tinymce.each(template, function(attr) {
each(template, function(attr) {
target.setAttributeNode(attr.cloneNode(true));
});
}
@@ -1482,6 +1505,12 @@ tinymce.util.Quirks = function(editor) {
// Override delete if the start container is a text node and is at the beginning of text or
// just before/after the last character to be deleted in collapsed mode
if (container.nodeType == 3 && container.nodeValue.length > 0 && ((offset === 0 && !collapsed) || (collapsed && offset === (isDelete ? 0 : 1)))) {
// Edge case when deleting <p><b><img> |x</b></p>
sibling = container.previousSibling;
if (sibling && sibling.nodeName == "IMG") {
return;
}
nonEmptyElements = editor.schema.getNonEmptyElements();
// Prevent default logic since it's broken
@@ -1565,7 +1594,7 @@ tinymce.util.Quirks = function(editor) {
function addBrAfterLastLinks() {
function fixLinks(editor, o) {
tinymce.each(dom.select('a'), function(node) {
each(dom.select('a'), function(node) {
var parentNode = node.parentNode, root = dom.getRoot();
if (parentNode.lastChild === node) {
@@ -1633,7 +1662,7 @@ tinymce.util.Quirks = function(editor) {
// IE10+
if (getDocumentMode() >= 10) {
emptyBlocksCSS = '';
tinymce.each('p div h1 h2 h3 h4 h5 h6'.split(' '), function(name, i) {
each('p div h1 h2 h3 h4 h5 h6'.split(' '), function(name, i) {
emptyBlocksCSS += (i > 0 ? ',' : '') + name + ':empty';
});
@@ -1750,7 +1779,7 @@ tinymce.util.Quirks = function(editor) {
width = height = 0;
}
tinymce.each(resizeHandles, function(handle, name) {
each(resizeHandles, function(handle, name) {
var handleElm;
// Get existing or render resize handle
@@ -1847,7 +1876,7 @@ tinymce.util.Quirks = function(editor) {
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) {
each(dom.select('img[data-mce-selected]'), function(img) {
img.removeAttribute('data-mce-selected');
});
@@ -1914,6 +1943,17 @@ tinymce.util.Quirks = function(editor) {
}
}
function bodyHeight() {
editor.contentStyles.push('body {min-height: 100px}');
editor.onClick.add(function(ed, e) {
if (e.target.nodeName == 'HTML') {
editor.execCommand('SelectAll');
editor.selection.collapse(true);
editor.nodeChanged();
}
});
}
// All browsers
disableBackspaceIntoATable();
removeBlockQuoteOnBackSpace();
@@ -1937,7 +1977,7 @@ tinymce.util.Quirks = function(editor) {
}
// IE
if (tinymce.isIE) {
if (tinymce.isIE && !tinymce.isIE11) {
removeHrOnBackspace();
ensureBodyHasRoleApplication();
addNewLinesBeforeBrInPre();
@@ -1947,8 +1987,13 @@ tinymce.util.Quirks = function(editor) {
keepNoScriptContents();
}
// IE 11+
if (tinymce.isIE11) {
bodyHeight();
}
// Gecko
if (tinymce.isGecko) {
if (tinymce.isGecko && !tinymce.isIE11) {
removeHrOnBackspace();
focusBody();
removeStylesWhenDeletingAccrossBlockElements();
@@ -2185,6 +2230,12 @@ tinymce.html.Styles = function(settings, schema) {
function compress(prefix, suffix) {
var top, right, bottom, left;
// IE 11 will produce a border-image: none when getting the style attribute from <p style="border: 1px solid red"></p>
// So lets asume it shouldn't be there
if (styles['border-image'] === 'none') {
delete styles['border-image'];
}
// Get values and check it it needs compressing
top = styles[prefix + '-top' + suffix];
if (!top)
@@ -2707,7 +2758,7 @@ tinymce.html.Styles = function(settings, schema) {
selfClosingElementsMap = createLookupTable('self_closing_elements', 'colgroup dd dt li option p td tfoot th thead tr');
shortEndedElementsMap = createLookupTable('short_ended_elements', 'area base basefont br col frame hr img input isindex link meta param embed source wbr');
boolAttrMap = createLookupTable('boolean_attributes', 'checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls');
nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object', shortEndedElementsMap);
nonEmptyElementsMap = createLookupTable('non_empty_elements', 'td th iframe video audio object script', shortEndedElementsMap);
textBlockElementsMap = createLookupTable('text_block_elements', 'h1 h2 h3 h4 h5 h6 p div address pre form ' +
'blockquote center dir fieldset header footer article section hgroup aside nav figure');
blockElementsMap = createLookupTable('block_elements', 'hr table tbody thead tfoot ' +
@@ -3146,7 +3197,7 @@ tinymce.html.Styles = function(settings, schema) {
value = name in fillAttrsMap ? name : decode(value || val2 || val3 || ''); // Handle boolean attribute than value attribute
// Validate name and value
if (validate && !isInternalElement && name.indexOf('data-mce-') !== 0) {
if (validate && !isInternalElement && name.indexOf('data-') !== 0) {
attrRule = validAttributesMap[name];
// Find rule by pattern matching
@@ -5209,6 +5260,11 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
blockElementsMap = s.schema ? s.schema.getBlockElements() : {};
t.isBlock = function(node) {
// Fix for #5446
if (!node) {
return false;
}
// This function is called in module pattern style since it might be executed with the wrong this scope
var type = node.nodeType;
@@ -5223,7 +5279,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
fixDoc: function(doc) {
var settings = this.settings, name;
if (isIE && settings.schema) {
if (isIE && !tinymce.isIE11 && settings.schema) {
// Add missing HTML 4/5 elements to IE
('abbr article aside audio canvas ' +
'details figcaption figure footer ' +
@@ -5244,7 +5300,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
var self = this, clone, doc;
// TODO: Add feature detection here in the future
if (!isIE || node.nodeType !== 1 || deep) {
if (!isIE || tinymce.isIE11 || node.nodeType !== 1 || deep) {
return node.cloneNode(deep);
}
@@ -5517,7 +5573,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
switch (na) {
case 'opacity':
// IE specific opacity
if (isIE) {
if (isIE && ! tinymce.isIE11) {
s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")";
if (!n.currentStyle || !n.currentStyle.hasLayout)
@@ -5529,7 +5585,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
break;
case 'float':
isIE ? s.styleFloat = v : s.cssFloat = v;
(isIE && ! tinymce.isIE11) ? s.styleFloat = v : s.cssFloat = v;
break;
default:
@@ -5895,7 +5951,7 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
// IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug
// This fix seems to resolve that issue by realcing the document ones a stylesheet finishes loading
// It's ugly but it seems to work fine.
if (isIE && d.documentMode && d.recalc) {
if (isIE && !tinymce.isIE11 && d.documentMode && d.recalc) {
link.onload = function() {
if (d.recalc)
d.recalc();
@@ -6214,7 +6270,12 @@ tinymce.dom.TreeWalker = function(start_node, root_node) {
// Import
case 3:
addClasses(r.styleSheet);
try {
addClasses(r.styleSheet);
} catch (ex) {
// Ignore
}
break;
}
});
@@ -9316,7 +9377,7 @@ window.tinymce.dom.Sizzle = Sizzle;
if (!t.win.getSelection)
t.tridentSel = new tinymce.dom.TridentSelection(t);
if (tinymce.isIE && dom.boxModel)
if (tinymce.isIE && ! tinymce.isIE11 && dom.boxModel)
this._fixIESelection();
// Prevent leaks
@@ -9608,8 +9669,20 @@ window.tinymce.dom.Sizzle = Sizzle;
}
// Handle simple range
if (type)
return {rng : t.getRng()};
if (type) {
rng = t.getRng();
if (rng.setStart) {
rng = {
startContainer: rng.startContainer,
startOffset: rng.startOffset,
endContainer: rng.endContainer,
endOffset: rng.endOffset
};
}
return {rng : rng};
}
rng = t.getRng();
id = dom.uniqueId();
@@ -9675,7 +9748,7 @@ window.tinymce.dom.Sizzle = Sizzle;
},
moveToBookmark : function(bookmark) {
var t = this, dom = t.dom, marker1, marker2, rng, root, startContainer, endContainer, startOffset, endOffset;
var t = this, dom = t.dom, marker1, marker2, rng, rng2, root, startContainer, endContainer, startOffset, endOffset;
function setEndPoint(start) {
var point = bookmark[start ? 'start' : 'end'], i, node, offset, children;
@@ -9805,8 +9878,24 @@ window.tinymce.dom.Sizzle = Sizzle;
}
} else if (bookmark.name) {
t.select(dom.select(bookmark.name)[bookmark.index]);
} else if (bookmark.rng)
t.setRng(bookmark.rng);
} else if (bookmark.rng) {
rng = bookmark.rng;
if (rng.startContainer) {
rng2 = t.dom.createRng();
try {
rng2.setStart(rng.startContainer, rng.startOffset);
rng2.setEnd(rng.endContainer, rng.endOffset);
} catch (e) {
// Might fail with index error
}
rng = rng2;
}
t.setRng(rng);
}
}
},
@@ -9905,7 +9994,7 @@ window.tinymce.dom.Sizzle = Sizzle;
}
// We have W3C ranges and it's IE then fake control selection since IE9 doesn't handle that correctly yet
if (tinymce.isIE && rng && rng.setStart && doc.selection.createRange().item) {
if (tinymce.isIE && ! tinymce.isIE11 && rng && rng.setStart && doc.selection.createRange().item) {
elm = doc.selection.createRange().item(0);
rng = doc.createRange();
rng.setStartBefore(elm);
@@ -10318,6 +10407,16 @@ window.tinymce.dom.Sizzle = Sizzle;
return self;
},
scrollIntoView: function(elm) {
var y, viewPort, self = this, dom = self.dom;
viewPort = dom.getViewPort(self.editor.getWin());
y = dom.getPos(elm).y;
if (y < viewPort.y || y + 25 > viewPort.y + viewPort.h) {
self.editor.getWin().scrollTo(0, y < viewPort.y ? y : y - viewPort.h + 25);
}
},
destroy : function(manual) {
var self = this;
@@ -10760,7 +10859,7 @@ window.tinymce.dom.Sizzle = Sizzle;
// Add onload listener for non IE browsers since IE9
// fires onload event before the script is parsed and executed
if (!tinymce.isIE)
if (!tinymce.isIE || tinymce.isIE11)
elm.onload = done;
// Add onerror event will get fired on some browsers but not all of them
@@ -11173,18 +11272,22 @@ window.tinymce.dom.Sizzle = Sizzle;
switch (evt.keyCode) {
case DOM_VK_LEFT:
if (enableLeftRight) t.moveFocus(-1);
Event.cancel(evt);
break;
case DOM_VK_RIGHT:
if (enableLeftRight) t.moveFocus(1);
Event.cancel(evt);
break;
case DOM_VK_UP:
if (enableUpDown) t.moveFocus(-1);
Event.cancel(evt);
break;
case DOM_VK_DOWN:
if (enableUpDown) t.moveFocus(1);
Event.cancel(evt);
break;
case DOM_VK_ESCAPE:
@@ -11881,7 +11984,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
else
h += '<span class="mceIcon ' + s['class'] + '"></span>' + (l ? '<span class="' + cp + 'Label">' + l + '</span>' : '');
h += '<span class="mceVoiceLabel mceIconOnly" style="display: none;" id="' + this.id + '_voice">' + s.title + '</span>';
h += '<span class="mceVoiceLabel mceIconOnly" style="display: none;" id="' + this.id + '_voice">' + s.title + '</span>';
h += '</a>';
return h;
},
@@ -11906,9 +12009,11 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
return s.onclick.call(s.scope, e);
}
});
tinymce.dom.Event.add(t.id, 'keyup', function(e) {
if (!t.isDisabled() && e.keyCode==tinymce.VK.SPACEBAR)
tinymce.dom.Event.add(t.id, 'keydown', function(e) {
if (!t.isDisabled() && e.keyCode==tinymce.VK.SPACEBAR) {
tinymce.dom.Event.cancel(e);
return s.onclick.call(s.scope, e);
}
});
}
});
@@ -12321,7 +12426,7 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
// Accessibility keyhandler
Event.add(t.id, 'keydown', function(e) {
var bf;
var bf, DOM_VK_LEFT = 37, DOM_VK_RIGHT = 39, DOM_VK_UP = 38, DOM_VK_DOWN = 40, DOM_VK_RETURN = 13, DOM_VK_SPACE = 32;
Event.remove(t.id, 'change', ch);
changeListenerAdded = false;
@@ -12333,14 +12438,12 @@ tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
Event.remove(t.id, 'blur', bf);
});
//prevent default left and right keys on chrome - so that the keyboard navigation is used.
if (tinymce.isWebKit && (e.keyCode==37 ||e.keyCode==39)) {
return Event.prevent(e);
}
if (e.keyCode == 13 || e.keyCode == 32) {
if (e.keyCode == DOM_VK_RETURN || e.keyCode == DOM_VK_SPACE) {
onChange(e);
return Event.cancel(e);
} else if (e.keyCode == DOM_VK_DOWN || e.keyCode == DOM_VK_UP) {
// allow native implementation (navigate select element options)
e.stopImmediatePropagation();
}
});
@@ -13229,7 +13332,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
ed.render();
// Fix IE memory leaks
if (tinymce.isIE) {
if (tinymce.isIE && ! tinymce.isIE11) {
w.attachEvent('onunload', clr);
}
@@ -13627,10 +13730,16 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
// Store away the selection when it's changed to it can be restored later with a editor.focus() call
if (isIE) {
t.onInit.add(function(ed) {
ed.dom.bind(ed.getBody(), 'beforedeactivate keydown', function() {
ed.lastIERng = ed.selection.getRng();
ed.dom.bind(ed.getBody(), 'beforedeactivate keydown keyup', function() {
ed.bookmark = ed.selection.getBookmark(1);
});
});
t.onNodeChange.add(function(ed) {
if (document.activeElement.id == ed.id + "_ifr") {
ed.bookmark = ed.selection.getBookmark(1);
}
});
}
}
@@ -13667,10 +13776,12 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';
// IE8 doesn't support carets behind images setting ie7_compat would force IE8+ to run in IE7 compat mode.
if (s.ie7_compat)
t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" />';
else
t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=edge" />';
if (tinymce.isIE8) {
if (s.ie7_compat)
t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" />';
else
t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=edge" />';
}
t.iframeHTML += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
@@ -13948,8 +14059,9 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
var oed, self = this, selection = self.selection, contentEditable = self.settings.content_editable, ieRng, controlElm, doc = self.getDoc(), body;
if (!skip_focus) {
if (self.lastIERng) {
selection.setRng(self.lastIERng);
if (self.bookmark) {
selection.moveToBookmark(self.bookmark);
self.bookmark = null;
}
// Get selected control element
@@ -13970,7 +14082,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
body = self.getBody();
// Check for setActive since it doesn't scroll to the element
if (body.setActive) {
if (body.setActive && ! tinymce.isIE11) {
body.setActive();
} else {
body.focus();
@@ -14300,9 +14412,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
self.save();
// defer the call to hide to prevent an IE9 crash #4921
setTimeout(function() {
DOM.hide(self.getContainer());
}, 1);
DOM.hide(self.getContainer());
DOM.setStyle(self.id, 'display', self.orgDisplay);
},
@@ -14581,11 +14691,19 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
},
remove : function() {
var self = this, elm = self.getContainer();
var self = this, elm = self.getContainer(), doc = self.getDoc();
if (!self.removed) {
self.removed = 1; // Cancels post remove event execution
self.hide();
// Fixed bug where IE has a blinking cursor left from the editor
if (isIE && doc)
doc.execCommand('SelectAll');
// We must save before we hide so Safari doesn't crash
self.save();
DOM.setStyle(self.id, 'display', self.orgDisplay);
// Don't clear the window or document if content editable
// is enabled since other instances might still be present
@@ -15578,7 +15696,7 @@ tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
// Add undo level on save contents, drag end and blur/focusout
editor.onSaveContent.add(addNonTypingUndoLevel);
editor.dom.bind(editor.dom.getRoot(), 'dragend', addNonTypingUndoLevel);
editor.dom.bind(editor.getDoc(), tinymce.isGecko ? 'blur' : 'focusout', function(e) {
editor.dom.bind(editor.getBody(), 'focusout', function(e) {
if (!editor.removed && self.typing) {
addNonTypingUndoLevel();
}
@@ -16374,7 +16492,11 @@ tinymce.ForceBlocks = function(editor) {
getContentEditable = dom.getContentEditable;
function isTextBlock(name) {
return !!ed.schema.getTextBlocks()[name.toLowerCase()];
if (name.nodeType) {
name = name.nodeName;
}
return !!ed.schema.getTextBlockElements()[name.toLowerCase()];
}
function getParents(node, selector) {
@@ -16735,7 +16857,7 @@ tinymce.ForceBlocks = function(editor) {
// Is it valid to wrap this item
if (contentEditable && !hasContentEditableState && isValid(wrapName, nodeName) && isValid(parentName, wrapName) &&
!(!node_specific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node)) {
!(!node_specific && node.nodeType === 3 && node.nodeValue.length === 1 && node.nodeValue.charCodeAt(0) === 65279) && !isCaretNode(node) && (!format.inline || !isBlock(node))) {
// Start wrapping
if (!currentWrapElm) {
// Wrap the node
@@ -16941,6 +17063,11 @@ tinymce.ForceBlocks = function(editor) {
function process(node) {
var children, i, l, localContentEditable, lastContentEditable, hasContentEditableState;
// Skip on text nodes as they have neither format to remove nor children
if (node.nodeType === 3) {
return;
}
// Node has a contentEditable value
if (node.nodeType === 1 && getContentEditable(node)) {
lastContentEditable = contentEditable;
@@ -18010,10 +18137,6 @@ tinymce.ForceBlocks = function(editor) {
return next;
};
function isTextBlock(name) {
return /^(h[1-6]|p|div|pre|address|dl|dt|dd)$/.test(name);
};
function getContainer(rng, start) {
var container, offset, lastIdx, walker;
@@ -18249,11 +18372,23 @@ tinymce.ForceBlocks = function(editor) {
node.appendChild(dom.doc.createTextNode(INVISIBLE_CHAR));
node = node.firstChild;
// Insert caret container after the formated node
dom.insertAfter(caretContainer, formatNode);
var block = dom.getParent(formatNode, isTextBlock);
if (block && dom.isEmpty(block)) {
// Replace formatNode with caretContainer when removing format from empty block like <p><b>|</b></p>
formatNode.parentNode.replaceChild(caretContainer, formatNode);
} else {
// Insert caret container after the formated node
dom.insertAfter(caretContainer, formatNode);
}
// Move selection to text node
selection.setCursorLocation(node, 1);
// If the formatNode is empty, we can remove it safely.
if (dom.isEmpty(formatNode)) {
dom.remove(formatNode);
}
}
};
@@ -18443,7 +18578,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
function renderBlockOnIE(block) {
var oldRng;
if (tinymce.isIE && dom.isBlock(block)) {
if (tinymce.isIE && !tinymce.isIE11 && dom.isBlock(block)) {
oldRng = selection.getRng();
block.appendChild(dom.create('span', null, '\u00a0'));
selection.select(block);
@@ -18578,7 +18713,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
}
// BR is needed in empty blocks on non IE browsers
if (!tinymce.isIE) {
if (!tinymce.isIE || tinymce.isIE11) {
caretNode.innerHTML = '<br data-mce-bogus="1">';
}
@@ -18740,26 +18875,24 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
undoManager.add();
};
// Walks the parent block to the right and look for BR elements
function hasRightSideBr() {
// Walks the parent block to the right and look for any contents
function hasRightSideContent() {
var walker = new TreeWalker(container, parentBlock), node;
while (node = walker.current()) {
if (node.nodeName == 'BR') {
while (node = walker.next()) {
if (nonEmptyElementsMap[node.nodeName.toLowerCase()] || node.length > 0) {
return true;
}
node = walker.next();
}
}
// Inserts a BR element if the forced_root_block option is set to false or empty string
function insertBr() {
var brElm, extraBr;
var brElm, extraBr, marker;
if (container && container.nodeType == 3 && offset >= container.nodeValue.length) {
// Insert extra BR element at the end block elements
if (!tinymce.isIE && !hasRightSideBr()) {
if ((!tinymce.isIE || tinymce.isIE11) && !hasRightSideContent()) {
brElm = dom.create('br');
rng.insertNode(brElm);
rng.setStartAfter(brElm);
@@ -18772,10 +18905,16 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
rng.insertNode(brElm);
// Rendering modes below IE8 doesn't display BR elements in PRE unless we have a \n before it
if (tinymce.isIE && parentBlockName == 'PRE' && (!documentMode || documentMode < 8)) {
if ((tinymce.isIE && !tinymce.isIE11) && parentBlockName == 'PRE' && (!documentMode || documentMode < 8)) {
brElm.parentNode.insertBefore(dom.doc.createTextNode('\r'), brElm);
}
// Insert temp marker and scroll to that
marker = dom.create('span', {}, '&nbsp;');
brElm.parentNode.insertBefore(marker, brElm);
selection.scrollIntoView(marker);
dom.remove(marker);
if (!extraBr) {
rng.setStartAfter(brElm);
rng.setEndAfter(brElm);
@@ -18820,7 +18959,7 @@ tinymce.onAddEditor.add(function(tinymce, ed) {
var lastChild;
// IE will render the blocks correctly other browsers needs a BR
if (!tinymce.isIE) {
if (!tinymce.isIE || tinymce.isIE11) {
block.normalize(); // Remove empty text nodes that got left behind by the extract
// Check if the block is empty or contains a floated last child

View File

@@ -89,14 +89,14 @@ namespace Orchard.Data {
Logger.Debug("Reverting operations from transaction");
_transaction.Rollback();
}
_transaction.Dispose();
Logger.Debug("Transaction disposed");
}
catch (Exception e) {
Logger.Error(e, "Error while disposing the transaction.");
}
finally {
_transaction.Dispose();
Logger.Debug("Transaction disposed");
_transaction = null;
_cancelled = false;
}