correctly hunt for console.log

This commit is contained in:
Sam 2017-06-23 15:24:11 -04:00
parent 34867a6e07
commit da5ccd2000
2 changed files with 3 additions and 2 deletions

View File

@ -3,8 +3,8 @@ import { sanitize } from 'pretty-text/sanitizer';
function deprecate(feature, name){
return function() {
if (console && console.log) {
console.log(feature + ': ' + name + ' is deprecated, please use the new markdown it APIs');
if (window.console && window.console.log) {
window.console.log(feature + ': ' + name + ' is deprecated, please use the new markdown it APIs');
}
};
}

View File

@ -74,6 +74,7 @@ module PrettyText
if Rails.env.development? || Rails.env.test?
ctx.attach("console.log", proc { |l| p l })
ctx.eval('window.console = console;')
end
ctx_load(ctx, "#{Rails.root}/app/assets/javascripts/discourse-loader.js")