PDA

View Full Version : سوال: editor-Tinymce



bahareh-m
پنج شنبه 09 اردیبهشت 1389, 12:12 عصر
سلام مشکل من کار با Tiinymce است . لطفا راهنمایی بفرمایید چگونه و کجای صفحه می شود از آن استفاده کارد . متشکرم

Vahid_moghaddam
پنج شنبه 09 اردیبهشت 1389, 12:23 عصر
http://tinymce.moxiecode.com/examples/full.php

bahareh-m
پنج شنبه 09 اردیبهشت 1389, 14:01 عصر
با تشکر از راهنماییها ولی این error میگیرد
unknown server tag می دهد.

از این لینک چگونه باید استفاده کرد؟ چون من تمام فایلهای مربوط را دانلود کردم ولی این خطا را می دهد.
http://tinymce.moxiecode.com/examples/full.php

Vahid_moghaddam
پنج شنبه 09 اردیبهشت 1389, 14:22 عصر
میشه کد aspx رو بذارید؟ شما در المانی از Tag غیر مجاز استفاده کردید.

Vahid_moghaddam
پنج شنبه 09 اردیبهشت 1389, 14:40 عصر
از آدرس زیر فایل tinymce_3_3_4.zip رو دانلود کنید

http://tinymce.moxiecode.com/download.php

بعد از باز کردن این فایل شما باید فولدر زیر رو در فولدر وب سایت کپی کنید

jscripts

در فولدر jscripts فولدری با نام tiny_mce قرار داره. برای کار با این ادیتور فایل tiny_mce.js (در پوشه tiny_mce) باید به صفحه لینک بشه.
یه نمونه کد:



<%@ Page Language="C#" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

<script src="js/tiny_mce/tiny_mce.js" type="text/javascript"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode: "textareas",
theme: "advanced",
theme : "advanced",
skin : "o2k7",
skin_variant : "black",
plugins: "pagebreak,style,layer,table,save,advhr,advimage,ad vlink,emotions,iespell,inlinepopups,insertdatetime ,preview,media,searchreplace,print,contextmenu,pas te,directionality,fullscreen,noneditable,visualcha rs,nonbreaking,xhtmlxtras,template,wordcount,advli st,autosave",

// Theme options
theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethr ough,|,justifyleft,justifycenter,justifyright,just ifyfull,styleselect,formatselect,fontselect,fontsi zeselect",
theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replac e,|,bullist,numlist,|,outdent,indent,blockquote,|, undo,redo,|,link,unlink,anchor,image,cleanup,help, code,|,insertdate,inserttime,preview,|,forecolor,b ackcolor",
theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,su p,|,charmap,emotions,iespell,media,advhr,|,print,| ,ltr,rtl,|,fullscreen",
theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,st yleprops,|,cite,abbr,acronym,del,ins,attribs,|,vis ualchars,nonbreaking,template,pagebreak,restoredra ft",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "bottom",
theme_advanced_resizing: true,

// Example content CSS (should be your site CSS)
content_css: "css/content.css",

// Drop lists for link/image/media/template dialogs
template_external_list_url: "lists/template_list.js",
external_link_list_url: "lists/link_list.js",
external_image_list_url: "lists/image_list.js",
media_external_list_url: "lists/media_list.js",

// Style formats
style_formats: [
{ title: 'Bold text', inline: 'b' },
{ title: 'Red text', inline: 'span', styles: { color: '#ff0000'} },
{ title: 'Red header', block: 'h1', styles: { color: '#ff0000'} },
{ title: 'Example 1', inline: 'span', classes: 'example1' },
{ title: 'Example 2', inline: 'span', classes: 'example2' },
{ title: 'Table styles' },
{ title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
],

// Replace values for the template plugin
template_replace_values: {
username: "Some User",
staffid: "991234"
}
});

