Handling backspace on empty text element (wip)
[fnpeditor.git] / modules / documentCanvas / canvas / widgets.js
1 define([
2 'libs/jquery-1.9.1.min'
3 ], function($) {
4     
5 'use strict';
6
7 return {
8     labelWidget: function(tag, klass) {
9         return $('<span>')
10             .addClass('canvas-widget canvas-widget-label')
11             .text(tag + (klass ? ' / ' + klass : ''));
12     },
13
14     footnoteHandler: function(clickHandler) {
15         var mydom = $('<span>')
16             .addClass('canvas-widget canvas-widget-footnote-handle')
17             .css('display', 'inline')
18             .show();
19
20         mydom.click(function(e) {
21             e.stopPropagation();
22             clickHandler();
23         });
24
25         return mydom;
26     },
27
28     hideButton: function(clickHandler) {
29         var mydom = $('<span>x</span>')
30             .addClass('canvas-widget canvas-widget-hide-button');
31         mydom.click(function(e) {
32             e.stopPropagation();
33             clickHandler();
34         });
35         return mydom;
36     }
37
38 };
39
40 });