From e4c42b562d94dfe3f22c31ba9db70c10fa5dbd7f Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Mon, 21 Jan 2013 11:24:59 +0100 Subject: [PATCH] [formatting addon] Don't line-break around inline tags --- addon/format/formatting.js | 10 ++++++++-- demo/formatting.html | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/addon/format/formatting.js b/addon/format/formatting.js index 25ee1531a8..88b84307f6 100644 --- a/addon/format/formatting.js +++ b/addon/format/formatting.js @@ -22,11 +22,17 @@ } }); + var inlineElements = /^(a|abbr|acronym|area|base|bdo|big|br|button|caption|cite|code|col|colgroup|dd|del|dfn|em|frame|hr|iframe|img|input|ins|kbd|label|legend|link|map|object|optgroup|option|param|q|samp|script|select|small|span|strong|sub|sup|textarea|tt|var)$/; + CodeMirror.extendMode("xml", { commentStart: "", - newlineAfterToken: function(type, content, textAfter) { - return type == "tag" && />$/.test(content) || /^$/.test(content) && state.context) || + /^CodeMirror: Formatting demo function test(c){ for (var i = 0; i < 10; i++){ process("a.b();c = null;", 300);} } -
test 1
test 2
+
test 1
test 2