Added possibility to customize the xinha editor through a my_custom.js
file. See http://board.s9y.org/viewtopic.php?f=4&t=15286
This commit is contained in:
@@ -3,6 +3,12 @@
|
|||||||
Version 1.5 ()
|
Version 1.5 ()
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
* Added ability to specify a custom Xinha config. Either supply
|
||||||
|
a 'my_custom.js' file inside the template directory, or if
|
||||||
|
omitted, the default htmlarea/my_custom.js is used. With this
|
||||||
|
you can overwrite the plugins and buttons of all Xinha instances.
|
||||||
|
See the mentioned default file for usage. (garvinhicking)
|
||||||
|
|
||||||
* Upgrade to Smarty 2.6.26
|
* Upgrade to Smarty 2.6.26
|
||||||
|
|
||||||
* Removed inline styles of the s9y media insertion, they will now
|
* Removed inline styles of the s9y media insertion, they will now
|
||||||
|
44
htmlarea/my_custom.js
Normal file
44
htmlarea/my_custom.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// This JavaScript file can be customized.
|
||||||
|
// It is actually NOT like the my_config.js file of the Xinha Documentation.
|
||||||
|
// Instead, the JS function 's9y_xinha' is called just before the
|
||||||
|
// Xinha editor is created. So you are able to OVERWRITE Toolbars,
|
||||||
|
// plugins etc. with your own versions.
|
||||||
|
|
||||||
|
// You can also place a my_custom.js file inside a template directory,
|
||||||
|
// which will take precedence over the htmlarea/my_custom.js file.
|
||||||
|
|
||||||
|
// All of the functionality is currently only a stub, so you need
|
||||||
|
// to insert/uncomment, what you want it to do.
|
||||||
|
|
||||||
|
function s9y_xinha(xinha_editor) {
|
||||||
|
|
||||||
|
/* EXAMPLE USAGE ***
|
||||||
|
|
||||||
|
xinha_editor.registerPlugin('CharacterMap');
|
||||||
|
xinha_editor.registerPlugin('ContextMenu');
|
||||||
|
|
||||||
|
xinha_editor.config.pageStyleSheets = [ _editor_url + 'custom.css' ];
|
||||||
|
xinha_editor.config.fontsize = {
|
||||||
|
'1 (8pt)' : '1',
|
||||||
|
'2 (10pt)' : '1',
|
||||||
|
}
|
||||||
|
|
||||||
|
// s9y image selection is called: 'image_selector'
|
||||||
|
// If you use any event plugins that provide custom toolbars, and you are customizing xinha,
|
||||||
|
// you need to take care of inserting those custom toolbar buttons yourself!
|
||||||
|
xinha_editor.config.toolbar = [
|
||||||
|
[ "fontname", "space",
|
||||||
|
"fontsize", "space",
|
||||||
|
"formatblock", "space",
|
||||||
|
"bold", "italic", "underline", "strikethrough", "separator",
|
||||||
|
"subscript", "superscript", "separator",],
|
||||||
|
|
||||||
|
[ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
|
||||||
|
"orderedlist", "unorderedlist", "outdent", "indent", "separator",
|
||||||
|
"forecolor", "hilitecolor", "separator",
|
||||||
|
"inserthorizontalrule", "createlink", "insertimage", "image_selector", "inserttable", "htmlmode", "separator",
|
||||||
|
"popupeditor", "separator", "showhelp", "about" ]
|
||||||
|
];
|
||||||
|
* END OF EXAMPLE USAGE ***/
|
||||||
|
|
||||||
|
}
|
@@ -554,6 +554,11 @@ function serendipity_emit_htmlarea_code($item, $jsname, $spawnMulti = false) {
|
|||||||
$xinha = false;
|
$xinha = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$xinha_custom = serendipity_getTemplateFile('my_custom.js', 'serendipityHTTPPath');
|
||||||
|
if (empty($xinha_custom)) {
|
||||||
|
$xinha_custom = 'htmlarea/my_custom.js';
|
||||||
|
}
|
||||||
|
|
||||||
if (!$init) {
|
if (!$init) {
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -562,8 +567,12 @@ function serendipity_emit_htmlarea_code($item, $jsname, $spawnMulti = false) {
|
|||||||
_editor_skin = "silva";
|
_editor_skin = "silva";
|
||||||
var editorref = '';
|
var editorref = '';
|
||||||
</script>
|
</script>
|
||||||
<?php if ($xinha) { ?><script type="text/javascript" src="htmlarea/XinhaCore.js"></script>
|
<?php if ($xinha) { ?>
|
||||||
<?php } else { ?><script type="text/javascript" src="htmlarea/htmlarea.js"></script>
|
<script type="text/javascript" src="htmlarea/XinhaCore.js"></script>
|
||||||
|
<!-- This file can contain user customizations -->
|
||||||
|
<script type="text/javascript" src="<?= $xinha_custom; ?>"></script>
|
||||||
|
<?php } else { ?>
|
||||||
|
<script type="text/javascript" src="htmlarea/htmlarea.js"></script>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
@@ -732,6 +741,11 @@ function serendipity_emit_htmlarea_code($item, $jsname, $spawnMulti = false) {
|
|||||||
} ?>
|
} ?>
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (typeof('s9y_xinha') != 'undefined') {
|
||||||
|
s9y_xinha(editor<?php echo $jsname; ?>);
|
||||||
|
}
|
||||||
|
|
||||||
// editor<?php echo $jsname; ?>.registerPlugin(SpellChecker); // [SPELLCHECK]
|
// editor<?php echo $jsname; ?>.registerPlugin(SpellChecker); // [SPELLCHECK]
|
||||||
editor<?php echo $jsname; ?>.generate();
|
editor<?php echo $jsname; ?>.generate();
|
||||||
editor<?php echo $jsname; ?>._textArea.className = 'serendipity_entry';
|
editor<?php echo $jsname; ?>._textArea.className = 'serendipity_entry';
|
||||||
|
Reference in New Issue
Block a user