mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
made domline and content collector lineAttributes compatible
This commit is contained in:
parent
9efe838a32
commit
6507614e45
2 changed files with 62 additions and 22 deletions
|
@ -29,7 +29,7 @@
|
|||
var Security = require('./security');
|
||||
var hooks = require('./pluginfw/hooks');
|
||||
var _ = require('./underscore');
|
||||
|
||||
var lineAttributeMarker = require('./linestylefilter').lineAttributeMarker;
|
||||
var Ace2Common = require('./ace2_common');
|
||||
var noop = Ace2Common.noop;
|
||||
|
||||
|
@ -82,7 +82,8 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
|||
}
|
||||
|
||||
var html = [];
|
||||
var preHtml, postHtml;
|
||||
var preHtml = '',
|
||||
postHtml = '';
|
||||
var curHTML = null;
|
||||
|
||||
function processSpaces(s)
|
||||
|
@ -95,7 +96,9 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
|||
var lineClass = 'ace-line';
|
||||
result.appendSpan = function(txt, cls)
|
||||
{
|
||||
if (cls.indexOf('list') >= 0)
|
||||
var processedMarker = false;
|
||||
// Handle lineAttributeMarker, if present
|
||||
if (cls.indexOf(lineAttributeMarker) >= 0)
|
||||
{
|
||||
var listType = /(?:^| )list:(\S+)/.exec(cls);
|
||||
var start = /(?:^| )start:(\S+)/.exec(cls);
|
||||
|
@ -115,10 +118,26 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
|||
preHtml = '<ol '+start+' class="list-' + Security.escapeHTMLAttribute(listType) + '"><li>';
|
||||
postHtml = '</li></ol>';
|
||||
}
|
||||
}
|
||||
}
|
||||
processedMarker = true;
|
||||
}
|
||||
|
||||
_.map(hooks.callAll("aceDomLineProcessLineAttributes", {
|
||||
domline: domline,
|
||||
cls: cls
|
||||
}), function(modifier)
|
||||
{
|
||||
preHtml += modifier.preHtml;
|
||||
postHtml += modifier.postHtml;
|
||||
processedMarker |= modifier.processedMarker;
|
||||
});
|
||||
|
||||
if( processedMarker ){
|
||||
result.lineMarker += txt.length;
|
||||
return; // don't append any text
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
var href = null;
|
||||
var simpleTags = null;
|
||||
|
@ -203,7 +222,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
|||
{
|
||||
newHTML = (preHtml || '') + newHTML + (postHtml || '');
|
||||
}
|
||||
html = preHtml = postHtml = null; // free memory
|
||||
html = preHtml = postHtml = ''; // free memory
|
||||
if (newHTML !== curHTML)
|
||||
{
|
||||
curHTML = newHTML;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue