Skip to content

Create custom tooltip button

Miguel Michelson Martinez edited this page Mar 26, 2015 · 1 revision

Custom tooltip View

Since version 0.0.11 you can add custom toolbar button to the main editor tooltip.

 window.MyCustomTooltip = Dante.View.TooltipWidget.extend({
    initialize: function(opts) {
      if (opts == null) {
        opts = {};
      }
      this.icon = opts.icon || "icon-video";
      this.title = opts.title || "Add a Custom Thing!";
      this.action = opts.action || "custom-embed-simple";
      return this.current_editor = opts.current_editor;
    },
    handleClick: function(ev) {
      return alert("This is custom button with backbone extend style");
    }
  });

###Html , initialize tooltip with CustomTooltip

  var btn1 = new window.MyCustomTooltip

  editor = new Dante.Editor(
    {
      el: "#editor",
      extra_tooltip_widgets: [btn1]
    }
  )
  editor.start()

check source/custom_toolbar.erb for more examples.

Clone this wiki locally