"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "addon/display/placeholder.js" between
CodeMirror-5.58.2.tar.gz and CodeMirror-5.58.3.tar.gz

About: CodeMirror is a text editor implemented in JavaScript for the browser and specialized for editing code.

placeholder.js  (CodeMirror-5.58.2):placeholder.js  (CodeMirror-5.58.3)
skipping to change at line 53 skipping to change at line 53
elt.style.direction = cm.getOption("direction"); elt.style.direction = cm.getOption("direction");
elt.className = "CodeMirror-placeholder CodeMirror-line-like"; elt.className = "CodeMirror-placeholder CodeMirror-line-like";
var placeHolder = cm.getOption("placeholder") var placeHolder = cm.getOption("placeholder")
if (typeof placeHolder == "string") placeHolder = document.createTextNode(pl aceHolder) if (typeof placeHolder == "string") placeHolder = document.createTextNode(pl aceHolder)
elt.appendChild(placeHolder) elt.appendChild(placeHolder)
cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild); cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
} }
function onComposition(cm) { function onComposition(cm) {
setTimeout(function() { setTimeout(function() {
var empty = false, input = cm.getInputField() var empty = false
if (input.nodeName == "TEXTAREA") if (cm.lineCount() == 1) {
empty = !input.value var input = cm.getInputField()
else if (cm.lineCount() == 1) empty = input.nodeName == "TEXTAREA" ? !cm.getLine(0).length
empty = !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textCo : !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textConten
ntent) t)
}
if (empty) setPlaceholder(cm) if (empty) setPlaceholder(cm)
else clearPlaceholder(cm) else clearPlaceholder(cm)
}, 20) }, 20)
} }
function onBlur(cm) { function onBlur(cm) {
if (isEmpty(cm)) setPlaceholder(cm); if (isEmpty(cm)) setPlaceholder(cm);
} }
function onChange(cm) { function onChange(cm) {
var wrapper = cm.getWrapperElement(), empty = isEmpty(cm); var wrapper = cm.getWrapperElement(), empty = isEmpty(cm);
 End of changes. 1 change blocks. 
6 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)