Bugfix for EOF

This commit is contained in:
Diego Najar 2021-06-08 23:34:49 +02:00
parent 1edd3eec53
commit a98e5e4582
5 changed files with 154 additions and 152 deletions

2
.gitignore vendored
View file

@ -29,3 +29,5 @@ bl-themes/tagg
bl-themes/small bl-themes/small
bl-themes/future-imperfect bl-themes/future-imperfect
bl-themes/social-network bl-themes/social-network
Dockerfile
conf/*

View file

@ -68,53 +68,53 @@ class pluginEasyMDE extends Plugin {
$toolbar = Sanitize::htmlDecode($this->getValue('toolbar')); $toolbar = Sanitize::htmlDecode($this->getValue('toolbar'));
$pageBreak = PAGE_BREAK; $pageBreak = PAGE_BREAK;
return <<<EOF return <<<EOF
<script> <script>
// Function required for Bludit // Function required for Bludit
// Returns the content of the editor // Returns the content of the editor
function editorGetContent() { function editorGetContent() {
return easymde.value(); return easymde.value();
} }
// Function required for Bludit // Function required for Bludit
// Insert HTML content at the cursor position // Insert HTML content at the cursor position
function editorInsertContent(html, type='') { function editorInsertContent(html, type='') {
var text = easymde.value(); var text = easymde.value();
if (type == 'image') { if (type == 'image') {
easymde.value(text + "![$langImage]("+filename+")" + "\\n"); easymde.value(text + "![$langImage]("+filename+")" + "\\n");
} else { } else {
easymde.value(html + "\\n"); easymde.value(html + "\\n");
} }
easymde.codemirror.refresh(); easymde.codemirror.refresh();
} }
var easymde = new EasyMDE({ var easymde = new EasyMDE({
element: document.getElementById("editor"), element: document.getElementById("editor"),
status: false, status: false,
toolbarTips: true, toolbarTips: true,
toolbarGuideIcon: true, toolbarGuideIcon: true,
autofocus: false, autofocus: false,
placeholder: "", placeholder: "",
lineWrapping: true, lineWrapping: true,
autoDownloadFontAwesome: false, autoDownloadFontAwesome: false,
indentWithTabs: true, indentWithTabs: true,
tabSize: $tabSize, tabSize: $tabSize,
spellChecker: $spellCheckerEnable, spellChecker: $spellCheckerEnable,
toolbar: [$toolbar, toolbar: [$toolbar,
"|", "|",
{ {
name: "pageBreak", name: "pageBreak",
action: function addPageBreak(editor){ action: function addPageBreak(editor){
var cm = editor.codemirror; var cm = editor.codemirror;
output = "$pageBreak"; output = "$pageBreak";
cm.replaceSelection(output); cm.replaceSelection(output);
}, },
className: "bi-crop", className: "bi-crop",
title: "Page break", title: "Page break",
}] }]
}); });
</script> </script>
EOF; EOF;
} }
} }

View file

@ -90,60 +90,60 @@ class pluginTinymce extends Plugin {
$skin = 'oxide-dark'; $skin = 'oxide-dark';
} }
return <<<EOF return <<<EOF
<script> <script>
// Function required for Bludit // Function required for Bludit
// Returns the content of the editor // Returns the content of the editor
function editorGetContent() { function editorGetContent() {
return tinymce.get('editor').getContent(); return tinymce.get('editor').getContent();
} }
// Function required for Bludit // Function required for Bludit
// Insert HTML content at the cursor position // Insert HTML content at the cursor position
function editorInsertContent(content, type='') { function editorInsertContent(content, type='') {
if (type == 'image') { if (type == 'image') {
var html = '<img src="' + content + '" alt="" />'; var html = '<img src="' + content + '" alt="" />';
} else { } else {
var html = content; var html = content;
} }
tinymce.activeEditor.insertContent(html); tinymce.activeEditor.insertContent(html);
} }
tinymce.init({ tinymce.init({
selector: "#editor", selector: "#editor",
auto_focus: "editor", auto_focus: "editor",
element_format : "html", element_format : "html",
entity_encoding : "raw", entity_encoding : "raw",
skin: "$skin", skin: "$skin",
schema: "html5", schema: "html5",
statusbar: false, statusbar: false,
menubar:false, menubar:false,
branding: false, branding: false,
browser_spellcheck: true, browser_spellcheck: true,
pagebreak_separator: PAGE_BREAK, pagebreak_separator: PAGE_BREAK,
pagebreak_split_block: true, pagebreak_split_block: true,
paste_as_text: true, paste_as_text: true,
remove_script_host: false, remove_script_host: false,
convert_urls: true, convert_urls: true,
relative_urls: false, relative_urls: false,
valid_elements: "*[*]", valid_elements: "*[*]",
cache_suffix: "?version=$version", cache_suffix: "?version=$version",
$document_base_url $document_base_url
plugins: ["$plugins"], plugins: ["$plugins"],
toolbar1: "$toolbar1", toolbar1: "$toolbar1",
toolbar2: "$toolbar2", toolbar2: "$toolbar2",
language: "$lang", language: "$lang",
content_css: "$content_css", content_css: "$content_css",
init_instance_callback: function(editor) { init_instance_callback: function(editor) {
editor.on("keydown", function(event) { editor.on("keydown", function(event) {
keypress(event); keypress(event);
});
}
}); });
}
});
</script> </script>
EOF; EOF;
} }
} }

View file

@ -50,44 +50,44 @@ class pluginVisitsStats extends Plugin {
$labelVisits = $L->g('Visits'); $labelVisits = $L->g('Visits');
$labelUnique = $L->g('Unique'); $labelUnique = $L->g('Unique');
return <<<EOF return <<<EOF
<div class="pluginVisitsStats mb-4 pt-4 border-top"> <div class="pluginVisitsStats mb-4 pt-4 border-top">
<h3 class="m-0 p-0"><i class="bi bi-bar-chart"></i>$label</h3> <h3 class="m-0 p-0"><i class="bi bi-bar-chart"></i>$label</h3>
<canvas id="visits-stats"></canvas> <canvas id="visits-stats"></canvas>
</div> </div>
<script> <script>
var ctx = document.getElementById('visits-stats'); var ctx = document.getElementById('visits-stats');
new Chart(ctx, { new Chart(ctx, {
type: 'bar', type: 'bar',
data: { data: {
labels: [$labels], labels: [$labels],
datasets: [{ datasets: [{
backgroundColor: 'rgb(13,110,253)', backgroundColor: 'rgb(13,110,253)',
borderColor: 'rgb(13,110,253)', borderColor: 'rgb(13,110,253)',
label: '$labelUnique', label: '$labelUnique',
data: [$seriesUnique] data: [$seriesUnique]
}, },
{ {
backgroundColor: 'rgb(61,139,253)', backgroundColor: 'rgb(61,139,253)',
borderColor: 'rgb(61,139,253)', borderColor: 'rgb(61,139,253)',
label: '$labelVisits', label: '$labelVisits',
data: [$seriesVisits] data: [$seriesVisits]
}] }]
}, },
options: { options: {
scales: { scales: {
yAxes: [{ yAxes: [{
ticks: { ticks: {
beginAtZero: true, beginAtZero: true,
stepSize: 1 stepSize: 1
}
}]
} }
} }]
}); }
</script> }
EOF; });
</script>
EOF;
} }
// Plugin form for settings // Plugin form for settings

View file

@ -25,29 +25,29 @@ class pluginWelcome extends Plugin {
$labelGoodEvening = $L->g('good-evening'); $labelGoodEvening = $L->g('good-evening');
$labelGoodNight = $L->g('good-night'); $labelGoodNight = $L->g('good-night');
return <<<EOF return <<<EOF
<div class="pluginWelcome mb-4"> <div class="pluginWelcome mb-4">
<h2 id="hello-message" class="m-0 p-0"><i class="bi bi-emoji-laughing"></i>Welcome</h2> <h2 id="hello-message" class="m-0 p-0"><i class="bi bi-emoji-laughing"></i>Welcome</h2>
</div> </div>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$("#hello-message").fadeOut(1000, function() { $("#hello-message").fadeOut(1000, function() {
var date = new Date() var date = new Date()
var hours = date.getHours() var hours = date.getHours()
if (hours > 6 && hours < 12) { if (hours > 6 && hours < 12) {
$(this).html('<i class="bi bi-sunrise"></i>$labelGoodMorning, $name'); $(this).html('<i class="bi bi-sunrise"></i>$labelGoodMorning, $name');
} else if (hours >= 12 && hours < 18) { } else if (hours >= 12 && hours < 18) {
$(this).html('<i class="bi bi-sun"></i>$labelGoodAfternoon, $name'); $(this).html('<i class="bi bi-sun"></i>$labelGoodAfternoon, $name');
} else if (hours >= 18 && hours < 22) { } else if (hours >= 18 && hours < 22) {
$(this).html('<i class="bi bi-sunset"></i>$labelGoodEvening, $name'); $(this).html('<i class="bi bi-sunset"></i>$labelGoodEvening, $name');
} else { } else {
$(this).html('<i class="bi bi-moon-stars"></i>$labelGoodNight, $name'); $(this).html('<i class="bi bi-moon-stars"></i>$labelGoodNight, $name');
} }
}).fadeIn(1000); }).fadeIn(1000);
}); });
</script> </script>
EOF; EOF;
} }
} }