74 if (!this.originalValues[key]) { |
76 if (!this.originalValues[key]) { |
75 this.originalValues[key] = value; |
77 this.originalValues[key] = value; |
76 } |
78 } |
77 }, |
79 }, |
78 |
80 |
|
81 showDiffviewer: function (refId, sourceId, targetKey) { |
|
82 |
|
83 var sourceField = document.getElementById(sourceId); |
|
84 var targetField = this.$refs[this.targetKeyMap[targetKey]]; |
|
85 var targetType = this.targetFieldTypeMap[targetKey]; |
|
86 var diffViewer = this.$refs[refId]; |
|
87 |
|
88 if (!diffViewer) { throw new Error("The DiffViewer can't be found for " + targetKey); } |
|
89 |
|
90 if (targetType === "input") { |
|
91 diffViewer.showTextDiff(sourceField.value, targetField.value); |
|
92 } |
|
93 |
|
94 if (targetKey === "tag") { |
|
95 var source = this.$refs[sourceId]; |
|
96 var target = this.$refs['proposal-tags']; |
|
97 if ((source.tags.length !== 0) && (target.tags.length !== 0)) { |
|
98 diffViewer.showTagDiff(source.tags, target.tags); |
|
99 } |
|
100 } |
|
101 /* frag */ |
|
102 if ( targetKey === "frag") { |
|
103 |
|
104 var originalPath = targetField.getAttribute("d"); |
|
105 var modifiedPath = sourceField.getAttribute("d"); |
|
106 diffViewer.showFragmentDiff(originalPath, modifiedPath); |
|
107 } |
|
108 |
|
109 diffViewer.show(); |
|
110 }, |
|
111 |
|
112 |
79 hightlightSource: function (source) { |
113 hightlightSource: function (source) { |
80 source.className += "highlight"; |
114 source.className += "highlight"; |
81 }, |
115 }, |
82 |
116 |
83 save: function () { |
117 save: function () { |