- $('#html-view').bind('mousemove', function(event){
- var editable = $(event.target).closest('*[x-editable]');
- $('.active[x-editable]', element).not(editable).removeClass('active').children('.edit-button').remove();
- if (!editable.hasClass('active')) {
- editable.addClass('active').append(button);
- }
- if (editable.is('.annotation-inline-box')) {
- $('*[x-annotation-box]', editable).css({
- position: 'absolute',
- left: event.clientX - editable.offset().left + 5,
- top: event.clientY - editable.offset().top + 5
- }).show();
- }
- else {
- $('*[x-annotation-box]').hide();
- }
- });
-
- $('.motyw').live('click', function(){
- selectTheme($(this).attr('theme-class'));
- });
-
- $('#insert-annotation-button').click(function(){
- addAnnotation();
- return false;
- });
-
- $('#insert-theme-button').click(function(){
- addTheme();
- return false;
- });
+ options.callback = function() {
+ var element = $("#html-view");
+ var button = $('<button class="edit-button">Edytuj</button>');
+
+ $('#html-view').bind('mousemove', function(event){
+ var editable = $(event.target).closest('*[x-editable]');
+ $('.active', element).not(editable).removeClass('active').children('.edit-button').remove();
+
+ if (!editable.hasClass('active')) {
+ editable.addClass('active').append(button);
+ }
+ if (editable.is('.annotation-inline-box')) {
+ $('*[x-annotation-box]', editable).css({
+ position: 'absolute',
+ left: event.clientX - editable.offset().left + 5,
+ top: event.clientY - editable.offset().top + 5
+ }).show();
+ }
+ else {
+ $('*[x-annotation-box]').hide();
+ }
+ });
+
+ $('.motyw').live('click', function(){
+ selectTheme($(this).attr('theme-class'));
+ });
+
+ $('#insert-annotation-button').click(function(){
+ addAnnotation();
+ return false;
+ });
+
+ $('#insert-theme-button').click(function(){
+ addTheme();
+ return false;
+ });
+
+ $('.edit-button').live('click', function(event){
+ event.preventDefault();
+ openForEdit($(this).parent());
+ });
+
+ old_callback.call(this);
+ };