mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
more sanity stuff
This commit is contained in:
parent
4f808defe1
commit
e80beb4a8b
3 changed files with 64 additions and 21 deletions
|
@ -5251,12 +5251,17 @@ function Ace2Inner(){
|
||||||
|
|
||||||
// Temporary bodge in listen for events on images -- CAKE
|
// Temporary bodge in listen for events on images -- CAKE
|
||||||
$.getScript("../static/js/jquery_ui.js");
|
$.getScript("../static/js/jquery_ui.js");
|
||||||
$(root).on('click', 'img', function(e){
|
|
||||||
top.console.log(e);
|
$(root).on('mouseup', 'img', function(e){
|
||||||
top.console.log("FUCKKK");
|
top.console.log("NEW WIDTH mouseup", e.target.width);
|
||||||
$(e.target).resizable({ proxy: 'proxy', aspectRatio: 'preserve' });
|
|
||||||
$(e.target).addClass("resizing");
|
// disable content editable
|
||||||
// $(e.target).remove();
|
// document.execCommand("enableObjectResizing", false, false);
|
||||||
|
// e.target.contentEditable = false;
|
||||||
|
// make it resizable
|
||||||
|
// $(e.target).resizable({ proxy: 'proxy', aspectRatio: 'preserve' }); // I fuck shit up in FF because I modify the DOM
|
||||||
|
top.console.log("All done");
|
||||||
|
// ui-resizable-handle ui-resizable-e
|
||||||
});
|
});
|
||||||
|
|
||||||
if (browser.msie)
|
if (browser.msie)
|
||||||
|
|
|
@ -54,6 +54,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
},
|
},
|
||||||
nodeNumChildren: function(n)
|
nodeNumChildren: function(n)
|
||||||
{
|
{
|
||||||
|
console.log("childNodes", n.childNodes);
|
||||||
return n.childNodes.length;
|
return n.childNodes.length;
|
||||||
},
|
},
|
||||||
nodeChild: function(n, i)
|
nodeChild: function(n, i)
|
||||||
|
@ -124,10 +125,13 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
},
|
},
|
||||||
appendText: function(txt, attrString)
|
appendText: function(txt, attrString)
|
||||||
{
|
{
|
||||||
|
console.log("appendText", txt);
|
||||||
|
console.log("attrString", attrString);
|
||||||
textArray[textArray.length - 1] += txt;
|
textArray[textArray.length - 1] += txt;
|
||||||
//dmesg(txt+" / "+attrString);
|
//dmesg(txt+" / "+attrString);
|
||||||
op.attribs = attrString;
|
op.attribs = attrString;
|
||||||
op.chars = txt.length;
|
op.chars = txt.length;
|
||||||
|
console.log("op", op);
|
||||||
attribsBuilder.append(op);
|
attribsBuilder.append(op);
|
||||||
},
|
},
|
||||||
textLines: function()
|
textLines: function()
|
||||||
|
@ -218,12 +222,15 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
}
|
}
|
||||||
cc.incrementAttrib = function(state, attribName)
|
cc.incrementAttrib = function(state, attribName)
|
||||||
{
|
{
|
||||||
|
console.log("incrementAttrib");
|
||||||
if (!state.attribs[attribName])
|
if (!state.attribs[attribName])
|
||||||
{
|
{
|
||||||
state.attribs[attribName] = 1;
|
state.attribs[attribName] = 1;
|
||||||
|
console.log("incAttrib nope");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
console.log("incAttrib yep");
|
||||||
state.attribs[attribName]++;
|
state.attribs[attribName]++;
|
||||||
}
|
}
|
||||||
_recalcAttribString(state);
|
_recalcAttribString(state);
|
||||||
|
@ -316,6 +323,9 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
console.log("STEP 3.2", state.lineAttributes);
|
console.log("STEP 3.2", state.lineAttributes);
|
||||||
|
console.log("attributes", attributes);
|
||||||
|
console.log("apool", apool);
|
||||||
|
// CAKE I NEED TO REMOVE OLD ATTRIBUTES HERE!
|
||||||
lines.appendText('*', Changeset.makeAttribsString('+', attributes , apool));
|
lines.appendText('*', Changeset.makeAttribsString('+', attributes , apool));
|
||||||
}
|
}
|
||||||
cc.startNewLine = function(state)
|
cc.startNewLine = function(state)
|
||||||
|
@ -328,9 +338,9 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
{
|
{
|
||||||
_produceLineAttributesMarker(state);
|
_produceLineAttributesMarker(state);
|
||||||
console.log("startNewLine STEP 2b", state.lineAttributes);
|
console.log("startNewLine STEP 2b", state.lineAttributes);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log("START NEW");
|
||||||
lines.startNew();
|
lines.startNew();
|
||||||
}
|
}
|
||||||
cc.notifySelection = function(sel)
|
cc.notifySelection = function(sel)
|
||||||
|
@ -350,8 +360,12 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
};
|
};
|
||||||
cc.collectContent = function(node, state)
|
cc.collectContent = function(node, state)
|
||||||
{
|
{
|
||||||
|
console.log("NODE 2", node);
|
||||||
|
console.log("State 2", state);
|
||||||
if (!state)
|
if (!state)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
console.log("No state on ", node);
|
||||||
state = {
|
state = {
|
||||||
flags: { /*name -> nesting counter*/
|
flags: { /*name -> nesting counter*/
|
||||||
},
|
},
|
||||||
|
@ -461,6 +475,8 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
delete state.lineAttributes.imageWidth;
|
delete state.lineAttributes.imageWidth;
|
||||||
delete state.lineAttributes.imageHeight;
|
delete state.lineAttributes.imageHeight;
|
||||||
|
|
||||||
|
top.console.log("tname", tname);
|
||||||
|
|
||||||
if (tname == "img")
|
if (tname == "img")
|
||||||
{
|
{
|
||||||
// Are the width and height values set?
|
// Are the width and height values set?
|
||||||
|
@ -471,14 +487,15 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
if(width && width[1]) state.lineAttributes.imageWidth = width[1];
|
if(width && width[1]) state.lineAttributes.imageWidth = width[1];
|
||||||
if(height && height[1]) state.lineAttributes.imageHeight = height[1];
|
if(height && height[1]) state.lineAttributes.imageHeight = height[1];
|
||||||
state.lineAttributes.pastedImage = node.outerHTML;
|
state.lineAttributes.pastedImage = node.outerHTML;
|
||||||
console.log("CONTENT COLLETOR STATE", state);
|
// console.log("CONTENT COLLETOR STATE", state);
|
||||||
console.log("CONTENT COLLECTOR WIDTH", state.lineAttributes.imageWidth);
|
// console.log("CONTENT COLLECTOR WIDTH", state.lineAttributes.imageWidth);
|
||||||
console.log("CONTENT COLLECTOR HEIGHT", state.lineAttributes.imageHeight);
|
// console.log("CONTENT COLLECTOR HEIGHT", state.lineAttributes.imageHeight);
|
||||||
console.log("CONTENT COLLETOR STATE", state.lineAttributes);
|
// console.log("CONTENT COLLETOR STATE", state.lineAttributes);
|
||||||
isEmpty = false;
|
isEmpty = false;
|
||||||
var collectStyles = true;
|
var collectStyles = true;
|
||||||
// _produceLineAttributesMarker(state);
|
// _recalcAttribString(state);
|
||||||
cc.startNewLine(state);
|
_produceLineAttributesMarker(state);
|
||||||
|
// cc.startNewLine(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tname == "br")
|
if (tname == "br")
|
||||||
|
@ -505,7 +522,10 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
else if (!isEmpty)
|
else if (!isEmpty)
|
||||||
{
|
{
|
||||||
var styl = dom.nodeAttr(node, "style");
|
var styl = dom.nodeAttr(node, "style");
|
||||||
|
styl = "width:500px;height:500px";
|
||||||
|
console.log("styl", styl);
|
||||||
var cls = dom.nodeProp(node, "className");
|
var cls = dom.nodeProp(node, "className");
|
||||||
|
console.log("cls", cls);
|
||||||
|
|
||||||
var isPre = (tname == "pre");
|
var isPre = (tname == "pre");
|
||||||
if ((!isPre) && browser.safari)
|
if ((!isPre) && browser.safari)
|
||||||
|
@ -524,6 +544,8 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
styl: styl,
|
styl: styl,
|
||||||
cls: cls
|
cls: cls
|
||||||
});
|
});
|
||||||
|
// cc.doAttrib(state, "imageHeight:500");
|
||||||
|
|
||||||
if (tname == "b" || (styl && /\bfont-weight:\s*bold\b/i.exec(styl)) || tname == "strong")
|
if (tname == "b" || (styl && /\bfont-weight:\s*bold\b/i.exec(styl)) || tname == "strong")
|
||||||
{
|
{
|
||||||
cc.doAttrib(state, "bold");
|
cc.doAttrib(state, "bold");
|
||||||
|
@ -571,9 +593,12 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
}
|
}
|
||||||
|
|
||||||
var nc = dom.nodeNumChildren(node);
|
var nc = dom.nodeNumChildren(node);
|
||||||
|
console.log("node", node);
|
||||||
|
console.log("nc", nc);
|
||||||
for (var i = 0; i < nc; i++)
|
for (var i = 0; i < nc; i++)
|
||||||
{
|
{
|
||||||
var c = dom.nodeChild(node, i);
|
var c = dom.nodeChild(node, i);
|
||||||
|
console.log("state still", state, c); // never gets here
|
||||||
cc.collectContent(c, state);
|
cc.collectContent(c, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,6 +612,9 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
cls: cls
|
cls: cls
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
console.log("state now", state);
|
||||||
|
console.log("styl", styl);
|
||||||
|
console.log("cls now", cls);
|
||||||
|
|
||||||
if (isPre) cc.decrementFlag(state, 'preMode');
|
if (isPre) cc.decrementFlag(state, 'preMode');
|
||||||
if (state.localAttribs)
|
if (state.localAttribs)
|
||||||
|
|
|
@ -95,13 +95,25 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
||||||
var lineClass = 'ace-line';
|
var lineClass = 'ace-line';
|
||||||
result.appendSpan = function(txt, cls)
|
result.appendSpan = function(txt, cls)
|
||||||
{
|
{
|
||||||
console.log("HAM I HERE!");
|
|
||||||
var processedMarker = false;
|
var processedMarker = false;
|
||||||
// Handle lineAttributeMarker, if present
|
// Handle lineAttributeMarker, if present
|
||||||
if (cls.indexOf(lineAttributeMarker) >= 0)
|
if (cls.indexOf(lineAttributeMarker) >= 0)
|
||||||
{
|
{
|
||||||
var listType = /(?:^| )list:(\S+)/.exec(cls);
|
var listType = /(?:^| )list:(\S+)/.exec(cls);
|
||||||
var start = /(?:^| )start:(\S+)/.exec(cls);
|
var start = /(?:^| )start:(\S+)/.exec(cls);
|
||||||
|
|
||||||
|
console.log("WUT", cls, lineAttributeMarker)
|
||||||
|
|
||||||
|
_.map(hooks.callAll("aceDomLinePreProcessLineAttributes", {
|
||||||
|
domline: domline,
|
||||||
|
cls: cls
|
||||||
|
}), function(modifier)
|
||||||
|
{
|
||||||
|
preHtml += modifier.preHtml;
|
||||||
|
postHtml += modifier.postHtml;
|
||||||
|
processedMarker |= modifier.processedMarker;
|
||||||
|
});
|
||||||
|
|
||||||
if (listType)
|
if (listType)
|
||||||
{
|
{
|
||||||
listType = listType[1];
|
listType = listType[1];
|
||||||
|
@ -128,8 +140,6 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
||||||
processedMarker = true;
|
processedMarker = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//doesn't get here..
|
|
||||||
|
|
||||||
_.map(hooks.callAll("aceDomLineProcessLineAttributes", {
|
_.map(hooks.callAll("aceDomLineProcessLineAttributes", {
|
||||||
domline: domline,
|
domline: domline,
|
||||||
cls: cls
|
cls: cls
|
||||||
|
|
Loading…
Reference in a new issue