nodebb-plugin-composer-default 10.0.35 → 10.0.37

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/library.js CHANGED
@@ -120,17 +120,12 @@ plugin.filterComposerBuild = async function (hookData) {
120
120
  const { res } = hookData;
121
121
 
122
122
  if (req.query.p) {
123
- if (!res.locals.isAPI) {
124
- let a;
125
- try {
126
- a = url.parse(req.query.p, true, true);
127
- } catch (e) {
128
- return helpers.redirect(res, '/');
129
- }
123
+ try {
124
+ const a = url.parse(req.query.p, true, true);
130
125
  return helpers.redirect(res, `/${(a.path || '').replace(/^\/*/, '')}`);
126
+ } catch (e) {
127
+ return helpers.redirect(res, '/');
131
128
  }
132
- res.render('', {});
133
- return;
134
129
  } else if (!req.query.pid && !req.query.tid && !req.query.cid) {
135
130
  return helpers.redirect(res, '/');
136
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-composer-default",
3
- "version": "10.0.35",
3
+ "version": "10.0.37",
4
4
  "description": "Default composer for NodeBB",
5
5
  "main": "library.js",
6
6
  "repository": {
@@ -1,17 +1,16 @@
1
- <div component="composer" class="composer<!-- IF resizable --> resizable<!-- ENDIF resizable --><!-- IF !isTopicOrMain --> reply<!-- ENDIF !isTopicOrMain -->"<!-- IF !disabled --> style="visibility: inherit;"<!-- ENDIF !disabled -->>
2
-
1
+ <div component="composer" class="composer{{{ if resizable }}} resizable{{{ end }}}{{{ if !isTopicOrMain }}} reply{{{ end }}}"{{{ if !disabled }}} style="visibility: inherit;"{{{ end }}}>
3
2
  <div class="composer-container">
4
3
  <form id="compose-form" method="post">
5
- <!-- IF pid -->
4
+ {{{ if pid }}}
6
5
  <input type="hidden" name="pid" value="{pid}" />
7
6
  <input type="hidden" name="thumb" value="{thumb}" />
8
- <!-- ENDIF pid -->
9
- <!-- IF tid -->
7
+ {{{ end }}}
8
+ {{{ if tid }}}
10
9
  <input type="hidden" name="tid" value="{tid}" />
11
- <!-- ENDIF tid -->
12
- <!-- IF cid -->
10
+ {{{ end }}}
11
+ {{{ if cid }}}
13
12
  <input type="hidden" name="cid" value="{cid}" />
14
- <!-- ENDIF cid -->
13
+ {{{ end }}}
15
14
  <input type="hidden" name="_csrf" value="{config.csrf_token}" />
16
15
  </form>
17
16
 
@@ -21,8 +20,8 @@
21
20
 
22
21
  <!-- IMPORT partials/composer-write-preview.tpl -->
23
22
 
24
- <!-- IF isTopicOrMain -->
23
+ {{{ if isTopicOrMain }}}
25
24
  <!-- IMPORT partials/composer-tags.tpl -->
26
- <!-- ENDIF isTopicOrMain -->
25
+ {{{ end }}}
27
26
  </div>
28
27
  </div>
@@ -1,5 +1,4 @@
1
- <div component="composer" class="composer <!-- IF resizable --> resizable<!-- ENDIF resizable --><!-- IF !isTopicOrMain --> reply<!-- ENDIF !isTopicOrMain -->">
2
-
1
+ <div component="composer" class="composer {{{ if resizable }}} resizable{{{ end }}}{{{ if !isTopicOrMain }}} reply{{{ end }}}">
3
2
  <div class="composer-container d-flex flex-column gap-1 h-100">
4
3
  <!-- mobile header -->
5
4
  <nav class="navbar fixed-top mobile-navbar hidden-md hidden-lg text-bg-primary flex-nowrap gap-1">
@@ -7,14 +6,14 @@
7
6
  <button class="btn btn-sm btn-primary composer-discard" data-action="discard" tabindex="-1"><i class="fa fa-times"></i></button>
8
7
  <button class="btn btn-sm btn-primary composer-minimize" data-action="minimize" tabindex="-1"><i class="fa fa-minus"></i></button>
9
8
  </div>
10
- <!-- IF isTopic -->
9
+ {{{ if isTopic }}}
11
10
  <div class="category-name-container">
12
11
  <span class="category-name"></span> <i class="fa fa-sort"></i>
13
12
  </div>
14
- <!-- ENDIF isTopic -->
15
- <!-- IF !isTopicOrMain -->
13
+ {{{ end }}}
14
+ {{{ if !isTopicOrMain }}}
16
15
  <h4 class="title text-bg-primary">[[topic:composer.replying_to, "{topicTitle}"]]</h4>
17
- <!-- ENDIF !isTopicOrMain -->
16
+ {{{ end }}}
18
17
  <div class="display-scheduler p-2 {{{ if !canSchedule }}} hidden{{{ end }}}">
19
18
  <i class="fa fa-clock-o"></i>
20
19
  </div>
@@ -29,9 +28,9 @@
29
28
 
30
29
  <!-- IMPORT partials/composer-write-preview.tpl -->
31
30
 
32
- <!-- IF isTopicOrMain -->
31
+ {{{ if isTopicOrMain }}}
33
32
  <!-- IMPORT partials/composer-tags.tpl -->
34
- <!-- ENDIF isTopicOrMain -->
33
+ {{{ end }}}
35
34
 
36
35
  <div class="imagedrop"><div>[[topic:composer.drag_and_drop_images]]</div></div>
37
36
 
@@ -1,33 +1,33 @@
1
1
  <div class="d-flex justify-content-between gap-2 align-items-center formatting-bar">
2
2
  <ul class="list-unstyled mb-0 d-flex formatting-group gap-2 overflow-auto">
3
- <!-- BEGIN formatting -->
4
- <!-- IF formatting.spacer -->
3
+ {{{ each formatting }}}
4
+ {{{ if ./spacer }}}
5
5
  <li class="small spacer"></li>
6
- <!-- ELSE -->
6
+ {{{ else }}}
7
7
  {{{ if (./visibility.desktop && ((isTopicOrMain && ./visibility.main) || (!isTopicOrMain && ./visibility.reply))) }}}
8
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
- <i class="{formatting.className}"></i>
9
+ <a href="#" class="btn btn-sm btn-link text-reset" tabindex="-1" data-format="{./name}" title="{./title}">
10
+ <i class="{./className}"></i>
11
11
  </a>
12
12
  </li>
13
13
  {{{ end }}}
14
- <!-- ENDIF formatting.spacer -->
15
- <!-- END formatting -->
14
+ {{{ end }}}
15
+ {{{ end }}}
16
16
 
17
- <!-- IF privileges.upload:post:image -->
17
+ {{{ if privileges.upload:post:image }}}
18
18
  <li class="img-upload-btn small">
19
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
- <!-- ENDIF privileges.upload:post:image -->
24
- <!-- IF privileges.upload:post:file -->
23
+ {{{ end }}}
24
+ {{{ if privileges.upload:post:file }}}
25
25
  <li class="file-upload-btn small">
26
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>
30
- <!-- ENDIF privileges.upload:post:file -->
30
+ {{{ end }}}
31
31
 
32
32
  <form id="fileForm" method="post" enctype="multipart/form-data">
33
33
  <input type="file" id="files" name="files[]" multiple class="gte-ie9 hide"/>
@@ -1,9 +1,9 @@
1
- <div class="write-preview-container d-flex gap-2 flex-grow-1">
1
+ <div class="write-preview-container d-flex gap-2 flex-grow-1 overflow-auto">
2
2
  <div class="write-container d-flex d-md-flex w-50">
3
3
  <div class="float-end draft-icon hidden-md hidden-lg"></div>
4
4
  <textarea class="write shadow-none rounded-1 w-100 form-control" tabindex="4" placeholder="[[modules:composer.textarea.placeholder]]">{body}</textarea>
5
5
  </div>
6
6
  <div class="preview-container d-none d-md-flex w-50">
7
- <div class="preview card card-body bg-light rounded-1"></div>
7
+ <div class="preview card card-body bg-light rounded-1 overflow-auto"></div>
8
8
  </div>
9
9
  </div>