Added option to hide line numbers
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
c737543114
commit
da09362f99
3 changed files with 10 additions and 2 deletions
|
@ -81,6 +81,7 @@ export default class TextualBody extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
_applyFormatting() {
|
_applyFormatting() {
|
||||||
|
const showLineNumbers = SettingsStore.getValue("showCodeLineNumbers");
|
||||||
this.activateSpoilers([this._content.current]);
|
this.activateSpoilers([this._content.current]);
|
||||||
|
|
||||||
// pillifyLinks BEFORE linkifyElement because plain room/user URLs in the composer
|
// pillifyLinks BEFORE linkifyElement because plain room/user URLs in the composer
|
||||||
|
@ -101,8 +102,9 @@ export default class TextualBody extends React.Component {
|
||||||
this._handleCodeBlockExpansion(pres[i]);
|
this._handleCodeBlockExpansion(pres[i]);
|
||||||
this._addCodeExpansionButton(div, pres[i]);
|
this._addCodeExpansionButton(div, pres[i]);
|
||||||
this._addCodeCopyButton(div);
|
this._addCodeCopyButton(div);
|
||||||
// TODO: Add option to disable this
|
if (showLineNumbers) {
|
||||||
this._addLineNumbers(pres[i]);
|
this._addLineNumbers(pres[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Highlight code
|
// Highlight code
|
||||||
|
|
|
@ -47,6 +47,7 @@ export default class PreferencesUserSettingsTab extends React.Component {
|
||||||
'showRedactions',
|
'showRedactions',
|
||||||
'enableSyntaxHighlightLanguageDetection',
|
'enableSyntaxHighlightLanguageDetection',
|
||||||
'expandCodeByDefault',
|
'expandCodeByDefault',
|
||||||
|
'showCodeLineNumbers',
|
||||||
'showJoinLeaves',
|
'showJoinLeaves',
|
||||||
'showAvatarChanges',
|
'showAvatarChanges',
|
||||||
'showDisplaynameChanges',
|
'showDisplaynameChanges',
|
||||||
|
|
|
@ -305,6 +305,11 @@ export const SETTINGS: {[setting: string]: ISetting} = {
|
||||||
displayName: _td('Expand code blocks by default'),
|
displayName: _td('Expand code blocks by default'),
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
"showCodeLineNumbers": {
|
||||||
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||||
|
displayName: _td('Show line numbers in code blocks'),
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
"Pill.shouldShowPillAvatar": {
|
"Pill.shouldShowPillAvatar": {
|
||||||
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
supportedLevels: LEVELS_ACCOUNT_SETTINGS,
|
||||||
displayName: _td('Show avatars in user and room mentions'),
|
displayName: _td('Show avatars in user and room mentions'),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue