-
-
Notifications
You must be signed in to change notification settings - Fork 60
Xoops Editor TinyMCE 5 #1053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Xoops Editor TinyMCE 5 #1053
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f8753e1
Update Mage version to the lastest version 5.8.2
ForXoops 2291f59
Add prism plugin for display code
ForXoops c0ed6de
Merge branch 'XOOPS:master' into tinymce5
ForXoops 850e9dd
Add prism library for XoopsCode plugin
ForXoops 9ea15ff
Merge branch 'tinymce5' of https://github.com/ForXoops/XoopsCore25 in…
ForXoops File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# tinyMCE5ForXoops | ||
TinyMCE 5 pour xoops |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
/** | ||
* You may not change or alter any portion of this comment or credits | ||
* of supporting developers from this source code or any supporting source code | ||
* which is considered copyrighted (c) material of the original comment or credit authors. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
*/ | ||
|
||
/** | ||
* TinyMCE5 adapter for XOOPS | ||
* | ||
* @category XoopsEditor | ||
* @package TinyMCE5 | ||
* @author Gregory Mage | ||
* @author Taiwen Jiang <[email protected]> | ||
* @copyright 2020 XOOPS Project (http://xoops.org) | ||
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) | ||
* @link http://xoops.org | ||
*/ | ||
|
||
return $config = array( | ||
'name' => 'tinymce5', | ||
'class' => 'XoopsFormTinymce5', | ||
'file' => XOOPS_ROOT_PATH . '/class/xoopseditor/tinymce5/formtinymce5.php', | ||
'title' => _XOOPS_EDITOR_TINYMCE5, | ||
'order' => 5, | ||
'nohtml' => 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
To integrate the css of your theme in tinymce (for an identical rendering in the tinymce window and your theme), | ||
it is necessary to copy the css file from this folder to the root of your theme. | ||
|
||
If you use several css files, it is necessary to include them in tinymce.css (@import url ()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<script>history.go(-1);</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.tinymce5-body { | ||
background-color: white; | ||
color: black; | ||
padding-top: 0px; | ||
padding-left: 5px; | ||
} | ||
|
||
@import url(css-cerulean/bootstrap.min.css); | ||
@import url(style.css); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
<?php | ||
/** | ||
* You may not change or alter any portion of this comment or credits | ||
* of supporting developers from this source code or any supporting source code | ||
* which is considered copyrighted (c) material of the original comment or credit authors. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
*/ | ||
|
||
/** | ||
* TinyMCE5 adapter for XOOPS | ||
* | ||
* @category XoopsEditor | ||
* @package TinyMCE5 | ||
* @author Gregory Mage | ||
* @author Taiwen Jiang <[email protected]> | ||
* @copyright 2020 XOOPS Project (http://xoops.org) | ||
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) | ||
* @link http://xoops.org | ||
*/ | ||
|
||
xoops_load('XoopsEditor'); | ||
|
||
/** | ||
* Class XoopsFormTinymce | ||
*/ | ||
class XoopsFormTinymce5 extends XoopsEditor | ||
{ | ||
public $language; | ||
public $width = '100%'; | ||
public $height = '500px'; | ||
|
||
public $editor; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param array $configs Editor Options | ||
*/ | ||
public function __construct($configs) | ||
{ | ||
$current_path = __FILE__; | ||
if (DIRECTORY_SEPARATOR !== '/') { | ||
$current_path = str_replace(strpos($current_path, "\\\\", 2) ? "\\\\" : DIRECTORY_SEPARATOR, '/', $current_path); | ||
} | ||
|
||
$this->rootPath = '/class/xoopseditor/tinymce5'; | ||
parent::__construct($configs); | ||
$this->configs['elements'] = $this->getName(); | ||
$this->configs['language'] = $this->getLanguage(); | ||
$this->configs['rootpath'] = $this->rootPath; | ||
$this->configs['area_width'] = isset($this->configs['width']) ? $this->configs['width'] : $this->width; | ||
$this->configs['area_height'] = isset($this->configs['height']) ? $this->configs['height'] : $this->height; | ||
|
||
require_once __DIR__ . '/tinymce5.php'; | ||
$this->editor = new TinyMCE($this->configs); | ||
} | ||
|
||
/** | ||
* Renders the Javascript function needed for client-side for validation | ||
* | ||
* I'VE USED THIS EXAMPLE TO WRITE VALIDATION CODE | ||
* http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12616 | ||
* | ||
* @return string | ||
*/ | ||
public function renderValidationJS() | ||
{ | ||
if ($this->isRequired() && $eltname = $this->getName()) { | ||
//$eltname = $this->getName(); | ||
$eltcaption = $this->getCaption(); | ||
$eltmsg = empty($eltcaption) ? sprintf(_FORM_ENTER, $eltname) : sprintf(_FORM_ENTER, $eltcaption); | ||
$eltmsg = str_replace('"', '\"', stripslashes($eltmsg)); | ||
$ret = "\n"; | ||
$ret .= "if ( tinyMCE.get('{$eltname}').getContent() == \"\" || tinyMCE.get('{$eltname}').getContent() == null) "; | ||
$ret .= "{ window.alert(\"{$eltmsg}\"); tinyMCE.get('{$eltname}').focus(); return false; }"; | ||
|
||
return $ret; | ||
} | ||
|
||
return ''; | ||
} | ||
|
||
/** | ||
* get language | ||
* | ||
* @return string | ||
*/ | ||
public function getLanguage() | ||
{ | ||
if ($this->language) { | ||
return $this->language; | ||
} | ||
if (defined('_XOOPS_EDITOR_TINYMCE5_LANGUAGE')) { | ||
$this->language = strtolower(constant('_XOOPS_EDITOR_TINYMCE5_LANGUAGE')); | ||
} else { | ||
$this->language = str_replace('_', '-', strtolower(_LANGCODE)); | ||
if (strtolower(_CHARSET) === 'utf-8') { | ||
$this->language .= '_utf8'; | ||
} | ||
} | ||
|
||
return $this->language; | ||
} | ||
|
||
/** | ||
* prepare HTML for output | ||
* | ||
* @return string HTML | ||
*/ | ||
public function render() | ||
{ | ||
$ret = $this->editor->render(); | ||
$ret .= parent::render(); | ||
|
||
return $ret; | ||
} | ||
|
||
/** | ||
* Check if compatible | ||
* | ||
* @return bool | ||
*/ | ||
public function isActive() | ||
{ | ||
return is_readable(XOOPS_ROOT_PATH . $this->rootPath . '/tinymce5.php'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<script>history.go(-1);</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/** | ||
* TinyMCE adapter for XOOPS | ||
* | ||
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) | ||
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) | ||
* @package class | ||
* @subpackage editor | ||
* @since 2.3.0 | ||
* @author Laurent JEN <[email protected]> | ||
*/ | ||
|
||
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); | ||
|
||
// Add your code here to check access by groups | ||
|
||
return true; |
18 changes: 18 additions & 0 deletions
18
htdocs/class/xoopseditor/tinymce5/include/xoopsemotions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
/** | ||
* TinyMCE adapter for XOOPS | ||
* | ||
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) | ||
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) | ||
* @package class | ||
* @subpackage editor | ||
* @since 2.3.0 | ||
* @author Laurent JEN <[email protected]> | ||
*/ | ||
|
||
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); | ||
|
||
include_once XOOPS_ROOT_PATH . '/modules/system/constants.php'; | ||
// Add your code here to check access by groups | ||
|
||
return true; |
19 changes: 19 additions & 0 deletions
19
htdocs/class/xoopseditor/tinymce5/include/xoopsimagemanager.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
/** | ||
* TinyMCE adapter for XOOPS | ||
* | ||
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) | ||
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) | ||
* @package class | ||
* @subpackage editor | ||
* @since 2.3.0 | ||
* @author Laurent JEN <[email protected]> | ||
*/ | ||
|
||
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); | ||
|
||
// check categories readability by group | ||
$groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(XOOPS_GROUP_ANONYMOUS); | ||
$imgcat_handler = xoops_getHandler('imagecategory'); | ||
|
||
return !(count($imgcat_handler->getList($groups, 'imgcat_read', 1)) == 0); |
21 changes: 21 additions & 0 deletions
21
htdocs/class/xoopseditor/tinymce5/include/xoopsmlcontent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
/** | ||
* TinyMCE adapter for XOOPS | ||
* | ||
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) | ||
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) | ||
* @package class | ||
* @subpackage editor | ||
* @since 2.3.0 | ||
* @author Laurent JEN <[email protected]> | ||
*/ | ||
|
||
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); | ||
|
||
// Xlanguage | ||
if ($GLOBALS['module_handler']->getByDirname('xlanguage') && defined('XLANGUAGE_LANG_TAG')) { | ||
return true; | ||
} | ||
|
||
// Easiest Multi-Language Hack (EMLH) | ||
return defined('EASIESTML_LANGS') && defined('EASIESTML_LANGNAMES'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/** | ||
* TinyMCE adapter for XOOPS | ||
* | ||
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) | ||
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) | ||
* @package class / xoopseditor | ||
* @subpackage tinymce | ||
* @since 2.3.0 | ||
* @author Laurent JEN <[email protected]> | ||
*/ | ||
|
||
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); | ||
|
||
// Add your code here to check access by groups | ||
|
||
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<script>history.go(-1);</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* You may not change or alter any portion of this comment or credits | ||
* of supporting developers from this source code or any supporting source code | ||
* which is considered copyrighted (c) material of the original comment or credit authors. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
*/ | ||
|
||
/** | ||
* TinyMCE5 adapter for XOOPS | ||
* | ||
* @category XoopsEditor | ||
* @package TinyMCE5 | ||
* @author Gregory Mage | ||
* @author Taiwen Jiang <[email protected]> | ||
* @copyright 2020 XOOPS Project (http://xoops.org) | ||
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) | ||
* @link http://xoops.org | ||
*/ | ||
// Name of the editor | ||
define('_XOOPS_EDITOR_TINYMCE5', 'TinyMCE5'); | ||
// The value must be the same as /tinymce/jscripts/langs/your_language_code, for example, "en" for English, "fr" for French | ||
// For details, check http://tinymce.moxiecode.com/download_i18n.php | ||
define('_XOOPS_EDITOR_TINYMCE_LANGUAGE5', 'en'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* You may not change or alter any portion of this comment or credits | ||
* of supporting developers from this source code or any supporting source code | ||
* which is considered copyrighted (c) material of the original comment or credit authors. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
*/ | ||
|
||
/** | ||
* TinyMCE5 adapter for XOOPS | ||
* | ||
* @category XoopsEditor | ||
* @package TinyMCE5 | ||
* @author Gregory Mage | ||
* @author Taiwen Jiang <[email protected]> | ||
* @copyright 2020 XOOPS Project (http://xoops.org) | ||
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) | ||
* @link http://xoops.org | ||
*/ | ||
// Name of the editor | ||
define('_XOOPS_EDITOR_TINYMCE5', 'TinyMCE5'); | ||
// The value must be the same as /tinymce/jscripts/langs/your_language_code, for example, "en" for English, "fr" for French | ||
// For details, check http://tinymce.moxiecode.com/download_i18n.php | ||
define('_XOOPS_EDITOR_TINYMCE5_LANGUAGE', 'fr'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<script>history.go(-1);</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* You may not change or alter any portion of this comment or credits | ||
* of supporting developers from this source code or any supporting source code | ||
* which is considered copyrighted (c) material of the original comment or credit authors. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
*/ | ||
|
||
/** | ||
* TinyMCE5 adapter for XOOPS | ||
* | ||
* @category XoopsEditor | ||
* @package TinyMCE5 | ||
* @author Gregory Mage | ||
* @copyright 2020 XOOPS Project (http://xoops.org) | ||
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) | ||
* @link http://xoops.org | ||
*/ | ||
return array( | ||
'theme' => 'silver', | ||
'mode' => 'exact', | ||
'plugins' => 'advlist,anchor,autolink,charmap,code,hr,image,imagetools,lists,link,media,preview,searchreplace,table,xoopsemoticons,xoopscode,xoopsimagemanager', | ||
'toolbar' => 'undo redo | styleselect | bold italic | forecolor backcolor removeformat | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | table tabledelete | insertfile image media link | hr | xoopsemoticons xoopscode | code', | ||
'image_title' => true, | ||
'table_use_colgroups' => true, | ||
/*'image_class_list' => [ | ||
{title: 'None', value: ''}, | ||
{title: 'Width auto', value: 'col-12'} | ||
],*/ | ||
//'image_advtab' => true, dot work !! | ||
// This option prevents tinyeditor from deleting empty tags | ||
'valid_elements' => '*[*]', | ||
// Use of relative urls? | ||
'relative_urls' => false, | ||
'body_class' => 'tinymce5-body', | ||
'menubar' => false | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
body.mceContentBody { | ||
margin: 0; | ||
padding: 0; | ||
background: #fff none; | ||
color: #000; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IS it possible to read the css file automatically with XOOPS smarty ?
Cause if someone use dark theme, css-cerulean is not the good css file !
But Strange cause I used dark theme (slate theme) and the background, is the same dark background, not the cerulean background color.
Strange but it works ! ;-)
Bonnes vacances, Nicolas !