GithubHelp home page GithubHelp logo

mantisbt-plugins / bbcodeplus Goto Github PK

View Code? Open in Web Editor NEW
29.0 12.0 13.0 1.3 MB

BBCode plugin for Mantis BugTracker 1.3 and 2.x

License: GNU General Public License v2.0

PHP 31.44% CSS 55.72% JavaScript 12.54% HTML 0.31%
mantisbt-plugin

bbcodeplus's Introduction

BBCodePlus

Description

BBCode plugin for Mantis BugTracker 2.x

Incorporates the following configurable features:

  • Editor with toolbars and preview (using jQuery MarkItUp).
  • BBCode processing.
  • Syntax Highlighting (using prismjs).
  • Mostly compatible with the Mantis Formatting plugin (this means they can both be enabled, if desired).
  • NOTE: This plugin does NOT interact well with the Markdown Processing feature of the Mantis Formatting plugin. Disabling the functionality is advised.

Repository Information

NOTE: BBCodePlus 2.x is now the master for the BBCodePlus project. Please re-fork or (carefully) update your fork (branch structure on upstream and origin).

Branch Description
master Support for MantisBT 2.x (current production version).
master-1.3.x Support for MantisBT 1.3.x (legacy).

Contributing to BBCodePlus

If you would like to contribute to BBCode plus, please read this guide first.

Change Log

2.1.19

  • Corrected issue with clipboard js script not being referenced properly on some mantis installs.

2.1.18

  • Added nonce random token and directives for included js scripts in order to hopefully address CSP restrictions.
  • Corrected issue with referencing issue images (removed volatile token, now using only file id and type).

2.1.17

  • Fixed styling and scripting issues with issue image picker.
  • Resized markItUp editor elements.

2.1.16

  • NEW: Added image picker modal for picking images that have been uploaded to issue.

2.1.15

  • Now including clipboard.min.js locally, to avoid cdn interaction.

2.1.14

  • Corrected email parsing behavior when Email Processing is turned on. MantisBT does not support HTML email natively.

2.1.13

  • Added the following characters to work with the quotee's name in the named quote function (basically to support email-adresses here): . @ - @FSD-Christian-ISS

2.1.12

  • Fixed display of quotes when quotee's name contains unicode characters, commas or single quotes @FSD-Christian-ISS

2.1.11

  • Fixed issue with additional protocols in link insertion.

2.1.10

  • Fixed rendering issue of code blocks when language parameter was left empty
  • Fixed rendering issue of quote blocks when quotee parameter contained whitespaces

2.1.9

2.1.8

  • Removed leftover debug call that was breaking display.

2.1.7

  • Corrected outstanding bug with resolved bug links.

2.1.6

  • Corrected bug in handling of mention links.

2.1.5

  • Corrected use of $this inside code replace callback (causes issues with older versions of PHP).

2.1.4

  • Corrected issues with bug links and mentions.
  • Dropped support for CVS links.
  • Added better code block support for HTML syntax (<br/> tags were getting dropped).
  • Removed duplication of MantisCoreFormatting features. They will be used only when the plugin is enabled.

2.1.3

  • Cleaned up issues with undefined variable notices from old code.

2.1.2

  • Added MarkItUp toolbar support for custom textarea fields.

2.1.1

  • Fixed new parser incompatibility with PHP 5.5.9+.
  • Updated README for all languages supported by code highlighter.

2.1.0

  • Brand new BBCode/HTML parsers, from Genert/bbcode.
  • Updated Prism code highlighter, now with Copy to Clipboard functionality.
  • Addresses multiple outstanding issues.
  • Added check for Mantis Formatting Markdown feature (warns if it is ON, as it will cause issues with BBCodePlus).
  • Cleaned up lots of old code, which will make it easier to maintain.

2.0.18

  • Updated MarkItUp javascript dependency.

Screenshots:

Markup editor

Configuration

Configuration

Supported BBCode Tags

[img][/img] - Images.
[url][/url] - Links.
[email][/email] - Email addresses.
[color=red][/color] - Colored text.
[highlight=yellow][/highlight] - Highlighted text.
[size][/size] - Font size.
[list][/list] - Unordered lists.
[list=1][/list] - Numbered lists (number is starting number).
[list=a][/list] - Alpha lists (letter is starting letter).
[*] - List items.
[b][/b] - Bold.
[u][/u] - underline
[i][/i] - Italic.
[s][/s] - Strikethrough.
[left][/left] - Left align.
[center][/center] - Center.
[right][/right] - Right align.
[justify][/justify] - Justify.
[hr] - Horizontal rule.
[sub][/sub] - Subscript.
[sup][/sup] - Superscript.
[table][/table] - Table.
[table=1][/table] - Table with border of specified width.
[thead][/thead] - Table head block.
[tbody][/tbody] - Table body block.
[tr][/tr] - Table row.
[th][/th] - Table header column.
[td][/td] - Table column.
[code][/code] - Code block.
[code=sql][/code] - Code block with language definition.
[code start=3][/code] - Code block with line numbers starting at number.
[code=sql start=3][/code] - Code block with language definition and line numbers starting at number.
[quote][/quote] - Quote by *someone* (no name).
[quote=name][/quote] - Quote by *name*.

Supported Languages for Code Highlighting

