mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Simplify markdown escaping for warning
by using a regular expression instead of multiple replaces
This commit is contained in:
@@ -247,9 +247,7 @@ class Atom extends Model
|
||||
responseChannel = "check-portable-home-writable-response"
|
||||
ipc.on responseChannel, (response) ->
|
||||
ipc.removeAllListeners(responseChannel)
|
||||
escapeMarkdown = (inputMessage) ->
|
||||
inputMessage.split('\\').join('\\\\').split('.').join('\\.').split('-').join('\\-').split('+').join('\\+').split('_').join('\\_').split('#').join('\\#').split('!').join('\\!')
|
||||
atom.notifications.addWarning("#{escapeMarkdown response.message}") if not response.writable
|
||||
atom.notifications.addWarning("#{response.message.replace(/([\\\.+\\-_#!])/g, '\\$1')}") if not response.writable
|
||||
ipc.send('check-portable-home-writable', responseChannel)
|
||||
|
||||
checkPortableHomeWritable()
|
||||
|
||||
Reference in New Issue
Block a user