From 28c97f9d4f08221cf6ff0bd6b5a09bf4fad8b241 Mon Sep 17 00:00:00 2001 From: ericlin2 Date: Sat, 21 Sep 2024 17:29:37 -0400 Subject: [PATCH 1/5] added anonymous checkbox (frontend) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 42a1b3c705..777de42b8e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ dist/ yarn.lock npm-debug.log node_modules/ +!node_modules/nodebb-plugin-composer-default/ sftp-config.json config.json jsconfig.json From 7046d3374a4450491ee60f7dd34fdeeb627ba238 Mon Sep 17 00:00:00 2001 From: ericlin2 Date: Sun, 22 Sep 2024 15:51:20 -0400 Subject: [PATCH 2/5] add composer changes --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 777de42b8e..9bb46692c6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ yarn.lock npm-debug.log node_modules/ !node_modules/nodebb-plugin-composer-default/ +!node_modules/nodebb-plugin-composer-default/** sftp-config.json config.json jsconfig.json From 8207552051735ee4b7bdbbf4e66a6f884a172a39 Mon Sep 17 00:00:00 2001 From: ericlin2 Date: Sun, 22 Sep 2024 16:03:20 -0400 Subject: [PATCH 3/5] showing composer changes now --- .gitignore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9bb46692c6..0e7d2ff0b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,9 @@ dist/ yarn.lock npm-debug.log -node_modules/ +!node_modules/ +node_modules/** !node_modules/nodebb-plugin-composer-default/ -!node_modules/nodebb-plugin-composer-default/** sftp-config.json config.json jsconfig.json From 741e505102f07103b480e92c00afdfacfec60111 Mon Sep 17 00:00:00 2001 From: ericlin2 Date: Sun, 22 Sep 2024 16:05:09 -0400 Subject: [PATCH 4/5] actually showing composer changes now --- .gitignore | 1 + .../nodebb-plugin-composer-default/.eslintrc | 3 + .../.gitattributes | 22 + .../nodebb-plugin-composer-default/.jshintrc | 86 ++ .../nodebb-plugin-composer-default/LICENSE | 7 + .../nodebb-plugin-composer-default/README.md | 11 + .../controllers.js | 11 + .../nodebb-plugin-composer-default/library.js | 310 ++++++ .../package.json | 43 + .../plugin.json | 35 + .../screenshots/desktop.png | Bin 0 -> 27980 bytes .../screenshots/mobile.png | Bin 0 -> 21999 bytes .../static/lib/.eslintrc | 6 + .../static/lib/admin.js | 15 + .../static/lib/client.js | 89 ++ .../static/lib/composer.js | 886 ++++++++++++++++++ .../static/lib/composer/autocomplete.js | 99 ++ .../static/lib/composer/categoryList.js | 115 +++ .../static/lib/composer/controls.js | 171 ++++ .../static/lib/composer/drafts.js | 341 +++++++ .../static/lib/composer/formatting.js | 194 ++++ .../static/lib/composer/post-queue.js | 25 + .../static/lib/composer/preview.js | 105 +++ .../static/lib/composer/resize.js | 197 ++++ .../static/lib/composer/scheduler.js | 201 ++++ .../static/lib/composer/tags.js | 227 +++++ .../static/lib/composer/uploads.js | 271 ++++++ .../static/scss/composer.scss | 411 ++++++++ .../static/scss/page-compose.scss | 35 + .../static/scss/textcomplete.scss | 26 + .../static/scss/zen-mode.scss | 51 + .../admin/plugins/composer-default.tpl | 22 + .../static/templates/compose.tpl | 27 + .../static/templates/composer.tpl | 46 + .../templates/modals/topic-scheduler.tpl | 4 + .../partials/composer-formatting.tpl | 75 ++ .../templates/partials/composer-tags.tpl | 17 + .../partials/composer-title-container.tpl | 50 + .../partials/composer-write-preview.tpl | 10 + .../websockets.js | 94 ++ 40 files changed, 4339 insertions(+) create mode 100644 node_modules/nodebb-plugin-composer-default/.eslintrc create mode 100644 node_modules/nodebb-plugin-composer-default/.gitattributes create mode 100644 node_modules/nodebb-plugin-composer-default/.jshintrc create mode 100644 node_modules/nodebb-plugin-composer-default/LICENSE create mode 100644 node_modules/nodebb-plugin-composer-default/README.md create mode 100644 node_modules/nodebb-plugin-composer-default/controllers.js create mode 100644 node_modules/nodebb-plugin-composer-default/library.js create mode 100644 node_modules/nodebb-plugin-composer-default/package.json create mode 100644 node_modules/nodebb-plugin-composer-default/plugin.json create mode 100644 node_modules/nodebb-plugin-composer-default/screenshots/desktop.png create mode 100644 node_modules/nodebb-plugin-composer-default/screenshots/mobile.png create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/.eslintrc create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/admin.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/client.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/composer.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/composer/autocomplete.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/composer/categoryList.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/composer/controls.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/composer/drafts.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/composer/formatting.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/composer/post-queue.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/composer/preview.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/composer/resize.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/composer/scheduler.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/composer/tags.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/lib/composer/uploads.js create mode 100644 node_modules/nodebb-plugin-composer-default/static/scss/composer.scss create mode 100644 node_modules/nodebb-plugin-composer-default/static/scss/page-compose.scss create mode 100644 node_modules/nodebb-plugin-composer-default/static/scss/textcomplete.scss create mode 100644 node_modules/nodebb-plugin-composer-default/static/scss/zen-mode.scss create mode 100644 node_modules/nodebb-plugin-composer-default/static/templates/admin/plugins/composer-default.tpl create mode 100644 node_modules/nodebb-plugin-composer-default/static/templates/compose.tpl create mode 100644 node_modules/nodebb-plugin-composer-default/static/templates/composer.tpl create mode 100644 node_modules/nodebb-plugin-composer-default/static/templates/modals/topic-scheduler.tpl create mode 100644 node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-formatting.tpl create mode 100644 node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-tags.tpl create mode 100644 node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-title-container.tpl create mode 100644 node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-write-preview.tpl create mode 100644 node_modules/nodebb-plugin-composer-default/websockets.js diff --git a/.gitignore b/.gitignore index 0e7d2ff0b1..41ffb6fd54 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ npm-debug.log !node_modules/ node_modules/** !node_modules/nodebb-plugin-composer-default/ +!node_modules/nodebb-plugin-composer-default/** sftp-config.json config.json jsconfig.json diff --git a/node_modules/nodebb-plugin-composer-default/.eslintrc b/node_modules/nodebb-plugin-composer-default/.eslintrc new file mode 100644 index 0000000000..74e8dc064a --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/.eslintrc @@ -0,0 +1,3 @@ +{ + "extends": "nodebb/lib" +} \ No newline at end of file diff --git a/node_modules/nodebb-plugin-composer-default/.gitattributes b/node_modules/nodebb-plugin-composer-default/.gitattributes new file mode 100644 index 0000000000..412eeda78d --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/.gitattributes @@ -0,0 +1,22 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp +*.sln merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/node_modules/nodebb-plugin-composer-default/.jshintrc b/node_modules/nodebb-plugin-composer-default/.jshintrc new file mode 100644 index 0000000000..1981c254c5 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/.jshintrc @@ -0,0 +1,86 @@ +{ + // JSHint Default Configuration File (as on JSHint website) + // See http://jshint.com/docs/ for more details + + "maxerr" : 50, // {int} Maximum error before stopping + + // Enforcing + "bitwise" : true, // true: Prohibit bitwise operators (&, |, ^, etc.) + "camelcase" : false, // true: Identifiers must be in camelCase + "curly" : true, // true: Require {} for every new block or scope + "eqeqeq" : true, // true: Require triple equals (===) for comparison + "forin" : true, // true: Require filtering for..in loops with obj.hasOwnProperty() + "immed" : false, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` + "indent" : 4, // {int} Number of spaces to use for indentation + "latedef" : false, // true: Require variables/functions to be defined before being used + "newcap" : false, // true: Require capitalization of all constructor functions e.g. `new F()` + "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` + "noempty" : true, // true: Prohibit use of empty blocks + "nonew" : false, // true: Prohibit use of constructors for side-effects (without assignment) + "plusplus" : false, // true: Prohibit use of `++` & `--` + "quotmark" : false, // Quotation mark consistency: + // false : do nothing (default) + // true : ensure whatever is used is consistent + // "single" : require single quotes + // "double" : require double quotes + "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) + "unused" : true, // true: Require all defined variables be used + "strict" : true, // true: Requires all functions run in ES5 Strict Mode + "trailing" : false, // true: Prohibit trailing whitespaces + "maxparams" : false, // {int} Max number of formal params allowed per function + "maxdepth" : false, // {int} Max depth of nested blocks (within functions) + "maxstatements" : false, // {int} Max number statements per function + "maxcomplexity" : false, // {int} Max cyclomatic complexity per function + "maxlen" : false, // {int} Max number of characters per line + + // Relaxing + "asi" : false, // true: Tolerate Automatic Semicolon Insertion (no semicolons) + "boss" : false, // true: Tolerate assignments where comparisons would be expected + "debug" : false, // true: Allow debugger statements e.g. browser breakpoints. + "eqnull" : false, // true: Tolerate use of `== null` + "es5" : false, // true: Allow ES5 syntax (ex: getters and setters) + "esnext" : false, // true: Allow ES.next (ES6) syntax (ex: `const`) + "moz" : false, // true: Allow Mozilla specific syntax (extends and overrides esnext features) + // (ex: `for each`, multiple try/catch, function expression…) + "evil" : false, // true: Tolerate use of `eval` and `new Function()` + "expr" : false, // true: Tolerate `ExpressionStatement` as Programs + "funcscope" : false, // true: Tolerate defining variables inside control statements" + "globalstrict" : false, // true: Allow global "use strict" (also enables 'strict') + "iterator" : false, // true: Tolerate using the `__iterator__` property + "lastsemic" : false, // true: Tolerate omitting a semicolon for the last statement of a 1-line block + "laxbreak" : false, // true: Tolerate possibly unsafe line breakings + "laxcomma" : false, // true: Tolerate comma-first style coding + "loopfunc" : false, // true: Tolerate functions being defined in loops + "multistr" : false, // true: Tolerate multi-line strings + "proto" : false, // true: Tolerate using the `__proto__` property + "scripturl" : false, // true: Tolerate script-targeted URLs + "smarttabs" : false, // true: Tolerate mixed tabs/spaces when used for alignment + "shadow" : false, // true: Allows re-define variables later in code e.g. `var x=1; x=2;` + "sub" : false, // true: Tolerate using `[]` notation when it can still be expressed in dot notation + "supernew" : false, // true: Tolerate `new function () { ... };` and `new Object;` + "validthis" : false, // true: Tolerate using this in a non-constructor function + + // Environments + "browser" : true, // Web Browser (window, document, etc) + "couch" : false, // CouchDB + "devel" : true, // Development/debugging (alert, confirm, etc) + "dojo" : false, // Dojo Toolkit + "jquery" : true, // jQuery + "mootools" : false, // MooTools + "node" : true, // Node.js + "nonstandard" : false, // Widely adopted globals (escape, unescape, etc) + "prototypejs" : false, // Prototype and Scriptaculous + "rhino" : false, // Rhino + "worker" : false, // Web Workers + "wsh" : false, // Windows Scripting Host + "yui" : false, // Yahoo User Interface + + // Legacy + "nomen" : false, // true: Prohibit dangling `_` in variables + "onevar" : false, // true: Allow only one `var` statement per function + "passfail" : false, // true: Stop on first error + "white" : false, // true: Check against strict whitespace and indentation rules + + // Custom Globals + "globals" : {} // additional predefined global variables +} \ No newline at end of file diff --git a/node_modules/nodebb-plugin-composer-default/LICENSE b/node_modules/nodebb-plugin-composer-default/LICENSE new file mode 100644 index 0000000000..b8658d3aa1 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2016 NodeBB Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/nodebb-plugin-composer-default/README.md b/node_modules/nodebb-plugin-composer-default/README.md new file mode 100644 index 0000000000..7bcfff9aff --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/README.md @@ -0,0 +1,11 @@ +# Default Composer for NodeBB + +This plugin activates the default composer for NodeBB. It is activated by default, but can be swapped out as necessary. + +## Screenshots + +### Desktop +![Desktop Composer](screenshots/desktop.png?raw=true) + +### Mobile Devices +![Mobile Composer](screenshots/mobile.png?raw=true) \ No newline at end of file diff --git a/node_modules/nodebb-plugin-composer-default/controllers.js b/node_modules/nodebb-plugin-composer-default/controllers.js new file mode 100644 index 0000000000..cef271849f --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/controllers.js @@ -0,0 +1,11 @@ +'use strict'; + +const Controllers = {}; + +Controllers.renderAdminPage = function (req, res) { + res.render('admin/plugins/composer-default', { + title: 'Composer (Default)', + }); +}; + +module.exports = Controllers; diff --git a/node_modules/nodebb-plugin-composer-default/library.js b/node_modules/nodebb-plugin-composer-default/library.js new file mode 100644 index 0000000000..c80eef1f5e --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/library.js @@ -0,0 +1,310 @@ +'use strict'; + +const url = require('url'); + +const nconf = require.main.require('nconf'); +const validator = require('validator'); + +const plugins = require.main.require('./src/plugins'); +const topics = require.main.require('./src/topics'); +const categories = require.main.require('./src/categories'); +const posts = require.main.require('./src/posts'); +const user = require.main.require('./src/user'); +const meta = require.main.require('./src/meta'); +const privileges = require.main.require('./src/privileges'); +const translator = require.main.require('./src/translator'); +const utils = require.main.require('./src/utils'); +const helpers = require.main.require('./src/controllers/helpers'); +const SocketPlugins = require.main.require('./src/socket.io/plugins'); +const socketMethods = require('./websockets'); + +const plugin = module.exports; + +plugin.socketMethods = socketMethods; + +plugin.init = async function (data) { + const { router } = data; + const routeHelpers = require.main.require('./src/routes/helpers'); + const controllers = require('./controllers'); + SocketPlugins.composer = socketMethods; + routeHelpers.setupAdminPageRoute(router, '/admin/plugins/composer-default', controllers.renderAdminPage); +}; + +plugin.appendConfig = async function (config) { + config['composer-default'] = await meta.settings.get('composer-default'); + return config; +}; + +plugin.addAdminNavigation = async function (header) { + header.plugins.push({ + route: '/plugins/composer-default', + icon: 'fa-edit', + name: 'Composer (Default)', + }); + return header; +}; + +plugin.addPrefetchTags = async function (hookData) { + const prefetch = [ + '/assets/src/modules/composer.js', '/assets/src/modules/composer/uploads.js', '/assets/src/modules/composer/drafts.js', + '/assets/src/modules/composer/tags.js', '/assets/src/modules/composer/categoryList.js', '/assets/src/modules/composer/resize.js', + '/assets/src/modules/composer/autocomplete.js', '/assets/templates/composer.tpl', + `/assets/language/${meta.config.defaultLang || 'en-GB'}/topic.json`, + `/assets/language/${meta.config.defaultLang || 'en-GB'}/modules.json`, + `/assets/language/${meta.config.defaultLang || 'en-GB'}/tags.json`, + ]; + + hookData.links = hookData.links.concat(prefetch.map(path => ({ + rel: 'prefetch', + href: `${nconf.get('relative_path') + path}?${meta.config['cache-buster']}`, + }))); + + return hookData; +}; + +plugin.getFormattingOptions = async function () { + const defaultVisibility = { + mobile: true, + desktop: true, + + // op or reply + main: true, + reply: true, + }; + let payload = { + defaultVisibility, + options: [ + { + name: 'tags', + title: '[[global:tags.tags]]', + className: 'fa fa-tags', + visibility: { + ...defaultVisibility, + desktop: false, + }, + }, + { + name: 'zen', + title: '[[modules:composer.zen-mode]]', + className: 'fa fa-arrows-alt', + visibility: defaultVisibility, + }, + ], + }; + if (parseInt(meta.config.allowTopicsThumbnail, 10) === 1) { + payload.options.push({ + name: 'thumbs', + title: '[[topic:composer.thumb-title]]', + className: 'fa fa-address-card-o', + badge: true, + visibility: { + ...defaultVisibility, + reply: false, + }, + }); + } + + payload = await plugins.hooks.fire('filter:composer.formatting', payload); + + payload.options.forEach((option) => { + option.visibility = { + ...defaultVisibility, + ...option.visibility || {}, + }; + }); + + return payload ? payload.options : null; +}; + +plugin.filterComposerBuild = async function (hookData) { + const { req } = hookData; + const { res } = hookData; + + if (req.query.p) { + try { + const a = url.parse(req.query.p, true, true); + return helpers.redirect(res, `/${(a.path || '').replace(/^\/*/, '')}`); + } catch (e) { + return helpers.redirect(res, '/'); + } + } else if (!req.query.pid && !req.query.tid && !req.query.cid) { + return helpers.redirect(res, '/'); + } + const [ + isMainPost, + postData, + topicData, + categoryData, + isAdmin, + isMod, + formatting, + tagWhitelist, + globalPrivileges, + canTagTopics, + canScheduleTopics, + ] = await Promise.all([ + posts.isMain(req.query.pid), + getPostData(req), + getTopicData(req), + categories.getCategoryFields(req.query.cid, [ + 'name', 'icon', 'color', 'bgColor', 'backgroundImage', 'imageClass', 'minTags', 'maxTags', + ]), + user.isAdministrator(req.uid), + isModerator(req), + plugin.getFormattingOptions(), + getTagWhitelist(req.query, req.uid), + privileges.global.get(req.uid), + canTag(req), + canSchedule(req), + ]); + + const isEditing = !!req.query.pid; + const isGuestPost = postData && parseInt(postData.uid, 10) === 0; + const save_id = utils.generateSaveId(req.uid); + const discardRoute = generateDiscardRoute(req, topicData); + const body = await generateBody(req, postData); + + let action = 'topics.post'; + let isMain = isMainPost; + if (req.query.tid) { + action = 'posts.reply'; + } else if (req.query.pid) { + action = 'posts.edit'; + } else { + isMain = true; + } + globalPrivileges['topics:tag'] = canTagTopics; + const cid = parseInt(req.query.cid, 10); + const topicTitle = topicData && topicData.title ? topicData.title.replace(/%/g, '%').replace(/,/g, ',') : validator.escape(String(req.query.title || '')); + return { + req: req, + res: res, + templateData: { + disabled: !req.query.pid && !req.query.tid && !req.query.cid, + pid: parseInt(req.query.pid, 10), + tid: parseInt(req.query.tid, 10), + cid: cid || (topicData ? topicData.cid : null), + action: action, + toPid: parseInt(req.query.toPid, 10), + discardRoute: discardRoute, + + resizable: false, + allowTopicsThumbnail: parseInt(meta.config.allowTopicsThumbnail, 10) === 1 && isMain, + + // can't use title property as that is used for page title + topicTitle: topicTitle, + titleLength: topicTitle ? topicTitle.length : 0, + topic: topicData, + thumb: topicData ? topicData.thumb : '', + body: body, + + isMain: isMain, + isTopicOrMain: !!req.query.cid || isMain, + maximumTitleLength: meta.config.maximumTitleLength, + maximumPostLength: meta.config.maximumPostLength, + minimumTagLength: meta.config.minimumTagLength || 3, + maximumTagLength: meta.config.maximumTagLength || 15, + tagWhitelist: tagWhitelist, + selectedCategory: cid ? categoryData : null, + minTags: categoryData.minTags, + maxTags: categoryData.maxTags, + + isTopic: !!req.query.cid, + isEditing: isEditing, + canSchedule: canScheduleTopics, + showHandleInput: meta.config.allowGuestHandles === 1 && + (req.uid === 0 || (isEditing && isGuestPost && (isAdmin || isMod))), + handle: postData ? postData.handle || '' : undefined, + formatting: formatting, + isAdminOrMod: isAdmin || isMod, + save_id: save_id, + privileges: globalPrivileges, + 'composer:showHelpTab': meta.config['composer:showHelpTab'] === 1, + }, + }; +}; + +function generateDiscardRoute(req, topicData) { + if (req.query.cid) { + return `${nconf.get('relative_path')}/category/${validator.escape(String(req.query.cid))}`; + } else if ((req.query.tid || req.query.pid)) { + if (topicData) { + return `${nconf.get('relative_path')}/topic/${topicData.slug}`; + } + return `${nconf.get('relative_path')}/`; + } +} + +async function generateBody(req, postData) { + let body = ''; + // Quoted reply + if (req.query.toPid && parseInt(req.query.quoted, 10) === 1 && postData) { + const username = await user.getUserField(postData.uid, 'username'); + const translated = await translator.translate(`[[modules:composer.user-said, ${username}]]`); + body = `${translated}\n` + + `> ${postData ? `${postData.content.replace(/\n/g, '\n> ')}\n\n` : ''}`; + } else if (req.query.body || req.query.content) { + body = validator.escape(String(req.query.body || req.query.content)); + } + body = postData ? postData.content : ''; + return translator.escape(body); +} + +async function getPostData(req) { + if (!req.query.pid && !req.query.toPid) { + return null; + } + + return await posts.getPostData(req.query.pid || req.query.toPid); +} + +async function getTopicData(req) { + if (req.query.tid) { + return await topics.getTopicData(req.query.tid); + } else if (req.query.pid) { + return await topics.getTopicDataByPid(req.query.pid); + } + return null; +} + +async function isModerator(req) { + if (!req.loggedIn) { + return false; + } + const cid = cidFromQuery(req.query); + return await user.isModerator(req.uid, cid); +} + +async function canTag(req) { + if (parseInt(req.query.cid, 10)) { + return await privileges.categories.can('topics:tag', req.query.cid, req.uid); + } + return true; +} + +async function canSchedule(req) { + if (parseInt(req.query.cid, 10)) { + return await privileges.categories.can('topics:schedule', req.query.cid, req.uid); + } + return false; +} + +async function getTagWhitelist(query, uid) { + const cid = await cidFromQuery(query); + const [tagWhitelist, isAdminOrMod] = await Promise.all([ + categories.getTagWhitelist([cid]), + privileges.categories.isAdminOrMod(cid, uid), + ]); + return categories.filterTagWhitelist(tagWhitelist[0], isAdminOrMod); +} + +async function cidFromQuery(query) { + if (query.cid) { + return query.cid; + } else if (query.tid) { + return await topics.getTopicField(query.tid, 'cid'); + } else if (query.pid) { + return await posts.getCidByPid(query.pid); + } + return null; +} diff --git a/node_modules/nodebb-plugin-composer-default/package.json b/node_modules/nodebb-plugin-composer-default/package.json new file mode 100644 index 0000000000..625184980c --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/package.json @@ -0,0 +1,43 @@ +{ + "name": "nodebb-plugin-composer-default", + "version": "10.2.36", + "description": "Default composer for NodeBB", + "main": "library.js", + "repository": { + "type": "git", + "url": "https://github.com/NodeBB/nodebb-plugin-composer-default" + }, + "scripts": { + "lint": "eslint ." + }, + "keywords": [ + "nodebb", + "plugin", + "composer", + "markdown" + ], + "author": { + "name": "NodeBB Team", + "email": "sales@nodebb.org" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/NodeBB/nodebb-plugin-composer-default/issues" + }, + "readmeFilename": "README.md", + "nbbpm": { + "compatibility": "^3.0.0" + }, + "dependencies": { + "@textcomplete/contenteditable": "^0.1.12", + "@textcomplete/core": "^0.1.12", + "@textcomplete/textarea": "^0.1.12", + "screenfull": "^5.0.2", + "validator": "^13.7.0" + }, + "devDependencies": { + "eslint": "^7.32.0", + "eslint-config-nodebb": "^0.0.1", + "eslint-plugin-import": "^2.23.4" + } +} diff --git a/node_modules/nodebb-plugin-composer-default/plugin.json b/node_modules/nodebb-plugin-composer-default/plugin.json new file mode 100644 index 0000000000..c75ef14259 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/plugin.json @@ -0,0 +1,35 @@ +{ + "id": "nodebb-plugin-composer-default", + "url": "https://github.com/NodeBB/nodebb-plugin-composer-default", + "library": "library.js", + "hooks": [ + { "hook": "static:app.load", "method": "init" }, + { "hook": "filter:config.get", "method": "appendConfig" }, + { "hook": "filter:composer.build", "method": "filterComposerBuild" }, + { "hook": "filter:admin.header.build", "method": "addAdminNavigation" }, + { "hook": "filter:meta.getLinkTags", "method": "addPrefetchTags" } + ], + "scss": [ + "./static/scss/composer.scss" + ], + "scripts": [ + "./static/lib/client.js", + "./node_modules/screenfull/dist/screenfull.js" + ], + "modules": { + "composer.js": "./static/lib/composer.js", + "composer/categoryList.js": "./static/lib/composer/categoryList.js", + "composer/controls.js": "./static/lib/composer/controls.js", + "composer/drafts.js": "./static/lib/composer/drafts.js", + "composer/formatting.js": "./static/lib/composer/formatting.js", + "composer/preview.js": "./static/lib/composer/preview.js", + "composer/resize.js": "./static/lib/composer/resize.js", + "composer/scheduler.js": "./static/lib/composer/scheduler.js", + "composer/tags.js": "./static/lib/composer/tags.js", + "composer/uploads.js": "./static/lib/composer/uploads.js", + "composer/autocomplete.js": "./static/lib/composer/autocomplete.js", + "composer/post-queue.js": "./static/lib/composer/post-queue.js", + "../admin/plugins/composer-default.js": "./static/lib/admin.js" + }, + "templates": "static/templates" +} \ No newline at end of file diff --git a/node_modules/nodebb-plugin-composer-default/screenshots/desktop.png b/node_modules/nodebb-plugin-composer-default/screenshots/desktop.png new file mode 100644 index 0000000000000000000000000000000000000000..a6d4631e4e5cb94c39729b3c68fc1baebae80c2d GIT binary patch literal 27980 zcmbq)Wl&s8*DeVO96U&ZLxKi(1{fp+4<6jzWpJ0^4ncy$gb>`_28Y4j-Q8UVhD*+Q z&wIZ=x9Y39UAuPGp7vf(ueEyhGhqsH5*VmNs0auM7*dj=Ul9;qEh8YjX!r~1`4>f= zJ0k>y_Xtv=!pd&xhfAK?%FgRgXEW%XZGU~7dHvbOX{_rt`SQ5rV=z9WX7%}aZlZ-o zNy)vKHjTB#+Rh9OrwK{(iez{eK> zH5|3~+ca#ivu7=x!*O`W%M^3aePri?7s<0BI~*yUo^A_Y7>-ebgZ+1kwVI51-Hp(= zjc*Z5juyVRx-+rcL%gK^?w@RI>{u|su`;Ec~J*%QdC^_iI8mU6m&z zA#sk5Pv!HO1u<=e+=Y=ao6tKv$I4yK?mQd3j7mihXmnL&<waCMCl`;x!qWIKP0bTdE8JIubvBq#Hp|D?^D> zLw>Q7qKb-G(1es&P<;Ovd|gxdc@4NvfqsiCo%eqrc@^9fxX0{k*of_v+=<`m595 zD;Sob>!LG0C>f`LgVJ0VEmh_!xMd=Y#ba z0&NlAmF*wr=E*JOJ2fn}2t7|Um|*l1h@wRFA26gfXsaY7WVX-rjQ`S+X6acNh%Ac< znxM|9*OomY`anS;BpaOSOR?^g1ZnuZ)KY{LAbgQJ1KH*(b04zOy%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5k9F?v(MLGKvs1Pf##{1Lr6sn{5i_{pkAO-;Bn zXAcew4#t1mA};pr#Fhh=C9R`Yq|rc+XiuX??pUfLx#pJ~D$x6Nr%asd2f=7mTwAW7 zqnd!S@;qD0^gV7*%hb?k$4$>GzxpU%2!|GY^-)sn|CbQ?wjY0FZai>6ZS_sbm*$t* z_(Fy+YvGF&d{M&xGbL;-=_|4c)^_ys*^QTqSHh=2&fBee2PXT96qTe^ { + let pushData = { + save_id: data.save_id, + action: 'topics.post', + cid: data.cid, + handle: data.handle, + title: data.title || '', + body: data.body || '', + tags: data.tags || [], + modified: !!((data.title && data.title.length) || (data.body && data.body.length)), + isMain: true, + }; + + ({ pushData } = await hooks.fire('filter:composer.topic.push', { + data: data, + pushData: pushData, + })); + + push(pushData); + }; + + composer.addQuote = function (data) { + // tid, toPid, selectedPid, title, username, text, uuid + data.uuid = data.uuid || composer.active; + + var escapedTitle = (data.title || '') + .replace(/([\\`*_{}[\]()#+\-.!])/g, '\\$1') + .replace(/\[/g, '[') + .replace(/\]/g, ']') + .replace(/%/g, '%') + .replace(/,/g, ','); + + if (data.body) { + data.body = '> ' + data.body.replace(/\n/g, '\n> ') + '\n\n'; + } + var link = '[' + escapedTitle + '](' + config.relative_path + '/post/' + encodeURIComponent(data.selectedPid || data.toPid) + ')'; + if (data.uuid === undefined) { + if (data.title && (data.selectedPid || data.toPid)) { + composer.newReply({ + tid: data.tid, + toPid: data.toPid, + title: data.title, + body: '[[modules:composer.user-said-in, ' + data.username + ', ' + link + ']]\n' + data.body, + }); + } else { + composer.newReply({ + tid: data.tid, + toPid: data.toPid, + title: data.title, + body: '[[modules:composer.user-said, ' + data.username + ']]\n' + data.body, + }); + } + return; + } else if (data.uuid !== composer.active) { + // If the composer is not currently active, activate it + composer.load(data.uuid); + } + + var postContainer = $('.composer[data-uuid="' + data.uuid + '"]'); + var bodyEl = postContainer.find('textarea'); + var prevText = bodyEl.val(); + if (data.title && (data.selectedPid || data.toPid)) { + translator.translate('[[modules:composer.user-said-in, ' + data.username + ', ' + link + ']]\n', config.defaultLang, onTranslated); + } else { + translator.translate('[[modules:composer.user-said, ' + data.username + ']]\n', config.defaultLang, onTranslated); + } + + function onTranslated(translated) { + composer.posts[data.uuid].body = (prevText.length ? prevText + '\n\n' : '') + translated + data.body; + bodyEl.val(composer.posts[data.uuid].body); + focusElements(postContainer); + preview.render(postContainer); + } + }; + + composer.newReply = function (data) { + translator.translate(data.body, config.defaultLang, function (translated) { + push({ + save_id: data.save_id, + action: 'posts.reply', + tid: data.tid, + toPid: data.toPid, + title: data.title, + body: translated, + modified: !!(translated && translated.length), + isMain: false, + }); + }); + }; + + composer.editPost = function (data) { + // pid, text + socket.emit('plugins.composer.push', data.pid, function (err, postData) { + if (err) { + return alerts.error(err); + } + postData.save_id = data.save_id; + postData.action = 'posts.edit'; + postData.pid = data.pid; + postData.modified = false; + if (data.body) { + postData.body = data.body; + postData.modified = true; + } + if (data.title) { + postData.title = data.title; + postData.modified = true; + } + push(postData); + }); + }; + + composer.load = function (post_uuid) { + var postContainer = $('.composer[data-uuid="' + post_uuid + '"]'); + if (postContainer.length) { + activate(post_uuid); + resize.reposition(postContainer); + focusElements(postContainer); + onShow(); + } else if (composer.formatting) { + createNewComposer(post_uuid); + } else { + socket.emit('plugins.composer.getFormattingOptions', function (err, options) { + if (err) { + return alerts.error(err); + } + composer.formatting = options; + createNewComposer(post_uuid); + }); + } + }; + + composer.enhance = function (postContainer, post_uuid, postData) { + /* + This method enhances a composer container with client-side sugar (preview, etc) + Everything in here also applies to the /compose route + */ + + if (!post_uuid && !postData) { + post_uuid = utils.generateUUID(); + composer.posts[post_uuid] = ajaxify.data; + postData = ajaxify.data; + postContainer.attr('data-uuid', post_uuid); + } + + categoryList.init(postContainer, composer.posts[post_uuid]); + scheduler.init(postContainer, composer.posts); + + formatting.addHandler(postContainer); + formatting.addComposerButtons(); + preview.handleToggler(postContainer); + postQueue.showAlert(postContainer, postData); + uploads.initialize(post_uuid); + tags.init(postContainer, composer.posts[post_uuid]); + autocomplete.init(postContainer, post_uuid); + + postContainer.on('change', 'input, textarea', function () { + composer.posts[post_uuid].modified = true; + }); + + postContainer.on('click', '.composer-submit', function (e) { + e.preventDefault(); + e.stopPropagation(); // Other click events bring composer back to active state which is undesired on submit + + $(this).attr('disabled', true); + post(post_uuid); + }); + + require(['mousetrap'], function (mousetrap) { + mousetrap(postContainer.get(0)).bind('mod+enter', function () { + postContainer.find('.composer-submit').attr('disabled', true); + post(post_uuid); + }); + }); + + postContainer.find('.composer-discard').on('click', function (e) { + e.preventDefault(); + + if (!composer.posts[post_uuid].modified) { + composer.discard(post_uuid); + return removeComposerHistory(); + } + + formatting.exitFullscreen(); + + var btn = $(this).prop('disabled', true); + translator.translate('[[modules:composer.discard]]', function (translated) { + bootbox.confirm(translated, function (confirm) { + if (confirm) { + composer.discard(post_uuid); + removeComposerHistory(); + } + btn.prop('disabled', false); + }); + }); + }); + + postContainer.find('.composer-minimize, .minimize .trigger').on('click', function (e) { + e.preventDefault(); + e.stopPropagation(); + composer.minimize(post_uuid); + }); + + const textareaEl = postContainer.find('textarea'); + textareaEl.on('input propertychange', utils.debounce(function () { + preview.render(postContainer); + }, 250)); + + textareaEl.on('scroll', function () { + preview.matchScroll(postContainer); + }); + + drafts.init(postContainer, postData); + const draft = drafts.get(postData.save_id); + + preview.render(postContainer, function () { + preview.matchScroll(postContainer); + }); + + handleHelp(postContainer); + handleSearch(postContainer); + focusElements(postContainer); + if (postData.action === 'posts.edit') { + composer.updateThumbCount(post_uuid, postContainer); + } + + // Hide "zen mode" if fullscreen API is not enabled/available (ahem, iOS...) + if (!screenfull.isEnabled) { + $('[data-format="zen"]').parent().addClass('hidden'); + } + + hooks.fire('action:composer.enhanced', { postContainer, postData, draft }); + }; + + async function getSelectedCategory(postData) { + if (ajaxify.data.template.category && parseInt(postData.cid, 10) === parseInt(ajaxify.data.cid, 10)) { + // no need to load data if we are already on the category page + return ajaxify.data; + } else if (parseInt(postData.cid, 10)) { + return await api.get(`/api/category/${postData.cid}`, {}); + } + return null; + } + + async function createNewComposer(post_uuid) { + var postData = composer.posts[post_uuid]; + + var isTopic = postData ? postData.hasOwnProperty('cid') : false; + var isMain = postData ? !!postData.isMain : false; + var isEditing = postData ? !!postData.pid : false; + var isGuestPost = postData ? parseInt(postData.uid, 10) === 0 : false; + const isScheduled = postData.timestamp > Date.now(); + + // see + // https://github.com/NodeBB/NodeBB/issues/2994 and + // https://github.com/NodeBB/NodeBB/issues/1951 + // remove when 1951 is resolved + + var title = postData.title.replace(/%/g, '%').replace(/,/g, ','); + postData.category = await getSelectedCategory(postData); + const privileges = postData.category ? postData.category.privileges : ajaxify.data.privileges; + var data = { + topicTitle: title, + titleLength: title.length, + body: translator.escape(utils.escapeHTML(postData.body)), + mobile: composer.bsEnvironment === 'xs' || composer.bsEnvironment === 'sm', + resizable: true, + thumb: postData.thumb, + isTopicOrMain: isTopic || isMain, + maximumTitleLength: config.maximumTitleLength, + maximumPostLength: config.maximumPostLength, + minimumTagLength: config.minimumTagLength, + maximumTagLength: config.maximumTagLength, + 'composer:showHelpTab': config['composer:showHelpTab'], + isTopic: isTopic, + isEditing: isEditing, + canSchedule: !!(isMain && privileges && + ((privileges['topics:schedule'] && !isEditing) || (isScheduled && privileges.view_scheduled))), + showHandleInput: config.allowGuestHandles && + (app.user.uid === 0 || (isEditing && isGuestPost && app.user.isAdmin)), + handle: postData ? postData.handle || '' : undefined, + formatting: composer.formatting, + tagWhitelist: postData.category ? postData.category.tagWhitelist : ajaxify.data.tagWhitelist, + privileges: app.user.privileges, + selectedCategory: postData.category, + submitOptions: [ + // Add items using `filter:composer.create`, or just add them to the
    in DOM + // { + // action: 'foobar', + // text: 'Text Label', + // } + ], + }; + + if (data.mobile) { + mobileHistoryAppend(); + + app.toggleNavbar(false); + } + + postData.mobile = composer.bsEnvironment === 'xs' || composer.bsEnvironment === 'sm'; + + ({ postData, createData: data } = await hooks.fire('filter:composer.create', { + postData: postData, + createData: data, + })); + + app.parseAndTranslate('composer', data, function (composerTemplate) { + if ($('.composer.composer[data-uuid="' + post_uuid + '"]').length) { + return; + } + composerTemplate = $(composerTemplate); + + composerTemplate.find('.title').each(function () { + $(this).text(translator.unescape($(this).text())); + }); + + composerTemplate.attr('data-uuid', post_uuid); + + $(document.body).append(composerTemplate); + + var postContainer = $(composerTemplate[0]); + + resize.reposition(postContainer); + composer.enhance(postContainer, post_uuid, postData); + /* + Everything after this line is applied to the resizable composer only + Want something done to both resizable composer and the one in /compose? + Put it in composer.enhance(). + + Eventually, stuff after this line should be moved into composer.enhance(). + */ + + activate(post_uuid); + + postContainer.on('click', function () { + if (!taskbar.isActive(post_uuid)) { + taskbar.updateActive(post_uuid); + } + }); + + resize.handleResize(postContainer); + + if (composer.bsEnvironment === 'xs' || composer.bsEnvironment === 'sm') { + var submitBtns = postContainer.find('.composer-submit'); + var mobileSubmitBtn = postContainer.find('.mobile-navbar .composer-submit'); + var textareaEl = postContainer.find('.write'); + var idx = textareaEl.attr('tabindex'); + + submitBtns.removeAttr('tabindex'); + mobileSubmitBtn.attr('tabindex', parseInt(idx, 10) + 1); + } + + $(window).trigger('action:composer.loaded', { + postContainer: postContainer, + post_uuid: post_uuid, + composerData: composer.posts[post_uuid], + formatting: composer.formatting, + }); + + scrollStop.apply(postContainer.find('.write')); + focusElements(postContainer); + onShow(); + }); + } + + function mobileHistoryAppend() { + var path = 'compose?p=' + window.location.pathname; + var returnPath = window.location.pathname.slice(1) + window.location.search; + + // Remove relative path from returnPath + if (returnPath.startsWith(config.relative_path.slice(1))) { + returnPath = returnPath.slice(config.relative_path.length); + } + + // Add in return path to be caught by ajaxify when post is completed, or if back is pressed + window.history.replaceState({ + url: null, + returnPath: returnPath, + }, returnPath, config.relative_path + '/' + returnPath); + + // Update address bar in case f5 is pressed + window.history.pushState({ + url: path, + }, path, `${config.relative_path}/${returnPath}`); + } + + function handleHelp(postContainer) { + const helpBtn = postContainer.find('[data-action="help"]'); + helpBtn.on('click', async function () { + const html = await socket.emit('plugins.composer.renderHelp'); + if (html && html.length > 0) { + bootbox.dialog({ + size: 'large', + message: html, + onEscape: true, + backdrop: true, + onHidden: function () { + helpBtn.focus(); + }, + }); + } + }); + } + + function handleSearch(postContainer) { + var uuid = postContainer.attr('data-uuid'); + var isEditing = composer.posts[uuid] && composer.posts[uuid].action === 'posts.edit'; + var env = utils.findBootstrapEnvironment(); + var isMobile = env === 'xs' || env === 'sm'; + if (isEditing || isMobile) { + return; + } + + search.enableQuickSearch({ + searchElements: { + inputEl: postContainer.find('input.title'), + resultEl: postContainer.find('.quick-search-container'), + }, + searchOptions: { + composer: 1, + }, + hideOnNoMatches: true, + hideDuringSearch: true, + }); + } + + function activate(post_uuid) { + if (composer.active && composer.active !== post_uuid) { + composer.minimize(composer.active); + } + + composer.active = post_uuid; + const postContainer = $('.composer[data-uuid="' + post_uuid + '"]'); + postContainer.css('visibility', 'visible'); + $(window).trigger('action:composer.activate', { + post_uuid: post_uuid, + postContainer: postContainer, + }); + } + + function focusElements(postContainer) { + setTimeout(function () { + var title = postContainer.find('input.title'); + + if (title.length) { + title.focus(); + } else { + postContainer.find('textarea').focus().putCursorAtEnd(); + } + }, 20); + } + + async function post(post_uuid) { + var postData = composer.posts[post_uuid]; + var postContainer = $('.composer[data-uuid="' + post_uuid + '"]'); + var handleEl = postContainer.find('.handle'); + var titleEl = postContainer.find('.title'); + var bodyEl = postContainer.find('textarea'); + var thumbEl = postContainer.find('input#topic-thumb-url'); + var onComposeRoute = postData.hasOwnProperty('template') && postData.template.compose === true; + const submitBtn = postContainer.find('.composer-submit'); + + titleEl.val(titleEl.val().trim()); + bodyEl.val(utils.rtrim(bodyEl.val())); + if (thumbEl.length) { + thumbEl.val(thumbEl.val().trim()); + } + + var action = postData.action; + + var checkTitle = (postData.hasOwnProperty('cid') || parseInt(postData.pid, 10)) && postContainer.find('input.title').length; + var isCategorySelected = !checkTitle || (checkTitle && parseInt(postData.cid, 10)); + + // Specifically for checking title/body length via plugins + var payload = { + post_uuid: post_uuid, + postData: postData, + postContainer: postContainer, + titleEl: titleEl, + titleLen: titleEl.val().length, + bodyEl: bodyEl, + bodyLen: bodyEl.val().length, + }; + + await hooks.fire('filter:composer.check', payload); + $(window).trigger('action:composer.check', payload); + + if (payload.error) { + return composerAlert(post_uuid, payload.error); + } + + if (uploads.inProgress[post_uuid] && uploads.inProgress[post_uuid].length) { + return composerAlert(post_uuid, '[[error:still-uploading]]'); + } else if (checkTitle && payload.titleLen < parseInt(config.minimumTitleLength, 10)) { + return composerAlert(post_uuid, '[[error:title-too-short, ' + config.minimumTitleLength + ']]'); + } else if (checkTitle && payload.titleLen > parseInt(config.maximumTitleLength, 10)) { + return composerAlert(post_uuid, '[[error:title-too-long, ' + config.maximumTitleLength + ']]'); + } else if (action === 'topics.post' && !isCategorySelected) { + return composerAlert(post_uuid, '[[error:category-not-selected]]'); + } else if (payload.bodyLen < parseInt(config.minimumPostLength, 10)) { + return composerAlert(post_uuid, '[[error:content-too-short, ' + config.minimumPostLength + ']]'); + } else if (payload.bodyLen > parseInt(config.maximumPostLength, 10)) { + return composerAlert(post_uuid, '[[error:content-too-long, ' + config.maximumPostLength + ']]'); + } else if (checkTitle && !tags.isEnoughTags(post_uuid)) { + return composerAlert(post_uuid, '[[error:not-enough-tags, ' + tags.minTagCount() + ']]'); + } else if (scheduler.isActive() && scheduler.getTimestamp() <= Date.now()) { + return composerAlert(post_uuid, '[[error:scheduling-to-past]]'); + } + + let composerData = { + uuid: post_uuid, + }; + let method = 'post'; + let route = ''; + + if (action === 'topics.post') { + route = '/topics'; + composerData = { + ...composerData, + handle: handleEl ? handleEl.val() : undefined, + title: titleEl.val(), + content: bodyEl.val(), + thumb: thumbEl.val() || '', + cid: categoryList.getSelectedCid(), + tags: tags.getTags(post_uuid), + timestamp: scheduler.getTimestamp(), + }; + } else if (action === 'posts.reply') { + route = `/topics/${postData.tid}`; + composerData = { + ...composerData, + tid: postData.tid, + handle: handleEl ? handleEl.val() : undefined, + content: bodyEl.val(), + toPid: postData.toPid, + }; + } else if (action === 'posts.edit') { + method = 'put'; + route = `/posts/${postData.pid}`; + composerData = { + ...composerData, + pid: postData.pid, + handle: handleEl ? handleEl.val() : undefined, + content: bodyEl.val(), + title: titleEl.val(), + thumb: thumbEl.val() || '', + tags: tags.getTags(post_uuid), + timestamp: scheduler.getTimestamp(), + }; + } + var submitHookData = { + composerEl: postContainer, + action: action, + composerData: composerData, + postData: postData, + redirect: true, + }; + + await hooks.fire('filter:composer.submit', submitHookData); + hooks.fire('action:composer.submit', Object.freeze(submitHookData)); + + // Minimize composer (and set textarea as readonly) while submitting + var taskbarIconEl = $('#taskbar .composer[data-uuid="' + post_uuid + '"] i'); + var textareaEl = postContainer.find('.write'); + taskbarIconEl.removeClass('fa-plus').addClass('fa-circle-o-notch fa-spin'); + composer.minimize(post_uuid); + textareaEl.prop('readonly', true); + + api[method](route, composerData) + .then((data) => { + submitBtn.removeAttr('disabled'); + postData.submitted = true; + + composer.discard(post_uuid); + drafts.removeDraft(postData.save_id); + + if (data.queued) { + alerts.alert({ + type: 'success', + title: '[[global:alert.success]]', + message: data.message, + timeout: 10000, + clickfn: function () { + ajaxify.go(`/post-queue/${data.id}`); + }, + }); + } else if (action === 'topics.post') { + if (submitHookData.redirect) { + ajaxify.go('topic/' + data.slug, undefined, (onComposeRoute || composer.bsEnvironment === 'xs' || composer.bsEnvironment === 'sm')); + } + } else if (action === 'posts.reply') { + if (onComposeRoute || composer.bsEnvironment === 'xs' || composer.bsEnvironment === 'sm') { + window.history.back(); + } else if (submitHookData.redirect && + ((ajaxify.data.template.name !== 'topic') || + (ajaxify.data.template.topic && parseInt(postData.tid, 10) !== parseInt(ajaxify.data.tid, 10))) + ) { + ajaxify.go('post/' + data.pid); + } + } else { + removeComposerHistory(); + } + + hooks.fire('action:composer.' + action, { composerData: composerData, data: data }); + }) + .catch((err) => { + // Restore composer on error + composer.load(post_uuid); + textareaEl.prop('readonly', false); + if (err.message === '[[error:email-not-confirmed]]') { + return messagesModule.showEmailConfirmWarning(err.message); + } + composerAlert(post_uuid, err.message); + }); + } + + function onShow() { + $('html').addClass('composing'); + } + + function onHide() { + $('#content').css({ paddingBottom: 0 }); + $('html').removeClass('composing'); + app.toggleNavbar(true); + formatting.exitFullscreen(); + } + + composer.discard = function (post_uuid) { + if (composer.posts[post_uuid]) { + var postData = composer.posts[post_uuid]; + var postContainer = $('.composer[data-uuid="' + post_uuid + '"]'); + postContainer.remove(); + drafts.removeDraft(postData.save_id); + topicThumbs.deleteAll(post_uuid); + + taskbar.discard('composer', post_uuid); + $('[data-action="post"]').removeAttr('disabled'); + + hooks.fire('action:composer.discard', { + post_uuid: post_uuid, + postData: postData, + }); + delete composer.posts[post_uuid]; + composer.active = undefined; + } + scheduler.reset(); + onHide(); + }; + + // Alias to .discard(); + composer.close = composer.discard; + + composer.minimize = function (post_uuid) { + var postContainer = $('.composer[data-uuid="' + post_uuid + '"]'); + postContainer.css('visibility', 'hidden'); + composer.active = undefined; + taskbar.minimize('composer', post_uuid); + $(window).trigger('action:composer.minimize', { + post_uuid: post_uuid, + }); + + onHide(); + }; + + composer.minimizeActive = function () { + if (composer.active) { + composer.miminize(composer.active); + } + }; + + composer.updateThumbCount = function (uuid, postContainer) { + const composerObj = composer.posts[uuid]; + if (composerObj.action === 'topics.post' || (composerObj.action === 'posts.edit' && composerObj.isMain)) { + const calls = [ + topicThumbs.get(uuid), + ]; + if (composerObj.pid) { + calls.push(topicThumbs.getByPid(composerObj.pid)); + } + Promise.all(calls).then((thumbs) => { + const thumbCount = thumbs.flat().length; + const formatEl = postContainer.find('[data-format="thumbs"]'); + formatEl.find('.badge') + .text(thumbCount) + .toggleClass('hidden', !thumbCount); + }); + } + }; + + return composer; +}); diff --git a/node_modules/nodebb-plugin-composer-default/static/lib/composer/autocomplete.js b/node_modules/nodebb-plugin-composer-default/static/lib/composer/autocomplete.js new file mode 100644 index 0000000000..ec2ce15d33 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/lib/composer/autocomplete.js @@ -0,0 +1,99 @@ +'use strict'; + +define('composer/autocomplete', [ + 'composer/preview', '@textcomplete/core', '@textcomplete/textarea', '@textcomplete/contenteditable', +], function (preview, { Textcomplete }, { TextareaEditor }, { ContenteditableEditor }) { + var autocomplete = { + _active: {}, + }; + + $(window).on('action:composer.discard', function (evt, data) { + if (autocomplete._active.hasOwnProperty(data.post_uuid)) { + autocomplete._active[data.post_uuid].destroy(); + delete autocomplete._active[data.post_uuid]; + } + }); + + autocomplete.init = function (postContainer, post_uuid) { + var element = postContainer.find('.write'); + var dropdownClass = 'composer-autocomplete-dropdown-' + post_uuid; + var timer; + + if (!element.length) { + /** + * Some composers do their own thing before calling autocomplete.init() again. + * One reason is because they want to override the textarea with their own element. + * In those scenarios, they don't specify the "write" class, and this conditional + * looks for that and stops the autocomplete init process. + */ + return; + } + + var data = { + element: element, + strategies: [], + options: { + style: { + 'z-index': 20000, + }, + className: dropdownClass + ' dropdown-menu textcomplete-dropdown', + }, + }; + + element.on('keyup', function () { + clearTimeout(timer); + timer = setTimeout(function () { + var dropdown = document.querySelector('.' + dropdownClass); + if (dropdown) { + var pos = dropdown.getBoundingClientRect(); + + var margin = parseFloat(dropdown.style.marginTop, 10) || 0; + + var offset = window.innerHeight + margin - 10 - pos.bottom; + dropdown.style.marginTop = Math.min(offset, 0) + 'px'; + } + }, 0); + }); + + $(window).trigger('composer:autocomplete:init', data); + + autocomplete._active[post_uuid] = autocomplete.setup(data); + + data.element.on('textComplete:select', function () { + preview.render(postContainer); + }); + }; + + // This is a generic method that is also used by the chat + autocomplete.setup = function ({ element, strategies, options }) { + const targetEl = element.get(0); + if (!targetEl) { + return; + } + var editor; + if (targetEl.nodeName === 'TEXTAREA' || targetEl.nodeName === 'INPUT') { + editor = new TextareaEditor(targetEl); + } else if (targetEl.nodeName === 'DIV' && targetEl.getAttribute('contenteditable') === 'true') { + editor = new ContenteditableEditor(targetEl); + } + if (!editor) { + throw new Error('unknown target element type'); + } + // yuku-t/textcomplete inherits directionality from target element itself + targetEl.setAttribute('dir', document.querySelector('html').getAttribute('data-dir')); + + var textcomplete = new Textcomplete(editor, strategies, { + dropdown: options, + }); + textcomplete.on('rendered', function () { + if (textcomplete.dropdown.items.length) { + // Activate the first item by default. + textcomplete.dropdown.items[0].activate(); + } + }); + + return textcomplete; + }; + + return autocomplete; +}); diff --git a/node_modules/nodebb-plugin-composer-default/static/lib/composer/categoryList.js b/node_modules/nodebb-plugin-composer-default/static/lib/composer/categoryList.js new file mode 100644 index 0000000000..79f5b7a46b --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/lib/composer/categoryList.js @@ -0,0 +1,115 @@ +'use strict'; + +define('composer/categoryList', [ + 'categorySelector', 'taskbar', 'api', +], function (categorySelector, taskbar, api) { + var categoryList = {}; + + var selector; + + categoryList.init = function (postContainer, postData) { + var listContainer = postContainer.find('.category-list-container'); + if (!listContainer.length) { + return; + } + + postContainer.on('action:composer.resize', function () { + toggleDropDirection(postContainer); + }); + + categoryList.updateTaskbar(postContainer, postData); + + selector = categorySelector.init(listContainer.find('[component="category-selector"]'), { + privilege: 'topics:create', + states: ['watching', 'tracking', 'notwatching', 'ignoring'], + onSelect: function (selectedCategory) { + if (postData.hasOwnProperty('cid')) { + changeCategory(postContainer, postData, selectedCategory); + } + }, + }); + if (!selector) { + return; + } + if (postData.cid && postData.category) { + selector.selectedCategory = { cid: postData.cid, name: postData.category.name }; + } else if (ajaxify.data.template.compose && ajaxify.data.selectedCategory) { + // separate composer route + selector.selectedCategory = { cid: ajaxify.data.cid, name: ajaxify.data.selectedCategory }; + } + + // this is the mobile category selector + postContainer.find('.category-name') + .translateHtml(selector.selectedCategory ? selector.selectedCategory.name : '[[modules:composer.select-category]]') + .on('click', function () { + categorySelector.modal({ + privilege: 'topics:create', + states: ['watching', 'tracking', 'notwatching', 'ignoring'], + openOnLoad: true, + showLinks: false, + onSubmit: function (selectedCategory) { + postContainer.find('.category-name').text(selectedCategory.name); + selector.selectCategory(selectedCategory.cid); + if (postData.hasOwnProperty('cid')) { + changeCategory(postContainer, postData, selectedCategory); + } + }, + }); + }); + + toggleDropDirection(postContainer); + }; + + function toggleDropDirection(postContainer) { + postContainer.find('.category-list-container [component="category-selector"]').toggleClass('dropup', postContainer.outerHeight() < $(window).height() / 2); + } + + categoryList.getSelectedCid = function () { + var selectedCategory; + if (selector) { + selectedCategory = selector.getSelectedCategory(); + } + return selectedCategory ? selectedCategory.cid : 0; + }; + + categoryList.updateTaskbar = function (postContainer, postData) { + if (parseInt(postData.cid, 10)) { + api.get(`/categories/${postData.cid}`, {}).then(function (category) { + updateTaskbarByCategory(postContainer, category); + }); + } + }; + + function updateTaskbarByCategory(postContainer, category) { + if (category) { + var uuid = postContainer.attr('data-uuid'); + taskbar.update('composer', uuid, { + image: category.backgroundImage, + color: category.color, + 'background-color': category.bgColor, + icon: category.icon && category.icon.slice(3), + }); + } + } + + async function changeCategory(postContainer, postData, selectedCategory) { + postData.cid = selectedCategory.cid; + const categoryData = await window.fetch(`${config.relative_path}/api/category/${selectedCategory.cid}`).then(r => r.json()); + postData.category = categoryData; + updateTaskbarByCategory(postContainer, categoryData); + require(['composer/scheduler', 'composer/tags', 'composer/post-queue'], function (scheduler, tags, postQueue) { + scheduler.onChangeCategory(categoryData); + tags.onChangeCategory(postContainer, postData, selectedCategory.cid, categoryData); + postQueue.onChangeCategory(postContainer, postData); + + $(window).trigger('action:composer.changeCategory', { + postContainer: postContainer, + postData: postData, + selectedCategory: selectedCategory, + categoryData: categoryData, + }); + }); + } + + return categoryList; +}); diff --git a/node_modules/nodebb-plugin-composer-default/static/lib/composer/controls.js b/node_modules/nodebb-plugin-composer-default/static/lib/composer/controls.js new file mode 100644 index 0000000000..bf393fc21a --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/lib/composer/controls.js @@ -0,0 +1,171 @@ +'use strict'; + +define('composer/controls', ['composer/preview'], function (preview) { + var controls = {}; + + /** ********************************************** */ + /* Rich Textarea Controls */ + /** ********************************************** */ + controls.insertIntoTextarea = function (textarea, value) { + var payload = { + context: this, + textarea: textarea, + value: value, + preventDefault: false, + }; + $(window).trigger('action:composer.insertIntoTextarea', payload); + + if (payload.preventDefault) { + return; + } + + var $textarea = $(payload.textarea); + var currentVal = $textarea.val(); + var postContainer = $textarea.parents('[component="composer"]'); + + $textarea.val( + currentVal.slice(0, payload.textarea.selectionStart) + + payload.value + + currentVal.slice(payload.textarea.selectionStart) + ); + + preview.render(postContainer); + }; + + controls.replaceSelectionInTextareaWith = function (textarea, value) { + var payload = { + context: this, + textarea: textarea, + value: value, + preventDefault: false, + }; + $(window).trigger('action:composer.replaceSelectionInTextareaWith', payload); + + if (payload.preventDefault) { + return; + } + + var $textarea = $(payload.textarea); + var currentVal = $textarea.val(); + var postContainer = $textarea.parents('[component="composer"]'); + + $textarea.val( + currentVal.slice(0, payload.textarea.selectionStart) + + payload.value + + currentVal.slice(payload.textarea.selectionEnd) + ); + + preview.render(postContainer); + }; + + controls.wrapSelectionInTextareaWith = function (textarea, leading, trailing) { + var payload = { + context: this, + textarea: textarea, + leading: leading, + trailing: trailing, + preventDefault: false, + }; + $(window).trigger('action:composer.wrapSelectionInTextareaWith', payload); + + if (payload.preventDefault) { + return; + } + + if (trailing === undefined) { + trailing = leading; + } + + var $textarea = $(textarea); + var currentVal = $textarea.val(); + + var matches = /^(\s*)([\s\S]*?)(\s*)$/.exec(currentVal.slice(textarea.selectionStart, textarea.selectionEnd)); + + if (!matches[2]) { + // selection is entirely whitespace + matches = [null, '', currentVal.slice(textarea.selectionStart, textarea.selectionEnd), '']; + } + + $textarea.val( + currentVal.slice(0, textarea.selectionStart) + + matches[1] + + leading + + matches[2] + + trailing + + matches[3] + + currentVal.slice(textarea.selectionEnd) + ); + + return [matches[1].length, matches[3].length]; + }; + + controls.updateTextareaSelection = function (textarea, start, end) { + var payload = { + context: this, + textarea: textarea, + start: start, + end: end, + preventDefault: false, + }; + $(window).trigger('action:composer.updateTextareaSelection', payload); + + if (payload.preventDefault) { + return; + } + + textarea.setSelectionRange(payload.start, payload.end); + $(payload.textarea).focus(); + }; + + controls.getBlockData = function (textareaEl, query, selectionStart) { + // Determines whether the cursor is sitting inside a block-type element (bold, italic, etc.) + var value = textareaEl.value; + query = query.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&'); + var regex = new RegExp(query, 'g'); + var match; + var matchIndices = []; + var payload; + + // Isolate the line the cursor is on + value = value.split('\n').reduce(function (memo, line) { + if (memo !== null) { + return memo; + } + + memo = selectionStart <= line.length ? line : null; + + if (memo === null) { + selectionStart -= (line.length + 1); + } + + return memo; + }, null); + + // Find query characters and determine return payload + while ((match = regex.exec(value)) !== null) { + matchIndices.push(match.index); + } + + payload = { + in: !!(matchIndices.reduce(function (memo, cur) { + if (selectionStart >= cur + 2) { + memo += 1; + } + + return memo; + }, 0) % 2), + atEnd: matchIndices.reduce(function (memo, cur) { + if (memo) { + return memo; + } + + return selectionStart === cur; + }, false), + }; + + payload.atEnd = payload.in ? payload.atEnd : false; + return payload; + }; + + return controls; +}); diff --git a/node_modules/nodebb-plugin-composer-default/static/lib/composer/drafts.js b/node_modules/nodebb-plugin-composer-default/static/lib/composer/drafts.js new file mode 100644 index 0000000000..5a23cd10dc --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/lib/composer/drafts.js @@ -0,0 +1,341 @@ +'use strict'; + +define('composer/drafts', ['api', 'alerts'], function (api, alerts) { + const drafts = {}; + const draftSaveDelay = 1000; + drafts.init = function (postContainer, postData) { + const draftIconEl = postContainer.find('.draft-icon'); + const uuid = postContainer.attr('data-uuid'); + function doSaveDraft() { + // check if composer is still around, + // it might have been gone by the time this timeout triggers + if (!$(`[component="composer"][data-uuid="${uuid}"]`).length) { + return; + } + + if (!postData.save_id) { + postData.save_id = utils.generateSaveId(app.user.uid); + } + // Post is modified, save to list of opened drafts + drafts.addToDraftList('available', postData.save_id); + drafts.addToDraftList('open', postData.save_id); + saveDraft(postContainer, draftIconEl, postData); + } + + postContainer.on('keyup', 'textarea, input.handle, input.title', utils.debounce(doSaveDraft, draftSaveDelay)); + postContainer.on('click', 'input[type="checkbox"]', utils.debounce(doSaveDraft, draftSaveDelay)); + postContainer.on('click', '[component="category/list"] [data-cid]', utils.debounce(doSaveDraft, draftSaveDelay)); + postContainer.on('itemAdded', '.tags', utils.debounce(doSaveDraft, draftSaveDelay)); + postContainer.on('thumb.uploaded', doSaveDraft); + + draftIconEl.on('animationend', function () { + $(this).toggleClass('active', false); + }); + + $(window).on('unload', function () { + // remove all drafts from the open list + const open = drafts.getList('open'); + if (open.length) { + open.forEach(save_id => drafts.removeFromDraftList('open', save_id)); + } + }); + + drafts.migrateGuest(); + drafts.migrateThumbs(...arguments); + }; + + function getStorage(uid) { + return parseInt(uid, 10) > 0 ? localStorage : sessionStorage; + } + + drafts.get = function (save_id) { + if (!save_id) { + return null; + } + const uid = save_id.split(':')[1]; + const storage = getStorage(uid); + try { + const draftJson = storage.getItem(save_id); + const draft = JSON.parse(draftJson) || null; + if (!draft) { + throw new Error(`can't parse draft json for ${save_id}`); + } + draft.save_id = save_id; + if (draft.timestamp) { + draft.timestampISO = utils.toISOString(draft.timestamp); + } + $(window).trigger('action:composer.drafts.get', { + save_id: save_id, + draft: draft, + storage: storage, + }); + return draft; + } catch (e) { + console.warn(`[composer/drafts] Could not get draft ${save_id}, removing`); + drafts.removeFromDraftList('available'); + drafts.removeFromDraftList('open'); + return null; + } + }; + + function saveDraft(postContainer, draftIconEl, postData) { + if (canSave(app.user.uid ? 'localStorage' : 'sessionStorage') && postData && postData.save_id && postContainer.length) { + const titleEl = postContainer.find('input.title'); + const title = titleEl && titleEl.length && titleEl.val(); + const raw = postContainer.find('textarea').val(); + const storage = getStorage(app.user.uid); + + if (raw.length || (title && title.length)) { + const draftData = { + save_id: postData.save_id, + action: postData.action, + text: raw, + uuid: postContainer.attr('data-uuid'), + timestamp: Date.now(), + }; + + if (postData.action === 'topics.post') { + // New topic only + const tags = postContainer.find('input.tags').val(); + draftData.tags = tags; + draftData.title = title; + draftData.cid = postData.cid; + } else if (postData.action === 'posts.reply') { + // new reply only + draftData.title = postData.title; + draftData.tid = postData.tid; + draftData.toPid = postData.toPid; + } else if (postData.action === 'posts.edit') { + draftData.pid = postData.pid; + draftData.title = title || postData.title; + } + if (!app.user.uid) { + draftData.handle = postContainer.find('input.handle').val(); + } + + // save all draft data into single item as json + storage.setItem(postData.save_id, JSON.stringify(draftData)); + + $(window).trigger('action:composer.drafts.save', { + storage: storage, + postData: postData, + postContainer: postContainer, + }); + draftIconEl.toggleClass('active', true); + } else { + drafts.removeDraft(postData.save_id); + } + } + } + + drafts.removeDraft = function (save_id) { + if (!save_id) { + return; + } + + // Remove save_id from list of open and available drafts + drafts.removeFromDraftList('available', save_id); + drafts.removeFromDraftList('open', save_id); + const uid = save_id.split(':')[1]; + const storage = getStorage(uid); + storage.removeItem(save_id); + + $(window).trigger('action:composer.drafts.remove', { + storage: storage, + save_id: save_id, + }); + }; + + drafts.getList = function (set) { + try { + const draftIds = localStorage.getItem(`drafts:${set}`); + return JSON.parse(draftIds) || []; + } catch (e) { + console.warn('[composer/drafts] Could not read list of available drafts'); + return []; + } + }; + + drafts.addToDraftList = function (set, save_id) { + if (!canSave(app.user.uid ? 'localStorage' : 'sessionStorage') || !save_id) { + return; + } + const list = drafts.getList(set); + if (!list.includes(save_id)) { + list.push(save_id); + localStorage.setItem('drafts:' + set, JSON.stringify(list)); + } + }; + + drafts.removeFromDraftList = function (set, save_id) { + if (!canSave(app.user.uid ? 'localStorage' : 'sessionStorage') || !save_id) { + return; + } + const list = drafts.getList(set); + if (list.includes(save_id)) { + list.splice(list.indexOf(save_id), 1); + localStorage.setItem('drafts:' + set, JSON.stringify(list)); + } + }; + + drafts.migrateGuest = function () { + // If any drafts are made while as guest, and user then logs in, assume control of those drafts + if (canSave('localStorage') && app.user.uid) { + // composer:: + const test = /^composer:\d+:\d$/; + const keys = Object.keys(sessionStorage).filter(function (key) { + return test.test(key); + }); + const migrated = new Set([]); + const renamed = keys.map(function (key) { + const parts = key.split(':'); + parts[1] = app.user.uid; + + migrated.add(parts.join(':')); + return parts.join(':'); + }); + + keys.forEach(function (key, idx) { + localStorage.setItem(renamed[idx], sessionStorage.getItem(key)); + sessionStorage.removeItem(key); + }); + + migrated.forEach(function (save_id) { + drafts.addToDraftList('available', save_id); + }); + + return migrated; + } + }; + + drafts.migrateThumbs = function (postContainer, postData) { + if (!app.uid) { + return; + } + + // If any thumbs were uploaded, migrate them to this new composer's uuid + const newUUID = postContainer.attr('data-uuid'); + const draft = drafts.get(postData.save_id); + + if (draft && draft.uuid) { + api.put(`/topics/${draft.uuid}/thumbs`, { + tid: newUUID, + }).then(() => { + require(['composer'], function (composer) { + composer.updateThumbCount(newUUID, postContainer); + }); + }); + } + }; + + drafts.listAvailable = function () { + const available = drafts.getList('available'); + return available.map(drafts.get).filter(Boolean); + }; + + drafts.getAvailableCount = function () { + return drafts.listAvailable().length; + }; + + drafts.open = function (save_id) { + if (!save_id) { + return; + } + const draft = drafts.get(save_id); + openComposer(save_id, draft); + }; + + drafts.loadOpen = function () { + if (ajaxify.data.template.login || ajaxify.data.template.register || (config.hasOwnProperty('openDraftsOnPageLoad') && !config.openDraftsOnPageLoad)) { + return; + } + // Load drafts if they were open + const available = drafts.getList('available'); + const open = drafts.getList('open'); + + if (available.length) { + // Deconstruct each save_id and open up composer + available.forEach(function (save_id) { + if (!save_id || open.includes(save_id)) { + return; + } + const draft = drafts.get(save_id); + if (!draft || (!draft.text && !draft.title)) { + drafts.removeFromDraftList('available', save_id); + drafts.removeFromDraftList('open', save_id); + return; + } + openComposer(save_id, draft); + }); + } + }; + + function openComposer(save_id, draft) { + const saveObj = save_id.split(':'); + const uid = saveObj[1]; + // Don't open other peoples' drafts + if (parseInt(app.user.uid, 10) !== parseInt(uid, 10)) { + return; + } + require(['composer'], function (composer) { + if (draft.action === 'topics.post') { + composer.newTopic({ + save_id: draft.save_id, + cid: draft.cid, + handle: app.user && app.user.uid ? undefined : utils.escapeHTML(draft.handle), + title: utils.escapeHTML(draft.title), + body: draft.text, + tags: String(draft.tags || '').split(','), + }); + } else if (draft.action === 'posts.reply') { + api.get('/topics/' + draft.tid, {}, function (err, topicObj) { + if (err) { + return alerts.error(err); + } + + composer.newReply({ + save_id: draft.save_id, + tid: draft.tid, + toPid: draft.toPid, + title: topicObj.title, + body: draft.text, + }); + }); + } else if (draft.action === 'posts.edit') { + composer.editPost({ + save_id: draft.save_id, + pid: draft.pid, + title: draft.title ? utils.escapeHTML(draft.title) : undefined, + body: draft.text, + }); + } + }); + } + + // Feature detection courtesy of: https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API + function canSave(type) { + var storage; + try { + storage = window[type]; + var x = '__storage_test__'; + storage.setItem(x, x); + storage.removeItem(x); + return true; + } catch (e) { + return e instanceof DOMException && ( + // everything except Firefox + e.code === 22 || + // Firefox + e.code === 1014 || + // test name field too, because code might not be present + // everything except Firefox + e.name === 'QuotaExceededError' || + // Firefox + e.name === 'NS_ERROR_DOM_QUOTA_REACHED') && + // acknowledge QuotaExceededError only if there's something already stored + (storage && storage.length !== 0); + } + } + + return drafts; +}); diff --git a/node_modules/nodebb-plugin-composer-default/static/lib/composer/formatting.js b/node_modules/nodebb-plugin-composer-default/static/lib/composer/formatting.js new file mode 100644 index 0000000000..dca150fdd4 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/lib/composer/formatting.js @@ -0,0 +1,194 @@ +'use strict'; + +define('composer/formatting', [ + 'composer/preview', 'composer/resize', 'topicThumbs', 'screenfull', +], function (preview, resize, topicThumbs, screenfull) { + var formatting = {}; + + var formattingDispatchTable = { + picture: function () { + var postContainer = this; + postContainer.find('#files') + .attr('accept', 'image/*') + .click(); + }, + + upload: function () { + var postContainer = this; + postContainer.find('#files') + .attr('accept', '') + .click(); + }, + + thumbs: function () { + formatting.exitFullscreen(); + var postContainer = this; + require(['composer'], function (composer) { + const uuid = postContainer.get(0).getAttribute('data-uuid'); + const composerObj = composer.posts[uuid]; + + if (composerObj.action === 'topics.post' || (composerObj.action === 'posts.edit' && composerObj.isMain)) { + topicThumbs.modal.open({ id: uuid, pid: composerObj.pid }).then(() => { + postContainer.trigger('thumb.uploaded'); // toggle draft save + + // Update client-side with count + composer.updateThumbCount(uuid, postContainer); + }); + } + }); + }, + + tags: function () { + var postContainer = this; + postContainer.find('.tags-container').toggleClass('hidden'); + }, + + zen: function () { + var postContainer = this; + $(window).one('resize', function () { + function onResize() { + if (!screenfull.isFullscreen) { + app.toggleNavbar(true); + $('html').removeClass('zen-mode'); + resize.reposition(postContainer); + $(window).off('resize', onResize); + } + } + + if (screenfull.isFullscreen) { + app.toggleNavbar(false); + $('html').addClass('zen-mode'); + postContainer.find('.write').focus(); + + $(window).on('resize', onResize); + $(window).one('action:composer.topics.post action:composer.posts.reply action:composer.posts.edit action:composer.discard', screenfull.exit); + } + }); + + screenfull.toggle(postContainer.get(0)); + $(window).trigger('action:composer.fullscreen', { postContainer: postContainer }); + }, + }; + + var buttons = []; + + formatting.exitFullscreen = function () { + if (screenfull.isEnabled && screenfull.isFullscreen) { + screenfull.exit(); + } + }; + + formatting.addComposerButtons = function () { + const formattingBarEl = $('.formatting-bar'); + const fileForm = formattingBarEl.find('.formatting-group #fileForm'); + buttons.forEach((btn) => { + let markup = ``; + if (Array.isArray(btn.dropdownItems) && btn.dropdownItems.length) { + markup = generateFormattingDropdown(btn); + } else { + markup = ` +
  • + +
  • + `; + } + fileForm.before(markup); + }); + + const els = formattingBarEl.find('.formatting-group>li'); + els.tooltip({ + container: '#content', + animation: false, + trigger: 'manual', + }).on('mouseenter', function (ev) { + const target = $(ev.target); + const isDropdown = target.hasClass('dropdown-menu') || !!target.parents('.dropdown-menu').length; + if (!isDropdown) { + $(this).tooltip('show'); + } + }).on('click mouseleave', function () { + $(this).tooltip('hide'); + }); + }; + + function generateBadgetHtml(btn) { + let badgeHtml = ''; + if (btn.badge) { + badgeHtml = ``; + } + return badgeHtml; + } + + function generateFormattingDropdown(btn) { + const dropdownItemsHtml = btn.dropdownItems.map(function (btn) { + return ` +
  • + + ${btn.text} + ${generateBadgetHtml(btn)} + +
  • + `; + }); + return ` + + `; + } + + formatting.addButton = function (iconClass, onClick, title, name) { + name = name || iconClass.replace('fa fa-', ''); + formattingDispatchTable[name] = onClick; + buttons.push({ + name, + iconClass, + title, + }); + }; + + formatting.addDropdown = function (data) { + buttons.push({ + iconClass: data.iconClass, + title: data.title, + dropdownItems: data.dropdownItems, + }); + data.dropdownItems.forEach((btn) => { + if (btn.name && btn.onClick) { + formattingDispatchTable[btn.name] = btn.onClick; + } + }); + }; + + formatting.getDispatchTable = function () { + return formattingDispatchTable; + }; + + formatting.addButtonDispatch = function (name, onClick) { + formattingDispatchTable[name] = onClick; + }; + + formatting.addHandler = function (postContainer) { + postContainer.on('click', '.formatting-bar [data-format]', function (event) { + var format = $(this).attr('data-format'); + var textarea = $(this).parents('[component="composer"]').find('textarea')[0]; + + if (formattingDispatchTable.hasOwnProperty(format)) { + formattingDispatchTable[format].call( + postContainer, textarea, textarea.selectionStart, textarea.selectionEnd, event + ); + preview.render(postContainer); + } + }); + }; + + return formatting; +}); diff --git a/node_modules/nodebb-plugin-composer-default/static/lib/composer/post-queue.js b/node_modules/nodebb-plugin-composer-default/static/lib/composer/post-queue.js new file mode 100644 index 0000000000..2022430842 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/lib/composer/post-queue.js @@ -0,0 +1,25 @@ +'use strict'; + +define('composer/post-queue', [], function () { + const postQueue = {}; + + postQueue.showAlert = async function (postContainer, postData) { + const alertEl = postContainer.find('[component="composer/post-queue/alert"]') + if (!config.postQueue || app.user.isAdmin || app.user.isGlobalMod || app.user.isMod) { + alertEl.remove(); + return; + } + const shouldQueue = await socket.emit('plugins.composer.shouldQueue', { postData: postData }); + alertEl.toggleClass('show', shouldQueue); + alertEl.toggleClass('pe-none', !shouldQueue); + }; + + postQueue.onChangeCategory = async function (postContainer, postData) { + if (!config.postQueue) { + return; + } + postQueue.showAlert(postContainer, postData); + }; + + return postQueue; +}); diff --git a/node_modules/nodebb-plugin-composer-default/static/lib/composer/preview.js b/node_modules/nodebb-plugin-composer-default/static/lib/composer/preview.js new file mode 100644 index 0000000000..9074e6edc2 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/lib/composer/preview.js @@ -0,0 +1,105 @@ +'use strict'; + +define('composer/preview', ['hooks'], function (hooks) { + var preview = {}; + + preview.render = function (postContainer, callback) { + callback = callback || function () {}; + if (!postContainer.find('.preview-container').is(':visible')) { + return callback(); + } + + var textarea = postContainer.find('textarea'); + + socket.emit('plugins.composer.renderPreview', textarea.val(), function (err, preview) { + if (err) { + return; + } + preview = $('
    ' + preview + '
    '); + preview.find('img:not(.not-responsive)').addClass('img-fluid'); + postContainer.find('.preview').html(preview); + hooks.fire('action:composer.preview', { postContainer, preview }); + callback(); + }); + }; + + preview.matchScroll = function (postContainer) { + if (!postContainer.find('.preview-container').is(':visible')) { + return; + } + var textarea = postContainer.find('textarea'); + var preview = postContainer.find('.preview'); + + if (textarea.length && preview.length) { + var diff = textarea[0].scrollHeight - textarea.height(); + + if (diff === 0) { + return; + } + + var scrollPercent = textarea.scrollTop() / diff; + + preview.scrollTop(Math.max(preview[0].scrollHeight - preview.height(), 0) * scrollPercent); + } + }; + + preview.handleToggler = function ($postContainer) { + const postContainer = $postContainer.get(0); + preview.env = utils.findBootstrapEnvironment(); + const isMobile = ['xs', 'sm'].includes(preview.env); + const toggler = postContainer.querySelector('.formatting-bar [data-action="preview"]'); + const showText = toggler.querySelector('.show-text'); + const hideText = toggler.querySelector('.hide-text'); + const previewToggled = localStorage.getItem('composer:previewToggled'); + const hidePreviewOnOpen = config['composer-default'].hidePreviewOnOpen === 'on'; + let show = !isMobile && ( + ((previewToggled === null && !hidePreviewOnOpen) || previewToggled === 'true') + ); + const previewContainer = postContainer.querySelector('.preview-container'); + const writeContainer = postContainer.querySelector('.write-container'); + + if (!toggler) { + return; + } + + function togglePreview(show) { + if (isMobile) { + previewContainer.classList.toggle('hide', false); + writeContainer.classList.toggle('maximized', false); + + previewContainer.classList.toggle('d-none', !show); + previewContainer.classList.toggle('d-flex', show); + previewContainer.classList.toggle('w-100', show); + + writeContainer.classList.toggle('d-flex', !show); + writeContainer.classList.toggle('d-none', show); + writeContainer.classList.toggle('w-100', !show); + } else { + previewContainer.classList.toggle('hide', !show); + writeContainer.classList.toggle('w-50', show); + writeContainer.classList.toggle('w-100', !show); + localStorage.setItem('composer:previewToggled', show); + } + showText.classList.toggle('hide', show); + hideText.classList.toggle('hide', !show); + if (show) { + preview.render($postContainer); + } + preview.matchScroll($postContainer); + } + preview.toggle = togglePreview; + + toggler.addEventListener('click', (e) => { + if (e.button !== 0) { + return; + } + + show = !show; + togglePreview(show); + }); + + togglePreview(show); + }; + + return preview; +}); diff --git a/node_modules/nodebb-plugin-composer-default/static/lib/composer/resize.js b/node_modules/nodebb-plugin-composer-default/static/lib/composer/resize.js new file mode 100644 index 0000000000..5fa84f3a3f --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/lib/composer/resize.js @@ -0,0 +1,197 @@ + +'use strict'; + +define('composer/resize', ['taskbar'], function (taskbar) { + var resize = {}; + var oldRatio = 0; + var minimumRatio = 0.3; + var snapMargin = 0.05; + var smallMin = 768; + + var $body = $('body'); + var $window = $(window); + var $headerMenu = $('[component="navbar"]'); + const content = document.getElementById('content'); + + var header = $headerMenu[0]; + + function getSavedRatio() { + return localStorage.getItem('composer:resizeRatio') || 0.5; + } + + function saveRatio(ratio) { + localStorage.setItem('composer:resizeRatio', Math.min(ratio, 1)); + } + + function getBounds() { + var headerRect; + if (header) { + headerRect = header.getBoundingClientRect(); + } else { + // Mock data + headerRect = { bottom: 0 }; + } + + var headerBottom = Math.max(headerRect.bottom, 0); + + var rect = { + top: 0, + left: 0, + right: window.innerWidth, + bottom: window.innerHeight, + }; + + rect.width = rect.right; + rect.height = rect.bottom; + + rect.boundedTop = headerBottom; + rect.boundedHeight = rect.bottom - headerBottom; + + return rect; + } + + function doResize(postContainer, ratio) { + var bounds = getBounds(); + var elem = postContainer[0]; + var style = window.getComputedStyle(elem); + + // Adjust minimumRatio for shorter viewports + var minHeight = parseInt(style.getPropertyValue('min-height'), 10); + var adjustedMinimum = Math.max(minHeight / window.innerHeight, minimumRatio); + + if (bounds.width >= smallMin) { + const boundedDifference = (bounds.height - bounds.boundedHeight) / bounds.height; + ratio = Math.min(Math.max(ratio, adjustedMinimum + boundedDifference), 1); + + var top = ratio * bounds.boundedHeight / bounds.height; + elem.style.top = ((1 - top) * 100).toString() + '%'; + + // Add some extra space at the bottom of the body so that + // the user can still scroll to the last post w/ composer open + var rect = elem.getBoundingClientRect(); + content.style.paddingBottom = (rect.bottom - rect.top).toString() + 'px'; + } else { + elem.style.top = 0; + content.style.paddingBottom = 0; + } + + postContainer.ratio = ratio; + + taskbar.updateActive(postContainer.attr('data-uuid')); + } + + var resizeIt = doResize; + var raf = window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame; + + if (raf) { + resizeIt = function (postContainer, ratio) { + raf(function () { + doResize(postContainer, ratio); + + setTimeout(function () { + $window.trigger('action:composer.resize'); + postContainer.trigger('action:composer.resize'); + }, 0); + }); + }; + } + + resize.reposition = function (postContainer) { + var ratio = getSavedRatio(); + + if (ratio >= 1 - snapMargin) { + ratio = 1; + postContainer.addClass('maximized'); + } + + resizeIt(postContainer, ratio); + }; + + resize.maximize = function (postContainer, state) { + if (state) { + resizeIt(postContainer, 1); + } else { + resize.reposition(postContainer); + } + }; + + resize.handleResize = function (postContainer) { + var resizeOffset = 0; + var resizeBegin = 0; + var resizeEnd = 0; + var $resizer = postContainer.find('.resizer'); + var resizer = $resizer[0]; + + function resizeStart(e) { + var resizeRect = resizer.getBoundingClientRect(); + var resizeCenterY = (resizeRect.top + resizeRect.bottom) / 2; + + resizeOffset = (resizeCenterY - e.clientY) / 2; + resizeBegin = e.clientY; + + $window.on('mousemove', resizeAction); + $window.on('mouseup', resizeStop); + $body.on('touchmove', resizeTouchAction); + } + + function resizeAction(e) { + var position = e.clientY - resizeOffset; + var bounds = getBounds(); + var ratio = (bounds.height - position) / (bounds.boundedHeight); + + resizeIt(postContainer, ratio); + } + + function resizeStop(e) { + e.preventDefault(); + resizeEnd = e.clientY; + + postContainer.find('textarea').focus(); + $window.off('mousemove', resizeAction); + $window.off('mouseup', resizeStop); + $body.off('touchmove', resizeTouchAction); + + var position = resizeEnd - resizeOffset; + var bounds = getBounds(); + var ratio = (bounds.height - position) / (bounds.boundedHeight); + + if (resizeEnd - resizeBegin === 0 && postContainer.hasClass('maximized')) { + postContainer.removeClass('maximized'); + ratio = (!oldRatio || oldRatio >= 1 - snapMargin) ? 0.5 : oldRatio; + resizeIt(postContainer, ratio); + } else if (resizeEnd - resizeBegin === 0 || ratio >= 1 - snapMargin) { + resizeIt(postContainer, 1); + postContainer.addClass('maximized'); + oldRatio = ratio; + } else { + postContainer.removeClass('maximized'); + } + + saveRatio(ratio); + } + + function resizeTouchAction(e) { + e.preventDefault(); + resizeAction(e.touches[0]); + } + + $resizer + .on('mousedown', function (e) { + if (e.button !== 0) { + return; + } + + e.preventDefault(); + resizeStart(e); + }) + .on('touchstart', function (e) { + e.preventDefault(); + resizeStart(e.touches[0]); + }) + .on('touchend', resizeStop); + }; + + return resize; +}); diff --git a/node_modules/nodebb-plugin-composer-default/static/lib/composer/scheduler.js b/node_modules/nodebb-plugin-composer-default/static/lib/composer/scheduler.js new file mode 100644 index 0000000000..e238c33bdc --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/lib/composer/scheduler.js @@ -0,0 +1,201 @@ +'use strict'; + +define('composer/scheduler', ['benchpress', 'bootbox', 'alerts', 'translator'], function ( + Benchpress, + bootbox, + alerts, + translator +) { + const scheduler = {}; + const state = { + timestamp: 0, + open: false, + edit: false, + posts: {}, + }; + let displayBtnCons = []; + let displayBtns; + let cancelBtn; + let submitContainer; + let submitOptionsCon; + + const dropdownDisplayBtn = { + el: null, + defaultText: '', + activeText: '', + }; + + const submitBtn = { + el: null, + icon: null, + defaultText: '', + activeText: '', + }; + let dateInput; + let timeInput; + + $(window).on('action:composer.activate', handleOnActivate); + + scheduler.init = function ($postContainer, posts) { + state.timestamp = 0; + state.posts = posts; + + translator.translateKeys(['[[topic:composer.post-later]]', '[[modules:composer.change-schedule-date]]']).then((translated) => { + dropdownDisplayBtn.defaultText = translated[0]; + dropdownDisplayBtn.activeText = translated[1]; + }); + + displayBtnCons = $postContainer[0].querySelectorAll('.display-scheduler'); + displayBtns = $postContainer[0].querySelectorAll('.display-scheduler i'); + dropdownDisplayBtn.el = $postContainer[0].querySelector('.dropdown-item.display-scheduler'); + cancelBtn = $postContainer[0].querySelector('.dropdown-item.cancel-scheduling'); + submitContainer = $postContainer.find('[component="composer/submit/container"]'); + submitOptionsCon = $postContainer.find('[component="composer/submit/options/container"]'); + + submitBtn.el = $postContainer[0].querySelector('.composer-submit:not(.btn-sm)'); + submitBtn.icon = submitBtn.el.querySelector('i'); + submitBtn.defaultText = submitBtn.el.lastChild.textContent; + submitBtn.activeText = submitBtn.el.getAttribute('data-text-variant'); + + cancelBtn.addEventListener('click', cancelScheduling); + displayBtnCons.forEach(el => el.addEventListener('click', openModal)); + }; + + scheduler.getTimestamp = function () { + if (!scheduler.isActive() || isNaN(state.timestamp)) { + return 0; + } + return state.timestamp; + }; + + scheduler.isActive = function () { + return state.timestamp > 0; + }; + + scheduler.isOpen = function () { + return state.open; + }; + + scheduler.reset = function () { + state.timestamp = 0; + }; + + scheduler.onChangeCategory = function (categoryData) { + toggleDisplayButtons(categoryData.privileges['topics:schedule']); + toggleItems(false); + const optionsVisible = categoryData.privileges['topics:schedule'] || submitOptionsCon.attr('data-submit-options') > 0; + submitContainer.find('.composer-submit').toggleClass('rounded-1', !optionsVisible); + submitOptionsCon.toggleClass('hidden', !optionsVisible); + scheduler.reset(); + }; + + async function openModal() { + const html = await Benchpress.render('modals/topic-scheduler'); + bootbox.dialog({ + message: html, + title: '[[modules:composer.schedule-for]]', + className: 'topic-scheduler', + onShown: initModal, + onHidden: handleOnHidden, + onEscape: true, + buttons: { + cancel: { + label: state.timestamp ? '[[modules:composer.cancel-scheduling]]' : '[[modules:bootbox.cancel]]', + className: (state.timestamp ? 'btn-warning' : 'btn-outline-secondary') + (state.edit ? ' hidden' : ''), + callback: cancelScheduling, + }, + set: { + label: '[[modules:composer.set-schedule-date]]', + className: 'btn-primary', + callback: setTimestamp, + }, + }, + }); + } + + function initModal(ev) { + state.open = true; + const schedulerContainer = ev.target.querySelector('.datetime-picker'); + dateInput = schedulerContainer.querySelector('input[type="date"]'); + timeInput = schedulerContainer.querySelector('input[type="time"]'); + initDateTimeInputs(); + } + + function handleOnHidden() { + state.open = false; + } + + function handleOnActivate(ev, { post_uuid }) { + state.edit = false; + + const postData = state.posts[post_uuid]; + if (postData && postData.isMain && postData.timestamp > Date.now()) { + state.timestamp = postData.timestamp; + state.edit = true; + toggleItems(); + } + } + + function initDateTimeInputs() { + const d = new Date(); + // Update min. selectable date and time + const nowLocalISO = new Date(d.getTime() - (d.getTimezoneOffset() * 60000)).toJSON(); + dateInput.setAttribute('min', nowLocalISO.slice(0, 10)); + timeInput.setAttribute('min', nowLocalISO.slice(11, -8)); + + if (scheduler.isActive()) { + const scheduleDate = new Date(state.timestamp - (d.getTimezoneOffset() * 60000)).toJSON(); + dateInput.value = scheduleDate.slice(0, 10); + timeInput.value = scheduleDate.slice(11, -8); + } + } + + function setTimestamp() { + const bothFilled = dateInput.value && timeInput.value; + const timestamp = new Date(`${dateInput.value} ${timeInput.value}`).getTime(); + if (!bothFilled || isNaN(timestamp) || timestamp < Date.now()) { + state.timestamp = 0; + const message = timestamp < Date.now() ? '[[error:scheduling-to-past]]' : '[[error:invalid-schedule-date]]'; + alerts.alert({ + type: 'danger', + timeout: 3000, + title: '', + alert_id: 'post_error', + message, + }); + return false; + } + if (!state.timestamp) { + toggleItems(true); + } + state.timestamp = timestamp; + } + + function cancelScheduling() { + if (!state.timestamp) { + return; + } + toggleItems(false); + state.timestamp = 0; + } + + function toggleItems(active = true) { + displayBtns.forEach(btn => btn.classList.toggle('active', active)); + if (submitBtn.icon) { + submitBtn.icon.classList.toggle('fa-check', !active); + submitBtn.icon.classList.toggle('fa-clock-o', active); + } + if (dropdownDisplayBtn.el) { + dropdownDisplayBtn.el.textContent = active ? dropdownDisplayBtn.activeText : dropdownDisplayBtn.defaultText; + cancelBtn.classList.toggle('hidden', !active); + } + // Toggle submit button text + submitBtn.el.lastChild.textContent = active ? submitBtn.activeText : submitBtn.defaultText; + } + + function toggleDisplayButtons(show) { + displayBtnCons.forEach(btn => btn.classList.toggle('hidden', !show)); + } + + return scheduler; +}); diff --git a/node_modules/nodebb-plugin-composer-default/static/lib/composer/tags.js b/node_modules/nodebb-plugin-composer-default/static/lib/composer/tags.js new file mode 100644 index 0000000000..338e4546d2 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/lib/composer/tags.js @@ -0,0 +1,227 @@ + +'use strict'; + +define('composer/tags', ['alerts'], function (alerts) { + var tags = {}; + + var minTags; + var maxTags; + + tags.init = function (postContainer, postData) { + var tagEl = postContainer.find('.tags'); + if (!tagEl.length) { + return; + } + + minTags = ajaxify.data.hasOwnProperty('minTags') ? ajaxify.data.minTags : config.minimumTagsPerTopic; + maxTags = ajaxify.data.hasOwnProperty('maxTags') ? ajaxify.data.maxTags : config.maximumTagsPerTopic; + + tagEl.tagsinput({ + tagClass: 'badge bg-info rounded-1', + confirmKeys: [13, 44], + trimValue: true, + }); + var input = postContainer.find('.bootstrap-tagsinput input'); + + toggleTagInput(postContainer, postData, ajaxify.data); + + app.loadJQueryUI(function () { + input.autocomplete({ + delay: 100, + position: { my: 'left bottom', at: 'left top', collision: 'flip' }, + appendTo: postContainer.find('.bootstrap-tagsinput'), + open: function () { + $(this).autocomplete('widget').css('z-index', 20000); + }, + source: function (request, response) { + socket.emit('topics.autocompleteTags', { + query: request.term, + cid: postData.cid, + }, function (err, tags) { + if (err) { + return alerts.error(err); + } + if (tags) { + response(tags); + } + $('.ui-autocomplete a').attr('data-ajaxify', 'false'); + }); + }, + select: function (/* event, ui */) { + // when autocomplete is selected from the dropdown simulate a enter key down to turn it into a tag + triggerEnter(input); + }, + }); + + addTags(postData.tags, tagEl); + + tagEl.on('beforeItemAdd', function (event) { + var reachedMaxTags = maxTags && maxTags <= tags.getTags(postContainer.attr('data-uuid')).length; + var cleanTag = utils.cleanUpTag(event.item, config.maximumTagLength); + var different = cleanTag !== event.item; + event.cancel = different || + event.item.length < config.minimumTagLength || + event.item.length > config.maximumTagLength || + reachedMaxTags; + + if (event.item.length < config.minimumTagLength) { + return alerts.error('[[error:tag-too-short, ' + config.minimumTagLength + ']]'); + } else if (event.item.length > config.maximumTagLength) { + return alerts.error('[[error:tag-too-long, ' + config.maximumTagLength + ']]'); + } else if (reachedMaxTags) { + return alerts.error('[[error:too-many-tags, ' + maxTags + ']]'); + } + if (different) { + tagEl.tagsinput('add', cleanTag); + } + }); + + var skipAddCheck = false; + var skipRemoveCheck = false; + tagEl.on('itemRemoved', function (event) { + if (skipRemoveCheck) { + skipRemoveCheck = false; + return; + } + + if (!event.item) { + return; + } + socket.emit('topics.canRemoveTag', { tag: event.item }, function (err, allowed) { + if (err) { + return alerts.error(err); + } + if (!allowed) { + alerts.error('[[error:cant-remove-system-tag]]'); + skipAddCheck = true; + tagEl.tagsinput('add', event.item); + } + }); + }); + + tagEl.on('itemAdded', function (event) { + if (skipAddCheck) { + skipAddCheck = false; + return; + } + var cid = postData.hasOwnProperty('cid') ? postData.cid : ajaxify.data.cid; + socket.emit('topics.isTagAllowed', { tag: event.item, cid: cid || 0 }, function (err, allowed) { + if (err) { + return alerts.error(err); + } + if (!allowed) { + skipRemoveCheck = true; + return tagEl.tagsinput('remove', event.item); + } + $(window).trigger('action:tag.added', { cid: cid, tagEl: tagEl, tag: event.item }); + if (input.length) { + input.autocomplete('close'); + } + }); + }); + }); + + input.attr('tabIndex', tagEl.attr('tabIndex')); + input.on('blur', function () { + triggerEnter(input); + }); + + $('[component="composer/tag/dropdown"]').on('click', 'li', function () { + var tag = $(this).attr('data-tag'); + if (tag) { + addTags([tag], tagEl); + } + return false; + }); + }; + + tags.isEnoughTags = function (post_uuid) { + return tags.getTags(post_uuid).length >= minTags; + }; + + tags.minTagCount = function () { + return minTags; + }; + + tags.onChangeCategory = function (postContainer, postData, cid, categoryData) { + var tagDropdown = postContainer.find('[component="composer/tag/dropdown"]'); + if (!tagDropdown.length) { + return; + } + + toggleTagInput(postContainer, postData, categoryData); + tagDropdown.toggleClass('hidden', !categoryData.tagWhitelist || !categoryData.tagWhitelist.length); + if (categoryData.tagWhitelist) { + app.parseAndTranslate('composer', 'tagWhitelist', { tagWhitelist: categoryData.tagWhitelist }, function (html) { + tagDropdown.find('.dropdown-menu').html(html); + }); + } + }; + + function toggleTagInput(postContainer, postData, data) { + var tagEl = postContainer.find('.tags'); + var input = postContainer.find('.bootstrap-tagsinput input'); + if (!input.length) { + return; + } + + if (data.hasOwnProperty('minTags')) { + minTags = data.minTags; + } + if (data.hasOwnProperty('maxTags')) { + maxTags = data.maxTags; + } + + if (data.tagWhitelist && data.tagWhitelist.length) { + input.attr('readonly', ''); + input.attr('placeholder', ''); + + tagEl.tagsinput('items').slice().forEach(function (tag) { + if (data.tagWhitelist.indexOf(tag) === -1) { + tagEl.tagsinput('remove', tag); + } + }); + } else { + input.removeAttr('readonly'); + input.attr('placeholder', postContainer.find('input.tags').attr('placeholder')); + } + postContainer.find('.tags-container').toggleClass('haswhitelist', !!(data.tagWhitelist && data.tagWhitelist.length)); + postContainer.find('.tags-container').toggleClass('hidden', ( + data.privileges && data.privileges.hasOwnProperty('topics:tag') && !data.privileges['topics:tag']) || + (maxTags === 0 && !postData && !postData.tags && !postData.tags.length)); + + if (data.privileges && data.privileges.hasOwnProperty('topics:tag') && !data.privileges['topics:tag']) { + tagEl.tagsinput('removeAll'); + } + + $(window).trigger('action:tag.toggleInput', { + postContainer: postContainer, + tagWhitelist: data.tagWhitelist, + tagsInput: input, + }); + } + + function triggerEnter(input) { + // http://stackoverflow.com/a/3276819/583363 + var e = jQuery.Event('keypress'); + e.which = 13; + e.keyCode = 13; + setTimeout(function () { + input.trigger(e); + }, 100); + } + + function addTags(tags, tagEl) { + if (tags && tags.length) { + for (var i = 0; i < tags.length; ++i) { + tagEl.tagsinput('add', tags[i]); + } + } + } + + tags.getTags = function (post_uuid) { + return $('.composer[data-uuid="' + post_uuid + '"] .tags').tagsinput('items'); + }; + + return tags; +}); diff --git a/node_modules/nodebb-plugin-composer-default/static/lib/composer/uploads.js b/node_modules/nodebb-plugin-composer-default/static/lib/composer/uploads.js new file mode 100644 index 0000000000..6da01db605 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/lib/composer/uploads.js @@ -0,0 +1,271 @@ +'use strict'; + +define('composer/uploads', [ + 'composer/preview', + 'composer/categoryList', + 'translator', + 'alerts', + 'uploadHelpers', + 'jquery-form', +], function (preview, categoryList, translator, alerts, uploadHelpers) { + var uploads = { + inProgress: {}, + }; + + var uploadingText = ''; + + uploads.initialize = function (post_uuid) { + initializeDragAndDrop(post_uuid); + initializePaste(post_uuid); + + addChangeHandlers(post_uuid); + addTopicThumbHandlers(post_uuid); + translator.translate('[[modules:composer.uploading, ' + 0 + '%]]', function (translated) { + uploadingText = translated; + }); + }; + + function addChangeHandlers(post_uuid) { + var postContainer = $('.composer[data-uuid="' + post_uuid + '"]'); + + postContainer.find('#files').on('change', function (e) { + var files = (e.target || {}).files || + ($(this).val() ? [{ name: $(this).val(), type: utils.fileMimeType($(this).val()) }] : null); + if (files) { + uploadContentFiles({ files: files, post_uuid: post_uuid, route: '/api/post/upload' }); + } + }); + } + + function addTopicThumbHandlers(post_uuid) { + var postContainer = $('.composer[data-uuid="' + post_uuid + '"]'); + + postContainer.on('click', '.topic-thumb-clear-btn', function (e) { + postContainer.find('input#topic-thumb-url').val('').trigger('change'); + resetInputFile(postContainer.find('input#topic-thumb-file')); + $(this).addClass('hide'); + e.preventDefault(); + }); + + postContainer.on('paste change keypress', 'input#topic-thumb-url', function () { + var urlEl = $(this); + setTimeout(function () { + var url = urlEl.val(); + if (url) { + postContainer.find('.topic-thumb-clear-btn').removeClass('hide'); + } else { + resetInputFile(postContainer.find('input#topic-thumb-file')); + postContainer.find('.topic-thumb-clear-btn').addClass('hide'); + } + postContainer.find('img.topic-thumb-preview').attr('src', url); + }, 100); + }); + } + + function resetInputFile($el) { + $el.wrap('
    ').closest('form').get(0).reset(); + $el.unwrap(); + } + + function initializeDragAndDrop(post_uuid) { + var postContainer = $('.composer[data-uuid="' + post_uuid + '"]'); + uploadHelpers.handleDragDrop({ + container: postContainer, + callback: function (upload) { + uploadContentFiles({ + files: upload.files, + post_uuid: post_uuid, + route: '/api/post/upload', + formData: upload.formData, + }); + }, + }); + } + + function initializePaste(post_uuid) { + var postContainer = $('.composer[data-uuid="' + post_uuid + '"]'); + uploadHelpers.handlePaste({ + container: postContainer, + callback: function (upload) { + uploadContentFiles({ + files: upload.files, + fileNames: upload.fileNames, + post_uuid: post_uuid, + route: '/api/post/upload', + formData: upload.formData, + }); + }, + }); + } + + function escapeRegExp(text) { + return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); + } + + function insertText(str, index, insert) { + return str.slice(0, index) + insert + str.slice(index); + } + + function uploadContentFiles(params) { + var files = [...params.files]; + var post_uuid = params.post_uuid; + var postContainer = $('.composer[data-uuid="' + post_uuid + '"]'); + var textarea = postContainer.find('textarea'); + var text = textarea.val(); + var uploadForm = postContainer.find('#fileForm'); + var doneUploading = false; + uploadForm.attr('action', config.relative_path + params.route); + + var cid = categoryList.getSelectedCid(); + if (!cid && ajaxify.data.cid) { + cid = ajaxify.data.cid; + } + var i = 0; + var isImage = false; + for (i = 0; i < files.length; ++i) { + isImage = files[i].type.match(/image./); + if ((isImage && !app.user.privileges['upload:post:image']) || (!isImage && !app.user.privileges['upload:post:file'])) { + return alerts.error('[[error:no-privileges]]'); + } + } + + var filenameMapping = []; + let filesText = ''; + for (i = 0; i < files.length; ++i) { + // The filename map has datetime and iterator prepended so that they can be properly tracked even if the + // filenames are identical. + filenameMapping.push(i + '_' + Date.now() + '_' + (params.fileNames ? params.fileNames[i] : files[i].name)); + isImage = files[i].type.match(/image./); + + if (!app.user.isAdmin && files[i].size > parseInt(config.maximumFileSize, 10) * 1024) { + uploadForm[0].reset(); + return alerts.error('[[error:file-too-big, ' + config.maximumFileSize + ']]'); + } + filesText += (isImage ? '!' : '') + '[' + filenameMapping[i] + '](' + uploadingText + ') '; + } + + const cursorPosition = textarea.getCursorPosition(); + const textLen = text.length; + text = insertText(text, cursorPosition, filesText); + + if (uploadForm.length) { + postContainer.find('[data-action="post"]').prop('disabled', true); + } + textarea.val(text); + + $(window).trigger('action:composer.uploadStart', { + post_uuid: post_uuid, + files: filenameMapping.map(function (filename, i) { + return { + filename: filename.replace(/^\d+_\d{13}_/, ''), + isImage: /image./.test(files[i].type), + }; + }), + text: uploadingText, + }); + + uploadForm.off('submit').submit(function () { + function updateTextArea(filename, text, trim) { + var newFilename; + if (trim) { + newFilename = filename.replace(/^\d+_\d{13}_/, ''); + } + var current = textarea.val(); + var re = new RegExp(escapeRegExp(filename) + ']\\([^)]+\\)', 'g'); + textarea.val(current.replace(re, (newFilename || filename) + '](' + text + ')')); + + $(window).trigger('action:composer.uploadUpdate', { + post_uuid: post_uuid, + filename: filename, + text: text, + }); + } + + uploads.inProgress[post_uuid] = uploads.inProgress[post_uuid] || []; + uploads.inProgress[post_uuid].push(1); + + if (params.formData) { + params.formData.append('cid', cid); + } + + $(this).ajaxSubmit({ + headers: { + 'x-csrf-token': config.csrf_token, + }, + resetForm: true, + clearForm: true, + formData: params.formData, + data: { cid: cid }, + + error: function (xhr) { + doneUploading = true; + postContainer.find('[data-action="post"]').prop('disabled', false); + const errorMsg = onUploadError(xhr, post_uuid); + for (var i = 0; i < files.length; ++i) { + updateTextArea(filenameMapping[i], errorMsg, true); + } + preview.render(postContainer); + }, + + uploadProgress: function (event, position, total, percent) { + translator.translate('[[modules:composer.uploading, ' + percent + '%]]', function (translated) { + if (doneUploading) { + return; + } + for (var i = 0; i < files.length; ++i) { + updateTextArea(filenameMapping[i], translated); + } + }); + }, + + success: function (res) { + const uploads = res.response.images; + doneUploading = true; + if (uploads && uploads.length) { + for (var i = 0; i < uploads.length; ++i) { + uploads[i].filename = filenameMapping[i].replace(/^\d+_\d{13}_/, ''); + uploads[i].isImage = /image./.test(files[i].type); + updateTextArea(filenameMapping[i], uploads[i].url, true); + } + } + preview.render(postContainer); + textarea.prop('selectionEnd', cursorPosition + textarea.val().length - textLen); + textarea.focus(); + postContainer.find('[data-action="post"]').prop('disabled', false); + $(window).trigger('action:composer.upload', { + post_uuid: post_uuid, + files: uploads, + }); + }, + + complete: function () { + uploadForm[0].reset(); + uploads.inProgress[post_uuid].pop(); + }, + }); + + return false; + }); + + uploadForm.submit(); + } + + function onUploadError(xhr, post_uuid) { + var msg = (xhr.responseJSON && + (xhr.responseJSON.error || (xhr.responseJSON.status && xhr.responseJSON.status.message))) || + '[[error:parse-error]]'; + + if (xhr && xhr.status === 413) { + msg = xhr.statusText || 'Request Entity Too Large'; + } + alerts.error(msg); + $(window).trigger('action:composer.uploadError', { + post_uuid: post_uuid, + message: msg, + }); + return msg; + } + + return uploads; +}); + diff --git a/node_modules/nodebb-plugin-composer-default/static/scss/composer.scss b/node_modules/nodebb-plugin-composer-default/static/scss/composer.scss new file mode 100644 index 0000000000..4a2725c923 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/scss/composer.scss @@ -0,0 +1,411 @@ +.composer { + background-color: var(--bs-body-bg); + color: var(--bs-body-color); + z-index: $zindex-dropdown; + visibility: hidden; + padding: 0; + position: fixed; + bottom: 0; + top: 0; + right: 0; + left: 0; + + .mobile-navbar { + position: static; + min-height: 40px; + margin: 0; + + .btn-group { + flex-shrink: 0; + } + + button { + font-size: 20px; + } + + display: flex; + + .category-name-container, .title { + text-align: center; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; + flex-grow: 2; + font-size: 16px; + line-height: inherit; + padding: 9px 5px; + margin: 0; + } + } + + .title-container { + > div[data-component="composer/handle"] { + flex: 0.33; + } + + .category-list-container { + + [component="category-selector"] { + .category-dropdown-menu { + max-height: 300px; + } + } + } + + .category-list { + padding: 0 2rem; + } + + .action-bar { + .dropdown-menu:empty { + & ~ .dropdown-toggle { + display: none; + } + } + } + } + + .formatting-bar { + .spacer { + &:before { + content: ' | '; + color: $gray-200; + } + } + } + + .tags-container { + [component="composer/tag/dropdown"] { + .dropdown-menu { + max-height: 400px; + overflow-y: auto; + } + + > button { + border: 0; + } + } + // if picking tags from taglist dropdown hide the input + &.haswhitelist .bootstrap-tagsinput { + input { + display: none; + } + } + .bootstrap-tagsinput { + background: transparent; + flex-grow: 1; + border: 0; + padding: 0; + box-shadow: none; + max-height: 80px; + overflow: auto; + + input { + &::placeholder{ + color: $input-placeholder-color; + } + color: $body-color; + font-size: 16px; + width: 50%; + @include media-breakpoint-down(md) { + width: 100%; + } + + + height: 28px; + padding: 4px 6px; + } + + .ui-autocomplete { + max-height: 350px; + overflow-x: hidden; + overflow-y: auto; + } + } + } + + .resizer { + background: linear-gradient(transparent, var(--bs-body-bg)); + margin-left: calc($spacer * -0.5); + padding-left: $spacer; + + .trigger { + cursor: ns-resize; + + .handle { + border-top-left-radius: 50%; + border-top-right-radius: 50%; + border-bottom: 0 !important; + } + } + } + + .minimize { + display: none; + position: absolute; + top: 0px; + right: 10px; + height: 0; + + @include pointer; + + .trigger { + position: relative; + display: block; + top: -20px; + right: 0px; + margin: 0 auto; + margin-left: 20px; + line-height: 26px; + @include transition(filter .15s linear); + + &:hover { + filter: invert(100%); + } + + i { + width: 32px; + height: 32px; + background: #333; + border: 1px solid #333; + border-radius: 50%; + + position: relative; + + color: #FFF; + font-size: 16px; + + &:before { + position: relative; + top: 25%; + } + } + } + } + + &.reply { + .title-container { + display: none; + } + } + + &.resizable.maximized { + .resizer { + top: 0 !important; + background: transparent; + + .trigger { + height: $spacer * 0.5; + + .handle { + border-top-left-radius: 0%; + border-top-right-radius: 0%; + border-bottom-left-radius: 50%; + border-bottom-right-radius: 50%; + border-bottom: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; + } + + i { + &:before { + content: fa-content($fa-var-chevron-down); + } + } + } + } + } + + .draft-icon { + font-family: 'FontAwesome'; + color: $success; + opacity: 0; + + &::before { + content: fa-content($fa-var-save); + } + + &.active { + animation: draft-saved 3s ease; + } + } + + textarea { + resize: none; + } + + .preview { + padding: $input-padding-y $input-padding-x; + } + + .anonymous-checkbox { + display: flex; + align-items: center; + font-size: 16px; + color: var(--bs-body-color); + + input[type="checkbox"] { + margin-right: 8px; // Adjust spacing as needed + width: 16px; + height: 16px; + } + + label { + margin: 0; // Remove any default margin + } + + // Additional styles for responsiveness + @include media-breakpoint-down(sm) { + font-size: 14px; + } + + @include media-breakpoint-up(md) { + margin-left: 16px; // Add space between elements in larger screens + } +} +} + +.datetime-picker { + display: flex; + justify-content: center; + flex-direction: row; + min-width: 310px; + max-width: 310px; + margin: 0 auto; + + input { + flex: 3; + line-height: inherit; + } + + input + input { + border-left: none; + flex: 2; + } +} + +.modal.topic-scheduler { + z-index: 1070; + & + .modal-backdrop { + z-index: 1060; + } +} + +@keyframes draft-saved { + 0%, 100% { + opacity: 0; + } + + 15% { + opacity: 1; + } + + 30% { + opacity: 0.5; + } + + 45% { + opacity: 1; + } + + 85% { + opacity: 1; + } +} + +@keyframes pulse { + from { + transform: scale(1); + color: inherit; + } + 50% { + transform: scale(.9); + } + to { + transform: scale(1); + color: #00adff; + } +} + +@include media-breakpoint-down(lg) { + html.composing .composer { z-index: $zindex-modal; } +} + +@include media-breakpoint-down(sm) { + html.composing { + .composer { + height: 100%; + + .draft-icon { + position: absolute; + bottom: 1em; + right: 0em; + + &::after { + top: 7px; + } + } + + .preview-container { + max-width: initial; + } + } + + body { + padding-bottom: 0 !important; + } + } +} + +@include media-breakpoint-up(lg) { + html.composing { + .composer { + left: 15%; + width: 70%; + min-height: 400px; + + .resizer { + display: block; + } + + .minimize { + display: block; + } + } + } +} + +@include media-breakpoint-up(md) { + // without this formatting elements that are dropdowns are not visible on desktop. + // on mobile dropdowns use bottom-sheet and overflow is auto + .formatting-group { + overflow: visible!important; + } +} + +@import './zen-mode'; +@import './page-compose'; +@import './textcomplete'; + + +.skin-noskin, .skin-cosmo, .skin-flatly, +.skin-journal, .skin-litera, .skin-minty, .skin-pulse, +.skin-sandstone, .skin-sketchy, .skin-spacelab, .skin-united { + .composer { + color: var(--bs-secondary) !important; + background-color: var(--bs-light) !important; + } +} + +.skin-cerulean, .skin-lumen, .skin-lux, .skin-morph, +.skin-simplex, .skin-yeti, .skin-zephyr { + .composer { + color: var(--bs-body) !important; + background-color: var(--bs-light) !important; + } +} + +@include color-mode(dark) { + .skin-noskin .composer { + color: var(--bs-secondary)!important; + background-color: var(--bs-body-bg)!important; + } +} \ No newline at end of file diff --git a/node_modules/nodebb-plugin-composer-default/static/scss/page-compose.scss b/node_modules/nodebb-plugin-composer-default/static/scss/page-compose.scss new file mode 100644 index 0000000000..2b2756f426 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/scss/page-compose.scss @@ -0,0 +1,35 @@ +.page-compose .composer { + z-index: initial; + position: static; + [data-action="hide"] { + display: none; + } + + @include media-breakpoint-down(md) { + .title-container { + flex-wrap: wrap; + } + .category-list-container { + [component="category-selector-selected"] > span { + display: inline!important; + } + width: 100%; + } + } +} + +.zen-mode .page-compose .composer { + position: absolute; +} +.page-compose { + &.skin-noskin, &.skin-cosmo, &.skin-flatly, + &.skin-journal, &.skin-litera, &.skin-minty, &.skin-pulse, + &.skin-sandstone, &.skin-sketchy, &.skin-spacelab, &.skin-united, + &.skin-cerulean, &.skin-lumen, &.skin-lux, &.skin-morph, + &.skin-simplex, &.skin-yeti, &.skin-zephyr { + .composer { + color: var(--bs-body-color) !important; + background-color: var(--bs-body-bg) !important; + } + } +} diff --git a/node_modules/nodebb-plugin-composer-default/static/scss/textcomplete.scss b/node_modules/nodebb-plugin-composer-default/static/scss/textcomplete.scss new file mode 100644 index 0000000000..7a4cad943a --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/scss/textcomplete.scss @@ -0,0 +1,26 @@ +.textcomplete-dropdown { + border: 1px solid $border-color; + background-color: $body-bg; + color: $body-color; + list-style: none; + padding: 0; + margin: 0; + + li { + margin: 0; + } + + .textcomplete-footer, .textcomplete-item { + border-top: 1px solid $border-color; + } + + .textcomplete-item { + padding: 2px 5px; + cursor: pointer; + + &:hover, &.active { + color: $dropdown-link-hover-color; + background-color: $dropdown-link-hover-bg; + } + } +} \ No newline at end of file diff --git a/node_modules/nodebb-plugin-composer-default/static/scss/zen-mode.scss b/node_modules/nodebb-plugin-composer-default/static/scss/zen-mode.scss new file mode 100644 index 0000000000..b29340e8d3 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/scss/zen-mode.scss @@ -0,0 +1,51 @@ +html.zen-mode { + overflow: hidden; +} + +.zen-mode .composer { + &.resizable { + padding-top: 0; + } + + .composer-container { + padding-top: 5px; + } + + .tag-row { + display: none; + } + + .title-container .category-list-container { + margin-top: 3px; + } + + .write, .preview { + border: none; + outline: none; + } + + .resizer { + display: none; + } + + &.reply { + .title-container { + display: none; + } + } + + @include media-breakpoint-up(md) { + & { + padding-left: 15px; + padding-right: 15px; + } + .write-preview-container { + margin-bottom: 0; + + > div { + padding: 0; + margin: 0; + } + } + } +} \ No newline at end of file diff --git a/node_modules/nodebb-plugin-composer-default/static/templates/admin/plugins/composer-default.tpl b/node_modules/nodebb-plugin-composer-default/static/templates/admin/plugins/composer-default.tpl new file mode 100644 index 0000000000..a7fa31ce59 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/templates/admin/plugins/composer-default.tpl @@ -0,0 +1,22 @@ +
    + + +
    +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    +
    + diff --git a/node_modules/nodebb-plugin-composer-default/static/templates/compose.tpl b/node_modules/nodebb-plugin-composer-default/static/templates/compose.tpl new file mode 100644 index 0000000000..9fb4300baf --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/templates/compose.tpl @@ -0,0 +1,27 @@ +
    +
    +
    + {{{ if pid }}} + + + {{{ end }}} + {{{ if tid }}} + + {{{ end }}} + {{{ if cid }}} + + {{{ end }}} + +
    + + + + + + + + {{{ if isTopicOrMain }}} + + {{{ end }}} +
    +
    diff --git a/node_modules/nodebb-plugin-composer-default/static/templates/composer.tpl b/node_modules/nodebb-plugin-composer-default/static/templates/composer.tpl new file mode 100644 index 0000000000..f4ee338c69 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/templates/composer.tpl @@ -0,0 +1,46 @@ +
    +
    + + +
    + + + + + + + {{{ if isTopicOrMain }}} + + {{{ end }}} + +
    [[topic:composer.drag-and-drop-images]]
    + +
    +
    +
    + +
    +
    +
    +
    +
    +
    diff --git a/node_modules/nodebb-plugin-composer-default/static/templates/modals/topic-scheduler.tpl b/node_modules/nodebb-plugin-composer-default/static/templates/modals/topic-scheduler.tpl new file mode 100644 index 0000000000..29736747c6 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/templates/modals/topic-scheduler.tpl @@ -0,0 +1,4 @@ +
    + + +
    \ No newline at end of file diff --git a/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-formatting.tpl b/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-formatting.tpl new file mode 100644 index 0000000000..941f06f2e4 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-formatting.tpl @@ -0,0 +1,75 @@ +
    +
      + {{{ each formatting }}} + {{{ if ./spacer }}} +
    • + {{{ else }}} + {{{ if (./visibility.desktop && ((isTopicOrMain && ./visibility.main) || (!isTopicOrMain && ./visibility.reply))) }}} + {{{ if ./dropdownItems.length }}} + + {{{ else }}} +
    • + +
    • + {{{ end }}} + {{{ end }}} + {{{ end }}} + {{{ end }}} + + {{{ if privileges.upload:post:image }}} +
    • + +
    • + {{{ end }}} + + {{{ if privileges.upload:post:file }}} +
    • + +
    • + {{{ end }}} + +
      + +
      +
    +
    + + + {{{ if composer:showHelpTab }}} + + {{{ end }}} +
    +
    + diff --git a/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-tags.tpl b/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-tags.tpl new file mode 100644 index 0000000000..e247403419 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-tags.tpl @@ -0,0 +1,17 @@ +
    +
    +
    + + + +
    + +
    +
    \ No newline at end of file diff --git a/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-title-container.tpl b/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-title-container.tpl new file mode 100644 index 0000000000..b46ea269a2 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-title-container.tpl @@ -0,0 +1,50 @@ +
    + {{{ if isTopic }}} +
    + +
    + {{{ end }}} + + {{{ if showHandleInput }}} +
    + +
    + {{{ end }}} + +
    + {{{ if isTopicOrMain }}} + + {{{ else }}} + {{{ if isEditing }}}[[topic:composer.editing-in, "{topicTitle}"]]{{{ else }}}[[topic:composer.replying-to, "{topicTitle}"]]{{{ end }}} + {{{ end }}} + +
    + +
    +
    + + +
    + + +
    + +
    + + +
    +
    +
    +
    diff --git a/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-write-preview.tpl b/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-write-preview.tpl new file mode 100644 index 0000000000..37cefbd220 --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/static/templates/partials/composer-write-preview.tpl @@ -0,0 +1,10 @@ +
    +
    +
    [[modules:composer.post-queue-alert]]
    + + +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/node_modules/nodebb-plugin-composer-default/websockets.js b/node_modules/nodebb-plugin-composer-default/websockets.js new file mode 100644 index 0000000000..882dbb2b0d --- /dev/null +++ b/node_modules/nodebb-plugin-composer-default/websockets.js @@ -0,0 +1,94 @@ +'use strict'; + +const meta = require.main.require('./src/meta'); +const privileges = require.main.require('./src/privileges'); +const posts = require.main.require('./src/posts'); +const topics = require.main.require('./src/topics'); +const plugins = require.main.require('./src/plugins'); + +const Sockets = module.exports; + +Sockets.push = async function (socket, pid) { + const canRead = await privileges.posts.can('topics:read', pid, socket.uid); + if (!canRead) { + throw new Error('[[error:no-privileges]]'); + } + + const postData = await posts.getPostFields(pid, ['content', 'tid', 'uid', 'handle', 'timestamp']); + if (!postData && !postData.content) { + throw new Error('[[error:invalid-pid]]'); + } + + const [topic, tags, isMain] = await Promise.all([ + topics.getTopicDataByPid(pid), + topics.getTopicTags(postData.tid), + posts.isMain(pid), + ]); + + if (!topic) { + throw new Error('[[error:no-topic]]'); + } + + const result = await plugins.hooks.fire('filter:composer.push', { + pid: pid, + uid: postData.uid, + handle: parseInt(meta.config.allowGuestHandles, 10) ? postData.handle : undefined, + body: postData.content, + title: topic.title, + thumb: topic.thumb, + tags: tags, + isMain: isMain, + timestamp: postData.timestamp, + }); + return result; +}; + +Sockets.editCheck = async function (socket, pid) { + const isMain = await posts.isMain(pid); + return { titleEditable: isMain }; +}; + +Sockets.renderPreview = async function (socket, content) { + return await plugins.hooks.fire('filter:parse.raw', content); +}; + +Sockets.renderHelp = async function () { + const helpText = meta.config['composer:customHelpText'] || ''; + if (!meta.config['composer:showHelpTab']) { + throw new Error('help-hidden'); + } + + const parsed = await plugins.hooks.fire('filter:parse.raw', helpText); + if (meta.config['composer:allowPluginHelp'] && plugins.hooks.hasListeners('filter:composer.help')) { + return await plugins.hooks.fire('filter:composer.help', parsed) || helpText; + } + return helpText; +}; + +Sockets.getFormattingOptions = async function () { + return await require('./library').getFormattingOptions(); +}; + +Sockets.shouldQueue = async function (socket, data) { + if (!data || !data.postData) { + throw new Error('[[error:invalid-data]]'); + } + if (socket.uid <= 0) { + return false; + } + + let shouldQueue = false; + const { postData } = data; + if (postData.action === 'posts.reply') { + shouldQueue = await posts.shouldQueue(socket.uid, { + tid: postData.tid, + content: postData.content || '', + }); + } else if (postData.action === 'topics.post') { + shouldQueue = await posts.shouldQueue(socket.uid, { + cid: postData.cid, + content: postData.content || '', + }); + } + return shouldQueue; +}; From efdde030ac1a1701665638da657d1d79ee712238 Mon Sep 17 00:00:00 2001 From: ericlin2 Date: Sun, 22 Sep 2024 16:45:50 -0400 Subject: [PATCH 5/5] removed some css --- .../static/scss/composer.scss | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/node_modules/nodebb-plugin-composer-default/static/scss/composer.scss b/node_modules/nodebb-plugin-composer-default/static/scss/composer.scss index 4a2725c923..e9157dc92d 100644 --- a/node_modules/nodebb-plugin-composer-default/static/scss/composer.scss +++ b/node_modules/nodebb-plugin-composer-default/static/scss/composer.scss @@ -235,32 +235,6 @@ .preview { padding: $input-padding-y $input-padding-x; } - - .anonymous-checkbox { - display: flex; - align-items: center; - font-size: 16px; - color: var(--bs-body-color); - - input[type="checkbox"] { - margin-right: 8px; // Adjust spacing as needed - width: 16px; - height: 16px; - } - - label { - margin: 0; // Remove any default margin - } - - // Additional styles for responsiveness - @include media-breakpoint-down(sm) { - font-size: 14px; - } - - @include media-breakpoint-up(md) { - margin-left: 16px; // Add space between elements in larger screens - } -} } .datetime-picker {