The implementation of prism.js includes support for languages in 2 modes:

  • default (supported on plugin install).
  • Add support for extra languages (through the plugin's configuration page).

Languages supported by default

Keyword Description
aspnet ASP.NET
bash Bash + Shell
basic BASIC
batch Batch
clike C-like
cpp C++
csharp C#
csp CoffeeScript
css CSS
c C
django Django/Jinja2
docker Docker
hpkp HTTP Public-Key-Pins
hsts HTTP Strict-Transport-Security
http HTTP
ini Ini
javadoclike JavaDoc-like
javascript JavaScript
java Java
js-extras JS Extras
json5 JSON5
jsonp JSONP
json JSON
markup-templating Markup templating
markup Markup + HTML + XML + SVG + MathML
nginx nginx
pascal Pascal + Object Pascal
perl Perl
php-extras PHP Extras
phpdoc PHPDoc
php PHP
plsql PL/SQL
powershell PowerShell
python Python
regex Regex
ruby Ruby
smarty Smarty
sql SQL
vbnet VB.NET
vim vim
visual-basic Visual Basic
wiki Wiki markup
xquery XQuery
yaml YAML

Languages supported by the extra languages feature

Keyword Description
abap ABAP
actionscript ActionScript
apl APL
applescript AppleScript
autohotkey AutoHotKey
bison Bison
brainfuck Brainfuck
coffeescript CoffeeScript
css-extras CSS Extras
dart Dart
diff Diff
d D
eiffel Eiffel
elixir Elixir
erlang Erlang
fortran Fortran
fsharp F#
gherkin Gherkin
git Git
glsl GLSL
go Go
groovy Groovy
haskell Haskell
inform7 Inform 7
jsx React JSX
julia Julia
j J
keyman Keyman
latex LaTex
less Less
lolcode LOLCODE
makefile Makefile
markdown Markdown
matlab MATLAB
mel MEL
mizar Mizar
monkey Monkey
nasm NASM
nim Nim
nsis NSIS
objectivec Objective-C
ocaml OCaml
processing Processing
prolog Prolog
pure Pure
qore Qore
q Q
regex Regex
rest reST
rip Rip
rust Rust
r R
sass Sass (Sass)
sas SAS
scala Scala
scheme Scheme
scss Sass (Scss)
smalltalk Smalltalk
swift Swift
tcl Tcl
twig Twig
typescript TypeScript
verilog Verilog
vhdl VHDL

bbcodeplus's People

Contributors

atrol avatar bkraul avatar dregad avatar fsd-christian-adm avatar kirill avatar vieyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bbcodeplus's Issues

Installing the plugin breaks issue link in notification emails

In a typical notification email a user gets when, for example, the status of an issue is changed, should look like the following:

http://mysite.com/mantis/view.php?id=1

However, when I install the latest version of BBCodePlus (Ver. 2.1.3), the link format changes to the following:

http://mysite.com/mantis#1

This is a problem since clicking the second link takes you to the user's MyView page, not directly to the issue.

Additional Info

Capture

The '=' in [code=][/code] breaks the bbcode render if no language is specified

MantisBT 2.4.1.
Bbcode plugin (latest I assume)

Example: https://freecadweb.org/tracker/bug_revision_view_page.php?bugnote_id=9154

Reproduce:

  1. Click code button
    Result: overlay screen with dialog appears asking what coding language
  2. Press OK
    Result: [code=][/code] is printed
  3. Add text between brackets and then press 'Add Note'
    Result: text won't be rendered in bbcode

Suggested outcomes:
A. After step 2 markup doesn't include '=' ex. [code][/code]
or
B. After step 3 the [code=][/code] renders markup correctly even though language was not specified.

Edit: Downstream ticket https://freecadweb.org/tracker/view.php?id=3047

MarkItUp not working

MarkItUp not working:

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'".

Installation

Hye

thanks for your plugin.

How can I install it ?

I didn't see install instructions. Just copy BBCodePlus folder in my /plugins folder ?

Thanks

Plugin disables @mention hyperlink

When I use the @mention with the plugin enabled, the hyperlinked username does not work, and the mentioned username instead appears as plain text.
Any workarounds available for this?

Clarification: No MarkDown support?

There is an option "Enable MarkDown editor". However, as far as I understand, MarkItUp can support MarkDown, but in this plugin it is only configured to support BBCode. So, either it has to be clarified how MarkDown can be used, or the option has to be renamed to something like "Enable visual editor".

Default "process email" option results in broken emails

Fresh install of BBCode+ 2.0.15 on MantisBT 2.15.0 using PHPMAILER_METHOD_SMTP to send emails. After install, general administration email come through HTML encoded but Content-Type is still text/plain, so email appears garbled.

For example, after install of the plugin, an email looks like so:

<earlier headers snipped>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

The following account has been created:<br />
<br />
Username: user<br />
E-mail: user@domain<br />
Remote IP address: 1.1.1.1<br />
<a target=3D"_blank"
href=3D"http://issues.domain.name/">http://issues.domain.name/</a><br=
 />
<br />
Do not reply to this message

If the content happens to include a URL with an ampersand (eg. an account activation email), then the URL is no longer clickable or copy-pastable. The HTML encoding has to be undone first.

Changing the "Process email" option to "No" rectifies the situation, but I assume results in uglier emails which contain content from issues with BBCode in them.

Is this is a matter of BBCodePlus assuming MantisBT is sending HTML formatted emails?

Compatibility with PHP7 (preg_replace)

PHP Manual:

As of PHP 5.5.0 E_DEPRECATED level error is emitted when passing in the "\e" modifier. As of PHP 7.0.0 E_WARNING is emited in this case and "\e" modifier has no effect.

This causes that issues/bugs are not displayed correctly.

clipboard.min.js not found

Version 2.1.18

/plugin_file.php?file=BBCodePlus/prism/clipboard.min.js in prism.js throws

"GET /plugin_file.php?file=BBCodePlus/prism/clipboard.min.js HTTP/1.1" 404 196
in Apache access.log

and

script 'xxxxx/mantisroot/plugin_file.php' not found or unable to stat
in Apache error.log

Icons are disappearing

Hello dear !

thank you very much for your plugin it is very very useful !

there is something weird when i'm using it with an other plugin : To-do lists 2.5.0

as soon as I activate the Todolist plugin, the BBCOde+ plugin icons disappear

160082589-45df09e5-a1d9-4dfc-b69d-82aea7ad3116
160082767-6522c17f-a91f-4fdd-8590-3a350448fc1d

i'm working on mantis 2.25.2

Maybe you will be able to fix something.

Thank you again for your work !

David

Link images attached to the issue by name

Hello, I have a question:

I often upload images to the issue and then use them in the text of the issue as:
[img]/file_download.php?file_id=2560&type=bug[/img]

This approach needs to create an issue with the text, then upload the images to the issue, edit the text and add the images to the text of the issue, which is inconvenient.

Would it be possible to use some tag that would allow to use the images uploaded to the issue by name (as I know, the attachment names are unique within an issue) - for example
[imgx]MyImageUploadedToTheIssue.png[/imgx].

Thank you very much
Best Regards
Vladimír Duša

markitup icons not working

Mantis 2.18.0
BBCodePlus 2.0.15

The markitup editor doesnt show the Icons (Bold, italic, etc.) in the Browser.
These Icons are fetched like http://myhost/plugin_file.php?file=BBCodePlus/markitup/sets/mantis/images/justify.png
But when fetched this way, the icons are broken. "justify.png" e.g. is 214 Byte big instead of 209 Bytes.
5 leading 0x0a are inserted in the begining
is:
00000000: 0a0a 0a0a 0a89 504e 470d 0a1a 0a00 0000 ......PNG.......
should be:
0000000: 8950 4e47 0d0a 1a0a 0000 000d 4948 4452 .PNG........IHDR

Custom URL links and emails not clickable

MantisBT Version 2.21.1, PHP 7.3, BBCode+ 2.1.10

We have added additional URL protocols in the string_api.php of mantis, like this and it works fine, the links are clickable:
$t_url_protocol = '(?:https?|s?ftp|file|irc[6s]?|ssh|telnet|nntp|git|svn(?:\+ssh)?|cvs|example):\/\/';

After installing and activating BBCode+ 2.1.10, they are no longer clickable links, even emails, only the FTP, HTTP, and HTTPS URLs seem to be working as links.

This is not ideal since we are receiving reports outside of the mantis installation, generated by integration with another program in which users don't have access to formatting codes.

Feature Request: Ability to use BBCode Plus Toolbar on custom textarea fields

When installed the plugin works in both default and custom textarea fields. However, currently the toolbar only appears in Mantis default textareas (in the Reprt Issue page's default textarea and in 'Add Note' section in any already created issue) and not in any user-created custom fields.

customtext

It would be nice to be able to have toolbar visible in custom textareas as well.

Mantis Version: Mantis 2.19.0
BBCode: 2.1.0

BBCode is sent via email

Mantis emails are always plain text.
The BBCode replaced in the mail are formated for HTML output, so you have html code inside a plain text mail.

Preview not working with BBCodePlus 2.1.17

Hello bkraul,

I recently update the plugin to 2.1.17 (running on Mantis 2.24.1 with php 7.2.31)
However, i noticed that the preview button (green check mark) doesn't show a preview anymore.

When i click the button, nothing happens.

Tried with Chrome and Edge (also cleared cache)
I don't see anything happening in apache2 error log when clicking it.

Anything else i can do?

Thanks in advance.

Stefan

"indentation increase/decrease" and the table creation

Hi Belman, Hi Kirill,
Your editor is a great help for formatting the text input. May I ask you if the editor could be added by the functions of the "indentation increase/decrease" and the table creation?
The texts will looked much better.
Regards from Cologne

list numbering operation

Is it possible to create numbered lists like in here in GitHub?

i.e. you select 'Add list', it creates first bullet/number then you simply press enter to create more?

Would be much simpler instead of typing first, highlighting them then pressing the 'Add list' button, as is the case presently.

Otherwise many thanks for the plugin, it is fantastic.

Cannot get the toolbar to work (IIS8.5 + PHP Environment)

I installed BBCodePlus plug-in in my mantis installation, and it works on text areas just fine. I can manually do [ b]some text[ /b] etc and it will show me bold/italic etc.

However I cannot figure out how to get the toolbar to work. But according to the plugin Wiki, it's supposed to show you a toolbar.

This is what my config options look like:

bbcode

Is there a set of steps/installation guide? Otherwise, is there anything else I need to do to get it working.

Here's my mantis and my system information.
OS: Windows Server 2012 R2 (Version 6.2, Build 9200)
IIS Version: 8.5.9600.16384
PHP Version: 7.2.7 (verified that it's working)
Mantis Version: MantisBT 2.19.0
Browser: Google Chrome Version 72.0.3626.121 (Official Build) (64-bit)

jquery error

the plugins newest version has this error in console(I tried 2.1.19 to 2.1.8 and 2.1.0)
and seems the 2.0.15 is the only version work for me

plugin_file.php?file=BBCodePlus/markitup/jquery_markitup.js:108 Uncaught TypeError: Cannot read properties of undefined (reading 'safari')
    at init (plugin_file.php?file=BBCodePlus/markitup/jquery_markitup.js:108:52)
    at HTMLTextAreaElement.<anonymous> (plugin_file.php?file=BBCodePlus/markitup/jquery_markitup.js:542:4)
    at Function.each (jquery-2.2.4.min.js:2:2861)
    at n.fn.init.each (jquery-2.2.4.min.js:2:845)
    at $.fn.markItUp (plugin_file.php?file=BBCodePlus/markitup/jquery_markitup.js:62:15)
    at HTMLDocument.<anonymous> (plugin_file.php?file=BBCodePlus/markitup-init.js:8:39)
    at i (jquery-2.2.4.min.js:2:27151)
    at Object.fireWith [as resolveWith] (jquery-2.2.4.min.js:2:27914)
    at Function.ready (jquery-2.2.4.min.js:2:29707)
    at HTMLDocument.J (jquery-2.2.4.min.js:2:29892)
init @ plugin_file.php?file=BBCodePlus/markitup/jquery_markitup.js:108
(匿名) @ plugin_file.php?file=BBCodePlus/markitup/jquery_markitup.js:542
each @ jquery-2.2.4.min.js:2
each @ jquery-2.2.4.min.js:2
$.fn.markItUp @ plugin_file.php?file=BBCodePlus/markitup/jquery_markitup.js:62
(匿名) @ plugin_file.php?file=BBCodePlus/markitup-init.js:8
i @ jquery-2.2.4.min.js:2
fireWith @ jquery-2.2.4.min.js:2
ready @ jquery-2.2.4.min.js:2
J @ jquery-2.2.4.min.js:2
plugin_file.php?file=BBCodePlus/markitup/jquery_markitup.js:359 Uncaught TypeError: Cannot read properties of undefined (reading 'msie')
    at fixIeBug (plugin_file.php?file=BBCodePlus/markitup/jquery_markitup.js:359:19)
    at markup (plugin_file.php?file=BBCodePlus/markitup/jquery_markitup.js:311:15)
    at plugin_file.php?file=BBCodePlus/markitup/jquery_markitup.js:176:32

and seem this function already remove
https://stackoverflow.com/questions/15011729/uncaught-typeerror-cannot-read-property-safari-of-undefined

the newest mantisbt use jquery 2.2.4

Bulleted list appears as numeric list

If I add a bulleted list to my note it appears as an numeric list.

mantis_bb_edit
mantis_bb_result

I use mantisbt 1.3.1 - maybe there changed something in the depth of css:
mantis_bb_css

Why not using ul-Element?

Oddness previewing URLs

Over at the FreeCAD tracker we use your plugin.

I have noticed that the comment preview exhibits some strange behaviour. In particular it doesn't render URLs correctly:

[quote="[url=https://www.freecadweb.org/tracker/bug_report_page.php]tracker[/url]"]
here's a quote with a [url=https://www.freecadweb.org/tracker/bug_report_page.php]url[/url] in the attribution and in the body
[/quote]
And it doesn't preview properly
[quote=Eric the Viking]
  but this one does
[/quote]
[quote=Eric the Viking]
  a quote with a [url=https://www.freecadweb.org/tracker/bug_report_page.php]url[/url] in it doesn't work either
[/quote]

[list]
[*]lists preview somewhat differently too...
[*]...kind of with odd spacing
[/list]
Here's a plain url to check: [url=https://www.freecadweb.org/tracker/bug_report_page.php]url[/url]
And the preview fails
https://www.freecadweb.org/tracker/bug_report_page.php
Without the url bbcode, it still doesn't render usefully.

untitled

Installing plugin breaks issue links in bug_view_inc

The bug_view_inc.php displays the various sections/notes and produces urls for buglinks. However, when this plugin's formatted() funtion is called when dsplaying the bug, it strips the a hrefs that the MantisBTFormatting plugin makes
buglinksbug
. Possibly related to #64?

BBCodePlus.php string_process_bbcode()

if ( ON == $this->t_MantisCoreFormatting_process_urls ) { $p_string = string_strip_hrefs( $p_string ); }

Emails are being sent with bb tags and not formatted

I'm not sure what "Process email" does but I assumed it would convert bbcode into html for emails. I am having a problem where the emails sent out show the bbcode and it's a mess. Is this a bug? Is it maybe my version? I have the last 1.2 version of your plugin.

Mantis Version: 1.2.17
Schema Version: 183

<br> Tag replacement

When using xml to Highlight XML in the Bugnotes it seems that all tags that are starting with "<br" are replaced.

Even if all possible fields on the options page are set to "no" the plugin replaces this tags. The 2.0 master branch is used.

mantisxml

MantisBT 2.1.0 icons

Hi,
i dont see icons :/
i test uninstall all plugins and dont works :/
windows 10 FF, IE, Chrome same problem
Some ideas?
Thankssnag-0000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.