HotEditor - редактор html и bbc страниц

Автор esterny, 16 января 2010, 12:40:39

« назад - далее »

0 Пользователи и 1 гость просматривают эту тему.

esterny

Вот нашла редактор для форума с полным описанием.
Демо

Установка

Открыть

Themes/default/Display.template.php
Темы / по умолчанию / Display.template.php

найти

<textarea cols="75" rows="7" style="width: 95%; height: 100px;" name="message" tabindex="1"></textarea><br />

Изменить на

<!--//HotEditor MOD - Quick Reply -->
<textareastyle="visibility:hidden;position:absolute;top:-20;left:-20;width:1px;height:1px"cols="75" rows="7" id="message" name="message"tabindex="1"></textarea>
<style type="text/css">@import url(richedit/styles/office2007/style.css);</style>
<script language="JavaScript" type="text/javascript" src="richedit/editor.js?version=4.2"></script>
<script language="JavaScript" type="text/javascript">
var getdata =document.getElementById("message").value;
Instantiate("min","editor", getdata , "100%", "150px");
function get_hoteditor_data(){
if (HTML_ON == "no"){
alert ("Please uncheck the HTML checkbox");
return false;
}
else{
setCodeOutput();
var bbcode_output=document.getElementById("hoteditor_bbcode_ouput_editor").value;//Output to BBCode
document.getElementById("message").value = bbcode_output;
}
}
</script><br />
<!--//HotEditor MOD Quick Reply -->


найти

var smf_template_body_edit = \'<div id="error_box"style="padding: 4px; color: red;"></div><textareaclass="editor" name="message" rows="12" style="width: 94%;margin-bottom: 10px;">%body%</textarea><br /><inputtype="hidden" name="sc" value="', $context['session_id'], '"/><input type="hidden" name="topic" value="',$context['current_topic'], '" /><input type="hidden" name="msg"value="%msg_id%" /><div style="text-align: center;"><inputtype="submit" name="post" value="', $txt[10], '" onclick="returnmodify_save(\\\'' . $context['session_id'] . '\\\');" accesskey="s"/>&nbsp;&nbsp;', $context['show_spellchecking'] ? '<inputtype="button" value="' . $txt['spell_check'] . '"onclick="spellCheck(\\\'quickModForm\\\', \\\'message\\\');"/>&nbsp;&nbsp;' : '', '<input type="submit" name="cancel"value="', $txt['modify_cancel'], '" onclick="return modify_cancel();"/></div>\';

Изменить на

//HotEditor MOD QUICK EDIT / MODIFY POST
var edit_session_id = "', $context['session_id'], '";
var smf_template_body_edit = \'<div id="error_box" style="padding:4px; color: red;"></div><iframe frameborder=0 width=100%height=550px src="hoteditor_quickedit.html" scrolling=notarget="_top"></iframe><textareastyle="visibility:hidden;width:1px;height:1px" id="message"class="editor" name="message" rows="12" style="width: 94%;margin-bottom: 10px;">%body%</textarea><input type="hidden"name="sc" value="', $context['session_id'], '" /><inputtype="hidden" name="topic" value="', $context['current_topic'], '"/><input type="hidden" name="msg" value="%msg_id%" /><divstyle="text-align: center;"><input type="hidden" name="post"value="', $txt[10], '" onclick="return modify_save(\\\'' .$context['session_id'] . '\\\');" accesskey="s"/>&nbsp;&nbsp;', $context['show_spellchecking'] ? '<inputtype="button" value="' . $txt['spell_check'] . '"onclick="spellCheck(\\\'quickModForm\\\', \\\'message\\\');"/>&nbsp;&nbsp;' : '', '<input type="hidden" name="cancel"value="', $txt['modify_cancel'], '" onclick="return modify_cancel();"/></div>\';


открыть

Themes/default/Post.template.php
Темы / по умолчанию / Post.template.php

найти

function template_postbox(&$message)

Изменить на

