1

我有一个局部视图(asp.net MVC 3.0)将 Tinymce 渲染为 Richeditor,并希望在其上显示文本水印。

       @model String
        @using Nop.Web.Framework.UI;
        @{
            Html.AddScriptParts(@Url.Content("~/Content/editors/tinymce/tiny_mce.js"));

            //set useDefaultImagePlugin to 'true' if you want to move back to a standard image plugin           
            bool useDefaultImagePlugin = false;
            var imagePluginName = useDefaultImagePlugin ? "image" : "netadvimage";
        }

     @Html.TextArea(string.Empty, /* Name suffix */
            ViewData.TemplateInfo.FormattedModelValue /* Initial value */
        )
        <script type="text/javascript">

            //Notes: autosave plugin is disabled
            (function () {

                tinyMCE.init({

                    // General options
                    mode: "exact",
                    elements: "@ViewData.TemplateInfo.GetFullHtmlFieldName(string.Empty)",
                    theme: "advanced",
                    height: "120px",
                    width: "100%",
                    verify_html: false,
                    plugins: "equation,netadvimage,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist",

                    // Theme options
                    theme_advanced_buttons1: "equation,@imagePluginName,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,pastetext",
                    theme_advanced_buttons2: "",
                    theme_advanced_buttons3: "",
                    theme_advanced_toolbar_location: "top",
                    theme_advanced_toolbar_align: "left",
                    theme_advanced_resizing: false,

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

                    // 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"

                });

tinyMCE.focus(function () {
            if ($(this).getContent() == "Type some text here") {
                tinyMCE.setContent("");
            } else if ($(this).getContent() == "") {
                tinyMCE.setContent("Type some text here");
            }
        })
            })();

        </script>

我试图在上面的脚本中关注TinyMCE 提示文本中的类似帖子,但它从未在 textarea 内容上显示任何内容。

即使使用http://code.google.com/p/jquery-watermark/,它也只会闪烁内容并立即变为空白。

谢谢

4

0 回答 0