mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Resetting image sidepanel fields when opening the panel instead of inserting an image, to avoid losing focus of TinyMCE in IE. Using getBookmark() in TinyMCE to save the original location. (fixes #5263) (from r101975)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112052 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
e2d17d9b99
commit
d99c2c7ee4
26
javascript/tiny_mce_improvements.js
vendored
26
javascript/tiny_mce_improvements.js
vendored
@ -450,6 +450,19 @@ ImageForm.prototype = {
|
||||
this.elements.Width.onchange = function() { __form.update_params('Width'); };
|
||||
this.elements.Height.onchange = function() { __form.update_params('Height'); };
|
||||
},
|
||||
toggle: function(ed) {
|
||||
this.ToolbarForm.toggle(ed);
|
||||
|
||||
this.resetFields();
|
||||
},
|
||||
resetFields: function() {
|
||||
this.elements.AltText.value = '';
|
||||
this.elements.ImageTitle.value = '';
|
||||
this.elements.CSSClass.value = 'left';
|
||||
this.elements.CaptionText.value = '';
|
||||
this.elements.CaptionText.disabled = '';
|
||||
this.elements.CSSClass.disabled = '';
|
||||
},
|
||||
destroy: function() {
|
||||
this.ToolbarForm = null;
|
||||
this.onsubmit = null;
|
||||
@ -521,12 +534,6 @@ ImageForm.prototype = {
|
||||
this.elements.Height.value = imgElement.style.height ? parseInt(imgElement.style.height) : imgElement.height;
|
||||
} else {
|
||||
this.selectedNode = null;
|
||||
this.elements.AltText.value = '';
|
||||
this.elements.ImageTitle.value = '';
|
||||
this.elements.CSSClass.value = 'left';
|
||||
this.elements.CaptionText.value = '';
|
||||
this.elements.CaptionText.disabled = '';
|
||||
this.elements.CSSClass.disabled = '';
|
||||
}
|
||||
},
|
||||
|
||||
@ -650,6 +657,13 @@ ImageThumbnail.prototype = {
|
||||
if(el && el.nodeName == 'IMG') {
|
||||
ed.dom.setAttribs(el, attributes);
|
||||
} else {
|
||||
// Focus gets saved in tinymce_ssbuttons when opening the sidebar.
|
||||
// Unless the focus has changed in the meantime, reset it to the previous position.
|
||||
// This is necessary because IE can lose its focus if any of the sidebar input fields are used.
|
||||
if(ed.ss_focus_bookmark) {
|
||||
ed.selection.moveToBookmark(ed.ss_focus_bookmark);
|
||||
delete ed.ss_focus_bookmark;
|
||||
}
|
||||
ed.execCommand('mceInsertContent', false, html, {
|
||||
skip_undo : 1
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user