// This function displays all the stuff you'd expect to see with a message box, the box, BBC buttons and of course smileys.
function template_postbox(&$message)
{
global $context, $settings, $options, $txt, $modSettings;

// Now start printing all of the smileys.
if (!empty($context['smileys']['postform']))
{
echo '
<tr>
<td align="right"></td> 


Найти

replaceText(text, document.forms.postmodify.message);

Изменить на

//HotEditor MOD
if(editor_type=="0"){//BBCode Editor
WriteTEXT(text,"editor");
}
else{//WYSIWYG Editor
text=BBCodeToHTML(text);
WriteHTML(text,"editor");
}


Найти

<input type="submit" name="post" value="',$context['submit_label'], '" tabindex="', $context['tabindex']++, '"onclick="return submitThisOnce(this);" accesskey="s" />
<input type="submit" name="preview" value="', $txt[507], '"tabindex="', $context['tabindex']++, '" onclick="return event.ctrlKey|| previewPost();" accesskey="p" />';


Заменить на

<input type="submit" name="post" value="',$context['submit_label'], '" tabindex="', $context['tabindex']++, '"onclick="return get_hoteditor_data();submitThisOnce(this);"accesskey="s" />
<input type="submit" name="preview"value="', $txt[507], '" tabindex="', $context['tabindex']++, '"onclick="return event.ctrlKey || get_hoteditor_data();previewPost();"accesskey="p" />';


Открыть

Themes/default/Profile.template.php

Найти

echo '
</td>
<td>
<textareaclass="editor" onkeyup="calcCharLeft();" name="signature" rows="5"cols="50">', $context['member']['signature'],'</textarea><br />';


Заменить на

$sign_message=$context['member']['signature'];
print<<<HTML_CODE
</td>
<td>
<textareastyle="visibility:hidden;position:absolute;top:-20;left:-20;width:1px;height:1px"class="editor" id="signature" name="signature" rows="5"cols="50">$sign_message</textarea><br />
<style type="text/css">@import url(richedit/styles/office2007/style.css);</style>
<script language="JavaScript" type="text/javascript" src="richedit/editor.js?version=4.2"></script>
<script language="JavaScript" type="text/javascript">
var getdata =document.getElementById("signature").value;
getdata=getdata.replace(/\[S\]/gi,"[STRIKE]");
getdata=getdata.replace(/\[\/S\]/gi,"[/STRIKE]");
Instantiate("min","editor", getdata , "100%", "200px");
function get_hoteditor_data(){
if (HTML_ON == "no"){
alert ("Please uncheck the HTML checkbox");
return false;
}
else{
setCodeOutput();
var bbcode_output=document.getElementById("hoteditor_bbcode_ouput_editor").value;//Output to BBCode
document.getElementById("signature").value = bbcode_output;
}
}
</script>
HTML_CODE;


Найти

<form action="', $scripturl, '?action=profile2" method="post"accept-charset="', $context['character_set'], '" name="creator"id="creator" enctype="multipart/form-data">

Заменить на

<form onSubmit="return get_hoteditor_data();" action="',$scripturl, '?action=profile2" method="post" accept-charset="',$context['character_set'], '" name="creator" id="creator"enctype="multipart/form-data">

Открыть

Themes/default/script.js

Найти

function submitonce(theform)
{
smf_formSubmitted = true;
}


Изменить на

[code]function submitonce(theform)
{
//HotEditor MOD
get_hoteditor_data();

smf_formSubmitted = true;
}
[/code]

Найти

[size=1.35em]// Replaces the currently selected text with the passed text.
function replaceText(text, textarea)
{
// Attempt to create a text range (IE).
if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange)
{
var caretPos = textarea.caretPos;

caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
caretPos.select();
}[/size] 


Изменить на

/[size=1.35em]/ Replaces the currently selected text with the passed text.
function replaceText(text, textarea)
{
if(editor_type==1){
text=BBCodeToHTML(text);
WriteHTML(text,"editor");
}
else{
WriteTEXT(text,"editor");
}
}[/size]


Открыть

Sources/Subs.php

Найти

[size=1.35em]$codes = array([[/size]/code]

Заменить на

[code]//HotEditor MOD
array(
'tag' => 'highlight',
'type' => 'unparsed_equals',
'test' => '(#[\da-fA-F]{3}|#[\da-fA-F]{6}|[A-Za-z]{1,12})\]',
'before' => '<span style="background-color: $1;">',
'after' => '</span>',
),
array(
'tag' => 'strike',
'before' => '<strike>',
'after' => '</strike>',
),


Проблема только в том, где скачать сам мод hoteditor.4.2_smf.1.1.2.zip .

Сам редактор можно скачать отсюда
скачать

vladok

Харе кришна, май либер зольдат...