当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript EditorManager.init函数代码示例

本文整理汇总了TypeScript中tinymce/core/EditorManager.init函数的典型用法代码示例。如果您正苦于以下问题:TypeScript init函数的具体用法?TypeScript init怎么用?TypeScript init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了init函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

  suite.asyncTest('Do not reload language pack if it was already loaded or registered manually.', function (_, done) {
    const langCode = 'mce_lang';
    const langUrl = 'http://example.com/language/' + langCode + '.js';

    EditorManager.addI18n(langCode, {
      from: 'to'
    });

    viewBlock.update('<textarea></textarea>');

    EditorManager.init({
      selector: 'textarea',
      skin_url: '/project/js/tinymce/skins/lightgray',
      language: langCode,
      language_url: langUrl,
      init_instance_callback (ed) {
        const scripts = Tools.grep(document.getElementsByTagName('script'), function (script) {
          return script.src === langUrl;
        });

        LegacyUnit.equal(scripts.length, 0);

        teardown(done);
      }
    });
  });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:26,代码来源:EditorManagerTest.ts

示例2: function

export default function () {
  ModernTheme();

  const textarea = document.createElement('textarea');
  textarea.innerHTML = '<p>Bolt</p>';

  textarea.classList.add('tinymce');
  document.querySelector('#ephox-ui').appendChild(textarea);

  EditorManager.init({
    // imagetools_cors_hosts: ["moxiecode.cachefly.net"],
    // imagetools_proxy: "proxy.php",
    // imagetools_api_key: '123',

    // images_upload_url: 'postAcceptor.php',
    // images_upload_base_path: 'base/path',
    // images_upload_credentials: true,
    skin_url: '../../../../js/tinymce/skins/lightgray',
    setup (ed) {
      ed.addButton('demoButton', {
        type: 'button',
        text: 'Demo',
        onclick () {
          ed.insertContent('Hello world!');
        }
      });
    },

    selector: 'textarea.tinymce',
    theme: 'modern',
    toolbar1: 'demoButton bold italic',
    menubar: false
  });
}
开发者ID:howardjing,项目名称:tinymce,代码行数:34,代码来源:TinyMceDemo.ts

示例3: function

  const setup = function (success, failure) {
    const div = document.createElement('div');

    div.innerHTML = (
      '<div id="lists">' +
      '<ul><li>before</li></ul>' +
      '<ul id="inline"><li>x</li></ul>' +
      '<ul><li>after</li></ul>' +
      '</div>'
    );

    document.body.appendChild(div);

    EditorManager.init({
      selector: '#inline',
      inline: true,
      add_unload_trigger: false,
      skin: false,
      plugins: 'lists',
      disable_nodechange: true,
      init_instance_callback (editor) {
        Pipeline.async({}, suite.toSteps(editor), function () {
          teardown(editor, div);
          success();
        }, failure);
      },
      valid_styles: {
        '*': 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,' +
        'margin,margin-top,margin-right,margin-bottom,margin-left,display,position,top,left,list-style-type'
      }
    });
  };
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:32,代码来源:BackspaceDeleteInlineTest.ts

示例4:

  const mCreateInlineModeMultipleInstances = Step.stateful(function (value, next, die) {
    viewBlock.update('<div class="tinymce-editor"><p>a</p></div><div class="tinymce-editor"><p>b</p></div>');

    EditorManager.init({
      selector: '.tinymce-editor',
      inline: true,
      skin_url: '/project/js/tinymce/skins/lightgray'
    }).then(next, die);
  });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:9,代码来源:EditorInitializationTest.ts

示例5: function

 suite.asyncTest('selector on non existing targets', function (_, done) {
   EditorManager.init({
     selector: '#non-existing-id',
     skin_url: '/project/js/tinymce/skins/lightgray'
   }).then(function (result) {
     Assertions.assertEq('Should be an result that is zero length', 0, result.length);
     teardown(done);
   });
 });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:9,代码来源:EditorInitializationTest.ts

示例6: function

export default function () {
  EditorManager.init({
    selector: 'textarea.tinymce',
    theme: 'modern',
    plugins: [
      'advlist autolink autosave link image lists charmap print preview hr anchor pagebreak spellchecker',
      'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking',
      'save table contextmenu directionality emoticons template textcolor paste fullpage textcolor colorpicker codesample'
    ],
    skin_url: '../../../../../js/tinymce/skins/lightgray',
    add_unload_trigger: false,
    autosave_ask_before_unload: false,

    toolbar1: 'save newdocument fullpage | bold italic underline strikethrough | alignleft aligncenter alignright ' +
      'alignjustify | styleselect formatselect fontselect fontsizeselect',
    toolbar2: 'cut copy paste pastetext | searchreplace | bullist numlist | outdent indent blockquote | undo redo' +
      ' | link unlink anchor image media help code | insertdatetime preview | forecolor backcolor',
    toolbar3: 'table | hr removeformat | subscript superscript | charmap emoticons | print fullscreen | ltr rtl' +
      ' | spellchecker | visualchars visualblocks nonbreaking template pagebreak restoredraft | insertfile insertimage codesample',
    menubar: false,
    toolbar_items_size: 'small',

    style_formats: [
      { title: 'Bold text', inline: 'b' },
      { title: 'Red text', inline: 'span', styles: { color: '#ff0000' } },
      { title: 'Red header', block: 'h1', styles: { color: '#ff0000' } },
      { title: 'Example 1', inline: 'span', classes: 'example1' },
      { title: 'Example 2', inline: 'span', classes: 'example2' },
      { title: 'Table styles' },
      { title: 'Table row 1', selector: 'tr', classes: 'tablerow1' }
    ],

    templates: [
      { title: 'My template 1', description: 'Some fancy template 1', content: 'My html' },
      { title: 'My template 2', description: 'Some fancy template 2', url: 'development.html' }
    ],

    spellchecker_callback (method, data, success) {
      if (method === 'spellcheck') {
        const words = data.match(this.getWordCharPattern());
        const suggestions = {};

        for (let i = 0; i < words.length; i++) {
          suggestions[words[i]] = ['First', 'second'];
        }

        success({ words: suggestions, dictionary: true });
      }

      if (method === 'addToDictionary') {
        success();
      }
    }
  });
}
开发者ID:howardjing,项目名称:tinymce,代码行数:55,代码来源:ClassicDemo.ts

示例7: done

    return Step.async(function (done) {
      viewBlock.update(html);

      EditorManager.init({
        selector: '.tinymce',
        inline: true,
        skin_url: '/project/js/tinymce/skins/lightgray'
      }).then(function () {
        done();
      });
    });
开发者ID:aha-app,项目名称:tinymce-word-paste-filter,代码行数:11,代码来源:CefFocusTest.ts


注:本文中的tinymce/core/EditorManager.init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。