Plugin Directory

Changeset 1865784


Ignore:
Timestamp:
04/28/2018 02:33:24 PM (8 years ago)
Author:
Methodos
Message:

bug fix

Location:
indent-lists-button
Files:
17 added
3 edited

Legend:

Unmodified
Added
Removed
  • indent-lists-button/trunk/ili-indent-lists-button.php

    r1827735 r1865784  
    22/*
    33 * Plugin Name: Indent Lists Button
    4  * Version: 0.1.36
     4 * Version: 0.1.37
    55 * Plugin URI: http://www.elisewebredactie.nl/indent-lists-button
    66 * Author: Klaas van der Linden
     
    4141    // Register a new tinymce external plugin at wordpress.
    4242    function register_mce_plugin($plugin_array) {
    43         $plugin_array ['ili_mce_plugin'] = $this->url . 'js/mce-plugin.js';
     43        $plugin_array ['ili_mce_plugin'] = $this->url . 'js/mce-plugin.js?v=9';
    4444        return $plugin_array;
    4545    }
  • indent-lists-button/trunk/js/mce-plugin.js

    r1580326 r1865784  
    1 (function() {
     1(function($) {
    22    /* Bail out if the admin_head hook hasn't been called to add the iliGlob variable */
    33    if(typeof iliGlob === 'undefined')
     
    88    });
    99    /*
    10      * Variables to save the instances of the button and the editor for use in
    11      * the callbacks, plus one for jquery.
     10     * Variable to save the instances of the button for use in
     11     * the callbacks.
    1212     */
    1313    var iliButton = null;
    14     var theEditor = null;
    15     var $ = jQuery;
    1614    /* Firstly, create a tinymce plugin that adds a new button editor to the editor */
    1715    tinymce.create('tinymce.plugins.ili_mce_plugin', {
    1816        init : function(ed, url) {
    19             theEditor = ed;
    2017            /**
    2118             * Tell tinyMCE that this plugin should add a button to the editor, setting the
     
    4037             */
    4138            ed.addCommand('indent_lists', function() {
    42                 if (e = theEditor.selection.getNode()) {
     39                var nodeAtCaret = tinymce.activeEditor.selection.getNode();
     40                if (nodeAtCaret) {
    4341                    /* Indent a list if present in this main node */
    44                     $(e).closest('ul, ol').toggleClass('ili-indent');
     42                    $(nodeAtCaret).closest('ul, ol').toggleClass('ili-indent');
    4543                    ed.execCommand("mceRepaint");
    4644                }
     
    5553                if (iliButton) {
    5654                    icon = $('i.mce-i-ili_button');
    57                     list = $(theEditor.selection.getNode()).closest('ul, ol');
    58                     inList = (list.length == 1);
     55                    list = $(tinymce.activeEditor.selection.getNode()).closest('ul, ol');
     56                    inList = (list.length === 1);
    5957                    inIndentedList = (inList && list.hasClass('ili-indent'));
    6058                    /* Disable the button whenever the caret is outside a list. */
     
    8583    // Secondly, add the newly created plugin to the tinymce.PluginManager
    8684    tinymce.PluginManager.add('ili_mce_plugin', tinymce.plugins.ili_mce_plugin);
    87 })();
     85})(jQuery);
  • indent-lists-button/trunk/readme.txt

    r1827735 r1865784  
    44Tags: lists, indent, indentation, bullet lists, list, align, alignment, opsomming, inspringen, Twenty Sixteen, Twenty Fifteen, indent lists, opsommingen inspringen, 
    55Requires at least: 3.0.1
    6 Tested up to: 4.9.4
    7 Stable tag: 0.1.36
     6Tested up to: 4.9.5
     7Stable tag: 0.1.37
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    31311. Twenty Fifteen
    32322. Twenty Sixteen
     333. Twenty Seventeen
     344. Twety Eighteen
     355. Business Elite
    3336
    3437= Contact =
     
    4548
    4649== Changelog ==
     50
     51= 0.1.37 (2017-01-17) =
     52
     53* Bug fix (Thanks to Michel for finding the bug!)
     54
    4755= 0.1.35 (2017-01-17) =
    4856
Note: See TracChangeset for help on using the changeset viewer.