From 1416ff2d114666fefd69629de19cb3830e5e741f Mon Sep 17 00:00:00 2001 From: Mariela Michalek Date: Sat, 12 Apr 2014 15:00:51 -0300 Subject: [PATCH] update editor's events --- .../src/main/javascript/widget/LinkEditor.js | 24 ++++++++++++------- .../src/main/javascript/widget/NoteEditor.js | 16 ++++++------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/mindplot/src/main/javascript/widget/LinkEditor.js b/mindplot/src/main/javascript/widget/LinkEditor.js index db2a7d35..f7fa25df 100644 --- a/mindplot/src/main/javascript/widget/LinkEditor.js +++ b/mindplot/src/main/javascript/widget/LinkEditor.js @@ -52,7 +52,8 @@ mindplot.widget.LinkEditor = new Class({ input.css('width','70%').css('margin','0px 20px'); if (model.getValue() != null){ - input.value = model.getValue();} + input.val(model.getValue()); + } // type:Browser.ie ? 'text' : 'url', // IE workaround // Open Button @@ -69,18 +70,17 @@ mindplot.widget.LinkEditor = new Class({ form.append(open); $(document).ready(function () { - $(document).on('submit','#linkFormId',function () { + var me = this; + $(document).on('submit','#linkFormId',function (event) { event.stopPropagation(); event.preventDefault(); - if (input.value != null && input.value.trim() != "") { - model.setValue(input.value); + var inputValue = input.val(); + if (inputValue != null && inputValue.trim() != "") { + model.setValue(inputValue); } - this.close(); + me.close(); }); - $(document).on('click','#acceptBtn',function () { - $("#linkFormId").submit(); - }); }); // result.addEvent('keydown', function (event) { @@ -89,5 +89,13 @@ mindplot.widget.LinkEditor = new Class({ // result.append(form); return result; + }, + + onAcceptClick: function() { + $("#linkFormId").submit(); + }, + + close:function () { + this.parent(); } }); diff --git a/mindplot/src/main/javascript/widget/NoteEditor.js b/mindplot/src/main/javascript/widget/NoteEditor.js index 352fd2d7..7ac0a809 100644 --- a/mindplot/src/main/javascript/widget/NoteEditor.js +++ b/mindplot/src/main/javascript/widget/NoteEditor.js @@ -38,26 +38,26 @@ _buildPanel:function (model) { } result.append(form); - + var me = this; $(document).ready(function () { - $(document).on('submit','#noteFormId',function () { + $(document).on('submit','#noteFormId',function (event) { event.stopPropagation(); event.preventDefault(); if (textArea.val()) { model.setValue(textArea.val()); } - this.close(); - }); - - $(document).on('click','#acceptBtn',function () { - $("#noteFormId").submit(); + me.close(); }); }); return result; }, + onAcceptClick: function() { + $("#noteFormId").submit(); + }, + close:function () { - this.close(); + this.parent(); } });