User:PleaseStand/segregate-refs-dev.js: Difference between revisions

Content deleted Content added
quick fix for too small textbox when mw:Help:Extension:WikiEditor/Realtime Preview is enabled on the wiki
add refsDiv directly under #editform, not within .wikiEditor-ui (fixes overlap issue)
 
(One intermediate revision by the same user not shown)
Line 563:
return false;
}
 
function getEditboxContents() { // ajaxPreview compatibility
if(unloadHandlerRegistered) {
// wikEd compatibility (frame -> textarea)
if(typeof wikEdUseWikEd != "undefined" && wikEdUseWikEd) {
WikEdUpdateTextarea();
}
return integrateRefs(mainTextbox.value, refsTextbox.value, randPrefix, true).wikiText;
} else {
return mainTextbox.value;
}
}
 
// Leave a global for ajaxPreview to use.
window.getEditboxContents = getEditboxContents;
 
 
Line 624 ⟶ 609:
refsDiv.appendChild(refsButton);
refsDiv.appendChild(convertButton);
// Find position within the edit form to insert it at
mainTextbox.parentNode.insertBefore(refsDiv, mainTextbox.nextSibling);
var refsDivPos = mainTextbox, refsDivPosParent = refsDivPos.parentNode;
while (refsDivPosParent !== editForm) {
refsDivPos = refsDivPosParent;
refsDivPosParent = refsDivPos.parentNode;
if (!refsDivPosParent) {
return refsDivPos = mainTextbox.value;
refsDivPosParent = refsDivPos.parentNode;
break;
}
}
refsDivPos = refsDivPos.nextSibling;
if (refsDivPos && refsDivPos.classList.contains("wikiEditor-ui-clear")) {
refsDivPos = refsDivPos.nextSibling;
}
refsDivPosParent.insertBefore(refsDiv, refsDivPos);
} catch(e) {
}