saveDraft();
};
+ // Listen to shortcuts coming via events
+ $scope.$on('editor-keydown', (event, data) => {
+ // Save shortcut (ctrl+s)
+ if (data.keyCode == 83 && (navigator.platform.match("Mac") ? data.metaKey : data.ctrlKey)) {
+ data.preventDefault();
+ saveDraft();
+ }
+ });
+
/**
* Discard the current draft and grab the current page
* content from the system via an AJAX request.
const pageId = Number($attrs.pageId);
$scope.tags = [];
+
+ $scope.sortOptions = {
+ handle: '.handle',
+ items: '> tr',
+ containment: "parent",
+ axis: "y"
+ };
/**
* Push an empty tag to the end of the scope tags.
value: ''
});
}
+ $scope.addEmptyTag = addEmptyTag;
/**
* Get all tags for the current book and add into scope.
}
};
+ /**
+ * Save the tags to the current page.
+ */
$scope.saveTags = function() {
setTagOrder();
let postData = {tags: $scope.tags};
})
};
+ /**
+ * Remove a tag from the current list.
+ * @param tag
+ */
+ $scope.removeTag = function(tag) {
+ let cIndex = $scope.tags.indexOf(tag);
+ $scope.tags.splice(cIndex, 1);
+ };
+
}]);
};