From c86df0f0c6c79c98238e8a1a84cb9fab5a69a635 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 28 Oct 2015 13:09:39 -0400 Subject: Revert "PLT-395: Add syntax highlighting to Markdown code blocks" --- .../user_settings/code_theme_chooser.jsx | 55 ----------------- .../user_settings/user_settings_appearance.jsx | 23 +------- web/react/package.json | 1 - web/react/utils/constants.jsx | 32 ---------- web/react/utils/markdown.jsx | 65 --------------------- web/react/utils/utils.jsx | 26 --------- web/sass-files/sass/partials/_post.scss | 16 ----- web/static/css/highlight | 1 - web/static/images/themes/code_themes/github.png | Bin 9648 -> 0 bytes web/static/images/themes/code_themes/monokai.png | Bin 9303 -> 0 bytes .../images/themes/code_themes/solarized_dark.png | Bin 8172 -> 0 bytes .../images/themes/code_themes/solarized_light.png | Bin 8860 -> 0 bytes web/templates/head.html | 1 - 13 files changed, 1 insertion(+), 219 deletions(-) delete mode 100644 web/react/components/user_settings/code_theme_chooser.jsx delete mode 120000 web/static/css/highlight delete mode 100644 web/static/images/themes/code_themes/github.png delete mode 100644 web/static/images/themes/code_themes/monokai.png delete mode 100644 web/static/images/themes/code_themes/solarized_dark.png delete mode 100644 web/static/images/themes/code_themes/solarized_light.png (limited to 'web') diff --git a/web/react/components/user_settings/code_theme_chooser.jsx b/web/react/components/user_settings/code_theme_chooser.jsx deleted file mode 100644 index eef4b24ba..000000000 --- a/web/react/components/user_settings/code_theme_chooser.jsx +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -var Constants = require('../../utils/constants.jsx'); - -export default class CodeThemeChooser extends React.Component { - constructor(props) { - super(props); - this.state = {}; - } - render() { - const theme = this.props.theme; - - const premadeThemes = []; - for (const k in Constants.CODE_THEMES) { - if (Constants.CODE_THEMES.hasOwnProperty(k)) { - let activeClass = ''; - if (k === theme.codeTheme) { - activeClass = 'active'; - } - - premadeThemes.push( -
-
this.props.updateTheme(k)} - > - -
-
- ); - } - } - - return ( -
- {premadeThemes} -
- ); - } -} - -CodeThemeChooser.propTypes = { - theme: React.PropTypes.object.isRequired, - updateTheme: React.PropTypes.func.isRequired -}; diff --git a/web/react/components/user_settings/user_settings_appearance.jsx b/web/react/components/user_settings/user_settings_appearance.jsx index e94894a1d..8c62a189d 100644 --- a/web/react/components/user_settings/user_settings_appearance.jsx +++ b/web/react/components/user_settings/user_settings_appearance.jsx @@ -7,7 +7,6 @@ var Utils = require('../../utils/utils.jsx'); const CustomThemeChooser = require('./custom_theme_chooser.jsx'); const PremadeThemeChooser = require('./premade_theme_chooser.jsx'); -const CodeThemeChooser = require('./code_theme_chooser.jsx'); const AppDispatcher = require('../../dispatcher/app_dispatcher.jsx'); const Constants = require('../../utils/constants.jsx'); const ActionTypes = Constants.ActionTypes; @@ -19,14 +18,12 @@ export default class UserSettingsAppearance extends React.Component { this.onChange = this.onChange.bind(this); this.submitTheme = this.submitTheme.bind(this); this.updateTheme = this.updateTheme.bind(this); - this.updateCodeTheme = this.updateCodeTheme.bind(this); this.handleClose = this.handleClose.bind(this); this.handleImportModal = this.handleImportModal.bind(this); this.state = this.getStateFromStores(); this.originalTheme = this.state.theme; - this.originalCodeTheme = this.state.theme.codeTheme; } componentDidMount() { UserStore.addChangeListener(this.onChange); @@ -61,10 +58,6 @@ export default class UserSettingsAppearance extends React.Component { type = 'custom'; } - if (!theme.codeTheme) { - theme.codeTheme = Constants.DEFAULT_CODE_THEME; - } - return {theme, type}; } onChange() { @@ -100,13 +93,6 @@ export default class UserSettingsAppearance extends React.Component { ); } updateTheme(theme) { - theme.codeTheme = this.state.theme.codeTheme; - this.setState({theme}); - Utils.applyTheme(theme); - } - updateCodeTheme(codeTheme) { - var theme = this.state.theme; - theme.codeTheme = codeTheme; this.setState({theme}); Utils.applyTheme(theme); } @@ -116,7 +102,6 @@ export default class UserSettingsAppearance extends React.Component { handleClose() { const state = this.getStateFromStores(); state.serverError = null; - state.theme.codeTheme = this.originalCodeTheme; Utils.applyTheme(state.theme); @@ -185,13 +170,7 @@ export default class UserSettingsAppearance extends React.Component { {custom}
- {'Code Theme'} - -
- {serverError} + {serverError} ' + $(parsed).text() + ''; - } - - let parsed = highlightJs.highlight(language, code); - return '
' + - '' + HighlightedLanguages[language] + '' + - '' + parsed.value + '' + - '
'; } br() { diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx index 3140a5d77..b643c6012 100644 --- a/web/react/utils/utils.jsx +++ b/web/react/utils/utils.jsx @@ -408,11 +408,6 @@ export function toTitleCase(str) { } export function applyTheme(theme) { - if (!theme.codeTheme) { - theme.codeTheme = Constants.DEFAULT_CODE_THEME; - } - updateCodeTheme(theme.codeTheme); - if (theme.sidebarBg) { changeCss('.sidebar--left, .settings-modal .settings-table .settings-links, .sidebar--menu', 'background:' + theme.sidebarBg, 1); } @@ -599,27 +594,6 @@ export function rgb2hex(rgbIn) { return '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]); } -export function updateCodeTheme(theme) { - const path = '/static/css/highlight/' + theme + '.css'; - const $link = $('link.code_theme'); - if (path !== $link.attr('href')) { - changeCss('code.hljs', 'visibility: hidden'); - var xmlHTTP = new XMLHttpRequest(); - xmlHTTP.open('GET', path, true); - xmlHTTP.onload = function onLoad() { - $link.attr('href', path); - if (isBrowserFirefox()) { - $link.one('load', () => { - changeCss('code.hljs', 'visibility: visible'); - }); - } else { - changeCss('code.hljs', 'visibility: visible'); - } - }; - xmlHTTP.send(); - } -} - export function placeCaretAtEnd(el) { el.focus(); if (typeof window.getSelection != 'undefined' && typeof document.createRange != 'undefined') { diff --git a/web/sass-files/sass/partials/_post.scss b/web/sass-files/sass/partials/_post.scss index 3fac1fed9..f5fc1631f 100644 --- a/web/sass-files/sass/partials/_post.scss +++ b/web/sass-files/sass/partials/_post.scss @@ -466,22 +466,6 @@ body.ios { white-space: nowrap; cursor: pointer; } - .post-body--code { - font-size: .97em; - position:relative; - .post-body--code__language { - position: absolute; - right: 0; - background: #fff; - cursor: default; - padding: 0.3em 0.5em 0.1em; - border-bottom-left-radius: 4px; - @include opacity(.3); - } - code { - white-space: pre; - } - } } .create-reply-form-wrap { width: 100%; diff --git a/web/static/css/highlight b/web/static/css/highlight deleted file mode 120000 index c774cf397..000000000 --- a/web/static/css/highlight +++ /dev/null @@ -1 +0,0 @@ -../../react/node_modules/highlight.js/styles/ \ No newline at end of file diff --git a/web/static/images/themes/code_themes/github.png b/web/static/images/themes/code_themes/github.png deleted file mode 100644 index d0538d6c0..000000000 Binary files a/web/static/images/themes/code_themes/github.png and /dev/null differ diff --git a/web/static/images/themes/code_themes/monokai.png b/web/static/images/themes/code_themes/monokai.png deleted file mode 100644 index 8f92d2a18..000000000 Binary files a/web/static/images/themes/code_themes/monokai.png and /dev/null differ diff --git a/web/static/images/themes/code_themes/solarized_dark.png b/web/static/images/themes/code_themes/solarized_dark.png deleted file mode 100644 index 76055c678..000000000 Binary files a/web/static/images/themes/code_themes/solarized_dark.png and /dev/null differ diff --git a/web/static/images/themes/code_themes/solarized_light.png b/web/static/images/themes/code_themes/solarized_light.png deleted file mode 100644 index b9595c22d..000000000 Binary files a/web/static/images/themes/code_themes/solarized_light.png and /dev/null differ diff --git a/web/templates/head.html b/web/templates/head.html index fdc371af4..041831ed7 100644 --- a/web/templates/head.html +++ b/web/templates/head.html @@ -24,7 +24,6 @@ - -- cgit v1.2.3-1-g7c22