Skip to content

Commit 72a221a

Browse files
committed
Added help center handlers.
1 parent 5eebdaf commit 72a221a

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

src/editing/widgetContext.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ export interface WidgetContext {
5252
*/
5353
openWidgetEditor: () => void;
5454

55+
/**
56+
* Opens help center with specified article key.
57+
*/
58+
openHelpCenter: (articleKey: string) => void;
59+
5560
/**
5661
* Deletes selected widget.
5762
*/

src/objects.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ export function cleanupObject(source: object, options?: CleanupOptions): void {
135135
}
136136
}
137137
else if (childNode instanceof Object) {
138+
if (childNode === source) {
139+
console.log(`Ciruclar reference: `, source);
140+
throw new Error(`Ciruclar reference detected. See the message above.`);
141+
}
142+
138143
cleanupObject(childNode, options);
139144

140145
if (Object.keys(childNode).length === 0) {

src/tutorials/defaultHelpService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ const defaultHelpCenterUrl = `https://help.paperbits.io`;
44

55
export class DefaultHelpService implements HelpService {
66
public async getHelpContent(articleKey: string): Promise<string> {
7-
return `<iframe class="host" src="${defaultHelpCenterUrl}/${articleKey}"></iframe>`;
7+
return `<iframe class="host" src="${defaultHelpCenterUrl}${articleKey}"></iframe>`;
88
}
99
}

src/ui/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function openHelpArticleCommand(context: WidgetContext, articleKey: strin
4646
iconClass: "paperbits-icon paperbits-c-question",
4747
position: "top right",
4848
callback: () => {
49-
//
49+
context.openHelpCenter(articleKey);
5050
}
5151
}
5252
}

src/ui/view.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@ export interface View {
1717
*/
1818
component?: IComponent;
1919

20+
/**
21+
* Help heading.
22+
*/
23+
helpHeading?: string;
24+
2025
/**
2126
* Help text.
2227
*/
2328
helpText?: string;
2429

30+
helpArticle?: string;
31+
2532
/**
2633
* Host element.
2734
*/

0 commit comments

Comments
 (0)