use codeflask for user css editor

This commit is contained in:
Andrew Dolgov 2018-12-11 14:25:41 +03:00
parent 7a98105960
commit daa43e0572
9 changed files with 55 additions and 24 deletions

View File

@ -993,12 +993,7 @@ class Pref_Prefs extends Handler_Protected {
print_hidden("method", "setpref");
print_hidden("key", "USER_STYLESHEET");
print "<table width='100%'><tr><td>";
print "<textarea dojoType=\"dijit.form.SimpleTextarea\"
style='font-size : 12px; width : 98%; height: 200px;'
placeHolder='body#ttrssMain { font-size : 14px; };'
name='value'>$value</textarea>";
print "</td></tr></table>";
print "<div class='panel' id='user-css-editor'>$value</div>";
print "<div class='dlgButtons'>";
print "<button dojoType=\"dijit.form.Button\"

View File

@ -1434,6 +1434,12 @@ body.ttrss_prefs #header img {
vertical-align: middle;
cursor: pointer;
}
body.ttrss_prefs #user-css-editor {
height: 300px;
}
body.ttrss_prefs #user-css-editor .codeflask {
position: relative;
}
body.ttrss_prefs .dijitTree#filterTree .dijitTreeIcon,
body.ttrss_prefs .dijitTree#labelTree .dijitTreeIcon,
body.ttrss_prefs .dijitTree#filterTree .dijitTreeIcon {

File diff suppressed because one or more lines are too long

View File

@ -28,6 +28,14 @@ body.ttrss_prefs {
cursor : pointer;
}
#user-css-editor {
height : 300px;
.codeflask {
position : relative;
}
}
.dijitTree#filterTree .dijitTreeIcon,
.dijitTree#labelTree .dijitTreeIcon,
.dijitTree#filterTree .dijitTreeIcon {

View File

@ -103,27 +103,39 @@ define(["dojo/_base/declare"], function (declare) {
dialog.show();
},
customizeCSS: function() {
const query = "backend.php?op=pref-prefs&method=customizeCSS";
require(["codeflask"], function(CodeFlask) {
if (dijit.byId("cssEditDlg"))
dijit.byId("cssEditDlg").destroyRecursive();
const query = "backend.php?op=pref-prefs&method=customizeCSS";
const dialog = new dijit.Dialog({
id: "cssEditDlg",
title: __("Customize stylesheet"),
style: "width: 600px",
execute: function () {
Notify.progress('Saving data...', true);
if (dijit.byId("cssEditDlg"))
dijit.byId("cssEditDlg").destroyRecursive();
xhrPost("backend.php", this.attr('value'), () => {
window.location.reload();
});
const dialog = new dijit.Dialog({
id: "cssEditDlg",
title: __("Customize stylesheet"),
style: "width: 600px",
execute: function () {
Notify.progress('Saving data...', true);
},
href: query
const params = this.attr('value');
params.value = this._flask.getCode();
xhrPost("backend.php", params, () => {
window.location.reload();
});
},
href: query
});
dojo.connect(dialog, "onShow", function () {
setTimeout(() => {
dialog._flask = new CodeFlask('#user-css-editor', {language: 'css'});
}, 250);
});
dialog.show();
});
dialog.show();
},
confirmReset: function() {
if (confirm(__("Reset to defaults?"))) {

1
lib/codeflask.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -59,6 +59,9 @@
packages: [
{ name: "lib", location: "../" },
{ name: "fox", location: "../../js" },
],
aliases: [
[ "codeflask", "lib/codeflask.min.js" ]
]
};
</script>

View File

@ -1434,6 +1434,12 @@ body.ttrss_prefs #header img {
vertical-align: middle;
cursor: pointer;
}
body.ttrss_prefs #user-css-editor {
height: 300px;
}
body.ttrss_prefs #user-css-editor .codeflask {
position: relative;
}
body.ttrss_prefs .dijitTree#filterTree .dijitTreeIcon,
body.ttrss_prefs .dijitTree#labelTree .dijitTreeIcon,
body.ttrss_prefs .dijitTree#filterTree .dijitTreeIcon {

File diff suppressed because one or more lines are too long