Skip to content

Commit c538a36

Browse files
authored
Merge pull request #477 from NodeBB/3.x
feat: update for nodeb 3.2 and up
2 parents a240f46 + be542b5 commit c538a36

File tree

14 files changed

+299
-178
lines changed

14 files changed

+299
-178
lines changed

lib/controllers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Controllers.renderAdminPage = function (req, res, next) {
1111
}
1212

1313
res.render('admin/plugins/composer-quill', {
14+
title: 'Quill Composer',
1415
checks: checks,
1516
});
1617
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"readmeFilename": "README.md",
2525
"nbbpm": {
26-
"compatibility": "^1.17.0 || ^2.0.0"
26+
"compatibility": "^3.2.0"
2727
},
2828
"dependencies": {
2929
"async": "^3.2.0",

plugin.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
{ "hook": "filter:messaging.getFields", "method": "handleMessageEdit" },
1616
{ "hook": "filter:messaging.checkContent", "method": "handleMessageCheck" }
1717
],
18-
"less": [
19-
"../nodebb-plugin-composer-default/static/less/composer.less",
20-
"./static/less/quill.less",
21-
"./static/less/post.less",
22-
"./static/less/overrides.less"
18+
"scss": [
19+
"../nodebb-plugin-composer-default/static/scss/composer.scss",
20+
"./static/scss/quill.scss",
21+
"./static/scss/post.scss",
22+
"./static/scss/overrides.scss"
2323
],
2424
"modules": {
2525
"quill.js": "./node_modules/quill/dist/quill.js",
@@ -36,6 +36,7 @@
3636
"composer/tags.js": "../nodebb-plugin-composer-default/static/lib/composer/tags.js",
3737
"composer/uploads.js": "../nodebb-plugin-composer-default/static/lib/composer/uploads.js",
3838
"composer/autocomplete.js": "../nodebb-plugin-composer-default/static/lib/composer/autocomplete.js",
39+
"composer/post-queue.js": "../nodebb-plugin-composer-default/static/lib/composer/post-queue.js",
3940
"../admin/plugins/composer-quill.js": "./static/lib/admin.js"
4041
},
4142
"scripts": [

static/lib/client.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,36 @@ $(document).ready(() => {
2323
$(window).on('action:composer.topic.new', (ev, data) => {
2424
composer.newTopic({
2525
cid: data.cid,
26-
title: data.title,
27-
body: data.body,
26+
title: data.title || '',
27+
body: data.body || '',
28+
tags: data.tags || [],
2829
});
2930
});
3031

3132
$(window).on('action:composer.post.edit', (ev, data) => {
32-
composer.editPost(data.pid);
33+
composer.editPost({ pid: data.pid });
3334
});
3435

3536
$(window).on('action:composer.post.new', (ev, data) => {
36-
composer.newReply(data.tid, data.pid, data.topicName, data.text);
37+
data.body = data.body || data.text;
38+
data.title = data.title || data.topicName;
39+
composer.newReply({
40+
tid: data.tid,
41+
toPid: data.pid,
42+
title: data.title,
43+
body: data.body,
44+
});
3745
});
3846

3947
$(window).on('action:composer.addQuote', (ev, data) => {
40-
composer.newReply(data.tid, data.pid, data.topicName, wrapWithBlockquote(data.text));
48+
data.title = data.title || data.topicName;
49+
data.body = data.body || data.text;
50+
composer.newReply({
51+
tid: data.tid,
52+
toPid: data.pid,
53+
title: data.title,
54+
body: wrapWithBlockquote(data.body),
55+
});
4156
});
4257
});
4358
});

static/lib/quill-nbb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ window.quill.init = function (targetEl, data, callback) {
281281
if (className === 'picture') {
282282
buttonEl.html('<i class="fa fa-file-image-o"></i>');
283283
} else {
284-
buttonEl.html('<span class="fa-stack"><i class="fa fa-file-o fa-stack-1x"></i><i class="fa fa-arrow-up fa-stack-1x"></i></span>');
284+
buttonEl.html('<i class="fa fa-file-o"></i>');
285285
}
286286
}
287287
});

static/scss/overrides.scss

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.composer {
2+
.formatting-bar {
3+
display: none!important;
4+
}
5+
6+
.write-container {
7+
width: 100%!important;
8+
min-width: 0px; // fixes negation of overflow-wrap due this being a flex-item
9+
10+
textarea {
11+
display: none;
12+
}
13+
}
14+
}
15+
16+
.ql-toolbar {
17+
button > i {
18+
float: left;
19+
height: 100%;
20+
}
21+
}
22+
23+
[component="chat/composer"] {
24+
.ql-editor {
25+
padding: 0;
26+
}
27+
28+
[component="chat/input"] {
29+
display: none;
30+
}
31+
}

static/scss/post.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[component="post/content"], [component="chat/messages"] {
2+
.ql-align-center {
3+
text-align: center;
4+
}
5+
.ql-align-right {
6+
text-align: right;
7+
}
8+
.ql-align-justify {
9+
text-align: justify;
10+
}
11+
12+
// Fonts
13+
.ql-font-serif {
14+
font-family: Georgia, "Times New Roman", serif;
15+
}
16+
.ql-font-monospace {
17+
font-family: Monaco, "Courier New", monospace;
18+
}
19+
}

