summaryrefslogtreecommitdiff
path: root/js/PrefHelpers.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-12-11 14:25:41 +0300
committerAndrew Dolgov <[email protected]>2018-12-11 14:25:41 +0300
commitdaa43e05727d4cd4d7b261a5be3faefab4263dcd (patch)
tree6409a5a95d042928c3fa071ace9d28e6669311d1 /js/PrefHelpers.js
parent7a98105960dcbb53b4a221e2337ac7d1c955bd92 (diff)
use codeflask for user css editor
Diffstat (limited to 'js/PrefHelpers.js')
-rw-r--r--js/PrefHelpers.js44
1 files changed, 28 insertions, 16 deletions
diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js
index a3d122029..f7ca2525f 100644
--- a/js/PrefHelpers.js
+++ b/js/PrefHelpers.js
@@ -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();
- dialog.show();
+ 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();
+ });
},
confirmReset: function() {
if (confirm(__("Reset to defaults?"))) {