Change to CKEDITOR from NICEDIT

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
User avatar
ronwill
Veteran Member
Posts: 228
Joined: 2015-08-08 10:12
Location: Cheltenham UK +Weatherford USA

Change to CKEDITOR from NICEDIT

Post by ronwill » 2018-08-05 23:08

Sketcheditor.png
Sketcheditor.png (38.62 KiB) Viewed 2708 times
If you should want to change to another html editor (you can resize images etc. in this one), then this is how I do it - hope I've explained it clearly:

In the pages hook file:>>>>>
<?php

function XXXXX_header($contentType, $memberInfo, &$args){
$header='';

switch($contentType){
case 'tableview':
$header='';
break;

case 'detailview':
/* ADD following line, change /standard to option that suits your needs */
$header='<%%HEADER%%><script src="https://cdn.ckeditor.com/4.8.0/standard ... "></script>';
break;
/* There are 5 versions: /basic /standard /standard-all /full /full-all */
/* Visit:
https://ckeditor.com/cke4/presets-all to see differences */
?>

In the pages pagetemplate.dv file:>>>

Add to bottom of page:

<script> CKEDITOR.replace( 'text' );</script>

Where the reference to 'text' is the name of the text area you want to apply the ckeditor to, below is the text area for this example
taken from the pagetemplate.dv file:

<div class="form-group">
<label for="text" class="control-label col-lg-2">Article</label>
<div class="col-lg-9">
<textarea class="form-control" name="text" id="text" rows="5"><%%VALUE(text)%%></textarea>
</div>
</div>

Make sure you have it set as a 'text area' not varchar or 'rich(html)text' Note this file gets overwritten on generating application.

ALTERNATIVE METHOD, PLACE: <script> CKEDITOR.replace( 'text' );</script>
in hooks/footer-extras.php instead of the pagetemplate.dv file
This is best way if you don't want to write protect the pagetemplate.dv file as it gets over written on generating the appgini file.
Note this will apply CKEDITOR to all 'text' named text areas of all pages that footer-extras is applied to so avoid if required by using
unique text field names, adding respective script for each text area as required.

You don't need to make any other changes, nor do you need to remove standard NICEDIT (can use either text editor as/where you want to).

Hope that helps someone (newbies etc.) just trying to give back as always receiving help in this great forum

Cheers, Ron

Sketcheditor.png
Sketcheditor.png (38.62 KiB) Viewed 2708 times
Ron - Gloucestershire, UK: AppGini Pro V 23.15 Rev 1484 - LOVING IT!
Plugins: Mass Update + Search Page Maker + Summary Reports + Calendar + Messages
Bizzworxx: AppGiniHelper + Inline Detail View
Alejandro Landini: To-Do List + MPI + TV Field Editor
Other: Udemy Course

Post Reply