diff --git a/CHANGELOG.md b/CHANGELOG.md index de74408..0d43ef6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/inc/lib.pwt.admin.php b/inc/lib.pwt.admin.php index d320cf5..82f38bb 100644 --- a/inc/lib.pwt.admin.php +++ b/inc/lib.pwt.admin.php @@ -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) diff --git a/js/post.js b/js/post.js index 14c589e..afc97b8 100644 --- a/js/post.js +++ b/js/post.js @@ -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 + } ); -}); \ No newline at end of file + if ($.isFunction(jsToolBar)) { + $('#post_wtext').each(function() { + var tbWidgetText = new jsToolBar(this); + tbWidgetText.draw('xhtml'); + }); + } +});