2017-06-01 2 views
0

こんにちは、tinymce v4.0のプレースホルダを追加する方法はありますか?私はtinymceのHTML 5プレースホルダ実装が必要ですが、デフォルトではありません。tinymce v4.0でプレースホルダを追加する方法

<textarea id="Text" placeholder="Create your prompt here." ui-tinymce="$ctrl.tinymceOptions" ng-model="$ctrl.tmcModel"></textarea> 
+0

https://stackoverflow.com/questions/27237876/how-do-i-add-placeholder-text-to-tinymce多分? – tanmay

答えて

0

これは私に役立ちました。

var iframe = document.getElementsByTagName('iframe')[0]; 
    iframe.style.resize = 'vertical'; 
0

tinyMCE 4を使用していると仮定すると、initにプレースホルダーを追加してフォーカスを取り除くことができます。 TinyMCEはiframeを使用することを忘れないでください。 は、より効率的であるために研磨する必要があるが、ここでは簡単なアプローチです:

tinymce.init({ 
    //here all the rest of the options 
    //xxxxx 
    //Add the placeholder 
    setup: function (editor) { 
    editor.on('init', function(){ 
     if (tinymce.get('Text').getContent() == ''){ 
     tinymce.get('Text').setContent("<p id='#imThePlaceholder'>Your nice text here!</p>"); 
     } 
    }, 
    //and remove it on focus 
    editor.on('focus',function(){ 
     $('iframe').contents().find('#imThePlaceholder').remove(); 
    }), 
}) 
関連する問題