From aebaed2a8cba7a17c8883fafb3dbf71cffa2ee4e Mon Sep 17 00:00:00 2001 From: Hakim Zulkufli Date: Sun, 30 Apr 2017 17:03:33 +0800 Subject: [PATCH 1/5] Retain PNG transparency. Transparency data will be saved when cropping or resizing. --- bl-kernel/helpers/image.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bl-kernel/helpers/image.class.php b/bl-kernel/helpers/image.class.php index db70ae74..610117eb 100644 --- a/bl-kernel/helpers/image.class.php +++ b/bl-kernel/helpers/image.class.php @@ -108,6 +108,8 @@ class Image { // *** Resample - create image canvas of x, y size $this->imageResized = imagecreatetruecolor($optimalWidth, $optimalHeight); + imagealphablending($this->imageResized, false); + imagesavealpha($this->imageResized, true); imagecopyresampled($this->imageResized, $this->image, 0, 0, 0, 0, $optimalWidth, $optimalHeight, $this->width, $this->height); @@ -230,6 +232,8 @@ class Image { // *** Now crop from center to exact requested size $this->imageResized = imagecreatetruecolor($newWidth , $newHeight); + imagealphablending($this->imageResized, false); + imagesavealpha($this->imageResized, true); imagecopyresampled($this->imageResized, $crop , 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight , $newWidth, $newHeight); } } From 84aa89a861d6f50572e895e5b851350c13c65e90 Mon Sep 17 00:00:00 2001 From: Hakim Zulkufli Date: Sun, 30 Apr 2017 19:08:46 +0800 Subject: [PATCH 2/5] Quill plugin fix. Just making it work. It seems to be working fine on my end, but user-defined toolbar options are not implemented yet. The plugin now loads all toolbar options by default. See: var toolbarOptions --- bl-plugins/quill/plugin.php | 46 ++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/bl-plugins/quill/plugin.php b/bl-plugins/quill/plugin.php index 7a7076de..583b093b 100644 --- a/bl-plugins/quill/plugin.php +++ b/bl-plugins/quill/plugin.php @@ -56,7 +56,7 @@ class pluginQuill extends Plugin { $html .= 'getDbField('autosave')?'checked':'').'>'; $html .= ''; $html .= ''; - + $html .= '
'; $html .= ''; $html .= 'getDbField('spellChecker')?'checked':'').'>'; @@ -72,25 +72,43 @@ class pluginQuill extends Plugin { global $Language; $html = ''; - if( $this->enabled() ) { + // Load CSS and JS only on Controllers in array. + if(in_array($layout['controller'], $this->loadWhenController)) + { $html .= ' '; } return $html; } -} \ No newline at end of file +} From 743a88c29bf51fe554229ac3b14da1f6f58afb1e Mon Sep 17 00:00:00 2001 From: Hakim Zulkufli Date: Sun, 30 Apr 2017 19:50:32 +0800 Subject: [PATCH 3/5] Changed content input from textarea into div. This is to ensure that the area will be comaptible with any text editor plugins. I have tested with SimpleMDE and Quill. Both worked completely fine. Bonus: Added description of Quill's English locale. --- bl-kernel/admin/views/edit-page.php | 19 +++++++++++-------- bl-kernel/admin/views/edit-post.php | 17 ++++++++++------- bl-kernel/admin/views/new-page.php | 19 +++++++++++-------- bl-kernel/admin/views/new-post.php | 21 ++++++++++++--------- bl-plugins/quill/languages/en_US.json | 4 ++-- 5 files changed, 46 insertions(+), 34 deletions(-) diff --git a/bl-kernel/admin/views/edit-page.php b/bl-kernel/admin/views/edit-page.php index 35bcd2b0..1c98fe75 100644 --- a/bl-kernel/admin/views/edit-page.php +++ b/bl-kernel/admin/views/edit-page.php @@ -29,13 +29,16 @@ echo '
'; 'placeholder'=>$L->g('Title') )); + echo '
'; + // Content input - HTML::formTextarea(array( - 'name'=>'content', - 'value'=>$_Page->contentRaw(false), - 'class'=>'uk-width-1-1 uk-form-large', - 'placeholder'=>'' - )); + // HTML::formTextarea(array( + // 'name'=>'content', + // 'value'=>$_Post->contentRaw(false), + // 'class'=>'uk-width-1-1 uk-form-large', + // 'placeholder'=>'' + // )); + echo '
'; // Form buttons echo '
'; @@ -239,10 +242,10 @@ $(document).ready(function() } else { $(".sidebar-view").hide(); - $(view).show(); + $(view).show(); } }); }); - \ No newline at end of file + diff --git a/bl-kernel/admin/views/edit-post.php b/bl-kernel/admin/views/edit-post.php index c1d51b78..4a896ad5 100644 --- a/bl-kernel/admin/views/edit-post.php +++ b/bl-kernel/admin/views/edit-post.php @@ -29,13 +29,16 @@ echo '
'; 'placeholder'=>$L->g('Title') )); + echo '
'; + // Content input - HTML::formTextarea(array( - 'name'=>'content', - 'value'=>$_Post->contentRaw(false), - 'class'=>'uk-width-1-1 uk-form-large', - 'placeholder'=>'' - )); + // HTML::formTextarea(array( + // 'name'=>'content', + // 'value'=>$_Post->contentRaw(false), + // 'class'=>'uk-width-1-1 uk-form-large', + // 'placeholder'=>'' + // )); + echo '
'; // Form buttons echo '
@@ -197,7 +200,7 @@ $(document).ready(function() { } else { $(".sidebar-view").hide(); - $(view).show(); + $(view).show(); } }); diff --git a/bl-kernel/admin/views/new-page.php b/bl-kernel/admin/views/new-page.php index db5f1e05..6cf422af 100644 --- a/bl-kernel/admin/views/new-page.php +++ b/bl-kernel/admin/views/new-page.php @@ -23,13 +23,16 @@ echo '
'; 'placeholder'=>$L->g('Title') )); + echo '
'; + // Content input - HTML::formTextarea(array( - 'name'=>'content', - 'value'=>'', - 'class'=>'uk-width-1-1 uk-form-large', - 'placeholder'=>'' - )); + // HTML::formTextarea(array( + // 'name'=>'content', + // 'value'=>'', + // 'class'=>'uk-width-1-1 uk-form-large', + // 'placeholder'=>'' + // )); + echo '
'; // Form buttons echo '
@@ -212,10 +215,10 @@ $(document).ready(function() } else { $(".sidebar-view").hide(); - $(view).show(); + $(view).show(); } }); }); - \ No newline at end of file + diff --git a/bl-kernel/admin/views/new-post.php b/bl-kernel/admin/views/new-post.php index 95840c5d..c10694f8 100644 --- a/bl-kernel/admin/views/new-post.php +++ b/bl-kernel/admin/views/new-post.php @@ -23,13 +23,16 @@ echo '
'; 'placeholder'=>$L->g('Title') )); + echo '
'; + // Content input - HTML::formTextarea(array( - 'name'=>'content', - 'value'=>'', - 'class'=>'uk-width-1-1 uk-form-large', - 'placeholder'=>'' - )); + // HTML::formTextarea(array( + // 'name'=>'content', + // 'value'=>'', + // 'class'=>'uk-width-1-1 uk-form-large', + // 'placeholder'=>'' + // )); + echo '
'; // Form buttons echo '
@@ -73,7 +76,7 @@ echo '
'; )); echo ''; - + // IMAGES TAB // -------------------------------------------------------------------- echo '
  • '; @@ -182,10 +185,10 @@ $(document).ready(function() { } else { $(".sidebar-view").hide(); - $(view).show(); + $(view).show(); } }); }); - \ No newline at end of file + diff --git a/bl-plugins/quill/languages/en_US.json b/bl-plugins/quill/languages/en_US.json index aded94fc..ac8dc647 100644 --- a/bl-plugins/quill/languages/en_US.json +++ b/bl-plugins/quill/languages/en_US.json @@ -2,6 +2,6 @@ "plugin-data": { "name": "Quill", - "description": "" + "description": "Quill is a free, open source WYSIWYG editor built for the modern web. With its modular architecture and expressive API, it is completely customizable to fit any need." } -} \ No newline at end of file +} From f793a5acbd83ce5c66e5bd3eae681d114f398f98 Mon Sep 17 00:00:00 2001 From: Hakim Zulkufli Date: Sun, 30 Apr 2017 20:09:11 +0800 Subject: [PATCH 4/5] Revert "Changed content input from textarea into div." This reverts commit 743a88c29bf51fe554229ac3b14da1f6f58afb1e. --- bl-kernel/admin/views/edit-page.php | 19 ++++++++----------- bl-kernel/admin/views/edit-post.php | 17 +++++++---------- bl-kernel/admin/views/new-page.php | 19 ++++++++----------- bl-kernel/admin/views/new-post.php | 21 +++++++++------------ bl-plugins/quill/languages/en_US.json | 4 ++-- 5 files changed, 34 insertions(+), 46 deletions(-) diff --git a/bl-kernel/admin/views/edit-page.php b/bl-kernel/admin/views/edit-page.php index 1c98fe75..35bcd2b0 100644 --- a/bl-kernel/admin/views/edit-page.php +++ b/bl-kernel/admin/views/edit-page.php @@ -29,16 +29,13 @@ echo '
    '; 'placeholder'=>$L->g('Title') )); - echo '
    '; - // Content input - // HTML::formTextarea(array( - // 'name'=>'content', - // 'value'=>$_Post->contentRaw(false), - // 'class'=>'uk-width-1-1 uk-form-large', - // 'placeholder'=>'' - // )); - echo '
    '; + HTML::formTextarea(array( + 'name'=>'content', + 'value'=>$_Page->contentRaw(false), + 'class'=>'uk-width-1-1 uk-form-large', + 'placeholder'=>'' + )); // Form buttons echo '
    '; @@ -242,10 +239,10 @@ $(document).ready(function() } else { $(".sidebar-view").hide(); - $(view).show(); + $(view).show(); } }); }); - + \ No newline at end of file diff --git a/bl-kernel/admin/views/edit-post.php b/bl-kernel/admin/views/edit-post.php index 4a896ad5..c1d51b78 100644 --- a/bl-kernel/admin/views/edit-post.php +++ b/bl-kernel/admin/views/edit-post.php @@ -29,16 +29,13 @@ echo '
    '; 'placeholder'=>$L->g('Title') )); - echo '
    '; - // Content input - // HTML::formTextarea(array( - // 'name'=>'content', - // 'value'=>$_Post->contentRaw(false), - // 'class'=>'uk-width-1-1 uk-form-large', - // 'placeholder'=>'' - // )); - echo '
    '; + HTML::formTextarea(array( + 'name'=>'content', + 'value'=>$_Post->contentRaw(false), + 'class'=>'uk-width-1-1 uk-form-large', + 'placeholder'=>'' + )); // Form buttons echo '
    @@ -200,7 +197,7 @@ $(document).ready(function() { } else { $(".sidebar-view").hide(); - $(view).show(); + $(view).show(); } }); diff --git a/bl-kernel/admin/views/new-page.php b/bl-kernel/admin/views/new-page.php index 6cf422af..db5f1e05 100644 --- a/bl-kernel/admin/views/new-page.php +++ b/bl-kernel/admin/views/new-page.php @@ -23,16 +23,13 @@ echo '
    '; 'placeholder'=>$L->g('Title') )); - echo '
    '; - // Content input - // HTML::formTextarea(array( - // 'name'=>'content', - // 'value'=>'', - // 'class'=>'uk-width-1-1 uk-form-large', - // 'placeholder'=>'' - // )); - echo '
    '; + HTML::formTextarea(array( + 'name'=>'content', + 'value'=>'', + 'class'=>'uk-width-1-1 uk-form-large', + 'placeholder'=>'' + )); // Form buttons echo '
    @@ -215,10 +212,10 @@ $(document).ready(function() } else { $(".sidebar-view").hide(); - $(view).show(); + $(view).show(); } }); }); - + \ No newline at end of file diff --git a/bl-kernel/admin/views/new-post.php b/bl-kernel/admin/views/new-post.php index c10694f8..95840c5d 100644 --- a/bl-kernel/admin/views/new-post.php +++ b/bl-kernel/admin/views/new-post.php @@ -23,16 +23,13 @@ echo '
    '; 'placeholder'=>$L->g('Title') )); - echo '
    '; - // Content input - // HTML::formTextarea(array( - // 'name'=>'content', - // 'value'=>'', - // 'class'=>'uk-width-1-1 uk-form-large', - // 'placeholder'=>'' - // )); - echo '
    '; + HTML::formTextarea(array( + 'name'=>'content', + 'value'=>'', + 'class'=>'uk-width-1-1 uk-form-large', + 'placeholder'=>'' + )); // Form buttons echo '
    @@ -76,7 +73,7 @@ echo '
    '; )); echo ''; - + // IMAGES TAB // -------------------------------------------------------------------- echo '
  • '; @@ -185,10 +182,10 @@ $(document).ready(function() { } else { $(".sidebar-view").hide(); - $(view).show(); + $(view).show(); } }); }); - + \ No newline at end of file diff --git a/bl-plugins/quill/languages/en_US.json b/bl-plugins/quill/languages/en_US.json index ac8dc647..aded94fc 100644 --- a/bl-plugins/quill/languages/en_US.json +++ b/bl-plugins/quill/languages/en_US.json @@ -2,6 +2,6 @@ "plugin-data": { "name": "Quill", - "description": "Quill is a free, open source WYSIWYG editor built for the modern web. With its modular architecture and expressive API, it is completely customizable to fit any need." + "description": "" } -} +} \ No newline at end of file From a720b7ea5c79613732a936602551666aca9dbb69 Mon Sep 17 00:00:00 2001 From: Hakim Zulkufli Date: Sun, 30 Apr 2017 20:10:34 +0800 Subject: [PATCH 5/5] Revert "Quill plugin fix." This reverts commit 84aa89a861d6f50572e895e5b851350c13c65e90. --- bl-plugins/quill/plugin.php | 46 +++++++++++-------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/bl-plugins/quill/plugin.php b/bl-plugins/quill/plugin.php index 583b093b..7a7076de 100644 --- a/bl-plugins/quill/plugin.php +++ b/bl-plugins/quill/plugin.php @@ -56,7 +56,7 @@ class pluginQuill extends Plugin { $html .= 'getDbField('autosave')?'checked':'').'>'; $html .= ''; $html .= '
    '; - + $html .= '
    '; $html .= ''; $html .= 'getDbField('spellChecker')?'checked':'').'>'; @@ -72,43 +72,25 @@ class pluginQuill extends Plugin { global $Language; $html = ''; - // Load CSS and JS only on Controllers in array. - if(in_array($layout['controller'], $this->loadWhenController)) - { + if( $this->enabled() ) { $html .= ' '; } return $html; } -} +} \ No newline at end of file