2016-03-01 10:47:22 +08:00
|
|
|
import {MessageViewExtension} from 'nylas-exports';
|
2016-10-18 08:59:33 +08:00
|
|
|
import AutoloadImagesStore from './autoload-images-store';
|
2016-03-01 10:47:22 +08:00
|
|
|
|
|
|
|
export default class AutoloadImagesExtension extends MessageViewExtension {
|
2016-05-06 13:30:34 +08:00
|
|
|
static formatMessageBody = ({message}) => {
|
2016-03-01 10:47:22 +08:00
|
|
|
if (AutoloadImagesStore.shouldBlockImagesIn(message)) {
|
2016-05-06 13:30:34 +08:00
|
|
|
message.body = message.body.replace(AutoloadImagesStore.ImagesRegexp, (match, prefix) => {
|
2016-03-01 10:47:22 +08:00
|
|
|
return `${prefix}#`;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|