Clean up and Quill editor fixes

This commit is contained in:
Diego Najar 2018-07-03 23:04:08 +02:00
parent be555b289b
commit 8652daadf0
27 changed files with 85 additions and 61 deletions

View File

@ -51,6 +51,12 @@
'name'=>'coverImage', 'name'=>'coverImage',
'value'=>$page->coverImage() 'value'=>$page->coverImage()
)); ));
// Content
echo Bootstrap::formInputHidden(array(
'name'=>'content',
'value'=>$page->contentRaw(false)
));
?> ?>
<!-- TABS CONTENT --> <!-- TABS CONTENT -->
@ -61,11 +67,11 @@
</div> </div>
<div class="form-group mt-1"> <div class="form-group mt-1">
<div id="jscontent" name="content"><?php echo $page->contentRaw(false) ?></div> <textarea id="jseditor"></textarea>
</div> </div>
<div class="form-group mt-2"> <div class="form-group mt-2">
<button id="jsbuttonSave" type="submit" class="btn btn-primary"><?php echo $L->g('Publish') ?></button> <button id="jsbuttonSave" type="button" class="btn btn-primary"><?php echo $L->g('Publish') ?></button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary"><?php echo $L->g('Save as draft') ?></button> <button id="jsbuttonDraft" type="button" class="btn btn-secondary"><?php echo $L->g('Save as draft') ?></button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"><?php echo $L->g('Cancel') ?></a> <a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"><?php echo $L->g('Cancel') ?></a>
</div> </div>
@ -203,12 +209,14 @@ $(document).ready(function() {
// Button Save // Button Save
$("#jsbuttonSave").on("click", function() { $("#jsbuttonSave").on("click", function() {
$("#jsstatus").val("published"); $("#jsstatus").val("published");
$("#jscontent").val( editorGetContent() );
$("#jsform").submit(); $("#jsform").submit();
}); });
// Button Save as draft // Button Save as draft
$("#jsbuttonDraft").on("click", function() { $("#jsbuttonDraft").on("click", function() {
$("#jsstatus").val("draft"); $("#jsstatus").val("draft");
$("#jscontent").val( editorGetContent() );
$("#jsform").submit(); $("#jsform").submit();
}); });
@ -224,13 +232,13 @@ $(document).ready(function() {
}); });
// Generate slug when the user type the title // Generate slug when the user type the title
$("#jstitle").keyup(function() { // $("#jstitle").keyup(function() {
var text = $(this).val(); // var text = $(this).val();
var parent = $("#jsparent").val(); // var parent = $("#jsparent").val();
var currentKey = ""; // var currentKey = "";
var ajax = new bluditAjax(); // var ajax = new bluditAjax();
ajax.generateSlug(text, parent, currentKey, $("#jsslug")); // ajax.generateSlug(text, parent, currentKey, $("#jsslug"));
}); // });
// Autosave interval // Autosave interval
setInterval(function() { setInterval(function() {

View File

@ -45,6 +45,12 @@
'name'=>'coverImage', 'name'=>'coverImage',
'value'=>'' 'value'=>''
)); ));
// Content
echo Bootstrap::formInputHidden(array(
'name'=>'content',
'value'=>''
));
?> ?>
<!-- TABS CONTENT --> <!-- TABS CONTENT -->
@ -55,11 +61,11 @@
</div> </div>
<div class="form-group mt-1"> <div class="form-group mt-1">
<div id="jscontent" name="content"></div> <textarea id="jseditor"></textarea>
</div> </div>
<div class="form-group mt-2"> <div class="form-group mt-2">
<button id="jsbuttonSave" type="submit" class="btn btn-primary"><?php echo $L->g('Publish') ?></button> <button id="jsbuttonSave" type="button" class="btn btn-primary"><?php echo $L->g('Publish') ?></button>
<button id="jsbuttonDraft" type="button" class="btn btn-secondary"><?php echo $L->g('Save as draft') ?></button> <button id="jsbuttonDraft" type="button" class="btn btn-secondary"><?php echo $L->g('Save as draft') ?></button>
<a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"><?php echo $L->g('Cancel') ?></a> <a href="<?php echo HTML_PATH_ADMIN_ROOT ?>dashboard" class="btn btn-secondary"><?php echo $L->g('Cancel') ?></a>
</div> </div>
@ -186,12 +192,14 @@ $(document).ready(function() {
// Button Save // Button Save
$("#jsbuttonSave").on("click", function() { $("#jsbuttonSave").on("click", function() {
$("#jsstatus").val("published"); $("#jsstatus").val("published");
$("#jscontent").val( editorGetContent() );
$("#jsform").submit(); $("#jsform").submit();
}); });
// Button Save as draft // Button Save as draft
$("#jsbuttonDraft").on("click", function() { $("#jsbuttonDraft").on("click", function() {
$("#jsstatus").val("draft"); $("#jsstatus").val("draft");
$("#jscontent").val( editorGetContent() );
$("#jsform").submit(); $("#jsform").submit();
}); });

View File

@ -129,9 +129,9 @@ class Text {
global $Language; global $Language;
if (EXTREME_FRIENDLY_URL) { if (EXTREME_FRIENDLY_URL) {
$string = trim($string, '-');
$string = self::lowercase($string); $string = self::lowercase($string);
$string = preg_replace("/[\/_|+ -]+/", $separator, $string); $string = preg_replace("/[\/_|+:!@#$%^&*(). -]+/", $separator, $string);
$string = trim($string, '-');
return $string; return $string;
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -51,7 +51,10 @@ function editorGetContent() {
$(document).ready(function() { $(document).ready(function() {
quill = new Quill("#jscontent", { var content = $("#jscontent").val();
$("#jseditor").replaceWith("<div id=\"jseditor\">"+content+"</div>");
quill = new Quill("#jseditor", {
modules: { modules: {
toolbar: [ toolbar: [
[{ header: [1, 2, false] }], [{ header: [1, 2, false] }],

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -5,6 +5,6 @@
"version": "1.11.2", "version": "1.11.2",
"releaseDate": "2016-06-14", "releaseDate": "2016-06-14",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -99,20 +99,25 @@ class pluginsimpleMDE extends Plugin {
simplemde.value(text + content + "\n"); simplemde.value(text + content + "\n");
}'.PHP_EOL; }'.PHP_EOL;
// This function is necesary on each Editor, it is used by Bludit Images v8. // Function required for Autosave function
$html .= 'function editorAddImage(filename) { $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+")"); addContentSimpleMDE("!['.$Language->get('Image description').']("+filename+")");
}'.PHP_EOL; }'.PHP_EOL;
$html .= '$(document).ready(function() { '.PHP_EOL; $html .= '$(document).ready(function() { '.PHP_EOL;
$html .= ' $html .= '
var content = $("#jscontent").html(); var content = $("#jscontent").val();
$("#jscontent").replaceWith("<textarea id=\"jscontent\" name=\"content\">"+content+"</textarea>");
simplemde = new SimpleMDE({ simplemde = new SimpleMDE({
element: document.getElementById("jscontent"), element: document.getElementById("jseditor"),
status: false, status: false,
initialValue: content,
toolbarTips: true, toolbarTips: true,
toolbarGuideIcon: true, toolbarGuideIcon: true,
autofocus: false, autofocus: false,

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-03-07", "releaseDate": "2018-03-07",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -5,6 +5,6 @@
"version": "4.7.5", "version": "4.7.5",
"releaseDate": "2018-01-22", "releaseDate": "2018-01-22",
"license": "GPL v2", "license": "GPL v2",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://plugins.bludit.com", "website": "https://plugins.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-01-23", "releaseDate": "2018-01-23",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://themes.bludit.com", "website": "https://themes.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-02-20", "releaseDate": "2018-02-20",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }

View File

@ -2,9 +2,9 @@
"author": "Bludit", "author": "Bludit",
"email": "", "email": "",
"website": "https://themes.bludit.com", "website": "https://themes.bludit.com",
"version": "2.3", "version": "3.0",
"releaseDate": "2018-02-20", "releaseDate": "2018-02-20",
"license": "MIT", "license": "MIT",
"compatible": "2.3", "compatible": "3.0",
"notes": "" "notes": ""
} }