documented ace_setProperty
This commit is contained in:
parent
10cbb485fb
commit
4ef71c3534
|
@ -1123,57 +1123,45 @@ function OUTER(gscope)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This methed exposes a setter for some ace properties
|
||||||
|
// @param key the name of the parameter
|
||||||
|
// @param value the value to set to
|
||||||
editorInfo.ace_setProperty = function(key, value)
|
editorInfo.ace_setProperty = function(key, value)
|
||||||
{
|
{
|
||||||
var k = key.toLowerCase();
|
|
||||||
if (k == "wraps")
|
// Convinience function returning a setter for a class on an element
|
||||||
{
|
var setClassPresenceNamed = function(element, cls){
|
||||||
setWraps(value);
|
return function(value){
|
||||||
|
setClassPresence(element, cls, !! value)
|
||||||
}
|
}
|
||||||
else if (k == "showsauthorcolors")
|
};
|
||||||
{
|
|
||||||
setClassPresence(root, "authorColors", !! value);
|
// These properties are exposed
|
||||||
}
|
var setters = {
|
||||||
else if (k == "showsuserselections")
|
wraps: setWraps,
|
||||||
{
|
showsauthorcolors: setClassPresenceNamed(root, "authorColors"),
|
||||||
setClassPresence(root, "userSelections", !! value);
|
showsuserselections: setClassPresenceNamed(root, "userSelections"),
|
||||||
}
|
showslinenumbers : function(value){
|
||||||
else if (k == "showslinenumbers")
|
|
||||||
{
|
|
||||||
hasLineNumbers = !! value;
|
hasLineNumbers = !! value;
|
||||||
// disable line numbers on mobile devices
|
// disable line numbers on mobile devices
|
||||||
if (browser.mobile) hasLineNumbers = false;
|
if (browser.mobile) hasLineNumbers = false;
|
||||||
setClassPresence(sideDiv, "sidedivhidden", !hasLineNumbers);
|
setClassPresence(sideDiv, "sidedivhidden", !hasLineNumbers);
|
||||||
fixView();
|
fixView();
|
||||||
}
|
},
|
||||||
else if (k == "grayedout")
|
grayedout: setClassPresenceNamed(outerWin.document.body, "grayedout"),
|
||||||
{
|
dmesg: function(){ dmesg = window.dmesg = value; },
|
||||||
setClassPresence(outerWin.document.body, "grayedout", !! value);
|
userauthor: function(value){ thisAuthor = String(value); },
|
||||||
}
|
styled: setStyled,
|
||||||
else if (k == "dmesg")
|
textface: setTextFace,
|
||||||
{
|
textsize: setTextSize,
|
||||||
dmesg = value;
|
rtlistrue: setClassPresenceNamed(root, "rtl")
|
||||||
window.dmesg = value;
|
};
|
||||||
}
|
|
||||||
else if (k == 'userauthor')
|
var setter = setters[key.toLowerCase();];
|
||||||
{
|
|
||||||
thisAuthor = String(value);
|
// check if setter is present
|
||||||
}
|
if(setter !== undefined){
|
||||||
else if (k == 'styled')
|
setter(value)
|
||||||
{
|
|
||||||
setStyled(value);
|
|
||||||
}
|
|
||||||
else if (k == 'textface')
|
|
||||||
{
|
|
||||||
setTextFace(value);
|
|
||||||
}
|
|
||||||
else if (k == 'textsize')
|
|
||||||
{
|
|
||||||
setTextSize(value);
|
|
||||||
}
|
|
||||||
else if (k == 'rtlistrue')
|
|
||||||
{
|
|
||||||
setClassPresence(root, "rtl", !! value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue