Forráskód Böngészése

fix: Text panel should re-render when panel mode is changed #14922

Johannes Schill 7 éve
szülő
commit
a3e13b333e
1 módosított fájl, 10 hozzáadás és 2 törlés
  1. 10 2
      public/app/plugins/panel/text/module.ts

+ 10 - 2
public/app/plugins/panel/text/module.ts

@@ -33,11 +33,19 @@ export class TextPanelCtrl extends PanelCtrl {
     this.events.on('refresh', this.onRefresh.bind(this));
     this.events.on('render', this.onRender.bind(this));
 
+    const renderWhenChanged = (scope: any) => {
+      const { panel } = scope.ctrl;
+      return [
+        panel.content,
+        panel.mode
+      ].join();
+    };
+
     $scope.$watch(
-      'ctrl.panel.content',
+      renderWhenChanged,
       _.throttle(() => {
         this.render();
-      }, 1000)
+      }, 1000, {trailing: true})
     );
   }