/* Import plugin specific language pack */ tinyMCE.importPluginLanguagePack('wordpress', ''); function TinyMCE_wordpress_initInstance(inst) { if (!tinyMCE.settings['wordpress_skip_plugin_css']) tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/wordpress/wordpress.css"); } function TinyMCE_wordpress_getControlHTML(control_name) { switch (control_name) { case "wordpress": return ''; } return ""; } function TinyMCE_wordpress_parseAttributes(attribute_string) { var attributeName = ""; var attributeValue = ""; var withInName; var withInValue; var attributes = new Array(); var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g'); if (attribute_string == null || attribute_string.length < 2) return null; withInName = withInValue = false; for (var i=0; i'; tinyMCE.execCommand("mceInsertContent",true,html); tinyMCE.selectedInstance.repaint(); return true; case "mcewordpresspage": var flag = ""; var template = new Array(); var inst = tinyMCE.getInstanceById(editor_id); var focusElm = inst.getFocusElement(); // Is selection a image if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") { flag = getAttrib(focusElm, 'name'); if (flag != 'mce_plugin_wordpress_page') // Not a wordpress return true; action = "update"; } html = '' + ''; tinyMCE.execCommand("mceInsertContent",true,html); tinyMCE.selectedInstance.repaint(); return true; } // Pass to next handler in chain return false; } function TinyMCE_wordpress_cleanup(type, content) { switch (type) { case "insert_to_editor": var startPos = 0; // Parse all tags and replace them with images while ((startPos = content.indexOf('', startPos)) != -1) { // Insert image var contentAfter = content.substring(startPos + 11); content = content.substring(0, startPos); content += ' tags and replace them with images while ((startPos = content.indexOf('', startPos)) != -1) { // Insert image var contentAfter = content.substring(startPos + 15); content = content.substring(0, startPos); content += ' var startPos = -1; while ((startPos = content.indexOf('', startPos); var attribs = TinyMCE_wordpress_parseAttributes(content.substring(startPos + 4, endPos)); if (attribs['class'] == "mce_plugin_wordpress_more") { endPos += 2; var embedHTML = ''; // Insert embed/object chunk chunkBefore = content.substring(0, startPos); chunkAfter = content.substring(endPos); content = chunkBefore + embedHTML + chunkAfter; } if (attribs['class'] == "mce_plugin_wordpress_page") { endPos += 2; var embedHTML = ''; // Insert embed/object chunk chunkBefore = content.substring(0, startPos); chunkAfter = content.substring(endPos); content = chunkBefore + embedHTML + chunkAfter; } } // Handle TinyMCE weirdness without messing up the core //alert("Content before TinyMCE_wordpress_cleanup\n\n'"+content+"'"); // Strip any trailing
and whitespace. content = content.replace(new RegExp('
[ \t]*$', ''), ''); //alert("Content after TinyMCE_wordpress_cleanup\n\n'"+content+"'"); break; } // Pass through to next handler in chain return content; } function TinyMCE_wordpress_handleNodeChange(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) { function getAttrib(elm, name) { return elm.getAttribute(name) ? elm.getAttribute(name) : ""; } tinyMCE.switchClassSticky(editor_id + '_wordpress_more', 'mceButtonNormal'); tinyMCE.switchClassSticky(editor_id + '_wordpress_page', 'mceButtonNormal'); if (node == null) return; do { if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'class').indexOf('mce_plugin_wordpress_more') == 0) tinyMCE.switchClassSticky(editor_id + '_wordpress_more', 'mceButtonSelected'); if (node.nodeName.toLowerCase() == "img" && getAttrib(node, 'class').indexOf('mce_plugin_wordpress_page') == 0) tinyMCE.switchClassSticky(editor_id + '_wordpress_page', 'mceButtonSelected'); } while ((node = node.parentNode)); return true; }