diff --git a/src/grid/ko/gridEditor.ts b/src/grid/ko/gridEditor.ts index 20cd6d82..35fd027b 100644 --- a/src/grid/ko/gridEditor.ts +++ b/src/grid/ko/gridEditor.ts @@ -105,6 +105,25 @@ export class GridEditor { binding: binding, half: half, providers: providers, + openHelpCenter: (articleKey: string) => { + const view: View = { + heading: "Help center", + component: { + name: "help-center", + params: { + articleKey: articleKey, + } + }, + resizing: { + directions: "vertically horizontally", + initialWidth: 500, + initialHeight: 700 + }, + scrolling: false + }; + + this.viewManager.openViewAsPopup(view); + }, openWidgetEditor: () => { this.viewManager.openWidgetEditor(binding); }, diff --git a/src/ko/bindingHandlers/bindingHandlers.helpCenter.ts b/src/ko/bindingHandlers/bindingHandlers.helpCenter.ts index 80de474d..ec5a440c 100644 --- a/src/ko/bindingHandlers/bindingHandlers.helpCenter.ts +++ b/src/ko/bindingHandlers/bindingHandlers.helpCenter.ts @@ -21,13 +21,14 @@ export class HelpCenterBindingHandler { directions: "vertically horizontally", initialWidth: 500, initialHeight: 700 - } + }, + scrolling: false }; this.viewManager.openViewAsPopup(view); }; - ko.applyBindingsToNode(element, { click: openHelpCenter }, null); + ko.applyBindingsToNode(element, { activate: openHelpCenter }, null); } }; } diff --git a/src/ko/bindingHandlers/bindingHandlers.tooltip.ts b/src/ko/bindingHandlers/bindingHandlers.tooltip.ts index 37de236a..60265912 100644 --- a/src/ko/bindingHandlers/bindingHandlers.tooltip.ts +++ b/src/ko/bindingHandlers/bindingHandlers.tooltip.ts @@ -5,11 +5,21 @@ import { BalloonHandle, BalloonActivationMethod } from "@paperbits/common/ui/bal const defaultTooltipDelayMs = 700; interface TooltipOptions { + /** + * Tooltip heading. + */ + heading?: string; + /** * Tooltip message. */ message: string; + /** + * Tooltip help article. + */ + articleKey?: string; + /** * Preferred tooltip position, e.g. `top`. */ @@ -31,6 +41,11 @@ interface TooltipOptions { isDisabled: ko.Observable; } +interface TooltipParams { + heading: string; + observableText: ko.Observable; + articleKey: string; +} ko.bindingHandlers["tooltip"] = { init: (triggerElement: HTMLElement, valueAccessor: () => TooltipOptions) => { @@ -63,7 +78,11 @@ ko.bindingHandlers["tooltip"] = { let hasText: boolean = false; const isDisabled: () => boolean = () => !!options.isDisabled ? options.isDisabled() : false; - const textParams: any = {}; + const textParams: TooltipParams = { + heading: options.heading, + observableText: null, + articleKey: options.articleKey + }; let closeTimeout = 0; if (ko.isObservable(tooltipMessage)) { @@ -80,7 +99,7 @@ ko.bindingHandlers["tooltip"] = { } else { hasText = !!tooltipMessage; - textParams.text = tooltipMessage; + textParams.observableText = tooltipMessage; } ko.applyBindingsToNode(triggerElement, { diff --git a/src/ko/ui/tooltip.html b/src/ko/ui/tooltip.html index cfb15de1..6b540673 100644 --- a/src/ko/ui/tooltip.html +++ b/src/ko/ui/tooltip.html @@ -1,2 +1,12 @@ -
+
+ +

+ +
+ + + Learn more > + +
+ \ No newline at end of file diff --git a/src/ko/ui/tooltip.ts b/src/ko/ui/tooltip.ts index fa7d7a91..db656384 100644 --- a/src/ko/ui/tooltip.ts +++ b/src/ko/ui/tooltip.ts @@ -11,16 +11,24 @@ export class Tooltip { public readonly announcementText: ko.Observable; constructor() { + this.heading = ko.observable(); this.observableText = ko.observable(); this.announcementText = ko.observable(); + this.articleKey = ko.observable(); } @Param() public text: any; + @Param() + public heading: any; + @Param() public observableText: any; + @Param() + public articleKey: any; + @OnMounted() public init(): void { if (!this.text) { diff --git a/src/workshops/navigation/ko/navigationToolButton.ts b/src/workshops/navigation/ko/navigationToolButton.ts index fff0e2ac..399b9dd8 100644 --- a/src/workshops/navigation/ko/navigationToolButton.ts +++ b/src/workshops/navigation/ko/navigationToolButton.ts @@ -1,6 +1,6 @@ import { ToolButton, ViewManager, View } from "@paperbits/common/ui"; -const helpText = "

Navigation

Add or edit navigation menus.

"; +const helpText = "

Add or edit navigation menus.

"; export class NavigationToolButton implements ToolButton { public readonly iconClass: string = "paperbits-icon paperbits-menu-34"; @@ -15,6 +15,7 @@ export class NavigationToolButton implements ToolButton { const view: View = { heading: this.title, helpText: helpText, + helpArticle: "/navigation", component: { name: "navigation" } }; diff --git a/src/workshops/page/ko/pagesToolButton.ts b/src/workshops/page/ko/pagesToolButton.ts index 11ee002f..b08e8c4c 100644 --- a/src/workshops/page/ko/pagesToolButton.ts +++ b/src/workshops/page/ko/pagesToolButton.ts @@ -1,6 +1,6 @@ import { ToolButton, ViewManager, View } from "@paperbits/common/ui"; -const helpText = "

Pages

Add or edit pages of your website. Each page has a unique URL, which also automatically defines the layout it is part of.

"; +const helpText = "

Add or edit pages of your website. Each page has a unique URL, which also automatically defines the layout it is part of.

"; export class PagesToolButton implements ToolButton { public readonly iconClass: string = "paperbits-icon paperbits-menu-4"; @@ -14,7 +14,9 @@ export class PagesToolButton implements ToolButton { const view: View = { heading: this.title, + helpHeading: this.title, helpText: helpText, + helpArticle: "/pages", component: { name: "pages" } }; diff --git a/src/workshops/workshops.html b/src/workshops/workshops.html index 4d971d5c..1ccfbae8 100644 --- a/src/workshops/workshops.html +++ b/src/workshops/workshops.html @@ -28,7 +28,7 @@