GithubHelp home page GithubHelp logo

rbatinov / trumbowyg-plugin-image-as-a-link Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4.46 MB

This is a simple plugin for the Trumbowyg editor. It can be used to insert image which acts like a link and points to somewhere.

Home Page: https://rbatinov.github.io/Trumbowyg-Plugin-Image-As-A-Link/

License: MIT License

JavaScript 100.00%
trumbowyg trumbowyg-wysiwyg trumbowyg-plugin editor htmleditor javascript image links

trumbowyg-plugin-image-as-a-link's Introduction

Trumbowyg Plugin - Image As A Link

This is a simple plugin for the Trumbowyg editor. It can be used to insert image which acts like a link and points to somewhere.
Plugin DEMO

Instalation

  1. Go to Trumbowyg official website: https://alex-d.github.io/Trumbowyg/documentation/
  2. Install Trumbowyg editor based on the steps in the documentation.
  3. After that you need to download this plugin and paste the whole imageAsALink folder in the Trumbowyg downloaded plugins folder.
  4. Then you need to include link to the imageAsALink/trumbowyg.imageAsALink.js in YOUR project.
  5. To load the editor and this plugin as said in the Trumbowyg documentation you need to first load jQuery>=1.8, trumbowyg/dist/trumbowyg.min.js and to include in your head this trumbowyg/dist/ui/trumbowyg.min.css.
  6. After that you need to add to the options of the editor the name of the plugin (imageAsALink) and execute the editor with the options.
    • You need simple div or textarea
      html <div id="imageAsALinkExample"></div>
    • And the minimum options in JavaScript:
    var trumbowyg_options = {
     resetCss: true,
     removeformatPasted: true,
     autogrow: true,
     defaultLinkTarget: '_blank',
     btnsDef: {
        imageAsALink: {
            ico: 'insertImage'
        }
     },
     btns: [
          ['imageAsALink']
     ]}; 
     
     $('#imageAsALinkExample').trumbowyg(trumbowyg_options);
  7. Then image button will show and now you can use the plugin.

Plugin Properties

  • Image URL - This is the URL of an image. REQUIRED
  • Image ALT - This is the ALT Text of an image. NOT REQUIRED
    • If input is empty -> Default text "Image as a Link" will be added.
  • Link URL - This is the Link where you want the image to point to. REQUIRED
  • Width - This is the width of an image. It can be in px or % (it should be filled px or %). NOT REQUIRED
    • If input is empty -> Defauld width of 100% will be added.
  • Title - This is the title of an image. When you hover on the image it will show. NOT REQUIRED
    • If input is empty -> Default text "Click to open in new tab." will be added.

This Image Shows how to fill with REQUIRED properties:

alt text

This Image Shows how to fill ALL properties:

alt text

You can check DEMO of plugin on this link:

https://rbatinov.github.io/Trumbowyg-Plugin-Image-As-A-Link/

alt text
alt text

License

Plugin is under the MIT License

Enjoy!

trumbowyg-plugin-image-as-a-link's People

Contributors

rbatinov avatar

Watchers

 avatar

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.