fix javascript

master
Jean-Christian Paul Denis 2021-10-30 15:31:51 +02:00
parent 805cfbf2d7
commit b349e6298c
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
3 changed files with 23 additions and 42 deletions

View File

@ -7,7 +7,9 @@ dev
- complete readme file
- fix widget rendering
- fix combo name
- fix javascript
- add user pref for posts list filters
- move config to blog pref
2013.11.21
- Switch to Dotclear 2.6 and clean up code

View File

@ -93,7 +93,12 @@ class adminPostWidgetText
public static function adminPostHeaders()
{
return dcPage::jsLoad(dcPage::getPF('postWidgetText/js/post.js'));
global $core;
$editor = $core->auth->getOption('editor');
return
$core->callBehavior('adminPostEditor', $editor['xhtml'], 'pwt', ['#post_wtext'], 'xhtml') .
dcPage::jsLoad(dcPage::getPF('postWidgetText/js/post.js'));
}
public static function adminPostFormItems($main, $sidebar, $post)

View File

@ -1,44 +1,18 @@
/* -- BEGIN LICENSE BLOCK ----------------------------------
* This file is part of postWidgetText, a plugin for Dotclear 2.
*
* Copyright (c) 2009-2010 JC Denis and contributors
* jcdenis@gdwd.com
*
* Licensed under the GPL version 2.0 license.
* A copy of this license is available in LICENSE file or at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* -- END LICENSE BLOCK ------------------------------------*/
/*global $, dotclear, jsToolBar */
'use strict';
$(function(){
if(!document.getElementById){
return;
}
if(document.getElementById('edit-entry')){
var formatAddField=$('#post_format').get(0);
$(formatAddField).change(function(){
postWidgetTextTb.switchMode(this.value);
});
var postWidgetTextTb=new jsToolBar(document.getElementById('post_wtext'));
postWidgetTextTb.context='post';
}
/*
$('#edit-entry').onetabload(function(){
$('#post-wtext-form p#post-wtext-head').toggleWithLegend(
$('#post-wtext-form').children().not('p#post-wtext-head'),
{
fn:function(){postWidgetTextTb.switchMode(formatAddField.value);},
cookie:'dcx_post_wtext',
hide:$('#post-wtext-form').val()==''
}
);
});
*/
$(() => {
$('#post-wtext-form h4').toggleWithLegend(
$('#post-wtext-form').children().not('h4'),
{
fn:function(){postWidgetTextTb.switchMode(formatAddField.value);},
cookie:'dcx_zcfs_admin_form_sidebar',
legend_click:true
}
$('#post-wtext-form').children().not('h4'),
{
user_pref:'dcx_pwt_form',
legend_click:true
}
);
});
if ($.isFunction(jsToolBar)) {
$('#post_wtext').each(function() {
var tbWidgetText = new jsToolBar(this);
tbWidgetText.draw('xhtml');
});
}
});