diff options
author | John McLear <john@mclear.co.uk> | 2014-03-11 17:44:56 +0000 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2014-03-11 17:44:56 +0000 |
commit | 26869d29b386c40692ad8feadea63ef4eea78ec0 (patch) | |
tree | a44ebfda022eb938db27302a897b28655767a101 /src/static | |
parent | 6940106829e08e612e33e0603546324889654f3d (diff) | |
parent | f5716a3b2600a34623901952d825dfeaa1621691 (diff) | |
download | etherpad-lite-26869d29b386c40692ad8feadea63ef4eea78ec0.zip |
Merge pull request #2101 from ether/preProcessDomLine
preprocessor for domline attributes
Diffstat (limited to 'src/static')
-rw-r--r-- | src/static/js/domline.js | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/static/js/domline.js b/src/static/js/domline.js index 82dafb42..b1927b16 100644 --- a/src/static/js/domline.js +++ b/src/static/js/domline.js @@ -101,6 +101,17 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) { var listType = /(?:^| )list:(\S+)/.exec(cls); var start = /(?:^| )start:(\S+)/.exec(cls); + + _.map(hooks.callAll("aceDomLinePreProcessLineAttributes", { + domline: domline, + cls: cls + }), function(modifier) + { + preHtml += modifier.preHtml; + postHtml += modifier.postHtml; + processedMarker |= modifier.processedMarker; + }); + if (listType) { listType = listType[1]; @@ -108,8 +119,8 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) { if(listType.indexOf("number") < 0) { - preHtml = '<ul class="list-' + Security.escapeHTMLAttribute(listType) + '"><li>'; - postHtml = '</li></ul>'; + preHtml += '<ul class="list-' + Security.escapeHTMLAttribute(listType) + '"><li>'; + postHtml = '</li></ul>' + postHtml; } else { @@ -117,16 +128,15 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) if(start[1] == 1){ // if its the first one at this level? lineClass = lineClass + " " + "list-start-" + listType; // Add start class to DIV node } - preHtml = '<ol start='+start[1]+' class="list-' + Security.escapeHTMLAttribute(listType) + '"><li>'; + preHtml += '<ol start='+start[1]+' class="list-' + Security.escapeHTMLAttribute(listType) + '"><li>'; }else{ - preHtml = '<ol class="list-' + Security.escapeHTMLAttribute(listType) + '"><li>'; // Handles pasted contents into existing lists + preHtml += '<ol class="list-' + Security.escapeHTMLAttribute(listType) + '"><li>'; // Handles pasted contents into existing lists } - postHtml = '</li></ol>'; + postHtml += '</li></ol>'; } } processedMarker = true; } - _.map(hooks.callAll("aceDomLineProcessLineAttributes", { domline: domline, cls: cls @@ -136,13 +146,10 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) postHtml += modifier.postHtml; processedMarker |= modifier.processedMarker; }); - if( processedMarker ){ result.lineMarker += txt.length; return; // don't append any text } - - } var href = null; var simpleTags = null; @@ -245,7 +252,6 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) { return curHTML || ''; }; - return result; }; |