From 0ae1263d9deff16c25f849e9a438abd0e250e671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Vi=E1=BB=87t=20H=C6=B0ng?= Date: Wed, 6 Jun 2018 00:25:49 +0700 Subject: [PATCH] abort --- browser/components/MarkdownPreview.js | 2 +- browser/lib/markdown.js | 1 - browser/main/lib/ConfigManager.js | 3 - .../main/modals/PreferencesModal/Export.js | 120 ------------------ browser/main/modals/PreferencesModal/index.js | 11 +- 5 files changed, 2 insertions(+), 135 deletions(-) delete mode 100644 browser/main/modals/PreferencesModal/Export.js diff --git a/browser/components/MarkdownPreview.js b/browser/components/MarkdownPreview.js index ef11a0cc..04fc29fd 100755 --- a/browser/components/MarkdownPreview.js +++ b/browser/components/MarkdownPreview.js @@ -219,7 +219,7 @@ export default class MarkdownPreview extends React.Component { const {fontFamily, fontSize, codeBlockFontFamily, lineNumber, codeBlockTheme, scrollPastEnd, theme} = this.getStyleParams() const inlineStyles = buildStyle(fontFamily, fontSize, codeBlockFontFamily, lineNumber, scrollPastEnd, theme) - let body = this.markdown.render(ConfigManager.get().exports.escapeHtml ? escapeHtmlCharacters(noteContent) : noteContent) + let body = this.markdown.render(escapeHtmlCharacters(noteContent)) const files = [this.GetCodeThemeLink(codeBlockTheme), ...CSS_FILES] const attachmentsAbsolutePaths = attachmentManagement.getAbsolutePathsOfAttachmentsInContent(noteContent, this.props.storagePath) diff --git a/browser/lib/markdown.js b/browser/lib/markdown.js index 5848aeea..2d81cd31 100644 --- a/browser/lib/markdown.js +++ b/browser/lib/markdown.js @@ -239,4 +239,3 @@ class Markdown { } export default Markdown - diff --git a/browser/main/lib/ConfigManager.js b/browser/main/lib/ConfigManager.js index 5b263191..79fe0f5f 100644 --- a/browser/main/lib/ConfigManager.js +++ b/browser/main/lib/ConfigManager.js @@ -65,9 +65,6 @@ export const DEFAULT_CONFIG = { token: '', username: '', password: '' - }, - exports: { - escapeHtml: true } } diff --git a/browser/main/modals/PreferencesModal/Export.js b/browser/main/modals/PreferencesModal/Export.js deleted file mode 100644 index c7d99c8c..00000000 --- a/browser/main/modals/PreferencesModal/Export.js +++ /dev/null @@ -1,120 +0,0 @@ -import React from 'react' -import ConfigManager from 'browser/main/lib/ConfigManager' -import i18n from 'browser/lib/i18n' -import styles from './ConfigTab.styl' -import CSSModules from 'browser/lib/CSSModules' -import store from 'browser/main/store' - -const electron = require('electron') -const ipc = electron.ipcRenderer - -class Export extends React.Component { - constructor (props) { - super(props) - this.state = { - config: props.config - } - } - - componentDidMount () { - this.handleSettingDone = () => { - this.setState({ExportAlert: { - type: 'success', - message: i18n.__('Successfully applied!') - }}) - } - this.handleSettingError = (err) => { - this.setState({ExportAlert: { - type: 'error', - message: err.message != null ? err.message : i18n.__('Error occurs!') - }}) - } - ipc.addListener('APP_SETTING_DONE', this.handleSettingDone) - ipc.addListener('APP_SETTING_ERROR', this.handleSettingError) - } - - componentWillUnmount () { - ipc.removeListener('APP_SETTING_DONE', this.handleSettingDone) - ipc.removeListener('APP_SETTING_ERROR', this.handleSettingError) - } - - handleUIChange (e) { - const newConfig = { - exports: { - escapeHtml: this.refs.escapeHtmlExport.checked - } - } - - this.setState({ config: newConfig }, () => { - const { exports } = this.props.config - this.currentConfig = { exports } - if (_.isEqual(this.currentConfig, this.state.config)) { - this.props.haveToSave() - } else { - this.props.haveToSave({ - tab: 'EXPORT', - type: 'warning', - message: i18n.__('You have to save!') - }) - } - }) - } - - handleSaveUIClick (e) { - const newConfig = { - exports: this.state.config.exports - } - - ConfigManager.set(newConfig) - - store.dispatch({ - type: 'SET_UI', - config: newConfig - }) - this.clearMessage() - this.props.haveToSave() - } - - clearMessage () { - _.debounce(() => { - this.setState({ - UiAlert: null - }) - }, 2000)() - } - - render () { - const ExportAlert = this.state.ExportAlert - const ExportAlertElement = ExportAlert != null - ?

- {ExportAlert.message} -

- : null - return ( -
-
-
{i18n.__('Export')}
- -
- -
-
- - {ExportAlertElement} -
-
-
- ) - } -} - -export default CSSModules(Export, styles) diff --git a/browser/main/modals/PreferencesModal/index.js b/browser/main/modals/PreferencesModal/index.js index 02710289..70e25a88 100644 --- a/browser/main/modals/PreferencesModal/index.js +++ b/browser/main/modals/PreferencesModal/index.js @@ -7,7 +7,6 @@ import InfoTab from './InfoTab' import Crowdfunding from './Crowdfunding' import StoragesTab from './StoragesTab' import Blog from './Blog' -import Export from './Export' import ModalEscButton from 'browser/components/ModalEscButton' import CSSModules from 'browser/lib/CSSModules' import styles from './PreferencesModal.styl' @@ -87,13 +86,6 @@ class Preferences extends React.Component { haveToSave={alert => this.setState({BlogAlert: alert})} /> ) - case 'EXPORT': - return ( - this.setState({ExportAlert: alert})} - /> - ) case 'STORAGES': default: return ( @@ -131,8 +123,7 @@ class Preferences extends React.Component { {target: 'UI', label: i18n.__('Interface'), UI: this.state.UIAlert}, {target: 'INFO', label: i18n.__('About')}, {target: 'CROWDFUNDING', label: i18n.__('Crowdfunding')}, - {target: 'BLOG', label: i18n.__('Blog'), Blog: this.state.BlogAlert}, - {target: 'EXPORT', label: i18n.__('Export')} + {target: 'BLOG', label: i18n.__('Blog'), Blog: this.state.BlogAlert} ] const navButtons = tabs.map((tab) => {