1

私はここで少し縛られています。MVC4 プロジェクトで TinyMCE をテキスト エディターとして使用しようとしています。

ここまでは非常に単純です。エディターを正しく表示できるようにする必要があるだけです。

私は重要な2つのクラスを持っています。

コントローラー:

public class RapportController : Controller
{
    ImageHandler handler = ImageHandler.Instance;
    IDictionary<string, System.Drawing.Image> pics = ImageHandler.Instance.SharedCollection.GetCollection();

    public ActionResult Index()
    {
        return View(handler.SharedCollection.GetCollection().Values.ToList());
    }

    public void GetImage(string name)
    {
        using (MemoryStream s = new MemoryStream())
        {
            pics[name].Save(s, System.Drawing.Imaging.ImageFormat.Png);
            System.Web.Helpers.WebImage webImg = new System.Web.Helpers.WebImage(s);
            webImg.Write();
        }
    }

次に、TinyMCE を機能させようとしているビューがあります。

@model IList<System.Drawing.Image>

@{ ViewBag.Title = "インデックス"; }

親密な関係

tinyMCE.init({ mode: "textareas", theme: "advanced", plugins: "emotions,spellchecker,advhr,insertdatetime,preview", // テーマ オプション - ボタン番号は行番号のみを示しました theme_advanced_buttons1: "newdocument,|, bold,italic,underline,|,justifyleft,justifycenter,justifyright,fontselect,fontsizeselect,formatselect", theme_advanced_buttons2: "カット,コピー,ペースト,|,bullist,numlist,|,outdent,indent,|,元に戻す,やり直し,|, link,unlink,anchor,image,|,code,preview,|,forecolor,backcolor", theme_advanced_buttons3: "insertdate,inserttime,|,spellchecker,advhr,,removeformat,|,sub,sup,|,charmap,emotions", theme_advanced_toolbar_location: "上", theme_advanced_toolbar_align: "左",theme_advanced_statusbar_location: "bottom", theme_advanced_resizing: true });


これは、TinyMCE で編集できるコンテンツの一部です。

<div class="float-right">
    <ul id="images">
        @foreach (System.Drawing.Image item in Model) 
        {
            MemoryStream stream = new MemoryStream();    
            item.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
            stream.Seek(0, SeekOrigin.Begin);
            string base64 = Convert.ToBase64String(stream.ToArray());
            <li>                 
                <a href="JavaScript:newPopup('data:image/gif;base64,@base64');"><img height="100" width="200" src="data:image/gif;base64,@base64"/></a>             
            </li>
        }
    </ul>
</div>

// ポップアップ ウィンドウ コード function newPopup(url) { popupWindow = window.open( url, 'popUpWindow', 'height=600,width=1100,left=10,top=10,resizable=no,scrollbars=no,toolbar=いいえ、メニューバー=いいえ、場所=いいえ、ディレクトリ=いいえ、ステータス=はい') }

何らかの理由で、次の ようになります。

TinyMCE から機能を取得できない理由はありますか?

前もって感謝します :)

4

1 に答える 1

1

理解した。TinyMCE の場所を定義するときに、ローカル パスを使用することはできません。

于 2013-03-21T14:03:33.927 に答える