@fiduswriter/frontend 0.1.71 → 0.1.73
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/css/login.css +268 -0
- package/css/show_profile.css +111 -40
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +1 -0
- package/dist/app/index.js.map +1 -1
- package/dist/common/templates.d.ts.map +1 -1
- package/dist/common/templates.js +1 -0
- package/dist/common/templates.js.map +1 -1
- package/dist/common/user_util.d.ts +8 -1
- package/dist/common/user_util.d.ts.map +1 -1
- package/dist/common/user_util.js +24 -0
- package/dist/common/user_util.js.map +1 -1
- package/dist/css/fwtoolkit/data_table.css +31 -6
- package/dist/css/fwtoolkit/dialog.css +51 -0
- package/dist/css/fwtoolkit/fwtoolkit.css +157 -26
- package/dist/css/fwtoolkit/inline_tools.css +5 -8
- package/dist/css/fwtoolkit/overview_menu.css +70 -12
- package/dist/css/login.css +268 -0
- package/dist/css/manifest.json +1 -0
- package/dist/css/show_profile.css +111 -40
- package/dist/feedback/index.d.ts.map +1 -1
- package/dist/feedback/index.js +6 -1
- package/dist/feedback/index.js.map +1 -1
- package/dist/menu/index.d.ts.map +1 -1
- package/dist/menu/index.js +16 -2
- package/dist/menu/index.js.map +1 -1
- package/dist/user/auth/login.d.ts +14 -0
- package/dist/user/auth/login.d.ts.map +1 -1
- package/dist/user/auth/login.js +253 -131
- package/dist/user/auth/login.js.map +1 -1
- package/dist/user/profile/dialog.d.ts +72 -0
- package/dist/user/profile/dialog.d.ts.map +1 -0
- package/dist/user/profile/dialog.js +436 -0
- package/dist/user/profile/dialog.js.map +1 -0
- package/dist/user/profile/dialogs.d.ts +6 -6
- package/dist/user/profile/dialogs.d.ts.map +1 -1
- package/dist/user/profile/dialogs.js +29 -14
- package/dist/user/profile/dialogs.js.map +1 -1
- package/dist/user/profile/index.d.ts +12 -14
- package/dist/user/profile/index.d.ts.map +1 -1
- package/dist/user/profile/index.js +35 -236
- package/dist/user/profile/index.js.map +1 -1
- package/dist/user/profile/templates.d.ts +14 -1
- package/dist/user/profile/templates.d.ts.map +1 -1
- package/dist/user/profile/templates.js +178 -191
- package/dist/user/profile/templates.js.map +1 -1
- package/package.json +3 -2
- package/src/app/index.ts +1 -0
- package/src/common/templates.ts +1 -0
- package/src/common/user_util.ts +26 -1
- package/src/feedback/index.ts +8 -1
- package/src/menu/index.ts +19 -2
- package/src/user/auth/login.ts +338 -153
- package/src/user/profile/dialog.ts +609 -0
- package/src/user/profile/dialogs.ts +51 -14
- package/src/user/profile/index.ts +37 -334
- package/src/user/profile/templates.ts +222 -223
|
@@ -53,214 +53,201 @@ export const changePwdDialogTemplate = ({ username }) => `<table class="ui-dialo
|
|
|
53
53
|
</form></td></tr>
|
|
54
54
|
<tr><td><span id="fw-password-change-error" class="fw-warning"></span></td></tr>
|
|
55
55
|
</tbody></table>`;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<div
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
</span>
|
|
63
|
-
<select id="edit-avatar-pulldown">
|
|
64
|
-
<option value="change">${gettext("Change picture")}</option>
|
|
65
|
-
${user.avatar ? `<option value="delete">${gettext("Delete picture")}</option>` : ""}
|
|
66
|
-
</select>
|
|
56
|
+
/** "Basics" tab: name fields, password action, 2FA and E2EE passphrase. */
|
|
57
|
+
export const profileBasicsTemplate = (user, settings = {}) => `<form>
|
|
58
|
+
<div class="profile-data-row">
|
|
59
|
+
<div class="fw-floating-field">
|
|
60
|
+
<label for="username">${gettext("Username")}</label>
|
|
61
|
+
<input type="text" name="username" id="username" placeholder=" " autocomplete="username" value="${escapeText(user.username)}" />
|
|
67
62
|
</div>
|
|
68
63
|
</div>
|
|
69
|
-
<div
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
</
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<i class="fa fa-times"></i>
|
|
99
|
-
${gettext("Disabled")}
|
|
100
|
-
</span>
|
|
101
|
-
</div>
|
|
102
|
-
<span id="setup-two-factor" class="fw-link-text" style="display: none;">
|
|
103
|
-
<i class="fa fa-shield-alt"></i>
|
|
104
|
-
${gettext("Enable 2FA")}
|
|
64
|
+
<div class="profile-data-row">
|
|
65
|
+
<div class="fw-floating-field">
|
|
66
|
+
<label for="first_name">${gettext("First name")}</label>
|
|
67
|
+
<input type="text" name="firstname" id="first_name" placeholder=" " autocomplete="given-name" value="${escapeText(user.first_name)}" />
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="profile-data-row">
|
|
71
|
+
<div class="fw-floating-field">
|
|
72
|
+
<label for="last_name">${gettext("Last name")}</label>
|
|
73
|
+
<input type="text" name="lastname" id="last_name" placeholder=" " autocomplete="family-name" value="${escapeText(user.last_name)}" />
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
<div class="profile-data-row profile-password-row">
|
|
77
|
+
<div class="fw-floating-field">
|
|
78
|
+
<label for="profile-password-display">${gettext("Password")}</label>
|
|
79
|
+
<input type="password" id="profile-password-display" value="******" autocomplete="new-password" readonly disabled />
|
|
80
|
+
</div>
|
|
81
|
+
<button type="button" id="fw-edit-profile-pwd" class="fw-profile-action-btn" title="${gettext("Change password")}" aria-label="${gettext("Change password")}">
|
|
82
|
+
<i class="fa fa-check"></i>
|
|
83
|
+
</button>
|
|
84
|
+
</div>
|
|
85
|
+
</form>
|
|
86
|
+
${settings.TWO_FACTOR_ENABLED
|
|
87
|
+
? `<div class="profile-data-row profile-switch-row">
|
|
88
|
+
<span class="form-label">${gettext("Two-Factor Authentication")}</span>
|
|
89
|
+
<div id="two-factor-status">
|
|
90
|
+
<span id="two-factor-enabled-status" style="display: none;">
|
|
91
|
+
<i class="fa fa-check"></i>
|
|
92
|
+
${gettext("Enabled")}
|
|
105
93
|
</span>
|
|
106
|
-
<span id="
|
|
107
|
-
<i class="fa fa-
|
|
108
|
-
${gettext("
|
|
94
|
+
<span id="two-factor-disabled-status" style="display: none;">
|
|
95
|
+
<i class="fa fa-times"></i>
|
|
96
|
+
${gettext("Disabled")}
|
|
109
97
|
</span>
|
|
110
|
-
</div
|
|
98
|
+
</div>
|
|
99
|
+
<div id="two-factor-switch-host"></div>
|
|
100
|
+
</div>`
|
|
111
101
|
: ""}
|
|
112
|
-
|
|
102
|
+
${settings.E2EE_MODE && settings.E2EE_MODE !== "disabled"
|
|
113
103
|
? `<div class="profile-data-row">
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
</span>
|
|
120
|
-
<span id="e2ee-passphrase-disabled-status" style="display: none;">
|
|
121
|
-
<i class="fa fa-times"></i>
|
|
122
|
-
${gettext("Not set up")}
|
|
123
|
-
</span>
|
|
124
|
-
</div>
|
|
125
|
-
<span id="setup-e2ee-passphrase" class="fw-link-text" style="display: none;">
|
|
126
|
-
<i class="fa fa-lock"></i>
|
|
127
|
-
${gettext("Set up encryption passphrase")}
|
|
128
|
-
</span>
|
|
129
|
-
<span id="change-e2ee-passphrase" class="fw-link-text" style="display: none;">
|
|
130
|
-
<i class="fa fa-pencil-alt"></i>
|
|
131
|
-
${gettext("Change passphrase")}
|
|
104
|
+
<span class="form-label">${gettext("End-to-End Encryption")}</span>
|
|
105
|
+
<div id="e2ee-passphrase-status">
|
|
106
|
+
<span id="e2ee-passphrase-enabled-status" style="display: none;">
|
|
107
|
+
<i class="fa fa-check"></i>
|
|
108
|
+
${gettext("Personal passphrase set up")}
|
|
132
109
|
</span>
|
|
133
|
-
<span id="
|
|
134
|
-
<i class="fa fa-
|
|
135
|
-
${gettext("
|
|
110
|
+
<span id="e2ee-passphrase-disabled-status" style="display: none;">
|
|
111
|
+
<i class="fa fa-times"></i>
|
|
112
|
+
${gettext("Not set up")}
|
|
136
113
|
</span>
|
|
137
|
-
</div
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
114
|
+
</div>
|
|
115
|
+
<span id="setup-e2ee-passphrase" class="fw-link-text" style="display: none;">
|
|
116
|
+
<i class="fa fa-lock"></i>
|
|
117
|
+
${gettext("Set up encryption passphrase")}
|
|
118
|
+
</span>
|
|
119
|
+
<span id="change-e2ee-passphrase" class="fw-link-text" style="display: none;">
|
|
120
|
+
<i class="fa fa-pencil-alt"></i>
|
|
121
|
+
${gettext("Change passphrase")}
|
|
122
|
+
</span>
|
|
123
|
+
<span id="recover-e2ee-passphrase" class="fw-link-text" style="display: none;">
|
|
124
|
+
<i class="fa fa-key"></i>
|
|
125
|
+
${gettext("Recover with recovery key")}
|
|
126
|
+
</span>
|
|
127
|
+
</div>`
|
|
128
|
+
: ""}`;
|
|
129
|
+
/** "Profile image" tab. */
|
|
130
|
+
export const profileAvatarTemplate = (user) => `<div id="profile-avatar">
|
|
131
|
+
${avatarTemplate({ user })}
|
|
132
|
+
<div id="avatar-pulldown-wrapper">
|
|
133
|
+
<span id="edit-avatar-btn" class="fw-link-text">
|
|
134
|
+
${gettext("Edit profile picture")}
|
|
135
|
+
</span>
|
|
136
|
+
<select id="edit-avatar-pulldown">
|
|
137
|
+
<option value="change">${gettext("Change picture")}</option>
|
|
138
|
+
${user.avatar ? `<option value="delete">${gettext("Delete picture")}</option>` : ""}
|
|
139
|
+
</select>
|
|
140
|
+
</div>
|
|
141
|
+
</div>`;
|
|
142
|
+
/** "E-mail address" tab. */
|
|
143
|
+
export const profileEmailsTemplate = (user) => `<table class="fw-data-table profile-email-table">
|
|
144
|
+
<thead class="fw-data-table-header">
|
|
145
|
+
<tr>
|
|
146
|
+
<th>${gettext("Email")}</th>
|
|
147
|
+
<th>${gettext("Primary address")}</th>
|
|
148
|
+
<th>${gettext("Verified")}</th>
|
|
149
|
+
<th> </th>
|
|
150
|
+
</tr>
|
|
151
|
+
</thead>
|
|
152
|
+
<tbody>
|
|
153
|
+
${user.emails
|
|
151
154
|
.map((email) => `<tr${email.primary ? ' class="primary-email-tr"' : ""}>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
<td class="emailaddress">${email.address}</td>
|
|
156
|
+
<td>
|
|
157
|
+
${email.verified
|
|
155
158
|
? `<input type="radio" class="primary-email-radio" value="${email.address}"
|
|
156
|
-
|
|
159
|
+
name="primaryemail"${email.primary ? " checked" : ""} />`
|
|
157
160
|
: ""}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
</td>
|
|
162
|
+
<td>
|
|
163
|
+
${email.verified ? '<i class="fa fa-check"></i>' : ""}
|
|
164
|
+
</td>
|
|
165
|
+
<td class="profile-email-action">
|
|
166
|
+
${email.primary
|
|
164
167
|
? " "
|
|
165
168
|
: `<span class="delete-email fw-link-text" data-email="${email.address}">` +
|
|
166
169
|
'<i class="fa fa-trash-alt"></i>' +
|
|
167
170
|
"</span>"}
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
</td>
|
|
172
|
+
</tr>`)
|
|
170
173
|
.join("")}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
174
|
+
<tr>
|
|
175
|
+
<td colspan="3"></td>
|
|
176
|
+
<td class="profile-email-action">
|
|
177
|
+
<span class="fw-link-text" id="add-profile-email">
|
|
178
|
+
<i class="fa fa-plus-circle"></i>
|
|
179
|
+
</span>
|
|
180
|
+
</td>
|
|
181
|
+
</tr>
|
|
182
|
+
</tbody>
|
|
183
|
+
</table>`;
|
|
184
|
+
/** "Language" tab. */
|
|
185
|
+
export const profileLanguageTemplate = (user, settings = {}) => `<div class="profile-data-row">
|
|
186
|
+
<label class="form-label" for="language">${gettext("Language")}</label>
|
|
187
|
+
<select name="language" id="language" class="entry-form dk fw-button fw-large">
|
|
188
|
+
<option value="">${gettext("Default language")}</option>
|
|
189
|
+
${(settings.LANGUAGES || [])
|
|
187
190
|
.map(([code, _name]) => `<option value="${code}" ${user.language === code ? "selected" : ""}>${langName(code)}</option>`)
|
|
188
191
|
.join("")}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
</label>
|
|
213
|
-
<p class="inline-editor-hint">${gettext("Check spelling and grammar while typing with the built-in LingoTweaker checker. It runs entirely in your browser; no external server is needed.")}</p>
|
|
214
|
-
|
|
215
|
-
</div>
|
|
216
|
-
</div>
|
|
217
|
-
${socialaccount_providers.length
|
|
218
|
-
? `<div class="profile-data-row">
|
|
219
|
-
<table class="fw-data-table profile-social-accounts-table">
|
|
220
|
-
<thead class="fw-data-table-header">
|
|
221
|
-
<tr>
|
|
222
|
-
<th>${gettext("Social Account Provider")}</th>
|
|
223
|
-
<th>${gettext("Username")}</th>
|
|
224
|
-
<th> </th>
|
|
225
|
-
</tr>
|
|
226
|
-
</thead>
|
|
227
|
-
<tbody>
|
|
228
|
-
${socialaccount_providers
|
|
229
|
-
.map((provider) => {
|
|
230
|
-
const account = user.socialaccounts.find((saccount) => saccount.provider ===
|
|
231
|
-
provider.id);
|
|
232
|
-
if (account) {
|
|
233
|
-
return `<tr>
|
|
234
|
-
<td>${escapeText(provider.name)}</td>
|
|
235
|
-
<td>${escapeText(account.name)}</td>
|
|
236
|
-
<td>
|
|
237
|
-
<span class="delete-socialaccount fw-link-text" data-socialaccount="${account.id}" data-provider="${escapeText(provider.name)}">
|
|
238
|
-
<i class="fa fa-trash-alt"></i>
|
|
239
|
-
</span>
|
|
240
|
-
</td>
|
|
241
|
-
</tr>`;
|
|
242
|
-
}
|
|
243
|
-
else {
|
|
244
|
-
return `<tr>
|
|
245
|
-
<td>${escapeText(provider.name)}</td>
|
|
246
|
-
<td> </td>
|
|
247
|
-
<td><a href="${provider.login_url}?process=connect">${gettext("Connect")}</a></td>
|
|
248
|
-
</tr>`;
|
|
249
|
-
}
|
|
250
|
-
})
|
|
251
|
-
.join("")}
|
|
252
|
-
</tbody>
|
|
253
|
-
</table>
|
|
254
|
-
</div>`
|
|
255
|
-
: ""}
|
|
256
|
-
${pluginTemplates.join("")}
|
|
257
|
-
<div id="profile-submit-wrapper">
|
|
258
|
-
<span id="submit-profile" class="fw-button fw-dark">
|
|
259
|
-
${gettext("Submit")}
|
|
260
|
-
</span>
|
|
261
|
-
<span id="delete-account" data-username="${user.username}" class="fw-button fw-orange">
|
|
262
|
-
${gettext("Delete account")}
|
|
263
|
-
</span>
|
|
264
|
-
</div>
|
|
192
|
+
</select>
|
|
193
|
+
</div>`;
|
|
194
|
+
/** "Editor" tab. */
|
|
195
|
+
export const profileEditorTemplate = (user) => `<div class="profile-editor-settings">
|
|
196
|
+
<label class="checkable-label">
|
|
197
|
+
<input type="checkbox" id="inline-references" ${user.preferences?.inline_references ? "checked" : ""} />
|
|
198
|
+
${gettext("Enable inline reference typing (@)")}
|
|
199
|
+
</label>
|
|
200
|
+
<p class="inline-editor-hint">${gettext("Type @ in the editor to insert a citation or cross-reference:")}</p>
|
|
201
|
+
<ul class="inline-editor-hint">
|
|
202
|
+
<li>${gettext("Citation: @entry_key – optional suffix: @entry_key[prefix][locator]. Textual citation: @@entry_key. Multiple sources: @key1;key2")}</li>
|
|
203
|
+
<li>${gettext("Cross-reference: @#target-id")}</li>
|
|
204
|
+
</ul>
|
|
205
|
+
<label class="checkable-label">
|
|
206
|
+
<input type="checkbox" id="inline-math" ${user.preferences?.inline_math ? "checked" : ""} />
|
|
207
|
+
${gettext("Enable inline math typing ($)")}
|
|
208
|
+
</label>
|
|
209
|
+
<p class="inline-editor-hint">${gettext("Type $ in the editor followed by LaTeX math to insert an equation inline, e.g. $x^2. Press Enter or Tab to confirm.")}</p>
|
|
210
|
+
<label class="checkable-label">
|
|
211
|
+
<input type="checkbox" id="grammar-check-continuous" ${user.preferences?.grammar_check_continuous ? "checked" : ""} />
|
|
212
|
+
${gettext("Continuous spell and grammar checking")}
|
|
213
|
+
</label>
|
|
214
|
+
<p class="inline-editor-hint">${gettext("Check spelling and grammar while typing with the built-in LingoTweaker checker. It runs entirely in your browser; no external server is needed.")}</p>
|
|
265
215
|
</div>`;
|
|
216
|
+
/** "Social account providers" tab. */
|
|
217
|
+
export const profileSocialAccountsTemplate = (user, socialaccount_providers) => `<table class="fw-data-table profile-social-accounts-table">
|
|
218
|
+
<thead class="fw-data-table-header">
|
|
219
|
+
<tr>
|
|
220
|
+
<th>${gettext("Social Account Provider")}</th>
|
|
221
|
+
<th>${gettext("Username")}</th>
|
|
222
|
+
<th> </th>
|
|
223
|
+
</tr>
|
|
224
|
+
</thead>
|
|
225
|
+
<tbody>
|
|
226
|
+
${socialaccount_providers
|
|
227
|
+
.map((provider) => {
|
|
228
|
+
const account = user.socialaccounts.find((saccount) => saccount.provider === provider.id);
|
|
229
|
+
if (account) {
|
|
230
|
+
return `<tr>
|
|
231
|
+
<td>${escapeText(provider.name)}</td>
|
|
232
|
+
<td>${escapeText(account.name)}</td>
|
|
233
|
+
<td>
|
|
234
|
+
<span class="delete-socialaccount fw-link-text" data-socialaccount="${account.id}" data-provider="${escapeText(provider.name)}">
|
|
235
|
+
<i class="fa fa-trash-alt"></i>
|
|
236
|
+
</span>
|
|
237
|
+
</td>
|
|
238
|
+
</tr>`;
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
return `<tr>
|
|
242
|
+
<td>${escapeText(provider.name)}</td>
|
|
243
|
+
<td> </td>
|
|
244
|
+
<td><a href="${provider.login_url}?process=connect">${gettext("Connect")}</a></td>
|
|
245
|
+
</tr>`;
|
|
246
|
+
}
|
|
247
|
+
})
|
|
248
|
+
.join("")}
|
|
249
|
+
</tbody>
|
|
250
|
+
</table>`;
|
|
251
|
+
/** Tab containing plugin-provided profile content. */
|
|
252
|
+
export const profilePluginTemplate = (pluginTemplates) => pluginTemplates.join("");
|
|
266
253
|
//# sourceMappingURL=templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/user/profile/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAA;AAE9D,2DAA2D;AAC3D,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAW,EAAE,CACpD,MAAM,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAA;AAE7C,4CAA4C;AAC5C,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAW,EAAE,CACnD;UACM,OAAO,CAAC,eAAe,CAAC;;wEAEsC,CAAA;AAExE,uEAAuE;AACvE,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAW,EAAE,CACjD;UACM,OAAO,CAAC,iEAAiE,CAAC;;;UAG1E,OAAO,CAAC,2FAA2F,CAAC;;;UAGpG,OAAO,CAAC,wCAAwC,CAAC;;;UAGjD,OAAO,CAAC,kIAAkI,CAAC;;;qEAGhF,OAAO,CAAC,UAAU,CAAC;wFACA,O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sDAAsD;AACtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,eAAyB,EAAU,EAAE,CACvE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiduswriter/frontend",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.73",
|
|
4
4
|
"description": "Fidus Writer-specific shared utilities and UI chrome",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fiduswriter",
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
"@fiduswriter/image-manager": "^0.1.31",
|
|
217
217
|
"downloadjs": "^1.4.7",
|
|
218
218
|
"fast-deep-equal": "^3.1.3",
|
|
219
|
-
"fwtoolkit": "^1.0.
|
|
219
|
+
"fwtoolkit": "^1.0.11",
|
|
220
220
|
"jszip": "^3.10.1",
|
|
221
221
|
"prosemirror-history": "^1.3.2",
|
|
222
222
|
"prosemirror-keymap": "^1.2.2",
|
|
@@ -286,6 +286,7 @@
|
|
|
286
286
|
"admin.css",
|
|
287
287
|
"flatpage.css",
|
|
288
288
|
"prelogin.css",
|
|
289
|
+
"login.css",
|
|
289
290
|
"document_overview.css",
|
|
290
291
|
"document_template_admin.css",
|
|
291
292
|
"show_profile.css",
|
package/src/app/index.ts
CHANGED
|
@@ -161,6 +161,7 @@ export class App {
|
|
|
161
161
|
this.config.goTo = (url: string) => this.goTo(url)
|
|
162
162
|
this.config.menuPlugins = this.menuPlugins
|
|
163
163
|
this.config.documentsOverviewPlugins = this.documentsOverviewPlugins
|
|
164
|
+
this.config.profilePlugins = this.profilePlugins
|
|
164
165
|
this.config.apiConnectors = this.apiConnectors
|
|
165
166
|
|
|
166
167
|
this.routes = {
|
package/src/common/templates.ts
CHANGED
|
@@ -43,6 +43,7 @@ export const baseBodyTemplate = ({
|
|
|
43
43
|
</div><!-- end container -->
|
|
44
44
|
</header>
|
|
45
45
|
<div class="fw-contents-outer">
|
|
46
|
+
${hasOverview ? '<div class="fw-overview-search-wrapper"><ul id="fw-overview-search"></ul></div>' : ""}
|
|
46
47
|
<div class="fw-contents">
|
|
47
48
|
${contents}
|
|
48
49
|
</div>
|
package/src/common/user_util.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {avatarTemplate, escapeText} from "fwtoolkit"
|
|
2
|
+
import type {Email, FrontendApp} from "../types.js"
|
|
2
3
|
|
|
3
4
|
/** Pick the primary email address from a list of email objects.
|
|
4
5
|
* Falls back to the first address if no primary is marked.
|
|
@@ -14,3 +15,27 @@ export const filterPrimaryEmail = (emails: Email[]): string => {
|
|
|
14
15
|
}
|
|
15
16
|
return primaryEmails[0].address
|
|
16
17
|
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Refresh the header user area (avatar button and the preferences pulldown's
|
|
21
|
+
* avatar card) in place after profile/avatar changes. This avoids a full page
|
|
22
|
+
* re-render, which would tear down any dialog (e.g. the profile dialog) open
|
|
23
|
+
* over the page.
|
|
24
|
+
*/
|
|
25
|
+
export const refreshUserChrome = (app: FrontendApp): void => {
|
|
26
|
+
const user = app.user
|
|
27
|
+
if (!user) {
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
const preferencesBtn = document.getElementById("preferences-btn")
|
|
31
|
+
if (preferencesBtn) {
|
|
32
|
+
preferencesBtn.innerHTML = avatarTemplate({user})
|
|
33
|
+
}
|
|
34
|
+
const avatarCard = document.querySelector(".fw-avatar-card")
|
|
35
|
+
if (avatarCard) {
|
|
36
|
+
avatarCard.innerHTML =
|
|
37
|
+
`<span class='fw-avatar-card-avatar'>${avatarTemplate({user})}</span>` +
|
|
38
|
+
`<span class='fw-avatar-card-name'>${escapeText(user.username)}` +
|
|
39
|
+
`<span class='fw-avatar-card-email'>${escapeText(filterPrimaryEmail(user.emails))}</span></span>`
|
|
40
|
+
}
|
|
41
|
+
}
|
package/src/feedback/index.ts
CHANGED
|
@@ -43,16 +43,23 @@ export class FeedbackTab {
|
|
|
43
43
|
)
|
|
44
44
|
|
|
45
45
|
// Design 5: on overview pages the feedback opener is a blue circle
|
|
46
|
-
// button in the header, left of the user preferences.
|
|
46
|
+
// button in the header, left of the user preferences. The login page
|
|
47
|
+
// has no header, so the circle is placed fixed in the top right corner.
|
|
47
48
|
const userPreferences = document.querySelector(
|
|
48
49
|
".fw-header:not(.prelogin) #user-preferences"
|
|
49
50
|
)
|
|
51
|
+
const loginPage = document.querySelector(".fw-login-page")
|
|
50
52
|
|
|
51
53
|
if (userPreferences) {
|
|
52
54
|
userPreferences.insertAdjacentHTML(
|
|
53
55
|
"beforebegin",
|
|
54
56
|
`<button type="button" class="feedback-btn feedback-open" aria-label="${gettext("Technical support")}" title="${gettext("Technical support")}"></button>`
|
|
55
57
|
)
|
|
58
|
+
} else if (loginPage) {
|
|
59
|
+
loginPage.insertAdjacentHTML(
|
|
60
|
+
"beforeend",
|
|
61
|
+
`<button type="button" class="feedback-btn feedback-open" aria-label="${gettext("Technical support")}" title="${gettext("Technical support")}"></button>`
|
|
62
|
+
)
|
|
56
63
|
} else {
|
|
57
64
|
let headerNavWrapper = document.querySelector(
|
|
58
65
|
"#footer-menu.prelogin .fw-container"
|
package/src/menu/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {keyName} from "w3c-keyname"
|
|
|
2
2
|
|
|
3
3
|
import {dropdownSelect, ensureCSS, NavigationDrawer, whenReady} from "fwtoolkit"
|
|
4
4
|
import {siteMenuDrawerTemplate} from "./templates.js"
|
|
5
|
+
import {ProfileDialog} from "../user/profile/dialog.js"
|
|
5
6
|
import type {FrontendApp, MenuPlugins, NavItem, SiteMenuLike} from "../types.js"
|
|
6
7
|
|
|
7
8
|
// Site navigation on overview pages (Design 5): a menu button in the header
|
|
@@ -171,9 +172,25 @@ export class SiteMenu implements SiteMenuLike {
|
|
|
171
172
|
button,
|
|
172
173
|
onChange: value => {
|
|
173
174
|
switch (value) {
|
|
174
|
-
case "profile":
|
|
175
|
-
|
|
175
|
+
case "profile": {
|
|
176
|
+
// The menu is constructed with either the App or a
|
|
177
|
+
// config object depending on the page; both expose a
|
|
178
|
+
// `config` (App) or are a config (which carries user +
|
|
179
|
+
// profilePlugins) that the dialog needs.
|
|
180
|
+
const appAny = this.app as any
|
|
181
|
+
const config: FrontendApp =
|
|
182
|
+
(appAny.user ? this.app : appAny.config) as FrontendApp
|
|
183
|
+
const profileDialog = new ProfileDialog({
|
|
184
|
+
app: config,
|
|
185
|
+
user: config.user as any,
|
|
186
|
+
socialaccount_providers:
|
|
187
|
+
config.socialaccount_providers ?? [],
|
|
188
|
+
profilePlugins:
|
|
189
|
+
(config.profilePlugins as any) ?? []
|
|
190
|
+
})
|
|
191
|
+
profileDialog.open()
|
|
176
192
|
break
|
|
193
|
+
}
|
|
177
194
|
case "contacts":
|
|
178
195
|
this.app.goTo("/user/contacts/")
|
|
179
196
|
break
|