From a5aa6dd4b1217af15f34f259374911abb2c86697 Mon Sep 17 00:00:00 2001 From: Zhenlei Jia Date: Fri, 8 Feb 2019 08:14:45 -0500 Subject: [PATCH] Fix a bug of project note edit dialog Before fix, accepting the edit by "Shift+Enter" will discard all editings. Solution: setup dialog.target, dialog.action and dialog.getInput properly for DialogBoxMorph's 'accept' method. Changes are made in src/gui.js, but the 'why' part is at the DialogBoxMorph.accept method in the file src/widget.js. --- src/gui.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui.js b/src/gui.js index 3e9ea7f5..b97b9a60 100644 --- a/src/gui.js +++ b/src/gui.js @@ -3749,7 +3749,6 @@ IDE_Morph.prototype.editProjectNotes = function () { var dialog = new DialogBoxMorph().withKey('projectNotes'), frame = new ScrollFrameMorph(), text = new TextMorph(this.projectNotes || ''), - ok = dialog.ok, myself = this, size = 250, world = this.world(); @@ -3776,10 +3775,13 @@ IDE_Morph.prototype.editProjectNotes = function () { frame.addContents(text); text.drawNew(); - dialog.ok = function () { - myself.projectNotes = text.text; - ok.call(this); - }; + dialog.getInput = function () { + return text.text; + } + dialog.target = myself; + dialog.action = function (note) { + myself.projectNotes = note; + } dialog.justDropped = function () { text.edit();