proposed change for selectable bbcode/html editor

ruud
ruud
  • ruud
  • 10 months ago
Hi,

made some adjustments in cjblog to better fit our needs. Would really like to see some of these adjustments to be part of the distributed package: this extends the functionality of the component and saves me the redoing (and retesting) of the changes manually every time I update cjblog / cjlib :woohoo:

use case:
Currently cjblog uses bbcode editor for the about text, my bloggers (50+) are wondering why the default editor is not used (the same they use for creating their blogs). CJBlog has this functionality but a few changes are needed to make the html editor the default editor for the About Me text..

proposed change:
Make the used editor configurable so the administrator can in the back-end select between the bbcode of html editor for the About Me text.

Changes:
based on cjblog version 1.2.2, cjlib version 2.0.20

in file .components/com_cjblog/views/profile/tmpl/default.php
add:
$params = JComponentHelper::getParams(CJBLOG);
$editor = $params->get('about_editor', 'wysiwygbb');

replace

<p class="user-about">
<?php echo CJFunctions::parse_html($this->profile['about'], false, true);?>
</p>

with

<p class="user-about">
<?php if($editor == "wysiwygbb") {
echo CJFunctions::parse_html($this->profile['about'], false, true);
} else {
echo CJFunctions::parse_html($this->profile['about'], false, false, false);
}?>
</p>

replace

<?php echo CJFunctions::load_editor('wysiwygbb', 'user-about', 'user-about', $this->profile['about'], '10', '40', '100%', '250px', 'form-control', 'width: 100%;', true); ?>

with

<?php echo CJFunctions::load_editor($editor, 'user-about', 'user-about', $this->profile['about'], '10', '40', '100%', '250px', 'form-control', 'width: 100%;', true); ?>


in file ./administrator/language/en-GB/en-GB.com_cjblog.ini
add
COM_CJBLOG_ABOUT_EDITOR="About text Editor"
COM_CJBLOG_ABOUT_EDITOR_DESC="Select the Editor to be used to edit the about text. Default = BBcode editor. 'User profile selected (HTML)' is the editor the user has selected in his/her Joomla user details."
COM_CJBLOG_WYSIWYGBB="BBcode editor (Default)"
COM_CJBLOG_WYSIWYG="User profile selected (HTML)"


in file./administrator/components/com_cjblog/config.xml
after > field display_messages add

<field name="about_editor" type="radio" class="btn-group" label="COM_CJBLOG_ABOUT_EDITOR" description="COM_CJBLOG_ABOUT_EDITOR_DESC" default="wysiwygbb">
<option value="wysiwygbb">COM_CJBLOG_WYSIWYGBB</option>
<option value="wysiwyg">COM_CJBLOG_WYSIWYG</option>
</field>

in file ./components/com_cjblog/views/users/tmpl/default.php
add
$params = JComponentHelper::getParams(CJBLOG);
$editor = $params->get('about_editor', 'wysiwygbb');

replace

<div class="muted padbottom-5">
<?php echo CJFunctions::substrws(CJFunctions::parse_html($user['about'], false, true));?>
</div>

with

<div class="muted padbottom-5">
<?php if($editor == "wysiwygbb") {
echo CJFunctions::substrws(CJFunctions::parse_html($user['about'], false, true));
} else {
echo CJFunctions::substrws(CJFunctions::parse_html($user['about'], false, false, false));
}?>
</div>

in file ./media/com_cjblog/js/cjblog.min.js
replace

$('.btn-save-about').click(function()

with

$('.btn-save-about').click(function()
if(typeof tinymce != 'undefined'){
tinymce.triggerSave(); /* omit parameters true, true because of jce save fix */
}

Access to viewing replies is restricted.
Showing 4 of 4 replies
You do not have permissions for replying to this topic.
Loading...
Confirm delete? This action is irreversible and the data will be deleted permanently. Do you want to continue? Confirm Add New Delete Unpublish Cancel Import Uninstall The selected item successfully deleted.
Shondalai