fixed text editor & scope issue

This commit is contained in:
Torkel Ödegaard
2014-09-23 22:30:01 +02:00
parent 6794260e3f
commit d6f1c379c0
2 changed files with 12 additions and 8 deletions
+1 -1
View File
@@ -53,7 +53,6 @@ function (angular, $, _) {
link: function($scope, elem) {
var $link = $(linkTemplate);
var $panelContainer = elem.parents(".panel-container");
var menuTemplate = createMenuTemplate($scope);
var menuWidth = 246;
var menuScope = null;
var timeout = null;
@@ -106,6 +105,7 @@ function (angular, $, _) {
menuLeftPos = 0;
}
var menuTemplate = createMenuTemplate($scope);
$menu = $(menuTemplate);
$menu.css('left', menuLeftPos);
$menu.mouseleave(function() {
+11 -7
View File
@@ -20,13 +20,8 @@ function (angular, _) {
},
{
text: 'edit',
editorLink: "app/partials/paneleditor.html",
condition: !$scope.panelMeta.fullscreenEdit
},
{
text: 'edit',
click: "toggleFullscreen(true)",
condition: $scope.panelMeta.fullscreenEdit
click: 'editPanel()',
condition: true,
},
{
text: 'duplicate',
@@ -66,6 +61,15 @@ function (angular, _) {
$scope.inspector = {};
$scope.panelMeta.menu = _.where(menu, { condition: true });
$scope.editPanel = function() {
if ($scope.panelMeta.fullscreenEdit) {
$scope.toggleFullscreen(true);
}
else {
$scope.emitAppEvent('show-dash-editor', { src: 'app/partials/paneleditor.html', scope: $scope });
}
};
$scope.editPanelJson = function() {
$scope.emitAppEvent('show-json-editor', { object: $scope.panel, updateHandler: $scope.replacePanel });
};