Giter VIP home page Giter VIP logo

bs3_panel_shortcode's Introduction

bs3_panel_shortcode

A plugin to add Bootstrap 3 panel shortcode as a part to the GWP tutorial a part of the Take your shortcodes to the ultimate level tutorial http://generatewp.com/?p=11889

Analytics

bs3_panel_shortcode's People

Contributors

bainternet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bs3_panel_shortcode's Issues

restoreShortcodes( content ) problem when ran from multiple plugins

If you try to duplicate this lugin for more than 1 plugin. It will have issues when you switch between visual and text editor where it changes from image to shortcode text and then from shortcode text back to image.

If more than 1 plugin run then they all fire this same function below which replaces the image into a shortcode text. The result is the last plugin to run having its data be the one used.

A solution would be to modify the RegEx to search the image for images with a matching CSS class name as the one the plugin adds to the image. THis way when this function is ran on each plugin it will only update the images that belong to that particular plugin resulting in the correct shortcodes to be built.

    function restoreShortcodes( content ) {
        return content.replace( /(?:<p(?: [^>]+)?>)*(<img [^>]+>)(?:<\/p>)*/g, function( match, image ) {
            var data = getAttr( image, 'data-sh-attr' );
            var con = getAttr( image, 'data-sh-content' );

            if ( data ) {
                return '<p>[' + sh_tag + data + ']' + con + '[/'+sh_tag+']</p>';
            }
            return match;
        });
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.