Git Product home page Git Product logo

Comments (3)

vova07 avatar vova07 commented on June 5, 2024

Hi @mrbig00 ,
I took a look to clips.js plugin, but if really I'm not sure how to configure this plugin. The items variable is predefined, and there is no possibility to override it. I was searching for clipsJson but without success, can you provide a link to that documentation where you found that option?

from yii2-imperavi-widget.

mrbig00 avatar mrbig00 commented on June 5, 2024

In the plugin isn't implemented a feature to load custom items from the config.

So if you modify the init function in the clips.js to this:

        if (!this.opts.clipsJson) return;

        var items = JSON.parse(this.opts.clipsJson);

        this.clips.template = $('<ul id="redactor-modal-list">');

        for (var i = 0; i < items.length; i++)
        {
            var li = $('<li>');
            var a = $('<a href="#" class="redactor-clip-link">').text(items[i][0]);
            var div = $('<div class="redactor-clip">').hide().html(items[i][1]);

            li.append(a);
            li.append(div);
            this.clips.template.append(li);
        }

        this.modal.addTemplate('clips', '<section>' + this.utils.getOuterHtml(this.clips.template) + '</section>');

        var button = this.button.add('clips', 'Clips');
        this.button.addCallback(button, this.clips.show);

You can define custom elements in the config

                            'clipsJson' => Json::encode([["button" ,"<button>This is a button</button>"]]),

from yii2-imperavi-widget.

vova07 avatar vova07 commented on June 5, 2024

Ok, I think you can try 'clipsJson' => [["button" ,"<button>This is a button</button>"]], because in final this code will be encoded by the widget. Hope this will work for you.

from yii2-imperavi-widget.

Related Issues (20)

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.