function show() {
var div = document.getElementById('div');
var mce = tinyMCE.get('elm1');
div.innerHTML = mce.getContent();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">

</textarea>
</div>
<input id="Button1" type="button" value="button" onclick="show();"/>
<div id="div">

</div>
</form>
</body>
</html>


در کد بالا فولدر tiny_mce در فولدر js کپی شده. با دستور tinyMCE.init المان textarea به شکل ادیتور در میاد.

bahareh-m
پنج شنبه 09 اردیبهشت 1389, 14:41 عصر
آقای مقدم لطفا کامل تر توضیح دهید. با تشکر

Vahid_moghaddam
پنج شنبه 09 اردیبهشت 1389, 14:50 عصر
شما با کدوم قسمت مشکل دارید؟ فایل ها رو همونطور که گفتم توی فولدر سایتتون کپی کنید. این فایل ها شامل توابع جاوا اسکریپت و style ها و ... مورد نیاز tinyMCE هست. با اجرای دستور tinyMCE.init که یه نمونه اش رو در کدی که گذاشتم می بینید، textarea تبدیل به ادیتور می شه. textarea یه کنترل html هست.
برای بدست اوردن متن داخل ادیتور هم می تونید از دستور زیر استفاده کنید (در کلاینت):


var content=tinyMCE.get('elm1');که elm1 در بالا id برای textarea هست:



<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">

</textarea>
بعد از بدست آوردن محتویات ادیتور می تونید اون رو به سرور بفرستید.

شکل های دیگه دستور tinyMCE.init در قسمت مثال های سایت tinyMCE وجود داره.

bahareh-m
پنج شنبه 09 اردیبهشت 1389, 17:38 عصر
با تشکر مجدد
تمام مراحل را انجام دادم خطای زیر ارسال میشود:
Required installPath setting is missing, add it to your web.config. You can also add it directly to your tinymce:TextArea element using InstallPath but the web.config method is recommended since it allows you to switch over to gzip compression.

Vahid_moghaddam
پنج شنبه 09 اردیبهشت 1389, 18:05 عصر
شما از ورژن دات نت tinyMCE استفاده می کنید؟

bahareh-m
پنج شنبه 09 اردیبهشت 1389, 18:11 عصر
این فایل را من دانلود کردم
Main package.
tinymce_3_3_4.zip (https://sourceforge.net/projects/tinymce/files/TinyMCE/3.3.4/tinymce_3_3_4.zip/download)

bahareh-m
پنج شنبه 09 اردیبهشت 1389, 18:16 عصر
من این فایل را دانلود کردم
Main package

tinymce_3_3_4.zip (https://sourceforge.net/projects/tinymce/files/TinyMCE/3.3.4/tinymce_3_3_4.zip/download)

Vahid_moghaddam
پنج شنبه 09 اردیبهشت 1389, 18:59 عصر
کد aspx رو بذارید

Peyman.Gh
پنج شنبه 09 اردیبهشت 1389, 19:36 عصر
پیشنهاد میدم از FCKeditor استفاده نمایید راحت تر میتونید باهاش کار کنید.

Vahid_moghaddam
پنج شنبه 09 اردیبهشت 1389, 20:21 عصر
خطایی که برای شما پیش میاد واسه وقتیه که دارید از پکیج دات نت استفاده می کنید و قسمت زیر رو در web.config تعریف نکردید:



<TinyMCE installPath="js/tiny_mce" mode="src">
<!-- Default settings for all TinyMCE instances -->
<globalSettings>
<add key="relative_urls" value="false" />
</globalSettings>

<!-- Compressor specific settings -->
<gzipCompressor
enabled="yes"
diskCache="no"
cachePath="c:\temp"
expiresOffset="10d"
/>
</TinyMCE>


احتمالا tag مربوط به ادیتور در صفحه شما شبیه به tag زیر هست:



<tinymce:TextArea ID="TextArea1" theme="advanced" runat="server" />


اینطوره؟

mohsen.nsb44
جمعه 10 اردیبهشت 1389, 11:44 صبح
از آدرس زیر فایل tinymce_3_3_4.zip رو دانلود کنید

http://tinymce.moxiecode.com/download.php

بعد از باز کردن این فایل شما باید فولدر زیر رو در فولدر وب سایت کپی کنید

jscripts

در فولدر jscripts فولدری با نام tiny_mce قرار داره. برای کار با این ادیتور فایل tiny_mce.js (در پوشه tiny_mce) باید به صفحه لینک بشه.
یه نمونه کد:



<%@ Page Language="C#‎" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

<script src="js/tiny_mce/tiny_mce.js" type="text/javascript"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode: "textareas",
theme: "advanced",
theme : "advanced",
skin : "o2k7",
skin_variant : "black",
plugins: "pagebreak,style,layer,table,save,advhr,advimage,ad vlink,emotions,iespell,inlinepopups,insertdatetime ,preview,media,searchreplace,print,contextmenu,pas te,directionality,fullscreen,noneditable,visualcha rs,nonbreaking,xhtmlxtras,template,wordcount,advli st,autosave",

// Theme options
theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethr ough,|,justifyleft,justifycenter,justifyright,just ifyfull,styleselect,formatselect,fontselect,fontsi zeselect",
theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replac e,|,bullist,numlist,|,outdent,indent,blockquote,|, undo,redo,|,link,unlink,anchor,image,cleanup,help, code,|,insertdate,inserttime,preview,|,forecolor,b ackcolor",
theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,su p,|,charmap,emotions,iespell,media,advhr,|,print,| ,ltr,rtl,|,fullscreen",
theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,st yleprops,|,cite,abbr,acronym,del,ins,attribs,|,vis ualchars,nonbreaking,template,pagebreak,restoredra ft",
theme_advanced_toolbar_location: "top",
theme_advanced_toolbar_align: "left",
theme_advanced_statusbar_location: "bottom",
theme_advanced_resizing: true,

// Example content CSS (should be your site CSS)
content_css: "css/content.css",

// Drop lists for link/image/media/template dialogs
template_external_list_url: "lists/template_list.js",
external_link_list_url: "lists/link_list.js",
external_image_list_url: "lists/image_list.js",
media_external_list_url: "lists/media_list.js",

// Style formats
style_formats: [
{ title: 'Bold text', inline: 'b' },
{ title: 'Red text', inline: 'span', styles: { color: '#ff0000'} },
{ title: 'Red header', block: 'h1', styles: { color: '#ff0000'} },
{ title: 'Example 1', inline: 'span', classes: 'example1' },
{ title: 'Example 2', inline: 'span', classes: 'example2' },
{ title: 'Table styles' },
{ title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
],

// Replace values for the template plugin
template_replace_values: {
username: "Some User",
staffid: "991234"
}
});

function show() {
var div = document.getElementById('div');
var mce = tinyMCE.get('elm1');
div.innerHTML = mce.getContent();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 80%">

</textarea>
</div>
<input id="Button1" type="button" value="button" onclick="show();"/>
<div id="div">

</div>
</form>
</body>
</html>
در کد بالا فولدر tiny_mce در فولدر js کپی شده. با دستور tinyMCE.init المان textarea به شکل ادیتور در میاد.
سلام من کد های بالا رو کپی کردم و همه کارهایی که فرمودید رو انجام دادم اما هنگام اجرا ادیتور دیده نمی شود بلکه یک تکست باکس با یک دکمه دیده میشود. میشه راهنمایی بکنید

Vahid_moghaddam
جمعه 10 اردیبهشت 1389, 12:25 عصر
آدرس پوشه فایل ها رو به درستی به صفحه لینک کردید؟

mohsen.nsb44
جمعه 10 اردیبهشت 1389, 16:58 عصر
آدرس پوشه فایل ها رو به درستی به صفحه لینک کردید؟
دقیقا همان کار ها را کردم اما الان منصرف شدم از fckeditor دارم استفاده میکنم ولی یه مشکل دارم که در تاپیک مشکل در خروجی fckeditor یاداشت کردم اگه کمکم کنید و پاسخ اون تاپیکو بدین ازتون ممنون میشم