mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00: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->loadDataFrom($this);
|
||||
$form->addExtraClass('htmleditorfield-form htmleditorfield-linkform');
|
||||
|
||||
$this->extend('updateLinkForm', $form);
|
||||
|
||||
@ -347,6 +348,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
||||
$form->unsetValidator();
|
||||
$form->disableSecurityToken();
|
||||
$form->loadDataFrom($this);
|
||||
$form->addExtraClass('htmleditorfield-form htmleditorfield-imageform');
|
||||
|
||||
return $form;
|
||||
}
|
||||
@ -385,6 +387,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
||||
$form->unsetValidator();
|
||||
$form->loadDataFrom($this);
|
||||
$form->disableSecurityToken();
|
||||
$form->addExtraClass('htmleditorfield-form htmleditorfield-flashform');
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
@ -7,7 +7,11 @@
|
||||
*/
|
||||
|
||||
(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)
|
||||
*/
|
||||
|
29
javascript/tiny_mce_improvements.js
vendored
29
javascript/tiny_mce_improvements.js
vendored
@ -5,14 +5,10 @@ ToolbarForm.prototype = {
|
||||
else this.open(ed);
|
||||
},
|
||||
close: function(ed) {
|
||||
if(this.style.display == 'block') {
|
||||
this.style.display = 'none';
|
||||
}
|
||||
jQuery(this).dialog('close');
|
||||
},
|
||||
open: function(ed) {
|
||||
if(this.style.display != 'block') {
|
||||
this.style.display = 'block';
|
||||
}
|
||||
jQuery(this).dialog('open');
|
||||
},
|
||||
onsubmit: function() {
|
||||
return false;
|
||||
@ -140,6 +136,7 @@ LinkForm.prototype = {
|
||||
},
|
||||
|
||||
updateSelection: function(ed) {
|
||||
if(ed == null) ed = tinyMCE.activeEditor;
|
||||
if(ed.selection.getRng()) {
|
||||
this.originalSelection = ed.selection.getRng();
|
||||
}
|
||||
@ -164,6 +161,7 @@ LinkForm.prototype = {
|
||||
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.
|
||||
@ -171,7 +169,6 @@ LinkForm.prototype = {
|
||||
if(!Form.Element.getValue(this.elements.LinkType)) Form.Element.setValue(this.elements.LinkType, 'internal');
|
||||
}
|
||||
this.linkTypeChanged(data ? false : true);
|
||||
}
|
||||
},
|
||||
|
||||
handleaction_insert: function() {
|
||||
@ -437,6 +434,7 @@ SideFormAction.prototype = {
|
||||
} catch(er) {
|
||||
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 {
|
||||
alert("Couldn't find form method handle" + this.name);
|
||||
}
|
||||
@ -622,13 +620,6 @@ 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
|
||||
});
|
||||
@ -898,13 +889,3 @@ function sapphiremce_cleanup(type, value) {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
contentPanelCloseButton = Class.create();
|
||||
contentPanelCloseButton.prototype = {
|
||||
onclick: function() {
|
||||
tinyMCE.activeEditor.execCommand('ssclosesidepanel');
|
||||
}
|
||||
}
|
||||
|
||||
contentPanelCloseButton.applyTo('#contentPanel h2 img');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user