0

私は CLEditor テキスト エディタを使用していますが、突然フルスクリーン モードがないことに気付きました (Wordpress のようなもので、評判の高い「気晴らしモード」を使用しています)。基本的なJavascriptを使用して、自分でフルスクリーンモードを構築しようとしています(私をクレイジーと呼んでください)。これまでのところ、あるべき場所にテキスト エディターを配置しました。フルスクリーン モードをクリックすると、CLEditor コンテナ div が取得され、それが別の div に配置されます。別の div には、すべてのブラウザ ウィンドウを埋めて残りを残すスタイルがあります。それは機能しますが、(途中にいくつかのバグがあります)、エディターに入力できません-少なくともブラウザーウィンドウのサイズを変更するまでは。エディターが再び作業を開始するには、「こんにちは」とシェイクする必要があるようです。JavascriptまたはjQueryによる「更新」が必要なようですが、わかりません。

誰でも助けることができますか?

敬具、 ティアゴ・カストロ

4

3 に答える 3

1

このために、プラグインjquery.cleditor.fullscreen.jsを作成しました ( jquery.cleditor.jsと同じ場所に配置します)

(function($) {
    //Style for fullscreen mode
    var fullscreen = 'height: 100%; left: 0; position: fixed; top: 0; width: 100%; z-index: 9999;',
        style = '';

    // Define the fullscreen button
    $.cleditor.buttons.fullscreen = {
        name: 'fullscreen',
        image: 'fullscreen.gif',
        title: 'Fullscreen',
        command: '',
        popupName: '',
        popupClass: '',
        popupContent: '',
        getPressed: fullscreenGetPressed,
        buttonClick: fullscreenButtonClick,
    };

    // Add the button to the default controls before the bold button
    $.cleditor.defaultOptions.controls = $.cleditor.defaultOptions.controls.replace("bold", "fullscreen | bold");

    function fullscreenGetPressed(data) {
        return data.editor.$main.hasClass('fullscreen');
    };

    function fullscreenButtonClick(e, data) {
        var main = data.editor.$main;

        if (main.hasClass('fullscreen')) main.attr('style', style).removeClass('fullscreen');
        else {
            style = main.attr('style');
            main.attr('style', fullscreen).addClass('fullscreen');
        };

        editor.focus();
        return false;
    }
})(jQuery);

cleditor imagesフォルダーに fullscreen.gif を入れまし 全画面表示ボタンのアイコンた。jquery.cleditor.jsの後に、このプラグインをhtmlのheadセクションに追加するよりも。

于 2013-01-28T01:24:17.257 に答える
0

これを行う場合:

$('#cleditor_max_container').append(textEditor.editor.$main);

あなたはこれをしたいかもしれません:

textEditor.editor.refresh();

わたしにはできる.. :)

于 2012-07-05T00:07:46.337 に答える