static/scss/quill.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// @import './quill/dist/quill.snow';
2+
// @import './quill/dist/quill.bubble';
3+
@import 'nodebb-plugin-composer-quill/node_modules/quill/dist/quill.snow';
4+
@import 'nodebb-plugin-composer-quill/node_modules/quill/dist/quill.bubble';
Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,60 @@
1-
<div class="row">
2-
<div class="col-lg-8 col-sm-6">
3-
<div class="panel panel-default">
4-
<div class="panel-heading">Quill Composer</div>
5-
<div class="panel-body">
6-
<p>
7-
<a href="https://quilljs.com/">Quill</a> is a free, open source WYSIWYG editor built for the modern web. With its modular architecture and expressive API, it is completely customizable to fit any need.
8-
</p>
9-
</div>
10-
</div>
11-
</div>
12-
<div class="col-lg-4 col-sm-6">
13-
<div class="panel panel-default">
14-
<div class="panel-heading">Migration</div>
15-
<div class="panel-body">
1+
<div class="acp-page-container">
2+
<style>#save {display: none;}</style>
3+
<!-- IMPORT admin/partials/settings/header.tpl -->
4+
5+
<div class="row m-0">
6+
<div id="spy-container" class="col-12 col-md-8 px-0 mb-4" tabindex="0">
7+
<p>
8+
<a href="https://quilljs.com/">Quill</a> is a free, open source WYSIWYG editor built for the modern web. With its modular architecture and expressive API, it is completely customizable to fit any need.
9+
</p>
10+
11+
<hr/>
12+
13+
<div>
14+
<h5>Migration</h5>
15+
1616
<p>
1717
If you are switching to Quill from a different composer (i.e. composer-default/markdown), you will need to convert your existing posts to Quill's format. You may use the utilities below to do so.
1818
</p>
1919

20-
<button class="btn btn-block btn-default" data-action="migrate/in">Migrate to Quill <i class="fa fa-arrow-circle-o-left"></i></button>
21-
<button class="btn btn-block btn-default" data-action="migrate/out">Migrate from Quill <i class="fa fa-arrow-circle-o-right"></i></button>
20+
<button class="btn btn-light" data-action="migrate/in">Migrate to Quill <i class="fa fa-arrow-circle-o-left"></i></button>
21+
<button class="btn btn-light" data-action="migrate/out">Migrate from Quill <i class="fa fa-arrow-circle-o-right"></i></button>
2222
</div>
23-
</div><div class="panel panel-default">
24-
<div class="panel-heading">Compatibility Checks</div>
25-
<div class="panel-body">
23+
24+
<hr />
25+
26+
<div>
27+
<h5>Compatibility Checks</h5>
28+
2629
<ul class="list-group">
27-
<li class="list-group-item list-group-item-<!-- IF checks.markdown -->success<!-- ELSE -->danger<!-- ENDIF checks.markdown -->">
30+
<li class="list-group-item list-group-item-{{{ if checks.markdown }}}success{{{ else }}}danger{{{ end }}}">
2831
<strong>Markdown Compatibility</strong>
29-
<!-- IF checks.markdown -->
30-
<span class="badge"><i class="fa fa-check"></i></span>
32+
{{{ if checks.markdown }}}
33+
<i class="fa fa-check"></i>
3134
<p>The Markdown plugin is either disabled, or HTML sanitization is disabled</p>
32-
<!-- ELSE -->
33-
<span class="badge"><i class="fa fa-times"></i></span>
35+
{{{ else }}}
36+
<i class="fa fa-times"></i>
3437
<p>
3538
In order to render post content correctly, the Markdown plugin needs to have HTML sanitization disabled,
3639
or the entire plugin should be disabled altogether.
3740
</p>
38-
<!-- ENDIF checks.markdown -->
41+
{{{ end }}}
3942
</li>
40-
<li class="list-group-item list-group-item-<!-- IF checks.composer -->success<!-- ELSE -->danger<!-- ENDIF checks.composer -->">
43+
<li class="list-group-item list-group-item-{{{ if checks.composer }}}success{{{ else }}}danger{{{ end }}}">
4144
<strong>Composer Conflicts</strong>
42-
<!-- IF checks.composer -->
43-
<span class="badge"><i class="fa fa-check"></i></span>
45+
{{{ if checks.composer }}}
46+
<i class="fa fa-check"></i>
4447
<p>Great! Looks like Quill is the only composer active</p>
45-
<!-- ELSE -->
46-
<span class="badge"><i class="fa fa-times"></i></span>
48+
{{{ else }}}
49+
<i class="fa fa-times"></i>
4750
<p>Quill must be the only composer active. Please disable other composers and reload NodeBB.</p>
48-
<!-- ENDIF checks.composer -->
51+
{{{ end }}}
4952
</li>
5053
</ul>
5154
</div>
5255
</div>
56+
57+
<!-- IMPORT admin/partials/settings/toc.tpl -->
5358
</div>
5459
</div>
60+

0 commit comments

Comments
 (0)