cop.createLayer("ShrinkTextLayer").refineClass(lively.morphic.Text, { shrinkWhitespace: function() { this.textString = this.textString.replace(/( |\t|\n)+/g, " ") }, morphMenuItems: function() { return cop.proceed() .concat([["shrink whitespace", this.shrinkWhitespace.bind(this) ]]) } }).beGlobal()