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
|
||||
$.getScript("../static/js/jquery_ui.js");
|
||||
$(root).on('click', 'img', function(e){
|
||||
top.console.log(e);
|
||||
top.console.log("FUCKKK");
|
||||
$(e.target).resizable({ proxy: 'proxy', aspectRatio: 'preserve' });
|
||||
$(e.target).addClass("resizing");
|
||||
// $(e.target).remove();
|
||||
|
||||
$(root).on('mouseup', 'img', function(e){
|
||||
top.console.log("NEW WIDTH mouseup", e.target.width);
|
||||
|
||||
// disable content editable
|
||||
// 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)
|
||||
|
|
|
@ -54,6 +54,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
},
|
||||
nodeNumChildren: function(n)
|
||||
{
|
||||
console.log("childNodes", n.childNodes);
|
||||
return n.childNodes.length;
|
||||
},
|
||||
nodeChild: function(n, i)
|
||||
|
@ -124,10 +125,13 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
},
|
||||
appendText: function(txt, attrString)
|
||||
{
|
||||
console.log("appendText", txt);
|
||||
console.log("attrString", attrString);
|
||||
textArray[textArray.length - 1] += txt;
|
||||
//dmesg(txt+" / "+attrString);
|
||||
op.attribs = attrString;
|
||||
op.chars = txt.length;
|
||||
console.log("op", op);
|
||||
attribsBuilder.append(op);
|
||||
},
|
||||
textLines: function()
|
||||
|
@ -218,12 +222,15 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
}
|
||||
cc.incrementAttrib = function(state, attribName)
|
||||
{
|
||||
console.log("incrementAttrib");
|
||||
if (!state.attribs[attribName])
|
||||
{
|
||||
state.attribs[attribName] = 1;
|
||||
console.log("incAttrib nope");
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("incAttrib yep");
|
||||
state.attribs[attribName]++;
|
||||
}
|
||||
_recalcAttribString(state);
|
||||
|
@ -316,6 +323,9 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
})
|
||||
);
|
||||
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));
|
||||
}
|
||||
cc.startNewLine = function(state)
|
||||
|
@ -328,9 +338,9 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
{
|
||||
_produceLineAttributesMarker(state);
|
||||
console.log("startNewLine STEP 2b", state.lineAttributes);
|
||||
|
||||
}
|
||||
}
|
||||
console.log("START NEW");
|
||||
lines.startNew();
|
||||
}
|
||||
cc.notifySelection = function(sel)
|
||||
|
@ -350,8 +360,12 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
};
|
||||
cc.collectContent = function(node, state)
|
||||
{
|
||||
console.log("NODE 2", node);
|
||||
console.log("State 2", state);
|
||||
if (!state)
|
||||
{
|
||||
|
||||
console.log("No state on ", node);
|
||||
state = {
|
||||
flags: { /*name -> nesting counter*/
|
||||
},
|
||||
|
@ -461,6 +475,8 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
delete state.lineAttributes.imageWidth;
|
||||
delete state.lineAttributes.imageHeight;
|
||||
|
||||
top.console.log("tname", tname);
|
||||
|
||||
if (tname == "img")
|
||||
{
|
||||
// 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(height && height[1]) state.lineAttributes.imageHeight = height[1];
|
||||
state.lineAttributes.pastedImage = node.outerHTML;
|
||||
console.log("CONTENT COLLETOR STATE", state);
|
||||
console.log("CONTENT COLLECTOR WIDTH", state.lineAttributes.imageWidth);
|
||||
console.log("CONTENT COLLECTOR HEIGHT", state.lineAttributes.imageHeight);
|
||||
console.log("CONTENT COLLETOR STATE", state.lineAttributes);
|
||||
// console.log("CONTENT COLLETOR STATE", state);
|
||||
// console.log("CONTENT COLLECTOR WIDTH", state.lineAttributes.imageWidth);
|
||||
// console.log("CONTENT COLLECTOR HEIGHT", state.lineAttributes.imageHeight);
|
||||
// console.log("CONTENT COLLETOR STATE", state.lineAttributes);
|
||||
isEmpty = false;
|
||||
var collectStyles = true;
|
||||
// _produceLineAttributesMarker(state);
|
||||
cc.startNewLine(state);
|
||||
// _recalcAttribString(state);
|
||||
_produceLineAttributesMarker(state);
|
||||
// cc.startNewLine(state);
|
||||
}
|
||||
|
||||
if (tname == "br")
|
||||
|
@ -505,7 +522,10 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
else if (!isEmpty)
|
||||
{
|
||||
var styl = dom.nodeAttr(node, "style");
|
||||
styl = "width:500px;height:500px";
|
||||
console.log("styl", styl);
|
||||
var cls = dom.nodeProp(node, "className");
|
||||
console.log("cls", cls);
|
||||
|
||||
var isPre = (tname == "pre");
|
||||
if ((!isPre) && browser.safari)
|
||||
|
@ -524,6 +544,8 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
styl: styl,
|
||||
cls: cls
|
||||
});
|
||||
// cc.doAttrib(state, "imageHeight:500");
|
||||
|
||||
if (tname == "b" || (styl && /\bfont-weight:\s*bold\b/i.exec(styl)) || tname == "strong")
|
||||
{
|
||||
cc.doAttrib(state, "bold");
|
||||
|
@ -571,9 +593,12 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
}
|
||||
|
||||
var nc = dom.nodeNumChildren(node);
|
||||
console.log("node", node);
|
||||
console.log("nc", nc);
|
||||
for (var i = 0; i < nc; i++)
|
||||
{
|
||||
var c = dom.nodeChild(node, i);
|
||||
console.log("state still", state, c); // never gets here
|
||||
cc.collectContent(c, state);
|
||||
}
|
||||
|
||||
|
@ -587,6 +612,9 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
|||
cls: cls
|
||||
});
|
||||
}
|
||||
console.log("state now", state);
|
||||
console.log("styl", styl);
|
||||
console.log("cls now", cls);
|
||||
|
||||
if (isPre) cc.decrementFlag(state, 'preMode');
|
||||
if (state.localAttribs)
|
||||
|
|
|
@ -95,13 +95,25 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
|||
var lineClass = 'ace-line';
|
||||
result.appendSpan = function(txt, cls)
|
||||
{
|
||||
console.log("HAM I HERE!");
|
||||
var processedMarker = false;
|
||||
// Handle lineAttributeMarker, if present
|
||||
if (cls.indexOf(lineAttributeMarker) >= 0)
|
||||
{
|
||||
var listType = /(?:^| )list:(\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)
|
||||
{
|
||||
listType = listType[1];
|
||||
|
@ -128,8 +140,6 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
|||
processedMarker = true;
|
||||
}
|
||||
|
||||
//doesn't get here..
|
||||
|
||||
_.map(hooks.callAll("aceDomLineProcessLineAttributes", {
|
||||
domline: domline,
|
||||
cls: cls
|
||||
|
@ -238,9 +248,9 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
|
|||
}
|
||||
if (lineClass !== null) result.node.className = lineClass;
|
||||
|
||||
hooks.callAll("acePostWriteDomLineHTML", {
|
||||
node: result.node
|
||||
});
|
||||
hooks.callAll("acePostWriteDomLineHTML", {
|
||||
node: result.node
|
||||
});
|
||||
}
|
||||
result.prepareForAdd = writeHTML;
|
||||
result.finishUpdate = writeHTML;
|
||||
|
|
Loading…
Reference in a new issue