Code

Code 2.2.0

No permission to download

CMTV

Well-known member
CMTV submitted a new resource:

Code - Making [code] bbcode and code editor a way more functional. A must have addon if you use code!

View attachment 182661

Description

This addon makes code bbcode and code editor way more functional by adding copy, expand, collapse buttons, resizer bar and automatically adjusting the colors to fit chosen forum style.

If you appreciate my work, please consider leaving a like, review and a contribution via PayPal (PM me for details)

This is an open source addon. Visit GitHub repository for...

Read more about this resource...
 
CMTV updated Code with a new update entry:

Important bug fixes 1.1

Fixed bugs
  • Fixed a bug with incorrect code block height when horizontal scrollbar is visible
    • This also fixes a bug with horizontal scrollbar overlapping the conten of single line code block
  • Optimized the way of adding line numbers to code
  • Dark code style type now correctly works in "Insert code" dialog
  • Some colors are lighter now when dark code style type is active

Read the rest of this update entry...
 
@sub_ubi Yes. The process of adding a new language is absolutely the same. But for "Common languages" and "Default language" you have to use addon options.
 
I have installed this and added C++ as the only input for both common and default code language. Then rebuilt master data.
When insert the code in editor, there is no Common Language block.
Also when I use the code bbcode, I expect it to use the default language same as when I specify code=c++ bbcode but it doesn't.

Screen Shot 2018-09-01 at 1.08.55 PM.webp
 
Did you write "cpp" in common and default code language? Or "c++"?

"c++" won't work as well as "c#". You need to specify a letters-only language name: "cpp"/"csharp".
 
Last edited:
You are right. I entered C++ instead of cpp. That solves it.
Now, I notice something else. This addon doesn't do code syntax highlight like the default xf as seen here
https://xenforo.com/community/threads/testing-code.153092/
I attach how the same code appears in your addon.

My suggestion is to instead of showing the header as Code in the picture, use C++ as shown in the xf test thread. This way, people can see which language is use. Unless you specific a language, it will always show the default language.

Screen Shot 2018-09-01 at 1.26.24 PM.webp
 
Try to write cpp in both "Common languages" and "Default language":

1535827876736.webp

Everything is working fine on my test forum:

1535827886939.webp

If it is not wokring, try to revert bb_code_tag_code and code_editor templates and check if it is working.

Don't forget to save your template changes somewhere by the way if you want to reapply them later.
 
Great addon. If you're using UIX 2 Dark, you will need to use a darker background for the code blocks. You can do that by adding this to extra.less or modifying Code_style_dark.less

CSS:
.bbCodeBlock--code .bbCodeBlock-content {
    background-color: #2a2a2a;
}

I'm not trying to knock your style, it's really great and I love the addon. But I am more partial to my Xonokai themed style I made, if you wanna check it out, not sure if you'd seen it. Maybe you'll like it, I never made a plugin out of it so if you wanna do something with it, go ahead https://xenforo.com/community/threads/code-block-syntax-highlighting-dark-theme.144111/

Would love to see a mod that adds Assembly syntax highlighting to XF2 if you're looking for ideas :)

Cheers
 
Is this normal? Or is the background supposed to be dark when using the dark theme?
firefox_2018-09-20_21-55-04.png
 
I have dark code style selected, I did a reinstall just to make sure, and it's still occuring. I do use ThemeHouses's UI.X2 Dark Theme latest patch with XF2's latest patch, so maybe something just wasn't compatible. Anyways I was able to fix it with a little .css. Thanks again, really like this
 
There seems to be a slight bug concerning the "Preview" button when posting code?

The preview opens the code in a very small box, collapsing/expanding seems to do very little, and the resize drag and drop is non-responsive.
 
I was able to add in a lua and VB language packs and had it all working almost instantly! (... instantly after I striped out all of the "visual-basic" references in the .min.js and rename them to "vb", and then use vb everywhere.) Great add on, I really appreciate it!
 
There seems to be a slight bug concerning the "Preview" button when posting code?

The preview opens the code in a very small box, collapsing/expanding seems to do very little, and the resize drag and drop is non-responsive.
Sorry to chase @CMTV - just wondered if you're able to replicate this?
 
It's the Uniform style by @Ehren (seems this one actually is a conflict after previous false alarms!).

I'll do some digging around over the weekend if I have chance. Thanks.
 
Top Bottom