mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
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).
This commit is contained in:
parent
5e2a27a182
commit
98de2b0899
1 changed files with 2 additions and 46 deletions
|
@ -605,19 +605,9 @@ function Ace2Inner(){
|
||||||
recolorLinesInRange(0, rep.alltext.length);
|
recolorLinesInRange(0, rep.alltext.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setEditable(newVal)
|
function setEditable(newVal) {
|
||||||
{
|
|
||||||
isEditable = newVal;
|
isEditable = newVal;
|
||||||
|
root.contentEditable = isEditable ? 'true' : 'false';
|
||||||
// the following may fail, e.g. if iframe is hidden
|
|
||||||
if (!isEditable)
|
|
||||||
{
|
|
||||||
setDesignMode(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setDesignMode(true);
|
|
||||||
}
|
|
||||||
root.classList.toggle('static', !isEditable);
|
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;
|
var iePastedLines = null;
|
||||||
|
|
||||||
function handleIEPaste(evt)
|
function handleIEPaste(evt)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue