mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-09 16:35:01 -04:00
Merge 40fe13907e
into b2c06e78d0
This commit is contained in:
commit
d2e83ba29c
3 changed files with 83 additions and 16 deletions
|
@ -200,6 +200,10 @@ function Ace2Inner(){
|
||||||
|
|
||||||
var authorInfos = {}; // presence of key determines if author is present in doc
|
var authorInfos = {}; // presence of key determines if author is present in doc
|
||||||
|
|
||||||
|
function getAuthorInfos(){
|
||||||
|
return authorInfos;
|
||||||
|
};
|
||||||
|
editorInfo.ace_getAuthorInfos= getAuthorInfos;
|
||||||
function setAuthorInfo(author, info)
|
function setAuthorInfo(author, info)
|
||||||
{
|
{
|
||||||
if ((typeof author) != "string")
|
if ((typeof author) != "string")
|
||||||
|
@ -884,7 +888,12 @@ function Ace2Inner(){
|
||||||
editorInfo.ace_setEditable = setEditable;
|
editorInfo.ace_setEditable = setEditable;
|
||||||
editorInfo.ace_execCommand = execCommand;
|
editorInfo.ace_execCommand = execCommand;
|
||||||
editorInfo.ace_replaceRange = replaceRange;
|
editorInfo.ace_replaceRange = replaceRange;
|
||||||
|
editorInfo.ace_performDocumentReplaceRange = performDocumentReplaceRange;
|
||||||
|
editorInfo.ace_performDocumentReplaceCharRange = performDocumentReplaceCharRange;
|
||||||
|
editorInfo.ace_renumberList = renumberList;
|
||||||
|
editorInfo.ace_doReturnKey = doReturnKey;
|
||||||
|
editorInfo.ace_isBlockElement = isBlockElement;
|
||||||
|
editorInfo.ace_getLineListType = getLineListType;
|
||||||
editorInfo.ace_callWithAce = function(fn, callStack, normalize)
|
editorInfo.ace_callWithAce = function(fn, callStack, normalize)
|
||||||
{
|
{
|
||||||
var wrapper = function()
|
var wrapper = function()
|
||||||
|
@ -1683,16 +1692,34 @@ function Ace2Inner(){
|
||||||
p.mark("findsel");
|
p.mark("findsel");
|
||||||
// if the nodes that define the selection weren't encountered during
|
// if the nodes that define the selection weren't encountered during
|
||||||
// content collection, figure out where those nodes are now.
|
// content collection, figure out where those nodes are now.
|
||||||
if (selection && !selStart)
|
if (selection && !selStart)
|
||||||
{
|
{
|
||||||
//if (domChanges) dmesg("selection not collected");
|
//if (domChanges) dmesg("selection not collected");
|
||||||
selStart = getLineAndCharForPoint(selection.startPoint);
|
editorInfo.lineAndChar = null;
|
||||||
|
hooks.callAll('aceLineAndCharForPoint', {
|
||||||
|
callstack: currentCallStack,
|
||||||
|
editorInfo: editorInfo,
|
||||||
|
rep: rep,
|
||||||
|
root:root,
|
||||||
|
point:selection.startPoint,
|
||||||
|
documentAttributeManager: documentAttributeManager
|
||||||
|
});
|
||||||
|
selStart = editorInfo.lineAndChar || getLineAndCharForPoint(selection.startPoint);
|
||||||
}
|
}
|
||||||
if (selection && !selEnd)
|
if (selection && !selEnd)
|
||||||
{
|
{
|
||||||
selEnd = getLineAndCharForPoint(selection.endPoint);
|
editorInfo.lineAndChar = null;
|
||||||
|
hooks.callAll('aceLineAndCharForPoint', {
|
||||||
|
callstack: currentCallStack,
|
||||||
|
editorInfo: editorInfo,
|
||||||
|
rep: rep,
|
||||||
|
root:root,
|
||||||
|
point:selection.endPoint,
|
||||||
|
documentAttributeManager: documentAttributeManager
|
||||||
|
});
|
||||||
|
selEnd = editorInfo.lineAndChar || getLineAndCharForPoint(selection.endPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
// selection from content collection can, in various ways, extend past final
|
// selection from content collection can, in various ways, extend past final
|
||||||
// BR in firefox DOM, so cap the line
|
// BR in firefox DOM, so cap the line
|
||||||
var numLines = rep.lines.length();
|
var numLines = rep.lines.length();
|
||||||
|
@ -1845,16 +1872,18 @@ function Ace2Inner(){
|
||||||
{
|
{
|
||||||
return rep.selStart[0];
|
return rep.selStart[0];
|
||||||
}
|
}
|
||||||
|
editorInfo.ace_caretLine = caretLine;
|
||||||
|
|
||||||
function caretColumn()
|
function caretColumn()
|
||||||
{
|
{
|
||||||
return rep.selStart[1];
|
return rep.selStart[1];
|
||||||
}
|
}
|
||||||
|
editorInfo.ace_caretColumn = caretColumn;
|
||||||
function caretDocChar()
|
function caretDocChar()
|
||||||
{
|
{
|
||||||
return rep.lines.offsetOfIndex(caretLine()) + caretColumn();
|
return rep.lines.offsetOfIndex(caretLine()) + caretColumn();
|
||||||
}
|
}
|
||||||
|
editorInfo.ace_caretDocChar = caretDocChar;
|
||||||
|
|
||||||
function handleReturnIndentation()
|
function handleReturnIndentation()
|
||||||
{
|
{
|
||||||
|
@ -3447,7 +3476,7 @@ function Ace2Inner(){
|
||||||
{
|
{
|
||||||
return !!REGEX_WORDCHAR.exec(c);
|
return !!REGEX_WORDCHAR.exec(c);
|
||||||
}
|
}
|
||||||
|
editorInfo.ace_isWordChar = isWordChar;
|
||||||
function isSpaceChar(c)
|
function isSpaceChar(c)
|
||||||
{
|
{
|
||||||
return !!REGEX_SPACE.exec(c);
|
return !!REGEX_SPACE.exec(c);
|
||||||
|
@ -3548,7 +3577,17 @@ function Ace2Inner(){
|
||||||
|
|
||||||
if (!stopped)
|
if (!stopped)
|
||||||
{
|
{
|
||||||
if (isTypeForSpecialKey && keyCode == 8)
|
editorInfo.specialHandled = null;
|
||||||
|
hooks.callAll('aceKeyEvent', {
|
||||||
|
callstack: currentCallStack,
|
||||||
|
editorInfo: editorInfo,
|
||||||
|
rep: rep,
|
||||||
|
specialHandled:specialHandled,
|
||||||
|
documentAttributeManager: documentAttributeManager,
|
||||||
|
evt:evt
|
||||||
|
});
|
||||||
|
specialHandled = editorInfo.specialHandled||specialHandled;
|
||||||
|
if ((!specialHandled) &&isTypeForSpecialKey && keyCode == 8)
|
||||||
{
|
{
|
||||||
// "delete" key; in mozilla, if we're at the beginning of a line, normalize now,
|
// "delete" key; in mozilla, if we're at the beginning of a line, normalize now,
|
||||||
// or else deleting a blank line can take two delete presses.
|
// or else deleting a blank line can take two delete presses.
|
||||||
|
|
|
@ -372,7 +372,17 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
_reachBlockPoint(node, 0, state);
|
_reachBlockPoint(node, 0, state);
|
||||||
if (dom.isNodeText(node))
|
if (dom.isNodeText(node))
|
||||||
{
|
{
|
||||||
var txt = dom.nodeValue(node);
|
var tname = dom.nodeAttr(node.parentNode,"name");
|
||||||
|
hooks.callAll('collectContentTblTd', {
|
||||||
|
cc: this,
|
||||||
|
state: state,
|
||||||
|
tname: tname,
|
||||||
|
node:node,
|
||||||
|
text:dom.nodeValue(node),
|
||||||
|
styl: null,
|
||||||
|
cls: null
|
||||||
|
});
|
||||||
|
var txt = this.text||dom.nodeValue(node);
|
||||||
var rest = '';
|
var rest = '';
|
||||||
var x = 0; // offset into original text
|
var x = 0; // offset into original text
|
||||||
if (txt.length == 0)
|
if (txt.length == 0)
|
||||||
|
@ -440,7 +450,19 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
var tname = (dom.nodeTagName(node) || "").toLowerCase();
|
var tname = (dom.nodeTagName(node) || "").toLowerCase();
|
||||||
if (tname == "br")
|
if (tname == "br")
|
||||||
{
|
{
|
||||||
cc.startNewLine(state);
|
this.breakLine = true;
|
||||||
|
var tvalue = dom.nodeAttr(node, 'value');
|
||||||
|
hooks.callAll('collectContentBreak', {
|
||||||
|
cc: this,
|
||||||
|
state: state,
|
||||||
|
tname: tname,
|
||||||
|
tvalue:tvalue,
|
||||||
|
styl: null,
|
||||||
|
cls: null
|
||||||
|
});
|
||||||
|
if(this.breakLine){
|
||||||
|
cc.startNewLine(state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (tname == "script" || tname == "style")
|
else if (tname == "script" || tname == "style")
|
||||||
{
|
{
|
||||||
|
|
|
@ -153,14 +153,20 @@ linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFun
|
||||||
// prevent infinite loop if something funny's going on
|
// prevent infinite loop if something funny's going on
|
||||||
return nextAfterAuthorColors(txt, cls);
|
return nextAfterAuthorColors(txt, cls);
|
||||||
}
|
}
|
||||||
var spanSize = txt.length;
|
var spanSize = txt.length;
|
||||||
if (spanSize > leftInAuthor)
|
if(txt&&txt.indexOf('data-tables')!=-1){
|
||||||
{
|
spanSize = leftInAuthor = txt.length;
|
||||||
spanSize = leftInAuthor;
|
|
||||||
}
|
}
|
||||||
|
else if (spanSize > leftInAuthor){
|
||||||
|
spanSize = leftInAuthor;
|
||||||
|
}
|
||||||
var curTxt = txt.substring(0, spanSize);
|
var curTxt = txt.substring(0, spanSize);
|
||||||
txt = txt.substring(spanSize);
|
txt = txt.substring(spanSize);
|
||||||
nextAfterAuthorColors(curTxt, (cls && cls + " ") + extraClasses);
|
if(curTxt&&curTxt.indexOf('data-tables')!=-1){
|
||||||
|
nextAfterAuthorColors(curTxt,extraClasses );
|
||||||
|
}else{
|
||||||
|
nextAfterAuthorColors(curTxt, (cls && cls + " ") + extraClasses);
|
||||||
|
}
|
||||||
curIndex += spanSize;
|
curIndex += spanSize;
|
||||||
leftInAuthor -= spanSize;
|
leftInAuthor -= spanSize;
|
||||||
if (leftInAuthor == 0)
|
if (leftInAuthor == 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue