Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何在tinymce v4.0中添加占位符_Angularjs_Tinymce_Tinymce 4 - Fatal编程技术网

Angularjs 如何在tinymce v4.0中添加占位符

Angularjs 如何在tinymce v4.0中添加占位符,angularjs,tinymce,tinymce-4,Angularjs,Tinymce,Tinymce 4,嗨,有没有办法为tinymce v4.0添加占位符?我需要在tinymce中实现HTML5占位符,但默认情况下它不在那里 <textarea id="Text" placeholder="Create your prompt here." ui-tinymce="$ctrl.tinymceOptions" ng-model="$ctrl.tmcModel"></textarea> 这对我很有效 var iframe = document.getElementsBy

嗨,有没有办法为tinymce v4.0添加占位符?我需要在tinymce中实现HTML5占位符,但默认情况下它不在那里

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

这对我很有效

 var iframe = document.getElementsByTagName('iframe')[0];
     iframe.style.resize = 'vertical';
这对我有用

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

假设您使用的是tinyMCE 4,您可以在init上添加占位符,然后在focus上删除它。记住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();
    }),
})
tinymce.init({
//下面是所有其他选项
//xxxxx
//添加占位符
设置:函数(编辑器){
on('init',function(){
if(tinymce.get('Text').getContent()=''){
tinymce.get('Text').setContent(

您的漂亮文本在这里!

); } }, //并在焦点上移除它 on('focus',function(){ $('iframe').contents().find('imThePlaceholder').remove(); }), })
假设您使用的是tinyMCE 4,您可以在init上添加占位符,然后在focus上删除占位符。记住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();
    }),
})
tinymce.init({
//下面是所有其他选项
//xxxxx
//添加占位符
设置:函数(编辑器){
on('init',function(){
if(tinymce.get('Text').getContent()=''){
tinymce.get('Text').setContent(

您的漂亮文本在这里!

); } }, //并在焦点上移除它 on('focus',function(){ $('iframe').contents().find('imThePlaceholder').remove(); }), })
也许?也许?