Use `contentEditable` for all browsers

This makes it possible to disable `contentEditable` for certain
elements in some circumstances (e.g., on links so that users can click
on them normally).
pull/4470/head
Richard Hansen 2020-11-02 15:46:37 -05:00 committed by John McLear
parent 5e2a27a182
commit 98de2b0899
1 changed files with 2 additions and 46 deletions

View File

@ -605,19 +605,9 @@ function Ace2Inner(){
recolorLinesInRange(0, rep.alltext.length);
}
function setEditable(newVal)
{
function setEditable(newVal) {
isEditable = newVal;
// the following may fail, e.g. if iframe is hidden
if (!isEditable)
{
setDesignMode(false);
}
else
{
setDesignMode(true);
}
root.contentEditable = isEditable ? 'true' : 'false';
root.classList.toggle('static', !isEditable);
}
@ -4674,40 +4664,6 @@ function Ace2Inner(){
});
}
function setDesignMode(newVal)
{
try
{
function setIfNecessary(target, prop, val)
{
if (String(target[prop]).toLowerCase() != val)
{
target[prop] = val;
return true;
}
return false;
}
if (browser.msie || browser.safari)
{
setIfNecessary(root, 'contentEditable', (newVal ? 'true' : 'false'));
}
else
{
var wasSet = setIfNecessary(doc, 'designMode', (newVal ? 'on' : 'off'));
if (wasSet && newVal && browser.opera)
{
// turning on designMode clears event handlers
bindTheEventHandlers();
}
}
return true;
}
catch (e)
{
return false;
}
}
var iePastedLines = null;
function handleIEPaste(evt)