How to create a "New Topic" button in header
-
Is't possible to add text to the body a composer this way?
onclick="app.newTopic(2);"
Via
onclick
function like on this url:/compose?cid=2&body=Hello
-
That function doesn't support the body parameter, we should refactor it so it takes in an object with all the supported params. https://github.com/NodeBB/NodeBB/blob/master/public/src/app.js#L283
refactor app.newTopic/newReply so it takes in an object 路 Issue #11649 路 NodeBB/NodeBB
Node.js based forum software built for the modern web - refactor app.newTopic/newReply so it takes in an object 路 Issue #11649 路 NodeBB/NodeBB
GitHub (github.com)
-
This will be available in 3.2.0.
app.newTopic({ cid: 2, // optional title: 'fooo', // optional tags: ['foo1', 'foo2'], // optional body: 'some content here', // optional }); app.newReply({ tid: 2, //required pid: 10, //optional body: 'some content here', // optional });
The old versions will still work for backwards compatibility.
feat: allow more params to app.newTopic/newReply 路 NodeBB/NodeBB@325c195
Node.js based forum software built for the modern web - feat: allow more params to app.newTopic/newReply 路 NodeBB/NodeBB@325c195
GitHub (github.com)
-
This feature is really amazing! Because with this parameter we can create a button for users with topic/post template in composer, like this:
Name (paste your name): Vin Diesel Bio (talk about your): Actor E-mail (your mail): [email protected]
OMG, now code block have line numbers
-
@baris said in How to create a "New Topic" button in header:
app.newReply({
tid: 2, //required
pid: 10, //optional
body: 'some content here', // optional
});Error:
@baris said in How to create a "New Topic" button in header:
app.newTopic({
cid: 2, // optional
title: 'fooo', // optional
tags: ['foo1', 'foo2'], // optional
body: 'some content here', // optional
});Doesn't work, open a new empty topic! No category, tags, title or content
The old writing still works:app.newTopic(2, ['a', 'b']);
I think it is related to what I commented here, because always params is interpreted as boolean true, even if it is an object
-
-