|
|
Re: Editor Font Size [message #840231 is a reply to message #840056] |
Mon, 09 April 2012 20:59  |
Joe Ertaba Messages: 17 Registered: April 2012 |
Junior Member |
|
|
Hi Anton,
Thanks for your reply.
Here is my snippet for those who may need change each setting separately.
var setSetting = (function(){
var indexArray = [];
var styleSheet = function (path) {
for(var i = 0; i < doc.styleSheets.length; i++) {
var sheet = doc.styleSheets[i];
if(path.test(sheet.href))
return sheet;
}
return null;
}(/textview\.css/);
if (!styleSheet) return false;
const css = ".textviewContainer{%s}";
return function(type, value) {
if (indexArray[type])
styleSheet.deleteRule(indexArray[type]);
else
indexArray[type] = styleSheet.cssRules.length;
styleSheet.insertRule(css.replace("%s", type + ": " + value + " !important"), indexArray[type]);
textView.update(true);
return true;
}
})();
setSetting("font-family", "monospace");
setSetting("background-color", "white");
setSetting("font-size", "12pt");
"doc" and "textView" must be set before execution.
P.S:
The code has been just tested in Firefox browser.
[Updated on: Mon, 09 April 2012 21:05] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02636 seconds