From 8652daadf087774ddfa68974b404ff20ca9b4b99 Mon Sep 17 00:00:00 2001 From: Diego Najar Date: Tue, 3 Jul 2018 23:04:08 +0200 Subject: [PATCH] Clean up and Quill editor fixes --- bl-kernel/admin/views/edit-content.php | 26 +++++++++++++++-------- bl-kernel/admin/views/new-content.php | 12 +++++++++-- bl-kernel/helpers/text.class.php | 4 ++-- bl-plugins/about/metadata.json | 4 ++-- bl-plugins/api/metadata.json | 4 ++-- bl-plugins/backup/metadata.json | 4 ++-- bl-plugins/categories/metadata.json | 4 ++-- bl-plugins/disqus/metadata.json | 4 ++-- bl-plugins/html-code/metadata.json | 4 ++-- bl-plugins/links/metadata.json | 4 ++-- bl-plugins/maintenance-mode/metadata.json | 4 ++-- bl-plugins/navigation/metadata.json | 4 ++-- bl-plugins/opengraph/metadata.json | 4 ++-- bl-plugins/quill/plugin.php | 5 ++++- bl-plugins/rss/metadata.json | 4 ++-- bl-plugins/simple-stats/metadata.json | 4 ++-- bl-plugins/simplemde/metadata.json | 2 +- bl-plugins/simplemde/plugin.php | 15 ++++++++----- bl-plugins/sitemap/metadata.json | 4 ++-- bl-plugins/static-pages/metadata.json | 4 ++-- bl-plugins/tags/metadata.json | 4 ++-- bl-plugins/tinymce/metadata.json | 2 +- bl-plugins/twitter-cards/metadata.json | 4 ++-- bl-plugins/updater/metadata.json | 4 ++-- bl-plugins/version/metadata.json | 4 ++-- bl-themes/alternative/metadata.json | 4 ++-- bl-themes/blogx/metadata.json | 4 ++-- 27 files changed, 85 insertions(+), 61 deletions(-) diff --git a/bl-kernel/admin/views/edit-content.php b/bl-kernel/admin/views/edit-content.php index c3b2989b..7d12e145 100644 --- a/bl-kernel/admin/views/edit-content.php +++ b/bl-kernel/admin/views/edit-content.php @@ -51,6 +51,12 @@ 'name'=>'coverImage', 'value'=>$page->coverImage() )); + + // Content + echo Bootstrap::formInputHidden(array( + 'name'=>'content', + 'value'=>$page->contentRaw(false) + )); ?> @@ -61,11 +67,11 @@
-
contentRaw(false) ?>
+
- + g('Cancel') ?>
@@ -203,12 +209,14 @@ $(document).ready(function() { // Button Save $("#jsbuttonSave").on("click", function() { $("#jsstatus").val("published"); + $("#jscontent").val( editorGetContent() ); $("#jsform").submit(); }); // Button Save as draft $("#jsbuttonDraft").on("click", function() { $("#jsstatus").val("draft"); + $("#jscontent").val( editorGetContent() ); $("#jsform").submit(); }); @@ -224,13 +232,13 @@ $(document).ready(function() { }); // Generate slug when the user type the title - $("#jstitle").keyup(function() { - var text = $(this).val(); - var parent = $("#jsparent").val(); - var currentKey = ""; - var ajax = new bluditAjax(); - ajax.generateSlug(text, parent, currentKey, $("#jsslug")); - }); + // $("#jstitle").keyup(function() { + // var text = $(this).val(); + // var parent = $("#jsparent").val(); + // var currentKey = ""; + // var ajax = new bluditAjax(); + // ajax.generateSlug(text, parent, currentKey, $("#jsslug")); + // }); // Autosave interval setInterval(function() { diff --git a/bl-kernel/admin/views/new-content.php b/bl-kernel/admin/views/new-content.php index cdb84510..55ff4da8 100644 --- a/bl-kernel/admin/views/new-content.php +++ b/bl-kernel/admin/views/new-content.php @@ -45,6 +45,12 @@ 'name'=>'coverImage', 'value'=>'' )); + + // Content + echo Bootstrap::formInputHidden(array( + 'name'=>'content', + 'value'=>'' + )); ?> @@ -55,11 +61,11 @@
-
+
- + g('Cancel') ?>
@@ -186,12 +192,14 @@ $(document).ready(function() { // Button Save $("#jsbuttonSave").on("click", function() { $("#jsstatus").val("published"); + $("#jscontent").val( editorGetContent() ); $("#jsform").submit(); }); // Button Save as draft $("#jsbuttonDraft").on("click", function() { $("#jsstatus").val("draft"); + $("#jscontent").val( editorGetContent() ); $("#jsform").submit(); }); diff --git a/bl-kernel/helpers/text.class.php b/bl-kernel/helpers/text.class.php index fadd820f..a300059b 100644 --- a/bl-kernel/helpers/text.class.php +++ b/bl-kernel/helpers/text.class.php @@ -129,9 +129,9 @@ class Text { global $Language; if (EXTREME_FRIENDLY_URL) { - $string = trim($string, '-'); $string = self::lowercase($string); - $string = preg_replace("/[\/_|+ -]+/", $separator, $string); + $string = preg_replace("/[\/_|+:!@#$%^&*(). -]+/", $separator, $string); + $string = trim($string, '-'); return $string; } diff --git a/bl-plugins/about/metadata.json b/bl-plugins/about/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/about/metadata.json +++ b/bl-plugins/about/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/api/metadata.json b/bl-plugins/api/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/api/metadata.json +++ b/bl-plugins/api/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/backup/metadata.json b/bl-plugins/backup/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/backup/metadata.json +++ b/bl-plugins/backup/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/categories/metadata.json b/bl-plugins/categories/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/categories/metadata.json +++ b/bl-plugins/categories/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/disqus/metadata.json b/bl-plugins/disqus/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/disqus/metadata.json +++ b/bl-plugins/disqus/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/html-code/metadata.json b/bl-plugins/html-code/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/html-code/metadata.json +++ b/bl-plugins/html-code/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/links/metadata.json b/bl-plugins/links/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/links/metadata.json +++ b/bl-plugins/links/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/maintenance-mode/metadata.json b/bl-plugins/maintenance-mode/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/maintenance-mode/metadata.json +++ b/bl-plugins/maintenance-mode/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/navigation/metadata.json b/bl-plugins/navigation/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/navigation/metadata.json +++ b/bl-plugins/navigation/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/opengraph/metadata.json b/bl-plugins/opengraph/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/opengraph/metadata.json +++ b/bl-plugins/opengraph/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/quill/plugin.php b/bl-plugins/quill/plugin.php index c9397010..3e314f55 100644 --- a/bl-plugins/quill/plugin.php +++ b/bl-plugins/quill/plugin.php @@ -51,7 +51,10 @@ function editorGetContent() { $(document).ready(function() { - quill = new Quill("#jscontent", { + var content = $("#jscontent").val(); + $("#jseditor").replaceWith("
"+content+"
"); + + quill = new Quill("#jseditor", { modules: { toolbar: [ [{ header: [1, 2, false] }], diff --git a/bl-plugins/rss/metadata.json b/bl-plugins/rss/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/rss/metadata.json +++ b/bl-plugins/rss/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/simple-stats/metadata.json b/bl-plugins/simple-stats/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/simple-stats/metadata.json +++ b/bl-plugins/simple-stats/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/simplemde/metadata.json b/bl-plugins/simplemde/metadata.json index 16579b39..a242ed17 100644 --- a/bl-plugins/simplemde/metadata.json +++ b/bl-plugins/simplemde/metadata.json @@ -5,6 +5,6 @@ "version": "1.11.2", "releaseDate": "2016-06-14", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/simplemde/plugin.php b/bl-plugins/simplemde/plugin.php index 30abc230..f6bdf28c 100644 --- a/bl-plugins/simplemde/plugin.php +++ b/bl-plugins/simplemde/plugin.php @@ -99,20 +99,25 @@ class pluginsimpleMDE extends Plugin { simplemde.value(text + content + "\n"); }'.PHP_EOL; - // This function is necesary on each Editor, it is used by Bludit Images v8. - $html .= 'function editorAddImage(filename) { + // Function required for Autosave function + $html .= 'function editorGetContent(content) { + return simplemde.value(); + }'.PHP_EOL; + + // Function required for Media Manager to insert a file on the editor + $html .= 'function editorInsertMedia(filename) { addContentSimpleMDE("!['.$Language->get('Image description').']("+filename+")"); }'.PHP_EOL; $html .= '$(document).ready(function() { '.PHP_EOL; $html .= ' - var content = $("#jscontent").html(); - $("#jscontent").replaceWith(""); + var content = $("#jscontent").val(); simplemde = new SimpleMDE({ - element: document.getElementById("jscontent"), + element: document.getElementById("jseditor"), status: false, + initialValue: content, toolbarTips: true, toolbarGuideIcon: true, autofocus: false, diff --git a/bl-plugins/sitemap/metadata.json b/bl-plugins/sitemap/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/sitemap/metadata.json +++ b/bl-plugins/sitemap/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/static-pages/metadata.json b/bl-plugins/static-pages/metadata.json index 6cad204f..70ee43cd 100644 --- a/bl-plugins/static-pages/metadata.json +++ b/bl-plugins/static-pages/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-03-07", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/tags/metadata.json b/bl-plugins/tags/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/tags/metadata.json +++ b/bl-plugins/tags/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/tinymce/metadata.json b/bl-plugins/tinymce/metadata.json index d00a13b3..d24e6dca 100644 --- a/bl-plugins/tinymce/metadata.json +++ b/bl-plugins/tinymce/metadata.json @@ -5,6 +5,6 @@ "version": "4.7.5", "releaseDate": "2018-01-22", "license": "GPL v2", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/twitter-cards/metadata.json b/bl-plugins/twitter-cards/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/twitter-cards/metadata.json +++ b/bl-plugins/twitter-cards/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/updater/metadata.json b/bl-plugins/updater/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/updater/metadata.json +++ b/bl-plugins/updater/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-plugins/version/metadata.json b/bl-plugins/version/metadata.json index 13635940..f2d3a7f4 100644 --- a/bl-plugins/version/metadata.json +++ b/bl-plugins/version/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://plugins.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-01-23", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-themes/alternative/metadata.json b/bl-themes/alternative/metadata.json index aef93f86..a430debb 100644 --- a/bl-themes/alternative/metadata.json +++ b/bl-themes/alternative/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://themes.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-02-20", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file diff --git a/bl-themes/blogx/metadata.json b/bl-themes/blogx/metadata.json index aef93f86..a430debb 100644 --- a/bl-themes/blogx/metadata.json +++ b/bl-themes/blogx/metadata.json @@ -2,9 +2,9 @@ "author": "Bludit", "email": "", "website": "https://themes.bludit.com", - "version": "2.3", + "version": "3.0", "releaseDate": "2018-02-20", "license": "MIT", - "compatible": "2.3", + "compatible": "3.0", "notes": "" } \ No newline at end of file