2016-11-17 3 views
2

私は、、JS WYSIWYGエディタを使用するMyBBで動作するMaterial Design Lightを入手するための修正を探しています。 MDLはエディタのテキストボックスを分割するレイアウトクラスを追加するため、競合が発生します。 At Github there is a similar issue with TinyMCEしかし、SCEditorに修正を適用する方法がわかりません。マテリアルデザインライトの修正方法 - SCEditorの競合?

ご協力いただきありがとうございます。レイアウトがアップグレードされた後にエディタを初期化

答えて

3

は私のために問題を修正するようだ:

MyBBについては
document.addEventListener('mdl-componentupgraded', function (e) { 
    if (typeof e.target.MaterialLayout !== 'undefined') { 
    // Create editor JS here 
    $('textarea').sceditor({ 
     plugins: 'bbcode', 
     style: 'https://cdn.jsdelivr.net/sceditor/1.5.1/jquery.sceditor.default.min.css' 
     /* any other options options here */ 
    }); 
    } 
}); 

あなたはそのイベントハンドラにエディタを作成するJSを移動する必要がありますMDLがレイアウトをアップグレードした後に呼び出されます。あなたはJSを移動することができない場合は、削除する必要がありますし、それを修正するためにそれをエディタを再作成します。

document.addEventListener('mdl-componentupgraded', function (e) { 
    if (typeof e.target.MaterialLayout !== 'undefined') { 
    // Remove any previous instance first 
    $('textarea').sceditor('instance').destroy(); 

    // Create the editor 
    $('textarea').sceditor({ 
     plugins: 'bbcode', 
     style: 'https://cdn.jsdelivr.net/sceditor/1.5.1/jquery.sceditor.default.min.css' 
     /* any other options options here */ 
    }); 
    } 
}); 

非常に醜いが、SCEのために働く必要があります。

MDLは他のJSと競合する可能性がありますが、可能であれば、MyBB JSをイベントハンドラ内で移動する方がより良い解決策になります。

+0

完璧に働いてくれてありがとう! – maniacmusic

+0

これはckeditorでもうまくいきます。ありがとう!それはWSYWYGエディタの共通の問題だと思われます。 – user3322829

関連する問題