diff --git a/include/functions_entries_admin.inc.php b/include/functions_entries_admin.inc.php index 716d2bfe..f55ece93 100644 --- a/include/functions_entries_admin.inc.php +++ b/include/functions_entries_admin.inc.php @@ -599,6 +599,60 @@ function serendipity_emit_htmlarea_code($item, $jsname, $spawnMulti = false) { var editor = null; var config = null; + + var btn_callbacks = new Array(); + // Serendipity standardized editor functions + function serendipity_editor_getSelected(editor_id) { + var editor = findXinha(editor_id); + if (editor == 'undefined') { + editor = findHtmlArea(editor_id); + } + var html = editor.getSelectedHTML(); + return html; + } + function serendipity_editor_replaceSelected(editor_id, str) { + var editor = findXinha(editor_id); + if (editor == 'undefined') { + editor = findHtmlArea(editor_id); + } + editor.insertHTML(str); + } + function serendipity_editor_getAll(editor_id) { + var editor = findXinha(editor_id); + if (editor == 'undefined') { + editor = findHtmlArea(editor_id); + } + return editor.getEditorContent(); + } + function serendipity_editor_replaceAll(editor_id, str) { + var editor = findXinha(editor_id); + if (editor == 'undefined') { + editor = findHtmlArea(editor_id); + } + editor.setEditorContent(str); + } + // Serendipity standardized editor convenience function + function findXinha(editor_id) { + if (typeof(xinha_editors) != 'undefined') { + for (var editorName in xinha_editors) { + if (editor_id == xinha_editors[editorName]._textArea.name) { + return xinha_editors[editorName]; + } + } + } + return 'undefined'; + } + function findHtmlArea(editor_id) { + if (editor_id == 'serendipity[body]') { + return editorbody; + } else if (editor_id == 'serendipity[extended]') { + return editorextended; + } else if (typeof(htmlarea_editors) != 'undefined') { + return htmlarea_editors[editor_id]; + } + return 'undefined'; + } + function Spawn() { editor = new HTMLArea(""); @@ -613,6 +667,29 @@ function serendipity_emit_htmlarea_code($item, $jsname, $spawnMulti = false) { } ); config.toolbar.push([ "image_selector"]); + config.pageStyle = ''; config.cssFile = ''; @@ -622,15 +699,35 @@ function serendipity_emit_htmlarea_code($item, $jsname, $spawnMulti = false) { "fontsize", "space", "formatblock", "space", "bold", "italic", "underline", "strikethrough", "separator", - "subscript", "superscript", "separator", + "subscript", "superscript", "separator", "copy", "cut", "paste", "space", "undo", "redo" ], [ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator", "lefttoright", "righttoleft", "separator", "orderedlist", "unorderedlist", "outdent", "indent", "separator", "forecolor", "hilitecolor", "separator", - "inserthorizontalrule", "createlink", "insertimage", "image_selector", "inserttable", "htmlmode", "separator", - "popupeditor", "separator", "showhelp", "about" ] + "inserthorizontalrule", "createlink", "insertimage", "image_selector", "inserttable", "htmlmode", "separator", + "popupeditor", "separator", "showhelp", "about" ] + ]; // editor.registerPlugin(SpellChecker); // [SPELLCHECK] editor.generate();