1
0

Rewrite toggle_extended function to work with wysiwyg editor.

References #102
This commit is contained in:
Matthias Mees
2014-03-18 15:48:16 +01:00
parent 5ef157063c
commit 31eba101f6
3 changed files with 14 additions and 7 deletions

View File

@ -63,7 +63,9 @@
{serendipity_hookPlugin hook="backend_entry_toolbar_extended" data=$entry_data.entry hookAll="true"}
</div>
{/if}
<textarea id="serendipity[extended]" name="serendipity[extended]" rows="15">{$entry_vars.entry.extended|@escape}</textarea>
<div id="extended_entry_editor">
<textarea id="serendipity[extended]" name="serendipity[extended]" rows="15">{$entry_vars.entry.extended|@escape}</textarea>
</div>
</div>
<div id="edit_entry_metadata" class="clearfix">

View File

@ -357,10 +357,10 @@
// Toggle extended entry editor
serendipity.toggle_extended = function(setCookie) {
if ($('#toggle_extended').length == 0 && $('#tools_extended').length != 0) {
if ($('#toggle_extended').length == 0) {
// this function got called on load of the editor
var toggleButton = '#toggle_extended';
$('textarea[name="serendipity[extended]"]').parent().find('label').first().wrap('<button id="toggle_extended" class="icon_link" type="button"></button>');
$('#extended_entry_editor').parent().find('label').first().wrap('<button id="toggle_extended" class="icon_link" type="button"></button>');
$(toggleButton).prepend('<span class="icon-down-dir"></span> ');
$(toggleButton).click(function(e) {
e.preventDefault();
@ -372,19 +372,19 @@
}
}
if ($('textarea[name="serendipity[extended]"]:hidden').length > 0) {
$('textarea[name="serendipity[extended]"]').show(); // use name selector instead of id here; id does not work
if ($('#extended_entry_editor:hidden').length > 0) {
$('#extended_entry_editor').show(); // use name selector instead of id here; id does not work
$('#tools_extended').show();
$('#toggle_extended').find('> .icon-right-dir').removeClass('icon-right-dir').addClass('icon-down-dir');
localStorage.show_extended_editor = "true";
} else {
$('textarea[name="serendipity[extended]"]').hide();
$('#extended_entry_editor').hide();
$('#tools_extended').hide();
$('#toggle_extended').find('> .icon-down-dir').removeClass('icon-down-dir').addClass('icon-right-dir');
localStorage.show_extended_editor = "false";
}
if (setCookie) {
document.cookie = 'serendipity[toggle_extended]=' + (($('textarea[name="serendipity[extended]"]:hidden').length == 0) ? "true" : "") + ';';
document.cookie = 'serendipity[toggle_extended]=' + (($('#extended_entry_editor:hidden').length == 0) ? "true" : "") + ';';
}
}

View File

@ -1469,6 +1469,11 @@ fieldset p,
margin-top: 1em;
}
#extended_entry_editor > div {
margin-top: 1em;
margin-bottom: 1em;
}
.category_data {
margin: 0 1em 0 0;
}