Revision: 29299
          http://sourceforge.net/p/bibdesk/svn/29299
Author:   hofman
Date:     2025-07-18 16:19:58 +0000 (Fri, 18 Jul 2025)
Log Message:
-----------
use old value of note field for notification. Ignore textDidEndEditing when the 
user did not begin editing.

Modified Paths:
--------------
    trunk/bibdesk/BDSKEditor.m

Modified: trunk/bibdesk/BDSKEditor.m
===================================================================
--- trunk/bibdesk/BDSKEditor.m  2025-07-18 16:07:51 UTC (rev 29298)
+++ trunk/bibdesk/BDSKEditor.m  2025-07-18 16:19:58 UTC (rev 29299)
@@ -2283,8 +2283,13 @@
 
 // sent by the textViews
 - (void)textDidEndEditing:(NSNotification *)aNotification{
+    if (currentEditedView == nil)
+        return;
+    
     [self setEditing:NO];
     
+    NSParameterAssert([self textShouldEndEditing:currentEditedView 
error:NULL]);
+    
     NSString *field = nil;
     if(currentEditedView == notesView)
         field = BDSKAnnoteString;
@@ -2295,7 +2300,7 @@
     if (field) {
         // this is needed to update the search index and tex preview
         NSString *value = [publication valueOfField:field];
-        NSDictionary *notifInfo = [NSDictionary 
dictionaryWithObjectsAndKeys:field, BDSKBibItemKeyKey, value, 
BDSKBibItemNewValueKey, value, BDSKBibItemOldValueKey, nil];
+        NSDictionary *notifInfo = [NSDictionary 
dictionaryWithObjectsAndKeys:field, BDSKBibItemKeyKey, value, 
BDSKBibItemNewValueKey, previousValueForCurrentEditedNotesView, 
BDSKBibItemOldValueKey, nil];
         [[NSNotificationCenter defaultCenter] 
postNotificationName:BDSKBibItemChangedNotification
                                                             object:publication
                                                           userInfo:notifInfo];
@@ -2302,11 +2307,8 @@
     }
     
     // this is called multiple times when switching tabs
-    if (currentEditedView) {
-        NSParameterAssert([self textShouldEndEditing:currentEditedView 
error:NULL]);
-        currentEditedView = nil;
-        [self setPreviousValueForCurrentEditedNotesView:nil];
-    }
+    currentEditedView = nil;
+    [self setPreviousValueForCurrentEditedNotesView:nil];
 }
 
 #pragma mark Notification handling

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to