src_js/iconolab-bundle/src/components/editor/AnnotationForm.vue
changeset 418 a04c55054afe
parent 403 0ed5207089ee
child 427 2a9ce7ec3a29
--- a/src_js/iconolab-bundle/src/components/editor/AnnotationForm.vue	Thu Mar 09 12:39:36 2017 +0100
+++ b/src_js/iconolab-bundle/src/components/editor/AnnotationForm.vue	Mon Mar 13 18:48:35 2017 +0100
@@ -76,17 +76,15 @@
         data() {
             return defaults;
         },
+        mounted() {
+            if (this.annotation) {
+                this.loadAnnotation(this.annotation);
+            }
+        },
         watch: {
             annotation: function(annotation) {
                 if (annotation) {
-                    // Make sure we have an actual copy
-                    Object.assign(this, {
-                        title: annotation.title,
-                        description: annotation.description,
-                        fragment: annotation.fragment,
-                        tags: annotation.tags.slice(),
-                        readonly: true,
-                    });
+                    this.loadAnnotation(annotation);
                 } else {
                     this.reset();
                 }
@@ -128,6 +126,16 @@
             reset: function() {
                 Object.assign(this, defaults);
             },
+            loadAnnotation(annotation) {
+                // Make sure we have an actual copy
+                Object.assign(this, {
+                    title: annotation.title,
+                    description: annotation.description,
+                    fragment: annotation.fragment,
+                    tags: annotation.tags.slice(),
+                    readonly: true,
+                });
+            }
         }
     }