mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
ENHANCEMENT Changed HtmlEditorField link/image/flash forms to use model jQuery.dialog instead of side panel - less side effects when switching focus between editor and side panels, and fits better in new design drafts
This commit is contained in:
parent
f6edcd1170
commit
ff29f3e4e8
@ -275,6 +275,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
|
|
||||||
$form->unsetValidator();
|
$form->unsetValidator();
|
||||||
$form->loadDataFrom($this);
|
$form->loadDataFrom($this);
|
||||||
|
$form->addExtraClass('htmleditorfield-form htmleditorfield-linkform');
|
||||||
|
|
||||||
$this->extend('updateLinkForm', $form);
|
$this->extend('updateLinkForm', $form);
|
||||||
|
|
||||||
@ -347,6 +348,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
$form->unsetValidator();
|
$form->unsetValidator();
|
||||||
$form->disableSecurityToken();
|
$form->disableSecurityToken();
|
||||||
$form->loadDataFrom($this);
|
$form->loadDataFrom($this);
|
||||||
|
$form->addExtraClass('htmleditorfield-form htmleditorfield-imageform');
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
@ -385,6 +387,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
$form->unsetValidator();
|
$form->unsetValidator();
|
||||||
$form->loadDataFrom($this);
|
$form->loadDataFrom($this);
|
||||||
$form->disableSecurityToken();
|
$form->disableSecurityToken();
|
||||||
|
$form->addExtraClass('htmleditorfield-form htmleditorfield-flashform');
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(function($) {
|
(function($) {
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('.htmleditorfield-form').dialog({autoOpen: false, bgiframe: true, modal: true, height: 500, width: 500, ghost: true});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On page refresh load the initial images (in root)
|
* On page refresh load the initial images (in root)
|
||||||
*/
|
*/
|
||||||
|
39
javascript/tiny_mce_improvements.js
vendored
39
javascript/tiny_mce_improvements.js
vendored
@ -5,14 +5,10 @@ ToolbarForm.prototype = {
|
|||||||
else this.open(ed);
|
else this.open(ed);
|
||||||
},
|
},
|
||||||
close: function(ed) {
|
close: function(ed) {
|
||||||
if(this.style.display == 'block') {
|
jQuery(this).dialog('close');
|
||||||
this.style.display = 'none';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
open: function(ed) {
|
open: function(ed) {
|
||||||
if(this.style.display != 'block') {
|
jQuery(this).dialog('open');
|
||||||
this.style.display = 'block';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onsubmit: function() {
|
onsubmit: function() {
|
||||||
return false;
|
return false;
|
||||||
@ -140,6 +136,7 @@ LinkForm.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
updateSelection: function(ed) {
|
updateSelection: function(ed) {
|
||||||
|
if(ed == null) ed = tinyMCE.activeEditor;
|
||||||
if(ed.selection.getRng()) {
|
if(ed.selection.getRng()) {
|
||||||
this.originalSelection = ed.selection.getRng();
|
this.originalSelection = ed.selection.getRng();
|
||||||
}
|
}
|
||||||
@ -164,14 +161,14 @@ LinkForm.prototype = {
|
|||||||
Form.Element.setValue(this.elements[i], selected);
|
Form.Element.setValue(this.elements[i], selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we haven't selected an existing link, then just make sure we default to "internal" for the link
|
|
||||||
// type.
|
|
||||||
} else {
|
|
||||||
if(!Form.Element.getValue(this.elements.LinkType)) Form.Element.setValue(this.elements.LinkType, 'internal');
|
|
||||||
}
|
}
|
||||||
this.linkTypeChanged(data ? false : true);
|
|
||||||
|
// If we haven't selected an existing link, then just make sure we default to "internal" for the link
|
||||||
|
// type.
|
||||||
|
} else {
|
||||||
|
if(!Form.Element.getValue(this.elements.LinkType)) Form.Element.setValue(this.elements.LinkType, 'internal');
|
||||||
}
|
}
|
||||||
|
this.linkTypeChanged(data ? false : true);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleaction_insert: function() {
|
handleaction_insert: function() {
|
||||||
@ -437,6 +434,7 @@ SideFormAction.prototype = {
|
|||||||
} catch(er) {
|
} catch(er) {
|
||||||
alert("An error occurred. Please try again, or reload the CMS if the problem persists.\n\nError details: " + er.message);
|
alert("An error occurred. Please try again, or reload the CMS if the problem persists.\n\nError details: " + er.message);
|
||||||
}
|
}
|
||||||
|
jQuery(this).parents('form').dialog('close');
|
||||||
} else {
|
} else {
|
||||||
alert("Couldn't find form method handle" + this.name);
|
alert("Couldn't find form method handle" + this.name);
|
||||||
}
|
}
|
||||||
@ -622,13 +620,6 @@ ImageThumbnail.prototype = {
|
|||||||
if(el && el.nodeName == 'IMG') {
|
if(el && el.nodeName == 'IMG') {
|
||||||
ed.dom.setAttribs(el, attributes);
|
ed.dom.setAttribs(el, attributes);
|
||||||
} else {
|
} 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, {
|
ed.execCommand('mceInsertContent', false, html, {
|
||||||
skip_undo : 1
|
skip_undo : 1
|
||||||
});
|
});
|
||||||
@ -898,13 +889,3 @@ function sapphiremce_cleanup(type, value) {
|
|||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
contentPanelCloseButton = Class.create();
|
|
||||||
contentPanelCloseButton.prototype = {
|
|
||||||
onclick: function() {
|
|
||||||
tinyMCE.activeEditor.execCommand('ssclosesidepanel');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
contentPanelCloseButton.applyTo('#contentPanel h2 img');
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user