nodebb-plugin-composer-default 10.0.22 → 10.0.24
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/package.json +1 -1
- package/static/lib/composer/drafts.js +7 -0
- package/static/lib/composer/preview.js +7 -6
- package/static/lib/composer.js +1 -1
- package/static/templates/composer.tpl +1 -1
- package/static/templates/partials/composer-formatting.tpl +22 -19
- package/static/templates/partials/composer-title-container.tpl +4 -4
package/package.json
CHANGED
|
@@ -5,7 +5,14 @@ define('composer/drafts', ['api', 'alerts'], function (api, alerts) {
|
|
|
5
5
|
const draftSaveDelay = 1000;
|
|
6
6
|
drafts.init = function (postContainer, postData) {
|
|
7
7
|
const draftIconEl = postContainer.find('.draft-icon');
|
|
8
|
+
const uuid = postContainer.attr('data-uuid');
|
|
8
9
|
function doSaveDraft() {
|
|
10
|
+
// check if composer is still around,
|
|
11
|
+
// it might have been gone by the time this timeout triggers
|
|
12
|
+
if (!$(`[component="composer"][data-uuid="${uuid}"]`).length) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
if (!postData.save_id) {
|
|
10
17
|
postData.save_id = utils.generateSaveId(app.user.uid);
|
|
11
18
|
}
|
|
@@ -48,6 +48,8 @@ define('composer/preview', ['hooks'], function (hooks) {
|
|
|
48
48
|
|
|
49
49
|
const isMobile = ['xs', 'sm'].includes(utils.findBootstrapEnvironment());
|
|
50
50
|
const toggler = postContainer.querySelector('.formatting-bar [data-action="preview"]');
|
|
51
|
+
const showText = toggler.querySelector('.show-text');
|
|
52
|
+
const hideText = toggler.querySelector('.hide-text');
|
|
51
53
|
let show = localStorage.getItem('composer:previewToggled') || (preview.env === 'xs' || preview.env === 'sm');
|
|
52
54
|
const previewContainer = postContainer.querySelector('.preview-container');
|
|
53
55
|
const writeContainer = postContainer.querySelector('.write-container');
|
|
@@ -64,11 +66,6 @@ define('composer/preview', ['hooks'], function (hooks) {
|
|
|
64
66
|
previewContainer.classList.toggle('d-flex', show);
|
|
65
67
|
writeContainer.classList.toggle('d-flex', !show);
|
|
66
68
|
writeContainer.classList.toggle('d-none', show);
|
|
67
|
-
|
|
68
|
-
// Render preview once on mobile
|
|
69
|
-
if (show) {
|
|
70
|
-
preview.render($postContainer);
|
|
71
|
-
}
|
|
72
69
|
} else {
|
|
73
70
|
previewContainer.classList.toggle('hide', !show);
|
|
74
71
|
writeContainer.classList.toggle('w-50', show);
|
|
@@ -76,7 +73,11 @@ define('composer/preview', ['hooks'], function (hooks) {
|
|
|
76
73
|
|
|
77
74
|
localStorage[show ? 'removeItem' : 'setItem']('composer:previewToggled', true);
|
|
78
75
|
}
|
|
79
|
-
|
|
76
|
+
showText.classList.toggle('hide', show);
|
|
77
|
+
hideText.classList.toggle('hide', !show);
|
|
78
|
+
if (show) {
|
|
79
|
+
preview.render($postContainer);
|
|
80
|
+
}
|
|
80
81
|
preview.matchScroll($postContainer);
|
|
81
82
|
}
|
|
82
83
|
preview.toggle = togglePreview;
|
package/static/lib/composer.js
CHANGED
|
@@ -417,7 +417,7 @@ define('composer', [
|
|
|
417
417
|
|
|
418
418
|
// Hide "zen mode" if fullscreen API is not enabled/available (ahem, iOS...)
|
|
419
419
|
if (!screenfull.isEnabled) {
|
|
420
|
-
$('[data-format="zen"]').addClass('hidden');
|
|
420
|
+
$('[data-format="zen"]').parent().addClass('hidden');
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
hooks.fire('action:composer.enhanced', { postContainer, postData, draft });
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div component="composer" class="composer pt-2 px-2<!-- IF resizable --> resizable<!-- ENDIF resizable --><!-- IF !isTopicOrMain --> reply<!-- ENDIF !isTopicOrMain -->">
|
|
2
2
|
|
|
3
|
-
<div class="composer-container d-flex flex-column h-100">
|
|
3
|
+
<div class="composer-container d-flex flex-column gap-1 h-100">
|
|
4
4
|
<!-- mobile header -->
|
|
5
5
|
<nav class="navbar fixed-top mobile-navbar hidden-md hidden-lg text-bg-primary flex-nowrap">
|
|
6
6
|
<div class="btn-group">
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<
|
|
2
|
-
<ul class="
|
|
1
|
+
<div class="d-flex justify-content-between align-items-center formatting-bar">
|
|
2
|
+
<ul class="list-unstyled mb-0 d-flex formatting-group gap-2">
|
|
3
3
|
<!-- BEGIN formatting -->
|
|
4
4
|
<!-- IF formatting.spacer -->
|
|
5
|
-
<li class="
|
|
5
|
+
<li class="small spacer"></li>
|
|
6
6
|
<!-- ELSE -->
|
|
7
7
|
{{{ if (./visibility.desktop && ((isTopicOrMain && ./visibility.main) || (!isTopicOrMain && ./visibility.reply))) }}}
|
|
8
|
-
<li class="
|
|
9
|
-
<a href="#" class="
|
|
8
|
+
<li class="small">
|
|
9
|
+
<a href="#" class="btn btn-sm btn-link text-reset" tabindex="-1" data-format="{formatting.name}" title="{formatting.title}">
|
|
10
10
|
<i class="{formatting.className}"></i>
|
|
11
11
|
</a>
|
|
12
12
|
</li>
|
|
@@ -15,15 +15,15 @@
|
|
|
15
15
|
<!-- END formatting -->
|
|
16
16
|
|
|
17
17
|
<!-- IF privileges.upload:post:image -->
|
|
18
|
-
<li class="img-upload-btn
|
|
19
|
-
<a href="#" class="
|
|
18
|
+
<li class="img-upload-btn small">
|
|
19
|
+
<a href="#" class="btn btn-sm btn-link text-reset" data-format="picture" tabindex="-1" title="[[modules:composer.upload-picture]]">
|
|
20
20
|
<i class="fa fa-file-image-o"></i>
|
|
21
21
|
</a>
|
|
22
22
|
</li>
|
|
23
23
|
<!-- ENDIF privileges.upload:post:image -->
|
|
24
24
|
<!-- IF privileges.upload:post:file -->
|
|
25
|
-
<li class="file-upload-btn
|
|
26
|
-
<a href="#" class="
|
|
25
|
+
<li class="file-upload-btn small">
|
|
26
|
+
<a href="#" class="btn btn-sm btn-link text-reset" data-format="upload" tabindex="-1" title="[[modules:composer.upload-file]]">
|
|
27
27
|
<i class="fa fa-file-o"></i>
|
|
28
28
|
</a>
|
|
29
29
|
</li>
|
|
@@ -33,14 +33,17 @@
|
|
|
33
33
|
<input type="file" id="files" name="files[]" multiple class="gte-ie9 hide"/>
|
|
34
34
|
</form>
|
|
35
35
|
</ul>
|
|
36
|
+
<div class="d-flex gap-1">
|
|
37
|
+
<div class="draft-icon mx-2 hidden-xs hidden-sm"></div>
|
|
38
|
+
<button class="btn btn-sm btn-link py-2 text-body fw-semibold" data-action="preview">
|
|
39
|
+
<i class="fa fa-eye"></i>
|
|
40
|
+
<span class="d-none d-md-inline show-text">[[modules:composer.show_preview]]</span>
|
|
41
|
+
<span class="d-none d-md-inline hide-text">[[modules:composer.hide_preview]]</span>
|
|
42
|
+
</button>
|
|
43
|
+
<button class="btn btn-sm btn-link py-2 text-body fw-semibold" data-action="help">
|
|
44
|
+
<i class="fa fa-question"></i>
|
|
45
|
+
<span class="d-none d-md-inline">[[modules:composer.help]]</span>
|
|
46
|
+
</button>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
36
49
|
|
|
37
|
-
<div class="draft-icon mx-2 hidden-xs hidden-sm"></div>
|
|
38
|
-
<button class="btn btn-sm btn-link text-body fw-semibold" data-action="preview">
|
|
39
|
-
<i class="fa fa-eye"></i>
|
|
40
|
-
<span class="d-none d-md-inline">[[modules:composer.show_preview]]</span>
|
|
41
|
-
</button>
|
|
42
|
-
<button class="btn btn-sm btn-link text-body fw-semibold" data-action="help">
|
|
43
|
-
<i class="fa fa-question"></i>
|
|
44
|
-
<span class="d-none d-md-inline">[[modules:composer.help]]</span>
|
|
45
|
-
</button>
|
|
46
|
-
</nav>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div class="title-container d-flex">
|
|
1
|
+
<div class="title-container align-items-center gap-2 d-flex">
|
|
2
2
|
{{{ if isTopic }}}
|
|
3
3
|
<div class="category-list-container hidden-sm hidden-xs align-self-center">
|
|
4
4
|
<!-- IMPORT partials/category-selector.tpl -->
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
<input class="handle form-control h-100 border-0 shadow-none" type="text" tabindex="1" placeholder="[[topic:composer.handle_placeholder]]" value="{handle}" />
|
|
11
11
|
</div>
|
|
12
12
|
{{{ end }}}
|
|
13
|
-
<div data-component="composer/title" class="position-relative flex-
|
|
13
|
+
<div data-component="composer/title" class="position-relative flex-1" style="min-width: 0;">
|
|
14
14
|
{{{ if isTopicOrMain }}}
|
|
15
15
|
<input class="title form-control h-100 rounded-1 shadow-none" type="text" tabindex="1" placeholder="[[topic:composer.title_placeholder]]" value="{topicTitle}"/>
|
|
16
16
|
{{{ else }}}
|
|
17
|
-
<span class="title h-100 text-truncate">{{{ if isEditing }}}[[topic:composer.editing]]{{{ else }}}[[topic:composer.replying_to, "{topicTitle}"]]{{{ end }}}</span>
|
|
17
|
+
<span class="d-block title h-100 text-truncate">{{{ if isEditing }}}[[topic:composer.editing]]{{{ else }}}[[topic:composer.replying_to, "{topicTitle}"]]{{{ end }}}</span>
|
|
18
18
|
{{{ end }}}
|
|
19
19
|
<div id="quick-search-container" class="quick-search-container mt-2 dropdown-menu d-block p-2 hidden">
|
|
20
20
|
<div class="text-center loading-indicator"><i class="fa fa-spinner fa-spin"></i></div>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
</div>
|
|
23
23
|
</div>
|
|
24
24
|
|
|
25
|
-
<div class="d-flex action-bar hidden-sm hidden-xs align-items-center">
|
|
25
|
+
<div class="d-flex action-bar gap-1 hidden-sm hidden-xs align-items-center">
|
|
26
26
|
<button class="btn btn-sm btn-link text-body fw-semibold" data-action="hide" tabindex="-1"><i class="fa fa-angle-down"></i> [[topic:composer.hide]]</button>
|
|
27
27
|
<button class="btn btn-sm btn-link composer-discard text-body fw-semibold" data-action="discard" tabindex="-1"><i class="fa fa-trash"></i> [[topic:composer.discard]]</button>
|
|
28
28
|
<div class="btn-group btn-group-sm">
|