@salesforcedevs/docs-components 1.17.2 → 1.17.5-edit
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lwc.config.json +1 -0
- package/package.json +2 -2
- package/src/modules/doc/markdownEditor/markdownEditor.css +225 -0
- package/src/modules/doc/markdownEditor/markdownEditor.html +80 -0
- package/src/modules/doc/markdownEditor/markdownEditor.ts +148 -0
- package/src/modules/doc/xmlContent/xmlContent.html +1 -9
- package/src/modules/doc/xmlContent/xmlContent.ts +8 -18
- package/LICENSE +0 -12
package/lwc.config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.5-edit",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"@types/lodash.orderby": "4.6.9",
|
|
26
26
|
"@types/lodash.uniqby": "4.7.9"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
|
|
29
29
|
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
.markdown-editor {
|
|
2
|
+
border: 1px solid #e1e5e9;
|
|
3
|
+
border-radius: 4px;
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
background: #fff;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* Editor Toolbar */
|
|
9
|
+
.editor-toolbar {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: flex-end;
|
|
13
|
+
gap: 0.5rem;
|
|
14
|
+
padding: 0.75rem 1rem;
|
|
15
|
+
background: #f8f9fa;
|
|
16
|
+
border-bottom: 1px solid #e1e5e9;
|
|
17
|
+
flex-wrap: wrap;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.edit-button,
|
|
21
|
+
.cancel-button,
|
|
22
|
+
.save-button {
|
|
23
|
+
min-width: 80px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.status-indicator {
|
|
27
|
+
margin-left: 0.5rem;
|
|
28
|
+
font-size: 0.875rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.status-saving {
|
|
32
|
+
color: #0176d3;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.status-success {
|
|
36
|
+
color: #04844b;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.status-error {
|
|
40
|
+
color: #ea001e;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Content Viewer */
|
|
44
|
+
.content-viewer {
|
|
45
|
+
padding: 1rem;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.content-display {
|
|
49
|
+
line-height: 1.6;
|
|
50
|
+
color: #3e3e3c;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.content-display h1,
|
|
54
|
+
.content-display h2,
|
|
55
|
+
.content-display h3,
|
|
56
|
+
.content-display h4,
|
|
57
|
+
.content-display h5,
|
|
58
|
+
.content-display h6 {
|
|
59
|
+
margin-top: 1.5rem;
|
|
60
|
+
margin-bottom: 0.5rem;
|
|
61
|
+
color: #181818;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.content-display p {
|
|
65
|
+
margin-bottom: 1rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.content-display ul,
|
|
69
|
+
.content-display ol {
|
|
70
|
+
margin-bottom: 1rem;
|
|
71
|
+
padding-left: 2rem;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.content-display code {
|
|
75
|
+
background-color: #f3f2f2;
|
|
76
|
+
padding: 0.125rem 0.25rem;
|
|
77
|
+
border-radius: 0.25rem;
|
|
78
|
+
font-family: Monaco, Menlo, "Ubuntu Mono", monospace;
|
|
79
|
+
font-size: 0.875rem;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.content-display pre {
|
|
83
|
+
background-color: #f3f2f2;
|
|
84
|
+
padding: 1rem;
|
|
85
|
+
border-radius: 0.25rem;
|
|
86
|
+
overflow-x: auto;
|
|
87
|
+
margin-bottom: 1rem;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.content-display pre code {
|
|
91
|
+
background-color: transparent;
|
|
92
|
+
padding: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* HTML Content Styling */
|
|
96
|
+
.html-content {
|
|
97
|
+
line-height: 1.6;
|
|
98
|
+
color: #3e3e3c;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.html-content h1,
|
|
102
|
+
.html-content h2,
|
|
103
|
+
.html-content h3,
|
|
104
|
+
.html-content h4,
|
|
105
|
+
.html-content h5,
|
|
106
|
+
.html-content h6 {
|
|
107
|
+
margin-top: 1.5rem;
|
|
108
|
+
margin-bottom: 0.5rem;
|
|
109
|
+
color: #181818;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.html-content p {
|
|
113
|
+
margin-bottom: 1rem;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.html-content ul,
|
|
117
|
+
.html-content ol {
|
|
118
|
+
margin-bottom: 1rem;
|
|
119
|
+
padding-left: 2rem;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.html-content code {
|
|
123
|
+
background-color: #f3f2f2;
|
|
124
|
+
padding: 0.125rem 0.25rem;
|
|
125
|
+
border-radius: 0.25rem;
|
|
126
|
+
font-family: Monaco, Menlo, "Ubuntu Mono", monospace;
|
|
127
|
+
font-size: 0.875rem;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.html-content pre {
|
|
131
|
+
background-color: #f3f2f2;
|
|
132
|
+
padding: 1rem;
|
|
133
|
+
border-radius: 0.25rem;
|
|
134
|
+
overflow-x: auto;
|
|
135
|
+
margin-bottom: 1rem;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.html-content pre code {
|
|
139
|
+
background-color: transparent;
|
|
140
|
+
padding: 0;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* No Content Message */
|
|
144
|
+
.no-content {
|
|
145
|
+
color: #706e6b;
|
|
146
|
+
font-style: italic;
|
|
147
|
+
text-align: center;
|
|
148
|
+
padding: 2rem;
|
|
149
|
+
background-color: #f8f9fa;
|
|
150
|
+
border: 1px dashed #e1e5e9;
|
|
151
|
+
border-radius: 4px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/* Editor Wrapper */
|
|
155
|
+
.editor-wrapper {
|
|
156
|
+
position: relative;
|
|
157
|
+
min-height: 300px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.simple-editor {
|
|
161
|
+
width: 100%;
|
|
162
|
+
min-height: 300px;
|
|
163
|
+
padding: 1rem;
|
|
164
|
+
border: none;
|
|
165
|
+
outline: none;
|
|
166
|
+
font-family: Monaco, Menlo, "Ubuntu Mono", monospace;
|
|
167
|
+
font-size: 0.875rem;
|
|
168
|
+
line-height: 1.5;
|
|
169
|
+
resize: vertical;
|
|
170
|
+
background: #fff;
|
|
171
|
+
color: #3e3e3c;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.simple-editor:focus {
|
|
175
|
+
outline: none;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.simple-editor::placeholder {
|
|
179
|
+
color: #706e6b;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* Loading Overlay */
|
|
183
|
+
.loading-overlay {
|
|
184
|
+
position: absolute;
|
|
185
|
+
top: 0;
|
|
186
|
+
left: 0;
|
|
187
|
+
right: 0;
|
|
188
|
+
bottom: 0;
|
|
189
|
+
background: rgb(255 255 255 / 80%);
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
justify-content: center;
|
|
193
|
+
z-index: 1000;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Responsive Design */
|
|
197
|
+
@media (max-width: 768px) {
|
|
198
|
+
.editor-toolbar {
|
|
199
|
+
flex-wrap: wrap;
|
|
200
|
+
gap: 0.25rem;
|
|
201
|
+
justify-content: flex-end;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.status-indicator {
|
|
205
|
+
margin-left: 0.25rem;
|
|
206
|
+
width: auto;
|
|
207
|
+
text-align: right;
|
|
208
|
+
margin-top: 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.simple-editor {
|
|
212
|
+
min-height: 250px;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.content-viewer {
|
|
216
|
+
padding: 0.75rem;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/* Empty state */
|
|
221
|
+
.content-display:empty::before {
|
|
222
|
+
content: "No content to display";
|
|
223
|
+
color: #706e6b;
|
|
224
|
+
font-style: italic;
|
|
225
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="markdown-editor">
|
|
3
|
+
<!-- Editor Toolbar -->
|
|
4
|
+
<div class="editor-toolbar">
|
|
5
|
+
<template if:true={showViewer}>
|
|
6
|
+
<dx-button
|
|
7
|
+
onclick={handleEdit}
|
|
8
|
+
variant="tertiary"
|
|
9
|
+
class="edit-button"
|
|
10
|
+
>
|
|
11
|
+
Edit Content
|
|
12
|
+
</dx-button>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<template if:true={showEditor}>
|
|
16
|
+
<dx-button
|
|
17
|
+
onclick={handleCancel}
|
|
18
|
+
variant="secondary"
|
|
19
|
+
class="cancel-button"
|
|
20
|
+
>
|
|
21
|
+
Cancel
|
|
22
|
+
</dx-button>
|
|
23
|
+
|
|
24
|
+
<dx-button
|
|
25
|
+
onclick={handleSave}
|
|
26
|
+
variant="primary"
|
|
27
|
+
disabled={saveButtonDisabled}
|
|
28
|
+
class="save-button"
|
|
29
|
+
>
|
|
30
|
+
Save
|
|
31
|
+
</dx-button>
|
|
32
|
+
|
|
33
|
+
<div class="status-indicator">
|
|
34
|
+
<span class={statusClass}>{statusMessage}</span>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<!-- Content Viewer (Read-only) -->
|
|
40
|
+
<template if:true={showViewer}>
|
|
41
|
+
<div class="content-viewer">
|
|
42
|
+
<div class="content-display">
|
|
43
|
+
<!-- Show HTML content if provided -->
|
|
44
|
+
<template if:true={hasHtmlContent}>
|
|
45
|
+
<div class="html-content" innerhtml={htmlContent}></div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<!-- Show message if no HTML content -->
|
|
49
|
+
<template if:false={hasHtmlContent}>
|
|
50
|
+
<div class="no-content">
|
|
51
|
+
No content to display. Click 'Edit Content' to fetch from the backend.
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<!-- Simple Editor -->
|
|
59
|
+
<template if:true={showEditor}>
|
|
60
|
+
<div class="editor-wrapper">
|
|
61
|
+
<textarea
|
|
62
|
+
class="simple-editor"
|
|
63
|
+
value={editorContent}
|
|
64
|
+
onchange={handleContentChange}
|
|
65
|
+
placeholder="Content will be loaded from the fetch URL..."
|
|
66
|
+
></textarea>
|
|
67
|
+
</div>
|
|
68
|
+
</template>
|
|
69
|
+
|
|
70
|
+
<!-- Loading Overlay -->
|
|
71
|
+
<template if:true={isLoading}>
|
|
72
|
+
<div class="loading-overlay">
|
|
73
|
+
<dx-spinner
|
|
74
|
+
size="medium"
|
|
75
|
+
alternative-text="Loading"
|
|
76
|
+
></dx-spinner>
|
|
77
|
+
</div>
|
|
78
|
+
</template>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { LightningElement, api, track } from "lwc";
|
|
2
|
+
|
|
3
|
+
export default class MarkdownEditor extends LightningElement {
|
|
4
|
+
@api fetchUrl: string = "";
|
|
5
|
+
@api saveUrl: string = "";
|
|
6
|
+
@api filePath: string = "";
|
|
7
|
+
@api htmlContent: string = "";
|
|
8
|
+
|
|
9
|
+
@track isEditing: boolean = false;
|
|
10
|
+
@track editorContent: string = "";
|
|
11
|
+
@track isLoading: boolean = false;
|
|
12
|
+
@track saveStatus: "idle" | "saving" | "success" | "error" = "idle";
|
|
13
|
+
|
|
14
|
+
// Event Handlers
|
|
15
|
+
async handleEdit() {
|
|
16
|
+
if (!this.fetchUrl) {
|
|
17
|
+
console.error("Fetch URL not configured");
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
this.isLoading = true;
|
|
22
|
+
this.saveStatus = "idle";
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const response = await fetch(this.fetchUrl, {
|
|
26
|
+
method: "GET",
|
|
27
|
+
headers: {
|
|
28
|
+
"Content-Type": "application/json"
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
if (response.ok) {
|
|
33
|
+
const data = await response.json();
|
|
34
|
+
this.editorContent = data.content || data.text || data.body || "";
|
|
35
|
+
this.isEditing = true;
|
|
36
|
+
} else {
|
|
37
|
+
throw new Error(`Failed to fetch content: ${response.status}`);
|
|
38
|
+
}
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error("Failed to fetch content:", error);
|
|
41
|
+
this.saveStatus = "error";
|
|
42
|
+
} finally {
|
|
43
|
+
this.isLoading = false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
handleCancel() {
|
|
48
|
+
this.isEditing = false;
|
|
49
|
+
this.saveStatus = "idle";
|
|
50
|
+
this.editorContent = "";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
handleContentChange(event: Event) {
|
|
54
|
+
const target = event.target as HTMLTextAreaElement;
|
|
55
|
+
this.editorContent = target.value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async handleSave() {
|
|
59
|
+
if (!this.saveUrl) {
|
|
60
|
+
console.error("Save URL not configured");
|
|
61
|
+
this.saveStatus = "error";
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this.saveStatus = "saving";
|
|
66
|
+
this.isLoading = true;
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
const response = await fetch(this.saveUrl, {
|
|
70
|
+
method: "POST",
|
|
71
|
+
headers: {
|
|
72
|
+
"Content-Type": "application/json"
|
|
73
|
+
},
|
|
74
|
+
body: JSON.stringify({
|
|
75
|
+
content: this.editorContent,
|
|
76
|
+
filePath: this.filePath
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (response.ok) {
|
|
81
|
+
this.saveStatus = "success";
|
|
82
|
+
this.isEditing = false;
|
|
83
|
+
this.editorContent = "";
|
|
84
|
+
|
|
85
|
+
// Dispatch save success event
|
|
86
|
+
this.dispatchEvent(
|
|
87
|
+
new CustomEvent("saved", {
|
|
88
|
+
detail: {
|
|
89
|
+
success: true,
|
|
90
|
+
content: this.editorContent,
|
|
91
|
+
filePath: this.filePath
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
);
|
|
95
|
+
} else {
|
|
96
|
+
throw new Error(`Save failed: ${response.status}`);
|
|
97
|
+
}
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.error("Save failed:", error);
|
|
100
|
+
this.saveStatus = "error";
|
|
101
|
+
} finally {
|
|
102
|
+
this.isLoading = false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Getters for UI state
|
|
107
|
+
get showEditor() {
|
|
108
|
+
return this.isEditing;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
get showViewer() {
|
|
112
|
+
return !this.isEditing;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
get saveButtonDisabled() {
|
|
116
|
+
return this.saveStatus === "saving" || this.isLoading || !this.editorContent.trim();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
get statusMessage() {
|
|
120
|
+
switch (this.saveStatus) {
|
|
121
|
+
case "saving":
|
|
122
|
+
return "Saving...";
|
|
123
|
+
case "success":
|
|
124
|
+
return "Saved successfully!";
|
|
125
|
+
case "error":
|
|
126
|
+
return "Save failed. Please try again.";
|
|
127
|
+
default:
|
|
128
|
+
return "";
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
get statusClass() {
|
|
133
|
+
switch (this.saveStatus) {
|
|
134
|
+
case "saving":
|
|
135
|
+
return "status-saving";
|
|
136
|
+
case "success":
|
|
137
|
+
return "status-success";
|
|
138
|
+
case "error":
|
|
139
|
+
return "status-error";
|
|
140
|
+
default:
|
|
141
|
+
return "";
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
get hasHtmlContent() {
|
|
146
|
+
return this.htmlContent && this.htmlContent.trim().length > 0;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<doc-content-layout
|
|
3
|
-
lwc:if={
|
|
3
|
+
lwc:if={loaded}
|
|
4
4
|
lwc:ref="docContentLayout"
|
|
5
5
|
coveo-organization-id={coveoOrganizationId}
|
|
6
6
|
coveo-public-access-token={coveoPublicAccessToken}
|
|
@@ -49,12 +49,4 @@
|
|
|
49
49
|
onnavclick={handleNavClick}
|
|
50
50
|
></doc-content>
|
|
51
51
|
</doc-content-layout>
|
|
52
|
-
<div lwc:if={display404}>
|
|
53
|
-
<dx-error
|
|
54
|
-
image="https://a.sfdcstatic.com/developer-website/images/404.svg"
|
|
55
|
-
code="404"
|
|
56
|
-
header="Beep boop. That did not compute."
|
|
57
|
-
subtitle="The document you're looking for doesn't seem to exist."
|
|
58
|
-
></dx-error>
|
|
59
|
-
</div>
|
|
60
52
|
</template>
|
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
SiderbarFooter,
|
|
12
12
|
HistoryState,
|
|
13
13
|
PageReference,
|
|
14
|
-
TocMap
|
|
15
|
-
ContentData
|
|
14
|
+
TocMap
|
|
16
15
|
} from "./types";
|
|
17
16
|
import { SearchSyncer } from "docUtils/searchSyncer";
|
|
18
17
|
import { LightningElementWithState } from "dxBaseElements/lightningElementWithState";
|
|
@@ -73,8 +72,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
73
72
|
private contentProvider?: FetchContent;
|
|
74
73
|
private docContent = "";
|
|
75
74
|
private language?: DocLanguage | null = null;
|
|
76
|
-
private
|
|
77
|
-
private display404 = false;
|
|
75
|
+
private loaded = false;
|
|
78
76
|
private _pageHeader?: Header;
|
|
79
77
|
private pdfUrl = "";
|
|
80
78
|
private tocMap: TocMap = {};
|
|
@@ -187,13 +185,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
187
185
|
this.apiDomain,
|
|
188
186
|
this.allLanguages
|
|
189
187
|
);
|
|
190
|
-
this.fetchDocument().then((
|
|
191
|
-
if (content) {
|
|
192
|
-
this.displayContent = true;
|
|
193
|
-
} else {
|
|
194
|
-
this.display404 = true;
|
|
195
|
-
}
|
|
196
|
-
});
|
|
188
|
+
this.fetchDocument().then(() => (this.loaded = true));
|
|
197
189
|
window.addEventListener("popstate", this.handlePopState);
|
|
198
190
|
|
|
199
191
|
this.searchSyncer.init();
|
|
@@ -471,7 +463,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
471
463
|
);
|
|
472
464
|
}
|
|
473
465
|
|
|
474
|
-
async fetchDocument(): Promise<
|
|
466
|
+
async fetchDocument(): Promise<void> {
|
|
475
467
|
this.setState({
|
|
476
468
|
isFetchingDocument: true
|
|
477
469
|
});
|
|
@@ -485,7 +477,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
485
477
|
this.setState({
|
|
486
478
|
isFetchingDocument: false
|
|
487
479
|
});
|
|
488
|
-
return
|
|
480
|
+
return;
|
|
489
481
|
}
|
|
490
482
|
|
|
491
483
|
this.docTitle = data.docTitle;
|
|
@@ -517,11 +509,11 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
517
509
|
data.id
|
|
518
510
|
) {
|
|
519
511
|
try {
|
|
520
|
-
|
|
512
|
+
await this.fetchContent();
|
|
521
513
|
this.setState({
|
|
522
514
|
isFetchingDocument: false
|
|
523
515
|
});
|
|
524
|
-
return
|
|
516
|
+
return;
|
|
525
517
|
} catch (error) {
|
|
526
518
|
this.pageReference.contentDocumentId = `${data.id}.htm`;
|
|
527
519
|
this.pageReference.hash = "";
|
|
@@ -535,10 +527,9 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
535
527
|
this.setState({
|
|
536
528
|
isFetchingDocument: false
|
|
537
529
|
});
|
|
538
|
-
return data.content;
|
|
539
530
|
}
|
|
540
531
|
|
|
541
|
-
async fetchContent(): Promise<
|
|
532
|
+
async fetchContent(): Promise<void> {
|
|
542
533
|
this.setState({
|
|
543
534
|
isFetchingContent: true
|
|
544
535
|
});
|
|
@@ -562,7 +553,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
562
553
|
this.setState({
|
|
563
554
|
isFetchingContent: false
|
|
564
555
|
});
|
|
565
|
-
return data;
|
|
566
556
|
}
|
|
567
557
|
|
|
568
558
|
updateHeaderAndSidebarFooter(): void {
|
package/LICENSE
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
-
|
|
6
|
-
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
-
|
|
8
|
-
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
-
|
|
10
|
-
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
-
|
|
12
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|