new 'addNavigationBarItem' plugin api

This commit is contained in:
Régis Hanol
2017-08-05 02:23:35 +02:00
parent e958500735
commit 4b53fe3cc7
2 changed files with 72 additions and 38 deletions

View File

@ -20,10 +20,11 @@ import { addPostClassesCallback } from 'discourse/widgets/post';
import { addPostTransformCallback } from 'discourse/widgets/post-stream';
import { attachAdditionalPanel } from 'discourse/widgets/header';
import { registerIconRenderer } from 'discourse-common/lib/icon-library';
import { addNavItem } from 'discourse/models/nav-item';
// If you add any methods to the API ensure you bump up this number
const PLUGIN_API_VERSION = '0.8.8';
const PLUGIN_API_VERSION = '0.8.9';
class PluginApi {
constructor(version, container) {
@ -524,6 +525,22 @@ class PluginApi {
addPostTransformCallback(callback) {
addPostTransformCallback(callback);
}
/**
*
* Adds a new item in the navigation bar.
*
* Example:
*
* addNavigationBarItem({
* name: "discourse",
* displayName: "Discourse"
* href: "https://www.discourse.org",
* })
*/
addNavigationBarItem(item) {
addNavItem(item);
}
}
let _pluginv01;